]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r6242: after talking to jeremy, we can actually consolidate
authorGerald Carter <jerry@samba.org>
Thu, 7 Apr 2005 22:37:03 +0000 (22:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:31 +0000 (10:56 -0500)
the 2 BOOL flags in dfs_redirect() down to one since
they both are used in essentially the same context
(from what we can tell).

Tested Win98SE, WinXP sp 1 & 2, Win2k3 sp1, and WIn2k Sp4.
All dfs operations still seem to work.

source/include/msdfs.h
source/smbd/msdfs.c
source/smbd/trans2.c

index 80a0c3a4f1e7179c13beb3ea007126010fab2f2b..8d6b23bcbfb3f70fe2f65c3757c2f0209894f7ad 100644 (file)
@@ -68,21 +68,14 @@ struct dfs_path
 #define RESOLVE_DFSPATH(name, conn, inbuf, outbuf)             \
 { if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) &&         \
       lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) &&          \
-      dfs_redirect(name, conn, False, False))                  \
-             return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED,     \
-                              ERRSRV, ERRbadpath);; }          
-
-#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf)    \
-{ if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) &&         \
-      lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) &&          \
-      dfs_redirect(name, conn, True, True))                    \
+      dfs_redirect(name, conn, False))                         \
              return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED,     \
                               ERRSRV, ERRbadpath);; }          
 
 #define RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf)        \
 { if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) &&         \
       lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) &&          \
-      dfs_redirect(name,conn, False, True))                    \
+      dfs_redirect(name,conn, True))                           \
              return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED,     \
                               ERRSRV, ERRbadpath);; }          
 
index c5e9d8d21cdfaed7dcec894b96c8a05a05d39217..b61a328080857b92d511816ce7ad373bf778835b 100644 (file)
@@ -282,8 +282,7 @@ should try the remaining path on the redirected server.
 *****************************************************************/
 
 static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp, 
-                     connection_struct* conn,
-                     BOOL findfirst_flag, BOOL allow_wcards,
+                     connection_struct* conn, BOOL search_flag, 
                      struct referral** reflistpp, int* refcntp,
                      BOOL* self_referralp, int* consumedcntp)
 {
@@ -315,7 +314,7 @@ static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
 
        /* check if need to redirect */
        if (is_msdfs_link(conn, localpath, reflistpp, refcntp, NULL)) {
-               if (findfirst_flag) {
+               if ( search_flag ) {
                        DEBUG(6,("resolve_dfs_path (FindFirst) No redirection "
                                 "for dfs link %s.\n", dfspath));
                        return False;
@@ -369,17 +368,20 @@ static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
 /*****************************************************************
   Decides if a dfs pathname should be redirected or not.
   If not, the pathname is converted to a tcon-relative local unix path
+
+  search_wcard_flag: this flag performs 2 functions bother related
+  to searches.  See resolve_dfs_path() and parse_processed_dfs_path()
+  for details.
 *****************************************************************/
 
-BOOL dfs_redirect( pstring pathname, connection_struct* conn, 
-                   BOOL findfirst_flag, BOOL allow_wcards )
+BOOL dfs_redirect( pstring pathname, connection_struct* conn, BOOL search_wcard_flag )
 {
        struct dfs_path dp;
        
        if (!conn || !pathname)
                return False;
 
-       parse_processed_dfs_path(pathname, &dp, allow_wcards);
+       parse_processed_dfs_path(pathname, &dp, search_wcard_flag);
 
        /* if dfs pathname for a non-dfs share, convert to tcon-relative
           path and return false */
@@ -391,7 +393,7 @@ BOOL dfs_redirect( pstring pathname, connection_struct* conn,
        if (!strequal(dp.servicename, lp_servicename(SNUM(conn)) )) 
                return False;
 
-       if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag, allow_wcards,
+       if (resolve_dfs_path(pathname, &dp, conn, search_wcard_flag,
                             NULL, NULL, NULL, NULL)) {
                DEBUG(3,("dfs_redirect: Redirecting %s\n", pathname));
                return True;
@@ -529,7 +531,7 @@ BOOL get_referred_path(char *pathname, struct junction_map *jucn,
                return False;
 
        /* If not remote & not a self referral, return False */
-       if (!resolve_dfs_path(pathname, &dp, conn, False, False,
+       if (!resolve_dfs_path(pathname, &dp, conn, False, 
                              &jucn->referral_list, &jucn->referral_count,
                              self_referralp, consumedcntp)) {
                if (!*self_referralp) {
index 9bc509ad549ca10391edc28832c0412fb3e746b0..8d673c25bd3e02e6cf7d2db80e980296443b1d5b 100644 (file)
@@ -1626,7 +1626,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
                return ERROR_NT(ntstatus);
        }
 
-       RESOLVE_FINDFIRST_DFSPATH(directory, conn, inbuf, outbuf);
+       RESOLVE_DFSPATH_WCARD(directory, conn, inbuf, outbuf);
 
        unix_convert(directory,conn,0,&bad_path,&sbuf);
        if (bad_path) {