svn commit: samba r6237 - in branches/SAMBA_3_0/source: include smbd

jerry at samba.org jerry at samba.org
Thu Apr 7 19:43:20 GMT 2005


Author: jerry
Date: 2005-04-07 19:43:19 +0000 (Thu, 07 Apr 2005)
New Revision: 6237

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6237

Log:
fix my breakage of WinXP sp2 msdfs support.
We did need the special case for RESOLVE_DFSPATH 
in the findfirst() code.

Jeremy, please verify I haven't broken the allow_wcard 
code you added to resolve_dfs_path()



Modified:
   branches/SAMBA_3_0/source/include/msdfs.h
   branches/SAMBA_3_0/source/smbd/msdfs.c
   branches/SAMBA_3_0/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/msdfs.h
===================================================================
--- branches/SAMBA_3_0/source/include/msdfs.h	2005-04-07 19:40:20 UTC (rev 6236)
+++ branches/SAMBA_3_0/source/include/msdfs.h	2005-04-07 19:43:19 UTC (rev 6237)
@@ -68,17 +68,24 @@
 #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))				\
+      dfs_redirect(name, conn, False, False))			\
              return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED,	\
 			       ERRSRV, ERRbadpath);; }		
 
-#define RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf)           	\
+#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))				\
+      dfs_redirect(name, conn, True, True))			\
              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))			\
+             return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED,	\
+			       ERRSRV, ERRbadpath);; }		
+
 #define init_dfsroot(conn, inbuf, outbuf)                    	\
 { if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) {        	\
         DEBUG(2,("Serving %s as a Dfs root\n", 			\

Modified: branches/SAMBA_3_0/source/smbd/msdfs.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/msdfs.c	2005-04-07 19:40:20 UTC (rev 6236)
+++ branches/SAMBA_3_0/source/smbd/msdfs.c	2005-04-07 19:43:19 UTC (rev 6237)
@@ -269,7 +269,9 @@
  Used by other functions to decide if a dfs path is remote,
 and to get the list of referred locations for that remote path.
  
-allow_wcards: Should we allow wildcards when parsing paths.
+findfirst_flag: For findfirsts, dfs links themselves are not
+redirected, but paths beyond the links are. For normal smb calls,
+even dfs links need to be redirected.
 
 self_referralp: clients expect a dfs referral for the same share when
 they request referrals for dfs roots on a server. 
@@ -281,7 +283,7 @@
 
 static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp, 
 		      connection_struct* conn,
-		      BOOL allow_wcards,
+		      BOOL findfirst_flag, BOOL allow_wcards,
 		      struct referral** reflistpp, int* refcntp,
 		      BOOL* self_referralp, int* consumedcntp)
 {
@@ -313,6 +315,12 @@
 
 	/* check if need to redirect */
 	if (is_msdfs_link(conn, localpath, reflistpp, refcntp, NULL)) {
+		if (findfirst_flag) {
+			DEBUG(6,("resolve_dfs_path (FindFirst) No redirection "
+				 "for dfs link %s.\n", dfspath));
+			return False;
+		}
+		
 		DEBUG(6,("resolve_dfs_path: %s resolves to a valid Dfs link.\n", dfspath));
 		if (consumedcntp) 
 			*consumedcntp = strlen(dfspath);
@@ -326,6 +334,7 @@
 		*p = '\0';
 		pstrcpy(localpath, reqpath);
 		if (is_msdfs_link(conn, localpath, reflistpp, refcntp, NULL)) {
+		
 			DEBUG(4, ("resolve_dfs_path: Redirecting %s because parent %s is dfs link\n", dfspath, localpath));
 
 			/* To find the path consumed, we truncate the original
@@ -333,6 +342,7 @@
 			   component. The length of the resulting string is
 			   the path consumed 
 			*/
+			
 			if (consumedcntp) {
 				char *q;
 				pstring buf;
@@ -361,7 +371,8 @@
   If not, the pathname is converted to a tcon-relative local unix path
 *****************************************************************/
 
-BOOL dfs_redirect(pstring pathname, connection_struct* conn, BOOL allow_wcards)
+BOOL dfs_redirect( pstring pathname, connection_struct* conn, 
+                   BOOL findfirst_flag, BOOL allow_wcards )
 {
 	struct dfs_path dp;
 	
@@ -380,7 +391,7 @@
 	if (!strequal(dp.servicename, lp_servicename(SNUM(conn)) )) 
 		return False;
 
-	if (resolve_dfs_path(pathname, &dp, conn, allow_wcards,
+	if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag, allow_wcards,
 			     NULL, NULL, NULL, NULL)) {
 		DEBUG(3,("dfs_redirect: Redirecting %s\n", pathname));
 		return True;
@@ -518,7 +529,7 @@
 		return False;
 
 	/* If not remote & not a self referral, return False */
-	if (!resolve_dfs_path(pathname, &dp, conn, False, 
+	if (!resolve_dfs_path(pathname, &dp, conn, False, False,
 			      &jucn->referral_list, &jucn->referral_count,
 			      self_referralp, consumedcntp)) {
 		if (!*self_referralp) {

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2005-04-07 19:40:20 UTC (rev 6236)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2005-04-07 19:43:19 UTC (rev 6237)
@@ -1626,7 +1626,7 @@
 		return ERROR_NT(ntstatus);
 	}
 
-	RESOLVE_DFSPATH_WCARD(directory, conn, inbuf, outbuf);
+	RESOLVE_FINDFIRST_DFSPATH(directory, conn, inbuf, outbuf);
 
 	unix_convert(directory,conn,0,&bad_path,&sbuf);
 	if (bad_path) {



More information about the samba-cvs mailing list