[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Nov 26 13:28:03 MST 2014


The branch, master has been updated
       via  f833052 param: remove unused get_share_params()
       via  2d755a4 srv_srvsvc_nt: remove unneeded get_share_params() call
       via  c426f97 libcli: SMB2: Pure SMB2-only negprot fix to make us behave as a Windows client does.
      from  068f9e2 gencache: Request mutexes for gencache_notrans.tdb

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


- Log -----------------------------------------------------------------
commit f83305289919d74704cc7e6dc508e84b3326481a
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Nov 25 22:22:24 2014 +0100

    param: remove unused get_share_params()
    
    Given a share name, get_share_params() returns corresponding snum inside
    a struct share_params. find_service() provides duplicate functionality.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Nov 26 21:27:21 CET 2014 on sn-devel-104

commit 2d755a4e2aa1e5dffdd3e8eafa82ce07f428def1
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Nov 25 22:22:23 2014 +0100

    srv_srvsvc_nt: remove unneeded get_share_params() call
    
    The snum and share name are already determined via the prior
    find_service() call.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c426f97238e4f664d1b13781101ca9c942aa7d0d
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 25 17:43:25 2014 -0800

    libcli: SMB2: Pure SMB2-only negprot fix to make us behave as a Windows client does.
    
    Required as some servers return zero when asked for
    zero credits in an initial SMB2-only negprot.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <rb at sernet.de>

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

Summary of changes:
 libcli/smb/smb2_negotiate_context.h       |  1 +
 libcli/smb/smbXcli_base.c                 | 10 ++++++++++
 source3/include/proto.h                   |  2 --
 source3/param/service.c                   | 22 ----------------------
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 11 +++--------
 5 files changed, 14 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb2_negotiate_context.h b/libcli/smb/smb2_negotiate_context.h
index d98104a..55aa032 100644
--- a/libcli/smb/smb2_negotiate_context.h
+++ b/libcli/smb/smb2_negotiate_context.h
@@ -50,5 +50,6 @@ NTSTATUS smb2_negotiate_context_add(TALLOC_CTX *mem_ctx, struct smb2_negotiate_c
  */
 struct smb2_negotiate_context *smb2_negotiate_context_find(const struct smb2_negotiate_contexts *b,
 							   uint16_t type);
+#define WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK	31
 
 #endif /* _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_ */
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 61ac6f0..a3a7ecb 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3864,6 +3864,16 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx,
 		 */
 		conn->dispatch_incoming = smb2cli_conn_dispatch_incoming;
 
+		/*
+		 * As we're starting with an SMB2 negprot, emulate Windows
+		 * and ask for 31 credits in the initial SMB2 negprot.
+		 * If we don't and leave requested credits at
+		 * zero, MacOSX servers return zero credits on
+		 * the negprot reply and we fail to connect.
+		 */
+		smb2cli_conn_set_max_credits(conn,
+			WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK);
+
 		subreq = smbXcli_negprot_smb2_subreq(state);
 		if (tevent_req_nomem(subreq, req)) {
 			return tevent_req_post(req, ev);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ce23289..82e1032 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1084,8 +1084,6 @@ int lp_numservices(void);
 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
 void lp_dump_one(FILE * f, bool show_defaults, int snum);
 int lp_servicenumber(const char *pszServiceName);
-struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
-				      const char *sharename);
 const char *volume_label(TALLOC_CTX *ctx, int snum);
 bool lp_domain_master(void);
 bool lp_preferred_master(void);
diff --git a/source3/param/service.c b/source3/param/service.c
index 473fc82..b21be60 100644
--- a/source3/param/service.c
+++ b/source3/param/service.c
@@ -251,25 +251,3 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out)
 
 	return (iService);
 }
-
-
-struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
-				      const char *sharename)
-{
-	struct share_params *result;
-	char *sname = NULL;
-	int snum;
-
-	snum = find_service(mem_ctx, sharename, &sname);
-	if (snum < 0 || sname == NULL) {
-		return NULL;
-	}
-
-	if (!(result = talloc(mem_ctx, struct share_params))) {
-		DEBUG(0, ("talloc failed\n"));
-		return NULL;
-	}
-
-	result->service = snum;
-	return result;
-}
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index eaa70e7..5c26f15 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -2143,7 +2143,6 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
 	int ret;
 	int snum;
 	bool is_disk_op;
-	struct share_params *params;
 	TALLOC_CTX *ctx = p->mem_ctx;
 
 	DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
@@ -2168,10 +2167,6 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
 		return WERR_NO_SUCH_SHARE;
 	}
 
-	if (!(params = get_share_params(p->mem_ctx, share_name))) {
-		return WERR_NO_SUCH_SHARE;
-	}
-
 	/* No change to printer shares. */
 	if (lp_printable(snum))
 		return WERR_ACCESS_DENIED;
@@ -2190,7 +2185,7 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
 			"%s \"%s\" \"%s\"",
 			lp_delete_share_command(talloc_tos()),
 			get_dyn_CONFIGFILE(),
-			lp_servicename(talloc_tos(), snum));
+			share_name);
 	if (!command) {
 		return WERR_NOMEM;
 	}
@@ -2219,9 +2214,9 @@ WERROR _srvsvc_NetShareDel(struct pipes_struct *p,
 		return WERR_ACCESS_DENIED;
 
 	/* Delete the SD in the database. */
-	delete_share_security(lp_servicename(talloc_tos(), params->service));
+	delete_share_security(share_name);
 
-	lp_killservice(params->service);
+	lp_killservice(snum);
 
 	return WERR_OK;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list