svn commit: samba r4852 - in branches/SAMBA_3_0/source/rpc_server: .

jerry at samba.org jerry at samba.org
Wed Jan 19 18:28:55 GMT 2005


Author: jerry
Date: 2005-01-19 18:28:55 +0000 (Wed, 19 Jan 2005)
New Revision: 4852

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

Log:
merge simo changes to srv_srvsvc_nt.c from trunk
that allows the add/change share command to create the directory
passed in as an arguement and not require that it pre-exist.

Also finish testing of SeDiskOperatorPrivilege via srvmgr.exe


Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c	2005-01-19 17:42:33 UTC (rev 4851)
+++ branches/SAMBA_3_0/source/rpc_server/srv_srvsvc_nt.c	2005-01-19 18:28:55 UTC (rev 4852)
@@ -1419,10 +1419,7 @@
 
 static char *valid_share_pathname(char *dos_pathname)
 {
-	pstring saved_pathname;
-	pstring unix_pathname;
 	char *ptr;
-	int ret;
 
 	/* Convert any '\' paths to '/' */
 	unix_format(dos_pathname);
@@ -1437,21 +1434,7 @@
 	if (*ptr != '/')
 		return NULL;
 
-	/* Can we cd to it ? */
-
-	/* First save our current directory. */
-	if (getcwd(saved_pathname, sizeof(saved_pathname)) == NULL)
-		return False;
-
-	pstrcpy(unix_pathname, ptr);
-	
-	ret = chdir(unix_pathname);
-
-	/* We *MUST* be able to chdir back. Abort if we can't. */
-	if (chdir(saved_pathname) == -1)
-		smb_panic("valid_share_pathname: Unable to restore current directory.\n");
-
-	return (ret != -1) ? ptr : NULL;
+	return ptr;
 }
 
 /*******************************************************************
@@ -1468,7 +1451,7 @@
 	int type;
 	int snum;
 	int ret;
-	char *ptr;
+	char *path;
 	SEC_DESC *psd = NULL;
 	SE_PRIV se_diskop = SE_DISK_OPERATOR;
 	BOOL is_disk_op;
@@ -1569,12 +1552,12 @@
 		return WERR_ACCESS_DENIED;
 		
 	/* Check if the pathname is valid. */
-	if (!(ptr = valid_share_pathname( pathname )))
+	if (!(path = valid_share_pathname( pathname )))
 		return WERR_OBJECT_PATH_INVALID;
 
 	/* Ensure share name, pathname and comment don't contain '"' characters. */
 	string_replace(share_name, '"', ' ');
-	string_replace(ptr, '"', ' ');
+	string_replace(path, '"', ' ');
 	string_replace(comment, '"', ' ');
 
 	DEBUG(10,("_srv_net_share_set_info: change share command = %s\n",
@@ -1582,13 +1565,13 @@
 
 	/* Only call modify function if something changed. */
 	
-	if (strcmp(ptr, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) ) 
+	if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) ) 
 	{
 		if (!lp_change_share_cmd() || !*lp_change_share_cmd()) 
 			return WERR_ACCESS_DENIED;
 
 		slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
-				lp_change_share_cmd(), dyn_CONFIGFILE, share_name, ptr, comment);
+				lp_change_share_cmd(), dyn_CONFIGFILE, share_name, path, comment);
 
 		DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
 				
@@ -1648,7 +1631,7 @@
 	int type;
 	int snum;
 	int ret;
-	char *ptr;
+	char *path;
 	SEC_DESC *psd = NULL;
 	SE_PRIV se_diskop = SE_DISK_OPERATOR;
 	BOOL is_disk_op;
@@ -1724,16 +1707,16 @@
 		return WERR_ACCESS_DENIED;
 		
 	/* Check if the pathname is valid. */
-	if (!(ptr = valid_share_pathname( pathname )))
+	if (!(path = valid_share_pathname( pathname )))
 		return WERR_OBJECT_PATH_INVALID;
 
 	/* Ensure share name, pathname and comment don't contain '"' characters. */
 	string_replace(share_name, '"', ' ');
-	string_replace(ptr, '"', ' ');
+	string_replace(path, '"', ' ');
 	string_replace(comment, '"', ' ');
 
 	slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
-			lp_add_share_cmd(), dyn_CONFIGFILE, share_name, ptr, comment);
+			lp_add_share_cmd(), dyn_CONFIGFILE, share_name, path, comment);
 			
 	DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
 	
@@ -1758,9 +1741,9 @@
 	message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL);
 
 	if (psd) {
-		if (!set_share_security(p->mem_ctx, share_name, psd))
-			DEBUG(0,("_srv_net_share_add: Failed to add security info to share %s.\n",
-				share_name ));
+		if (!set_share_security(p->mem_ctx, share_name, psd)) {
+			DEBUG(0,("_srv_net_share_add: Failed to add security info to share %s.\n", share_name ));
+		}
 	}
 
 	/*



More information about the samba-cvs mailing list