MS_DFS -> WITH_MSDFS as in HEAD
authorElrond <elrond@samba.org>
Fri, 25 Aug 2000 17:30:52 +0000 (17:30 +0000)
committerElrond <elrond@samba.org>
Fri, 25 Aug 2000 17:30:52 +0000 (17:30 +0000)
smbd/nttrans.c:
moved around one function and added some #if 0 part
from HEAD.
msdfs/:
Removed old code
include/smb.h:
Merged Jeremy's comment from HEAD.

12 files changed:
source/acconfig.h
source/configure
source/configure.in
source/include/config.h.in
source/include/msdfs.h
source/include/smb.h
source/msdfs/msdfs.c
source/msdfs/msdfs_tdb.c [deleted file]
source/msdfs/parse_dfs_map.c [deleted file]
source/smbd/negprot.c
source/smbd/nttrans.c
source/srvsvcd/srv_srvsvc_nt.c

index f8652b8054e788631e54bd45b93dbda83a7d25bf..bcfc9614a9ab084ba05f98d4f473d8fb35f915a8 100644 (file)
@@ -75,7 +75,7 @@
 #undef HAVE_SETRESUID
 #undef WITH_NETATALK
 #undef WITH_UTMP
-#undef MS_DFS
+#undef WITH_MSDFS
 #undef HAVE_INO64_T
 #undef HAVE_STRUCT_FLOCK64
 #undef SIZEOF_INO_T
index 1c2150a42097c739f6be84110f053289e888287e..901b82fdb5fbb5160eac417d7b3a34d1a865a86f 100755 (executable)
@@ -1014,7 +1014,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -2000,7 +2000,7 @@ for ac_kw in inline __inline__ __inline; do
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} int $ac_kw foo() {
 ; return 0; }
 EOF
 if { (eval echo configure:2007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
@@ -3059,7 +3059,7 @@ else
 int main() {
 
 /* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
 /* SunOS 4.1.1 cc rejects this.  */
 char const *const *ccp;
 char **p;
@@ -3134,7 +3134,7 @@ for ac_kw in inline __inline__ __inline; do
 #include "confdefs.h"
 
 int main() {
-} $ac_kw foo() {
+} int $ac_kw foo() {
 ; return 0; }
 EOF
 if { (eval echo configure:3141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
@@ -10906,7 +10906,7 @@ if test "${with_msdfs+set}" = set; then
   yes)
      echo "$ac_t""yes" 1>&6
      cat >> confdefs.h <<\EOF
-#define MS_DFS 1
+#define WITH_MSDFS 1
 EOF
 
      ;;
index 7a54da3dbdc49bed7a7e14664824aae125a86080..d8184d04cc6cefb37bb5e8a37b8159bfcb563671 100644 (file)
@@ -1626,7 +1626,7 @@ AC_ARG_WITH(msdfs,
 [ case "$withval" in
   yes)
      AC_MSG_RESULT(yes)
-     AC_DEFINE(MS_DFS)
+     AC_DEFINE(WITH_MSDFS)
      ;;
   *)
     AC_MSG_RESULT(no)
index 8cd69353c9e97ebff287e027518c30b20bffac54..5a0bc44b9a1259344d06da5b683a404a2f6d8187 100644 (file)
 #undef HAVE_SETRESUID
 #undef WITH_NETATALK
 #undef WITH_UTMP
-#undef MS_DFS
+#undef WITH_MSDFS
 #undef HAVE_INO64_T
 #undef HAVE_STRUCT_FLOCK64
 #undef SIZEOF_INO_T
index 5323b8749ac5f219775d7a6d02dc2f810c2a238f..2c0f9a19bac1e115a72914713030f9967c8d0b05 100644 (file)
@@ -59,7 +59,7 @@ struct dfs_path
   pstring restofthepath;
 };
 
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
 
 #define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \
 { if(((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES)) && \
index 318b08bf5ac732247689d80cbc499ba61f9a6952..47a692b6f3ca1b44becc2ca2f56ca514135f0f85 100644 (file)
@@ -385,6 +385,7 @@ typedef struct
 }
 vuser_key;
 
+
 #ifndef MAXSUBAUTHS
 #define MAXSUBAUTHS 15         /* max sub authorities in a SID */
 #endif
@@ -427,6 +428,11 @@ DOM_MAP_TYPE;
 /*
  * The complete list of SIDS belonging to this user.
  * Created when a vuid is registered.
+ * The definition of the user_sids array is as follows :
+ *
+ * token->user_sids[0] = primary user SID.
+ * token->user_sids[1] = primary group SID.
+ * token->user_sids[2-num_sids] = supplementary group SIDS.
  */
 
 #ifndef _NT_USER_TOKEN
@@ -663,6 +669,7 @@ struct dcinfo
 };
 
 
+
 enum {LPQ_QUEUED,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING};
 
 typedef struct _print_queue_struct
@@ -1811,7 +1818,7 @@ extern int chain_size;
 #define KERNEL_OPLOCK_CAPABILITY 0x1
 
 /*
- * Oplock break command code sent via the kernel interface.
+ * Oplock break command code sent via the kernel interface (if it exists).
  *
  * Form of this is :
  *
index 94cfb75c2073c8a2ff808f540da6388ca9601d3b..4cb823996df0f1af3099f39ed5e0f09479f1599f 100644 (file)
@@ -26,8 +26,11 @@ extern int DEBUGLEVEL;
 extern pstring global_myname;
 extern uint32 global_client_caps;
 
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
 
+/**********************************************************************
+ Create a tcon relative path from a dfs_path structure
+ **********************************************************************/
 static void create_nondfs_path(char* pathname, struct dfs_path* pdp)
 {
   pstrcpy(pathname,pdp->volumename); 
@@ -35,8 +38,10 @@ static void create_nondfs_path(char* pathname, struct dfs_path* pdp)
   pstrcat(pathname,pdp->restofthepath); 
 }
 
-/* Parse the pathname  of the form \hostname\service\volume\restofthepath
-   into the dfs_path structure */
+/**********************************************************************
+  Parse the pathname  of the form \hostname\service\volume\restofthepath
+  into the dfs_path structure 
+ **********************************************************************/
 static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 {
   pstring pathname_local;
@@ -89,6 +94,14 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
   return True;
 }
 
+/**********************************************************************
+ Forms a valid Unix pathname from the junction 
+ **********************************************************************/
+
+/**********************************************************************
+ Creates a junction structure from the Dfs pathname
+ **********************************************************************/
+
 /**********************************************************************
  Parse the contents of a symlink to verify if it is an msdfs referral
  A valid referral is of the form: msdfs:server1\share1,server2\share2
@@ -569,8 +582,13 @@ int dfs_path_error(char* inbuf, char* outbuf)
   return(ERROR(ERRSRV,ERRbadpath)); 
 }
 
+/**********************************************************************
+ The following functions are called by the NETDFS RPC pipe functions
+ **********************************************************************/
+
+
 #else
-/* Stub functions if MS_DFS not defined */
+/* Stub functions if WITH_MSDFS not defined */
 int setup_dfs_referral(char* pathname, int max_referral_level, 
                       char** ppdata)
 {
diff --git a/source/msdfs/msdfs_tdb.c b/source/msdfs/msdfs_tdb.c
deleted file mode 100644 (file)
index 2435d7a..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/* 
-   Unix SMB/Netbios implementation.
-   Version 3.0
-   MSDfs services for Samba
-   Copyright (C) Shirish Kalele 2000
-   Copyright (C) Samba Team 2000
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-
-extern int DEBUGLEVEL;
-
-#ifdef MS_DFS
-
-#define MSDFS_TDB "msdfs.tdb"
-
-/* structures for msdfs.tdb */
-struct tdb_junction_key
-{
-  pstring service_name;
-  pstring volume_name;
-};
-
-struct tdb_junction_data
-{
-  int referral_count;
-  struct referral first_referral;
-};
-
-static TDB_CONTEXT* msdfs_map = NULL;
-
-/*
- * Open the msdfs tdb map. Called once for update when parsing the dfsmap file 
- * and then subsequently at tconX for reading 
- */
-BOOL msdfs_open(BOOL update)
-{
-  pstring fname;
-  int oflags = (update)?O_RDWR|O_CREAT:O_RDONLY;
-  
-  /* close any open TDB contexts before opening */
-  if(msdfs_map != NULL)
-    {
-      DEBUG(10,("msdfs_open: Closing existing TDB_CONTEXT msdfs_map: name: %s, fd: %d\n",
-               msdfs_map->name,msdfs_map->fd));
-      tdb_close(msdfs_map);
-    }
-
-  pstrcpy(fname,lock_path(MSDFS_TDB));
-  DEBUG(10,("opening msdfs tdb : .%s.\n",fname));
-  if((msdfs_map = tdb_open(fname,0,0,oflags,0644)) == NULL)
-    {
-      DEBUG(1,("Couldn't open Dfs tdb map %s %s.\nError was %s\n",fname,
-              (update?"for update":"for reading"),strerror(errno) ));
-      return False;
-    }
-    DEBUG(10,("TDB_CONTEXT msdfs_map opened: name: %s, fd: %d\n",msdfs_map->name,msdfs_map->fd));
-
-  return True;
-}
-
-BOOL add_junction_entry(struct junction_map* junction)
-{
-  struct tdb_junction_key* tlk;
-  struct tdb_junction_data* tld;
-
-  TDB_DATA key,data;
-  uint16 data_size;
-  
-  int i=0;
-
-  if(msdfs_map == NULL)
-    {
-      DEBUG(4,("Attempt to add junction entry to unopened %s\n",MSDFS_TDB));
-      return False;
-    }
-
-  /* create the key */
-  if((tlk = (struct tdb_junction_key*) malloc(sizeof(struct tdb_junction_key))) == NULL)
-    {
-      DEBUG(0,("malloc failed for tdb junction key\n"));
-      return False;
-    }
-  
-  ZERO_STRUCTP(tlk);
-
-  pstrcpy(tlk->service_name,junction->service_name);
-  pstrcpy(tlk->volume_name,junction->volume_name);
-  strupper(tlk->service_name);
-  strupper(tlk->volume_name);
-
-  key.dptr = (char*) tlk;
-  key.dsize = sizeof(struct tdb_junction_key);
-
-  
-  /* create the data */
-  data_size = sizeof(struct tdb_junction_data) +
-       ((junction->referral_count-1)*sizeof(struct referral));
-
-  if( (tld = (struct tdb_junction_data*) malloc(data_size)) == NULL)
-    {
-      DEBUG(0,("malloc failed for tdb junction data\n"));
-      return False;
-    }
-
-  tld->referral_count = junction->referral_count;
-  memcpy(&tld->first_referral,junction->referral_list,junction->referral_count * sizeof(struct referral));
-  
-  data.dptr = (char*) tld;
-  data.dsize = data_size;
-
-  DEBUG(10,("Storing key: .%s:%s.\n",tlk->service_name,tlk->volume_name));
-  DEBUG(10,("Data: referral_count : %u\n",tld->referral_count));
-  for(i=0;i<tld->referral_count;i++)
-     {
-       struct referral* ref = &(junction->referral_list[i]);
-       DEBUG(10,("Path %d: %s, proximity: %u, ttl: %u\n",i+1,
-                 ref->alternate_path,ref->proximity,ref->ttl));
-     }
-
-  if( tdb_store(msdfs_map,key,data,TDB_REPLACE) != 0)
-    {
-      DEBUG(10,("Could not store referral for %s:%s \n",
-               junction->service_name, junction->volume_name));
-      free(key.dptr);
-      free(data.dptr);
-      return False;
-    }
-  
-  free(key.dptr);
-  free(data.dptr);
-  return True;
-}
-
-BOOL get_junction_entry(struct junction_map* junction)
-{
-  struct tdb_junction_key* tlk;
-  struct tdb_junction_data* tld;
-
-  uint16 reflistsize=0;
-
-  TDB_DATA key,data;
-  
-  if(msdfs_map == NULL)
-    {
-      DEBUG(4,("Attempt to get junction entry from unopened %s\n",MSDFS_TDB));
-      return False;
-    }
-
-  if( (tlk=(struct tdb_junction_key*) malloc(sizeof(struct tdb_junction_key))) == NULL)
-    {
-      DEBUG(0,("couldn't malloc for tdb junction key\n"));
-      return False;
-    }
-  
-  ZERO_STRUCTP(tlk);
-
-  pstrcpy(tlk->service_name,junction->service_name);
-  pstrcpy(tlk->volume_name,junction->volume_name);
-  strupper(tlk->service_name);
-  strupper(tlk->volume_name);
-
-  key.dptr = (char*) tlk;
-  key.dsize = sizeof(struct tdb_junction_key);
-
-  data = tdb_fetch(msdfs_map,key);
-  
-  if(data.dptr == NULL)
-    {
-      DEBUG(8,("No data found for key %s:%s\n",junction->service_name,junction->volume_name));
-      DEBUG(8,("Error was %s\n",strerror(errno)));
-      free(key.dptr);
-      return False;
-    }
-
-  tld = (struct tdb_junction_data*) data.dptr;
-
-  junction->referral_count = tld->referral_count;
-  reflistsize = junction->referral_count * sizeof(struct referral);
-
-  if((junction->referral_list = (struct referral*) malloc(reflistsize) ) == NULL)
-    {
-      DEBUG(0,("malloc failed for referral list\n"));
-      free(key.dptr);
-      free(data.dptr);
-      return False;
-    }
-  
-  memcpy(junction->referral_list,&(tld->first_referral),reflistsize);
-  free(key.dptr);
-  free(data.dptr);
-
-  return True;
-}
-
-BOOL isDfsShare(char* svc,char* vol)
-{
-  TDB_DATA key;
-  struct tdb_junction_key tlk;
-  
-  ZERO_STRUCT(tlk);
-
-  if(msdfs_map == NULL)
-    {
-      DEBUG(4,("Attempt to check junction existence in unopened %s\n",MSDFS_TDB));
-      return False;
-    }
-
-  pstrcpy(tlk.service_name,svc);
-  pstrcpy(tlk.volume_name,vol);
-
-  strupper(tlk.service_name);
-  strupper(tlk.volume_name);
-
-  key.dptr = (char*) &tlk;
-  key.dsize = sizeof(struct tdb_junction_key);
-
-  DEBUG(10,("tdb_exists for key %s:%s returns %d\n",tlk.service_name,tlk.volume_name,
-           tdb_exists(msdfs_map,key)));
-
-  if(tdb_exists(msdfs_map,key))
-    return True;
-  else
-    {
-      DEBUG(10,("error was %s\n",strerror(errno)));
-      return False;
-    }
-
-}
-
-void msdfs_close(void)
-{
-  if(msdfs_map != NULL)
-      tdb_close(msdfs_map);
-
-  msdfs_map = NULL;
-}
-
-void msdfs_end(void)
-{
-  /*  pstring fname; */
-  msdfs_close();
-  
-  /*  pstrcpy(fname,lock_path(MSDFS_TDB));
-  unlink(fname); */
-}
-#endif    
-  
-    
-      
-      
-  
-  
-      
diff --git a/source/msdfs/parse_dfs_map.c b/source/msdfs/parse_dfs_map.c
deleted file mode 100644 (file)
index df6b89b..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/* 
-   Unix SMB/Netbios implementation.
-   Version 3.0
-   MSDfs services for Samba
-   Copyright (C) Shirish Kalele 2000
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*********************************************************************** 
- * Parses the per-service Dfs map file which is of the form:
- * junction_point1
- *     alternate_path1:proximity:ttl
- *     alternate_path2:proximity:ttl
- * junction_point2
- * ...
- *
- * Junction points are directories in the service (upon encountering which
- * Samba redirects the client to the servers hosting the underlying share)
- *
- * Alternate paths are of the form: \\smbserver\share
- * Currently, the parser detects alternate paths by the leading \'s
- *
- ***********************************************************************/
-
-#include "includes.h"
-
-#ifdef MS_DFS
-
-#define MAX_ALTERNATE_PATHS 256
-
-extern int DEBUGLEVEL;
-
-static char* Dfs_Crop_Whitespace(char* line)
-{
-  int i=0;
-  int len = strlen(line);
-
-  if(line[0]=='#' || line[0]==';') return NULL;
-  
-  for(i=0;i<len && isspace(line[i]);i++);
-
-  if(i>=len) return NULL;
-  
-  line = &line[i];
-
-  /* crop off the newline at the end, if present */
-  /* if(line[len-1]=='\n') line[len-1]='\0'; */
-
-  /* remove white sace from the end */
-  for(i=strlen(line)-1;i>=0 && isspace(line[i]);i--);
-  
-  if(i<0) return NULL;
-
-  line[i]='\0';
-
-  if(line[0] == '\0') return NULL;
-
-  return line;
-}
-
-static BOOL parse_referral(char* s, struct referral* ref)
-{
-#define MAXTOK_IN_REFERRAL 3
-  char *tok[MAXTOK_IN_REFERRAL+1];
-  int count=0;
-  int i=0;
-
-  if(s[1]=='\\') s = &s[1]; /* skip one backslash
-                              if there are two */
-
-  tok[count++] = strtok(s,":");
-  
-  while( ((tok[count]=strtok(NULL,":")) != NULL) && count<MAXTOK_IN_REFERRAL)
-    count++;
-
-  DEBUG(10,("parse_referral: Tokens"));
-  for(i=0;i<count;i++)
-    DEBUG(10,(" %s",tok[i]));
-  DEBUG(10,(".\n"));
-  if(count > 0)
-    pstrcpy(ref->alternate_path,tok[0]);
-  else
-    {
-      DEBUG(6,("Invalid referral line: %s\n",s));
-      return False;
-    }
-
-  if(count > 1)
-    ref->proximity = atoi(tok[1]);
-  else
-    ref->proximity = 0;
-
-  if(count > 2)
-    ref->ttl = atoi(tok[2]);
-  else
-    ref->ttl = REFERRAL_TTL; 
-
-  return True;
-}
-
-static void create_mount_point(int snum, struct junction_map *jn)
-{
-  fstring dfsvolumepath;
-
-  fstrcpy(dfsvolumepath, lp_pathname(snum));
-  fstrcat(dfsvolumepath, "/");
-  fstrcat(dfsvolumepath, jn->volume_name);
-       
-  if(!directory_exist(dfsvolumepath, NULL))
-    {
-      DEBUG(10,("create_mount_point: creating msdfs mntpt %s\n",
-               dfsvolumepath));
-      become_root(False);
-      mkdir(dfsvolumepath, 0700);
-      unbecome_root(False);
-    }
-}
-static BOOL load_dfsmap(char* fname, int snum)
-{
-  struct junction_map* junction = NULL;
-  struct referral tmp_ref_array[MAX_ALTERNATE_PATHS];
-  int ref_count = 0;
-  FILE* fp;
-  int line_cnt = 0;
-
-  if(lp_dfsmap_loaded(snum))
-    return True;
-  
-  if((fp = sys_fopen(fname,"r")) == NULL)
-    {
-      DEBUG(1,("can't open dfs map file %s for service [%s]\nError was %s",fname,
-              lp_servicename(snum), strerror(errno)));
-      return False;
-    }
-
-  if(!msdfs_open(True))
-    return False;
-
-  while(!feof(fp))
-    {
-      pstring rawline;
-      char* line;
-
-      line_cnt++;
-      if(!fgets(rawline,PSTRING_LEN,fp))
-       continue;
-
-      if((line = Dfs_Crop_Whitespace(rawline)) == NULL)
-       continue;
-
-      DEBUG(6,("load_dfsmap: Cropped line: %s\n",line));
-
-      /* the line contains a new junction or 
-        an alternate path to current junction */
-
-      if(line[0]!='\\')
-       {
-         /* a new junction definition encountered */
-
-         /* add the current junction if it has any referrals defined */
-         if(junction && ref_count!=0)
-           {
-             junction->referral_count = ref_count;
-             junction->referral_list = tmp_ref_array;
-             DEBUG(4,("Adding Dfs junction: %s\\%s  Referrals: %u First referral path: %s\n",
-                      junction->service_name,junction->volume_name,
-                      junction->referral_count, junction->referral_list[0].alternate_path));
-
-             if(!add_junction_entry(junction))
-               {
-                 DEBUG(6,("Unable to add junction entry %s:%s after parsing\n",
-                          junction->service_name,junction->volume_name));
-               }
-
-             /* create a unix directory as a junction/mount point. */
-             create_mount_point(snum, junction);
-             free(junction);
-           }
-         
-         /* then, create a new junction_map node */
-         if((junction = (struct junction_map*) malloc(sizeof(struct junction_map))) == NULL)
-           {
-             DEBUG(0,("Couldn't malloc for Dfs junction_map node\n"));
-             return False;
-           }
-         pstrcpy(junction->service_name,lp_servicename(snum));
-         pstrcpy(junction->volume_name,line);
-         ref_count = 0;
-       }
-      else
-       {
-         /* referral encountered. add to current junction */
-         if(!junction)
-           {
-             DEBUG(4,("Invalid entry in Dfs map file.\nAlternate path defined outside of a junction in %s\nline %d: %s\n",fname, line_cnt, line));
-             return False;
-           }
-
-         /* parse the referral */
-         if(!parse_referral(line,&tmp_ref_array[ref_count]))
-           continue;
-         ref_count++;
-
-       }
-    }
-  
-  /* End of file. Add the current junction and return */
-  if(junction)
-    {
-      junction->referral_count = ref_count;
-      junction->referral_list = tmp_ref_array;
-      DEBUG(4,("Adding Dfs junction: %s\\%s  Referrals: %u First referral path: %s\n",
-                      junction->service_name,junction->volume_name,
-                      junction->referral_count, junction->referral_list[0].alternate_path));
-      if(!add_junction_entry(junction))
-       {
-         DEBUG(6,("Unable to add junction entry %s:%s after parsing\n",
-                  junction->service_name,junction->volume_name));
-       }
-      create_mount_point(snum, junction);
-      free(junction);
-    }
-  
-  fclose(fp);
-  msdfs_close();
-  return True;
-}
-
-void load_dfsmaps(void)
-{
-  int i=0;
-  if(!lp_host_msdfs()) 
-    return;
-  
-  for(i=0;*lp_servicename(i) && *lp_dfsmap(i) 
-       && !lp_dfsmap_loaded(i);i++)
-    {
-      char* dfsmapfile = lp_dfsmap(i);
-      DEBUG(4,("loading dfsmap for servicename: %s\n",lp_servicename(i)));
-      if(load_dfsmap(dfsmapfile,i))
-       {
-         set_dfsmap_loaded(i,True);
-       }
-      else
-       {
-         DEBUG(0,("handle_dfsmap: Unable to load Dfs map file %s.\nService %s not using MS Dfs\n",dfsmapfile,lp_servicename(i)));
-         set_dfsmap_loaded(i,False);
-       }
-      
-    }
-}
-         
-#else 
-/* Stub function if MS_DFS is not defined */     
-
-void load_dfsmaps(void)
-{}       
-         
-#endif         
-         
-         
-         
-            
-       
-       
-         
-         
index 8234852124fc964c28eacd015f0b8385ca45e646..aae3043ed233879711969d1032d77b5f697ff8fe 100644 (file)
@@ -176,7 +176,7 @@ static int reply_nt1(char *outbuf)
          capabilities |= CAP_RAW_MODE;
   }
 
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
   if(lp_host_msdfs())
        capabilities |= CAP_DFS;
 #endif
index 932ca51ee7eb0c1d2e70a3c3c3b0aa1ab5615bff..8ffb946b872548946c3572f185ddec7f42af9f53 100644 (file)
@@ -24,6 +24,7 @@
 #include "nterr.h"
 #include "sids.h"
 
+extern int DEBUGLEVEL;
 extern int Protocol;
 extern int smb_read_error;
 extern int global_oplock_break;
@@ -46,7 +47,7 @@ static char *known_nt_pipes[] = {
   "\\lsarpc",
   "\\winreg",
   "\\spoolss",
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
   "\\netdfs",
 #endif
   NULL
@@ -489,6 +490,68 @@ to open_mode %x\n", (unsigned long)desired_access, (unsigned long)share_access,
   return smb_open_mode;
 }
 
+#if 0
+/*
+ * This is a *disgusting* hack.
+ * This is *so* bad that even I'm embarrassed (and I
+ * have no shame). Here's the deal :
+ * Until we get the correct SPOOLSS code into smbd
+ * then when we're running with NT SMB support then
+ * NT makes this call with a level of zero, and then
+ * immediately follows it with an open request to
+ * the \\SRVSVC pipe. If we allow that open to
+ * succeed then NT barfs when it cannot open the
+ * \\SPOOLSS pipe immediately after and continually
+ * whines saying "Printer name is invalid" forever
+ * after. If we cause *JUST THIS NEXT OPEN* of \\SRVSVC
+ * to fail, then NT downgrades to using the downlevel code
+ * and everything works as well as before. I hate
+ * myself for adding this code.... JRA.
+ *
+ * The HACK_FAIL_TIME define allows only a 2
+ * second window for this to occur, just in
+ * case...
+ */
+
+static BOOL fail_next_srvsvc = False;
+static time_t fail_time;
+#define HACK_FAIL_TIME 2 /* In seconds. */
+
+void fail_next_srvsvc_open(void)
+{
+  /* Check client is WinNT proper; Win2K doesn't like Jeremy's hack - matty */
+  if (get_remote_arch() != RA_WINNT)
+    return;
+
+  fail_next_srvsvc = True;
+  fail_time = time(NULL);
+  DEBUG(10,("fail_next_srvsvc_open: setting up timeout close of \\srvsvc pipe for print fix.\n"));
+}
+
+/*
+ * HACK alert.... see above - JRA.
+ */
+
+BOOL should_fail_next_srvsvc_open(const char *pipename)
+{
+
+  DEBUG(10,("should_fail_next_srvsvc_open: fail = %d, pipe = %s\n",
+    (int)fail_next_srvsvc, pipename));
+
+  if(fail_next_srvsvc && (time(NULL) > fail_time + HACK_FAIL_TIME)) {
+    fail_next_srvsvc = False;
+    fail_time = (time_t)0;
+    DEBUG(10,("should_fail_next_srvsvc_open: End of timeout close of \\srvsvc pipe for print fix.\n"));
+  }
+
+  if(fail_next_srvsvc && strequal(pipename, "srvsvc")) {
+    fail_next_srvsvc = False;
+    DEBUG(10,("should_fail_next_srvsvc_open: Deliberately failing open of \\srvsvc pipe for print fix.\n"));
+    return True;
+  }
+  return False;
+}
+#endif
 
 /****************************************************************************
  Reply to an NT create and X call on a pipe.
@@ -498,6 +561,7 @@ static int nt_open_pipe(char *fname, connection_struct *conn,
 {
        pipes_struct *p = NULL;
        vuser_key key;
+
        uint16 vuid = SVAL(inbuf, smb_uid);
        int i;
 
@@ -517,6 +581,11 @@ static int nt_open_pipe(char *fname, connection_struct *conn,
        /* Strip \\ off the name. */
        fname++;
     
+#if 0
+       if(should_fail_next_srvsvc_open(fname))
+               return (ERROR(ERRSRV,ERRaccess));
+#endif
+
        DEBUG(3,("nt_open_pipe: Known pipe %s opening.\n", fname));
 
        key.pid = sys_getpid();
@@ -974,7 +1043,7 @@ static int call_nt_transact_create(connection_struct *conn,
 
       if( fname[0] == ':') {
           SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
-          return(ERROR(0, 0xc0000000|NT_STATUS_OBJECT_PATH_NOT_FOUND));
+          return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND));
       }
 
       return(ERROR(ERRDOS,ERRbadfid));
@@ -1268,44 +1337,6 @@ int reply_nttranss(connection_struct *conn,
        return(-1);
 }
 
-/****************************************************************************
- Reply to an NT transact rename command.
-****************************************************************************/
-
-static int call_nt_transact_rename(connection_struct *conn,
-                                  char *inbuf, char *outbuf, int length, 
-                                   int bufsize,
-                                   char **ppsetup, char **ppparams, char **ppdata)
-{
-  char *params = *ppparams;
-  pstring new_name;
-  files_struct *fsp = file_fsp(params, 0);
-  BOOL replace_if_exists = (SVAL(params,2) & RENAME_REPLACE_IF_EXISTS) ? True : False;
-  uint32 fname_len = MIN((((uint32)IVAL(inbuf,smb_nt_TotalParameterCount)-4)),
-                         ((uint32)sizeof(new_name)-1));
-  int outsize = 0;
-
-  CHECK_FSP(fsp, conn);
-  StrnCpy(new_name,params+4,fname_len);
-  new_name[fname_len] = '\0';
-
-  outsize = rename_internals(conn, inbuf, outbuf, fsp->fsp_name,
-                             new_name, replace_if_exists);
-  if(outsize == 0) {
-    /*
-     * Rename was successful.
-     */
-    send_nt_replies(inbuf, outbuf, bufsize, 0, NULL, 0, NULL, 0);
-
-    DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n", 
-          fsp->fsp_name, new_name));
-
-    outsize = -1;
-  }
-
-  return(outsize);
-}
-   
 /****************************************************************************
  This is the structure to keep the information needed to
  determine if a directory has changed.
@@ -1697,6 +1728,44 @@ name = %s\n", fsp->fsp_name ));
   return -1;
 }
 
+/****************************************************************************
+ Reply to an NT transact rename command.
+****************************************************************************/
+
+static int call_nt_transact_rename(connection_struct *conn,
+                                  char *inbuf, char *outbuf, int length, 
+                                   int bufsize,
+                                   char **ppsetup, char **ppparams, char **ppdata)
+{
+  char *params = *ppparams;
+  pstring new_name;
+  files_struct *fsp = file_fsp(params, 0);
+  BOOL replace_if_exists = (SVAL(params,2) & RENAME_REPLACE_IF_EXISTS) ? True : False;
+  uint32 fname_len = MIN((((uint32)IVAL(inbuf,smb_nt_TotalParameterCount)-4)),
+                         ((uint32)sizeof(new_name)-1));
+  int outsize = 0;
+
+  CHECK_FSP(fsp, conn);
+  StrnCpy(new_name,params+4,fname_len);
+  new_name[fname_len] = '\0';
+
+  outsize = rename_internals(conn, inbuf, outbuf, fsp->fsp_name,
+                             new_name, replace_if_exists);
+  if(outsize == 0) {
+    /*
+     * Rename was successful.
+     */
+    send_nt_replies(inbuf, outbuf, bufsize, 0, NULL, 0, NULL, 0);
+
+    DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n", 
+          fsp->fsp_name, new_name));
+
+    outsize = -1;
+  }
+
+  return(outsize);
+}
+
 /****************************************************************************
  Reply to query a security descriptor from an fsp. If it succeeds it allocates
  the space for the return elements and returns True.
index 8a4948be4ba5f08d90abbfc578d7ae7e2f51f75f..837ff6468fadeadebb747029df80dd52cbcd70d3 100644 (file)
@@ -386,7 +386,7 @@ static void make_srv_share_1005_info(SHARE_INFO_1005* sh1005, int snum)
   DEBUG(1, ("make_srv_share_1005_info\n"));
   sh1005->dfs_root_flag = 0;
 
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
   if(lp_host_msdfs() && lp_msdfs_root(snum))
     sh1005->dfs_root_flag = 3;
 #endif