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

jra at samba.org jra at samba.org
Fri Mar 25 00:58:16 GMT 2005


Author: jra
Date: 2005-03-25 00:58:15 +0000 (Fri, 25 Mar 2005)
New Revision: 6053

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

Log:
Fixup dfs path with the new wildcard parser code split out.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/include/msdfs.h
   branches/SAMBA_3_0/source/smbd/msdfs.c
   branches/SAMBA_3_0/source/smbd/posix_acls.c
   branches/SAMBA_3_0/source/smbd/reply.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-03-25 00:43:51 UTC (rev 6052)
+++ branches/SAMBA_3_0/source/include/msdfs.h	2005-03-25 00:58:15 UTC (rev 6053)
@@ -72,6 +72,13 @@
              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,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-03-25 00:43:51 UTC (rev 6052)
+++ branches/SAMBA_3_0/source/smbd/msdfs.c	2005-03-25 00:58:15 UTC (rev 6053)
@@ -75,7 +75,7 @@
   into the dfs_path structure 
  **********************************************************************/
 
-static BOOL parse_processed_dfs_path(char* pathname, struct dfs_path* pdp)
+static BOOL parse_processed_dfs_path(char* pathname, struct dfs_path* pdp, BOOL allow_wcards)
 {
 	pstring pathname_local;
 	char* p,*temp;
@@ -110,7 +110,11 @@
 	DEBUG(10,("parse_processed_dfs_path: servicename: %s\n",pdp->servicename));
 
 	/* rest is reqpath */
-	check_path_syntax(pdp->reqpath, p+1);
+	if (allow_wcards) {
+		check_path_syntax_wcard(pdp->reqpath, p+1);
+	} else {
+		check_path_syntax(pdp->reqpath, p+1);
+	}
 
 	DEBUG(10,("parse_processed_dfs_path: rest of the path: %s\n",pdp->reqpath));
 	return True;
@@ -265,9 +269,7 @@
  Used by other functions to decide if a dfs path is remote,
 and to get the list of referred locations for that remote path.
  
-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.
+allow_wcards: Should we allow wildcards when parsing paths.
 
 self_referralp: clients expect a dfs referral for the same share when
 they request referrals for dfs roots on a server. 
@@ -279,7 +281,7 @@
 
 static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp, 
 		      connection_struct* conn,
-		      BOOL findfirst_flag,
+		      BOOL allow_wcards,
 		      struct referral** reflistpp, int* refcntp,
 		      BOOL* self_referralp, int* consumedcntp)
 {
@@ -311,18 +313,11 @@
 
 	/* 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;
-		} else {		
-			DEBUG(6,("resolve_dfs_path: %s resolves to a valid Dfs link.\n",
-				 dfspath));
-			if (consumedcntp) 
-				*consumedcntp = strlen(dfspath);
-			return True;
-		}
-	} 
+		DEBUG(6,("resolve_dfs_path: %s resolves to a valid Dfs link.\n", dfspath));
+		if (consumedcntp) 
+			*consumedcntp = strlen(dfspath);
+		return True;
+	}
 
 	/* redirect if any component in the path is a link */
 	pstrcpy(reqpath, dp->reqpath);
@@ -366,15 +361,14 @@
   If not, the pathname is converted to a tcon-relative local unix path
 *****************************************************************/
 
-BOOL dfs_redirect(pstring pathname, connection_struct* conn,
-		  BOOL findfirst_flag)
+BOOL dfs_redirect(pstring pathname, connection_struct* conn, BOOL allow_wcards)
 {
 	struct dfs_path dp;
 	
 	if (!conn || !pathname)
 		return False;
 
-	parse_processed_dfs_path(pathname, &dp);
+	parse_processed_dfs_path(pathname, &dp, allow_wcards);
 
 	/* if dfs pathname for a non-dfs share, convert to tcon-relative
 	   path and return false */
@@ -386,7 +380,7 @@
 	if (!strequal(dp.servicename, lp_servicename(SNUM(conn)) )) 
 		return False;
 
-	if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag,
+	if (resolve_dfs_path(pathname, &dp, conn, allow_wcards,
 			     NULL, NULL, NULL, NULL)) {
 		DEBUG(3,("dfs_redirect: Redirecting %s\n", pathname));
 		return True;
@@ -802,6 +796,7 @@
 /**********************************************************************
  Creates a junction structure from a Dfs pathname
  **********************************************************************/
+
 BOOL create_junction(char* pathname, struct junction_map* jucn)
 {
         struct dfs_path dp;

Modified: branches/SAMBA_3_0/source/smbd/posix_acls.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/posix_acls.c	2005-03-25 00:43:51 UTC (rev 6052)
+++ branches/SAMBA_3_0/source/smbd/posix_acls.c	2005-03-25 00:58:15 UTC (rev 6053)
@@ -3067,7 +3067,7 @@
 	create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid);
 
 	acl_perms = unpack_canon_ace( fsp, &sbuf, &file_owner_sid, &file_grp_sid,
-									&file_ace_list, &dir_ace_list, security_info_sent, psd);
+					&file_ace_list, &dir_ace_list, security_info_sent, psd);
 
 	/* Ignore W2K traverse DACL set. */
 	if (file_ace_list || dir_ace_list) {

Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2005-03-25 00:43:51 UTC (rev 6052)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2005-03-25 00:58:15 UTC (rev 6053)
@@ -949,7 +949,7 @@
 		return ERROR_NT(nt_status);
 	}
 
-	RESOLVE_DFSPATH(path, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(path, conn, inbuf, outbuf);
   
 	p++;
 	status_len = SVAL(p, 0);
@@ -1823,7 +1823,7 @@
 		return ERROR_NT(status);
 	}
 	
-	RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf);
 	
 	DEBUG(3,("reply_unlink : %s\n",name));
 	
@@ -4293,8 +4293,8 @@
 		return ERROR_NT(status);
 	}
 	
-	RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
-	RESOLVE_DFSPATH(newname, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(newname, conn, inbuf, outbuf);
 	
 	DEBUG(3,("reply_mv : %s -> %s\n",name,newname));
 	
@@ -4453,8 +4453,8 @@
 		return ERROR_DOS(ERRSRV,ERRinvdevice);
 	}
 
-	RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
-	RESOLVE_DFSPATH(newname, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(newname, conn, inbuf, outbuf);
 
 	rc = unix_convert(name,conn,0,&bad_path1,&sbuf1);
 	unix_convert(newname,conn,0,&bad_path2,&sbuf2);

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2005-03-25 00:43:51 UTC (rev 6052)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2005-03-25 00:58:15 UTC (rev 6053)
@@ -1562,7 +1562,7 @@
 		return ERROR_NT(ntstatus);
 	}
 
-	RESOLVE_DFSPATH(directory, conn, inbuf, outbuf);
+	RESOLVE_DFSPATH_WCARD(directory, conn, inbuf, outbuf);
 
 	unix_convert(directory,conn,0,&bad_path,&sbuf);
 	if (bad_path) {



More information about the samba-cvs mailing list