[SCM] Samba Shared Repository - branch master updated

Christof Schmitt cs at samba.org
Thu Feb 6 11:44:03 MST 2014


The branch, master has been updated
       via  be8cd92 docs-xml: Add parameter CSC policy to the change share command.
       via  4cda0bf s3: rpc_server/srvsvc: NetShareSetInfo - let CSC policy be settable.
       via  cc84aa4 s3: rpc_server/srvsvc: NetShareSetInfo - Correctly initialize max_connections for info levels != 2 before calling the change share script.
      from  0ce4631 winbind3: Simplify fillup_pw_field

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit be8cd928cf3f71a6974d1b09e9a7dfd6a40bf7ba
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date:   Thu Feb 6 11:57:54 2014 +0530

    docs-xml: Add parameter CSC policy to the change share command.
    
    Signed-off-by: Shekhar Amlekar <samlekar at in.ibm.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    
    Autobuild-User(master): Christof Schmitt <cs at samba.org>
    Autobuild-Date(master): Thu Feb  6 19:43:06 CET 2014 on sn-devel-104

commit 4cda0bf24b3e2565d10c6295513b7f9d66f3cbd9
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date:   Tue Feb 4 14:43:53 2014 +0530

    s3: rpc_server/srvsvc: NetShareSetInfo - let CSC policy be settable.
    
    The current code simply denies changing the csc policy through RPC
    calls. Change that to allow changing the csc policy and call the 'change
    share command' when a SetInfo RPC call changes the setting.
    
    Signed-off-by: Shekhar Amlekar <samlekar at in.ibm.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit cc84aa48f0c24afdd9e83bc5816661248e530e44
Author: Shekhar Amlekar <samlekar at in.ibm.com>
Date:   Tue Feb 4 13:56:57 2014 +0530

    s3: rpc_server/srvsvc: NetShareSetInfo - Correctly initialize max_connections for info levels != 2 before calling the change share script.
    
    Signed-off-by: Shekhar Amlekar <samlekar at in.ibm.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/misc/changesharecommand.xml |    8 +++++-
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c       |   34 +++++++++++++++++-----
 2 files changed, 33 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/misc/changesharecommand.xml b/docs-xml/smbdotconf/misc/changesharecommand.xml
index 2033fcf..909a10c 100644
--- a/docs-xml/smbdotconf/misc/changesharecommand.xml
+++ b/docs-xml/smbdotconf/misc/changesharecommand.xml
@@ -23,7 +23,7 @@ moreinfo="none">smb.conf</filename>.
 
 	<para>
 	When executed, <command moreinfo="none">smbd</command> will automatically invoke the
-	<parameter moreinfo="none">change share command</parameter> with five parameters.
+	<parameter moreinfo="none">change share command</parameter> with six parameters.
 	</para>
 
 	<itemizedlist>
@@ -58,6 +58,12 @@ moreinfo="none">smb.conf</filename>.
 			share.
 			</para>
 		</listitem>
+
+		<listitem>
+			<para><parameter moreinfo="none">CSC policy</parameter> - client side caching
+			policy in string form. Valid values are: manual, documents, programs, disable.
+			</para>
+		</listitem>
 	</itemizedlist>
 
 	<para>
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 996bbdd..02938d4 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -1511,6 +1511,11 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
 	char *path = NULL;
 	struct security_descriptor *psd = NULL;
 	bool is_disk_op = False;
+	const char *csc_policy = NULL;
+	bool csc_policy_changed = false;
+	const char *csc_policies[] = {"manual", "documents", "programs",
+				      "disable"};
+	uint32_t client_csc_policy;
 	int max_connections = 0;
 	TALLOC_CTX *ctx = p->mem_ctx;
 	union srvsvc_NetShareInfo *info = r->in.info;
@@ -1561,6 +1566,9 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
 		return WERR_ACCESS_DENIED;
 	}
 
+	max_connections = lp_max_connections(snum);
+	csc_policy = csc_policies[lp_csc_policy(snum)];
+
 	switch (r->in.level) {
 	case 1:
 		pathname = lp_path(ctx, snum);
@@ -1601,14 +1609,21 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
 		   user, so we must compare it to see if it's what is set in
 		   smb.conf, so that we can contine other ops like setting
 		   ACLs on a share */
-		if (((info->info1005->dfs_flags &
-		      SHARE_1005_CSC_POLICY_MASK) >>
-		     SHARE_1005_CSC_POLICY_SHIFT) == lp_csc_policy(snum))
+		client_csc_policy = (info->info1005->dfs_flags &
+				     SHARE_1005_CSC_POLICY_MASK) >>
+				    SHARE_1005_CSC_POLICY_SHIFT;
+
+		if (client_csc_policy == lp_csc_policy(snum))
 			return WERR_OK;
 		else {
-			DEBUG(3, ("_srvsvc_NetShareSetInfo: client is trying to change csc policy from the network; must be done with smb.conf\n"));
-			return WERR_ACCESS_DENIED;
+			csc_policy = csc_policies[client_csc_policy];
+			csc_policy_changed = true;
 		}
+
+		pathname = lp_path(ctx, snum);
+		comment = lp_comment(ctx, snum);
+		type = STYPE_DISKTREE;
+		break;
 	case 1006:
 	case 1007:
 		return WERR_ACCESS_DENIED;
@@ -1655,20 +1670,23 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
 	/* Only call modify function if something changed. */
 
 	if (strcmp(path, lp_path(talloc_tos(), snum)) || strcmp(comment, lp_comment(talloc_tos(), snum))
-			|| (lp_max_connections(snum) != max_connections)) {
+			|| (lp_max_connections(snum) != max_connections)
+			|| csc_policy_changed) {
+
 		if (!lp_change_share_cmd(talloc_tos()) || !*lp_change_share_cmd(talloc_tos())) {
 			DEBUG(10,("_srvsvc_NetShareSetInfo: No change share command\n"));
 			return WERR_ACCESS_DENIED;
 		}
 
 		command = talloc_asprintf(p->mem_ctx,
-				"%s \"%s\" \"%s\" \"%s\" \"%s\" %d",
+				"%s \"%s\" \"%s\" \"%s\" \"%s\" %d \"%s\"",
 				lp_change_share_cmd(talloc_tos()),
 				get_dyn_CONFIGFILE(),
 				share_name,
 				path,
 				comment ? comment : "",
-				max_connections);
+				max_connections,
+				csc_policy);
 		if (!command) {
 			return WERR_NOMEM;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list