[PATCH] Some random small patches

Volker Lendecke vl at samba.org
Tue Feb 14 20:29:25 UTC 2017


Hi!

Review appreciated!

Thanks, Volker
-------------- next part --------------
>From 42ba1d4a9416612049519115166552e4a278d28f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 29 Jan 2017 11:05:12 +0000
Subject: [PATCH 01/11] rpc_server: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source4/rpc_server/netlogon/dcerpc_netlogon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 15f0a77..afa9b1c 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -837,7 +837,8 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_check(const struct netr_LogonSamLogonE
 
   This version of the function allows other wrappers to say 'do not check the credentials'
 
-  We can't do the traditional 'wrapping' format completly, as this function must only run under schannel
+  We can't do the traditional 'wrapping' format completely, as this
+  function must only run under schannel
 */
 static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
 					struct netr_LogonSamLogonEx *r, struct netlogon_creds_CredentialState *creds)
-- 
2.1.4


>From 9a4126fd13f3cab3b8db0cd3345c526668e5444f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 8 Feb 2017 15:19:54 +0100
Subject: [PATCH 02/11] smbd: Make "create_file_sids" static

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/posix_acls.c | 4 +++-
 source3/smbd/proto.h      | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index c8d2bb3..cddd4e0 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -911,7 +911,9 @@ static int map_acl_perms_to_permset(connection_struct *conn, mode_t mode, SMB_AC
  Function to create owner and group SIDs from a SMB_STRUCT_STAT.
 ****************************************************************************/
 
-void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid)
+static void create_file_sids(const SMB_STRUCT_STAT *psbuf,
+			     struct dom_sid *powner_sid,
+			     struct dom_sid *pgroup_sid)
 {
 	uid_to_sid( powner_sid, psbuf->st_ex_uid );
 	gid_to_sid( pgroup_sid, psbuf->st_ex_gid );
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 50ede9d..7ccb12a 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -762,7 +762,6 @@ void reply_pipe_read_and_X(struct smb_request *req);
 
 /* The following definitions come from smbd/posix_acls.c  */
 
-void create_file_sids(const SMB_STRUCT_STAT *psbuf, struct dom_sid *powner_sid, struct dom_sid *pgroup_sid);
 uint32_t map_canon_ace_perms(int snum,
                                 enum security_ace_type *pacl_type,
                                 mode_t perms,
-- 
2.1.4


>From edbc5985c4405d9c9976fcf6a47afdc102138419 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 9 Feb 2017 19:13:21 +0100
Subject: [PATCH 03/11] smbd: Fix some whitespace

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/modules/vfs_posixacl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c
index f009fcc..aeadcbc 100644
--- a/source3/modules/vfs_posixacl.c
+++ b/source3/modules/vfs_posixacl.c
@@ -187,7 +187,7 @@ static bool smb_ace_to_internal(acl_entry_t posix_ace,
 		acl_free(puid);
 		break;
 	}
-		
+
 	case SMB_ACL_GROUP: {
 		gid_t *pgid = (uid_t *)acl_get_qualifier(posix_ace);
 		if (pgid == NULL) {
@@ -230,7 +230,7 @@ static struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx)
 
 		entry_id = ACL_NEXT_ENTRY;
 
-		result->acl = talloc_realloc(result, result->acl, 
+		result->acl = talloc_realloc(result, result->acl,
 					     struct smb_acl_entry, result->count+1);
 		if (result->acl == NULL) {
 			TALLOC_FREE(result);
-- 
2.1.4


>From d596f2c24f4833d0cd41aa1a88baea0d4234271b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 18 Jan 2017 12:58:19 +0100
Subject: [PATCH 04/11] ctdb: Only build test_mutex_raw.c on Linux

This is pretty glibc on Linux specific. FreeBSD 11 also has
robust mutexes and can't build this.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 ctdb/wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/wscript b/ctdb/wscript
index 13384c8..0233149 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -830,7 +830,7 @@ def build(bld):
                               ib_deps,
                          install_path='${CTDB_TEST_LIBEXECDIR}')
 
-    if bld.env.HAVE_ROBUST_MUTEXES:
+    if bld.env.HAVE_ROBUST_MUTEXES and sys.platform.startswith('linux'):
         bld.SAMBA_BINARY('test_mutex_raw',
                          source='tests/src/test_mutex_raw.c',
                          deps='pthread',
-- 
2.1.4


>From 8ca5232ae23ecda096d2fb138ac9ccf6b4a0ae0a Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 13 Feb 2017 10:14:24 +0100
Subject: [PATCH 05/11] winbind: Fix a typo

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/winbindd/winbindd_cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 4eff7a7..d8c894c 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -3332,7 +3332,7 @@ static NTSTATUS cm_connect_netlogon_transport(struct winbindd_domain *domain,
 }
 
 /****************************************************************************
-Open a LSA connection to a DC, suiteable for LSA lookup calls.
+Open a NETLOGON connection to a DC, suiteable for SamLogon calls.
 ****************************************************************************/
 
 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
-- 
2.1.4


>From b742bac7bd816091e3af54dedd4732a7b711af40 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 11 Feb 2017 10:38:21 +0100
Subject: [PATCH 06/11] auth3: Use NT_STATUS_EQUAL

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/auth/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 833eae9..50d0188 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -229,7 +229,7 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
 					   &server_info);
 
 		/* check if the module did anything */
-		if ( NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ) {
+		if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED)) {
 			DEBUG(10,("check_ntlm_password: %s had nothing to say\n", auth_method->name));
 			TALLOC_FREE(tmp_ctx);
 			if (user_info->flags & USER_INFO_LOCAL_SAM_ONLY) {
-- 
2.1.4


>From 5a7fcb9f25dea18efb637e7d94b85d0e28624486 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 9 Feb 2017 18:43:46 +0100
Subject: [PATCH 07/11] smbd: Fix some whitespace

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/posix_acls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index cddd4e0..8187a8b 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3325,7 +3325,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 		 * would lead to usability problems under Windows: The Creator entries
 		 * are only available in browse lists of directories and not for files;
 		 * additionally the identity of the owning group couldn't be determined.
-		 * We therefore use those identities only for Default ACLs. 
+		 * We therefore use those identities only for Default ACLs.
 		 */
 
 		/* Create the canon_ace lists. */
@@ -3334,7 +3334,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
 					    SMB_ACL_TYPE_ACCESS);
 
 		/* We must have *some* ACLS. */
-	
+
 		if (count_canon_ace_list(file_ace) == 0) {
 			DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", name));
 			goto done;
-- 
2.1.4


>From 36879173cf732fdfbedbcc34e5d66fd47717f17c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 26 Jan 2017 12:51:24 +0100
Subject: [PATCH 08/11] lib: Fix some whitespace

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/winbind_util.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c
index b3ecac1..852929e 100644
--- a/source3/lib/winbind_util.c
+++ b/source3/lib/winbind_util.c
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    Winbind Utility functions
 
@@ -71,16 +71,16 @@ bool winbind_lookup_name(const char *dom_name, const char *name, struct dom_sid
 {
 	struct wbcDomainSid dom_sid;
 	wbcErr result;
-	enum wbcSidType type;	
+	enum wbcSidType type;
 
 	result = wbcLookupName(dom_name, name, &dom_sid, &type);
 	if (result != WBC_ERR_SUCCESS)
 		return false;
 
 	memcpy(sid, &dom_sid, sizeof(struct dom_sid));
-	*name_type = (enum lsa_SidType)type;	
+	*name_type = (enum lsa_SidType)type;
 
-	return true;	
+	return true;
 }
 
 /* Call winbindd to convert sid to name */
@@ -95,7 +95,7 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
 	char *domain_name = NULL;
 	char *account_name = NULL;
 
-	memcpy(&dom_sid, sid, sizeof(dom_sid));	
+	memcpy(&dom_sid, sid, sizeof(dom_sid));
 
 	result = wbcLookupSid(&dom_sid, &domain_name, &account_name, &type);
 	if (result != WBC_ERR_SUCCESS)
@@ -103,7 +103,7 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
 
 	/* Copy out result */
 
-	if (domain) {		
+	if (domain) {
 		*domain = talloc_strdup(mem_ctx, domain_name);
 	}
 	if (name) {
@@ -111,16 +111,16 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
 	}
 	*name_type = (enum lsa_SidType)type;
 
-	DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", 
+	DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n",
 		   sid_string_dbg(sid), domain_name, account_name));
 
 	wbcFreeMemory(domain_name);
 	wbcFreeMemory(account_name);
 
-	if ((domain && !*domain) || (name && !*name)) {		
+	if ((domain && !*domain) || (name && !*name)) {
 		DEBUG(0,("winbind_lookup_sid: talloc() failed!\n"));
 		return false;
-	}	
+	}
 
 
 	return true;
@@ -142,11 +142,11 @@ bool winbind_sid_to_uid(uid_t *puid, const struct dom_sid *sid)
 	struct wbcDomainSid dom_sid;
 	wbcErr result;
 
-	memcpy(&dom_sid, sid, sizeof(dom_sid));	
+	memcpy(&dom_sid, sid, sizeof(dom_sid));
 
-	result = wbcSidToUid(&dom_sid, puid);	
+	result = wbcSidToUid(&dom_sid, puid);
 
-	return (result == WBC_ERR_SUCCESS);	
+	return (result == WBC_ERR_SUCCESS);
 }
 
 /* Call winbindd to convert uid to sid */
@@ -173,11 +173,11 @@ bool winbind_sid_to_gid(gid_t *pgid, const struct dom_sid *sid)
 	struct wbcDomainSid dom_sid;
 	wbcErr result;
 
-	memcpy(&dom_sid, sid, sizeof(dom_sid));	
+	memcpy(&dom_sid, sid, sizeof(dom_sid));
 
-	result = wbcSidToGid(&dom_sid, pgid);	
+	result = wbcSidToGid(&dom_sid, pgid);
 
-	return (result == WBC_ERR_SUCCESS);	
+	return (result == WBC_ERR_SUCCESS);
 }
 
 /* Call winbindd to convert gid to sid */
@@ -210,7 +210,7 @@ wbcErr wb_is_trusted_domain(const char *domain)
 		wbcFreeMemory(info);
 	}
 
-	return result;	
+	return result;
 }
 
 /* Lookup a set of rids in a given domain */
@@ -226,15 +226,15 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
 	enum wbcSidType *name_types = NULL;
 	struct wbcDomainSid dom_sid;
 	wbcErr ret;
-	int i;	
+	int i;
 
 	memcpy(&dom_sid, domain_sid, sizeof(struct wbcDomainSid));
 
 	ret = wbcLookupRids(&dom_sid, num_rids, rids,
 			    &dom_name, &namelist, &name_types);
-	if (ret != WBC_ERR_SUCCESS) {		
+	if (ret != WBC_ERR_SUCCESS) {
 		return false;
-	}	
+	}
 
 	*domain_name = talloc_strdup(mem_ctx, dom_name);
 	*names       = talloc_array(mem_ctx, const char*, num_rids);
@@ -249,7 +249,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
 	wbcFreeMemory(namelist);
 	wbcFreeMemory(name_types);
 
-	return true;	
+	return true;
 }
 
 /* Ask Winbind to allocate a new uid for us */
@@ -428,7 +428,7 @@ bool winbind_uid_to_sid(struct dom_sid *sid, uid_t uid)
 
 bool winbind_sid_to_gid(gid_t *pgid, const struct dom_sid *sid)
 {
-	return false;	
+	return false;
 }
 
 /* Call winbindd to convert gid to sid */
-- 
2.1.4


>From 90b8f1dee3a34f20b33186fc522e81b7e2e7628b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 24 Jan 2017 21:17:38 +0100
Subject: [PATCH 09/11] libsmb: Fix whitespace

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/libsmb/trustdom_cache.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/source3/libsmb/trustdom_cache.c b/source3/libsmb/trustdom_cache.c
index 330fd41..d78a28c 100644
--- a/source3/libsmb/trustdom_cache.c
+++ b/source3/libsmb/trustdom_cache.c
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
 
    Trusted domain names cache on top of gencache.
@@ -99,7 +99,7 @@ static char* trustdom_cache_key(const char* name)
  * @return true upon successful value storing or
  *         false if store attempt failed
  **/
- 
+
 bool trustdom_cache_store(const char *name, const char *alt_name,
 			  const struct dom_sid *sid, time_t timeout)
 {
@@ -182,7 +182,7 @@ bool trustdom_cache_fetch(const char* name, struct dom_sid* sid)
 
 
 /*******************************************************************
- fetch the timestamp from the last update 
+ fetch the timestamp from the last update
 *******************************************************************/
 
 uint32_t trustdom_cache_fetch_timestamp( void )
@@ -195,7 +195,7 @@ uint32_t trustdom_cache_fetch_timestamp( void )
 		DEBUG(5, ("no timestamp for trusted domain cache located.\n"));
 		SAFE_FREE(value);
 		return 0;
-	} 
+	}
 
 	timestamp = atoi(value);
 
@@ -204,7 +204,7 @@ uint32_t trustdom_cache_fetch_timestamp( void )
 }
 
 /*******************************************************************
- store the timestamp from the last update 
+ store the timestamp from the last update
 *******************************************************************/
 
 bool trustdom_cache_store_timestamp( uint32_t t, time_t timeout )
@@ -216,7 +216,7 @@ bool trustdom_cache_store_timestamp( uint32_t t, time_t timeout )
 	if (!gencache_set(TDOMTSKEY, value, timeout)) {
 		DEBUG(5, ("failed to set timestamp for trustdom_cache\n"));
 		return False;
-	} 
+	}
 
 	return True;
 }
@@ -241,7 +241,7 @@ static void flush_trustdom_name(const char* key, const char *value, time_t timeo
 
 void trustdom_cache_flush(void)
 {
-	/* 
+	/*
 	 * iterate through each TDOM cache's entry and flush it
 	 * by flush_trustdom_name function
 	 */
@@ -349,7 +349,7 @@ done:
 }
 
 /********************************************************************
- update the trustdom_cache if needed 
+ update the trustdom_cache if needed
 ********************************************************************/
 #define TRUSTDOM_UPDATE_INTERVAL	600
 
@@ -364,8 +364,8 @@ void update_trustdom_cache( void )
 	time_t now = time(NULL);
 	int i;
 
-	/* get the timestamp.  We have to initialise it if the last timestamp == 0 */	
-	if ( (last_check = trustdom_cache_fetch_timestamp()) == 0 ) 
+	/* get the timestamp.  We have to initialise it if the last timestamp == 0 */
+	if ( (last_check = trustdom_cache_fetch_timestamp()) == 0 )
 		trustdom_cache_store_timestamp(0, now+TRUSTDOM_UPDATE_INTERVAL);
 
 	time_diff = (int) (now - last_check);
@@ -387,20 +387,20 @@ void update_trustdom_cache( void )
 
 	/* get the domains and store them */
 
-	if ( enumerate_domain_trusts(mem_ctx, lp_workgroup(), &domain_names, 
+	if ( enumerate_domain_trusts(mem_ctx, lp_workgroup(), &domain_names,
 		&num_domains, &dom_sids)) {
 		for ( i=0; i<num_domains; i++ ) {
-			trustdom_cache_store( domain_names[i], NULL, &dom_sids[i], 
+			trustdom_cache_store( domain_names[i], NULL, &dom_sids[i],
 				now+TRUSTDOM_UPDATE_INTERVAL);
-		}		
+		}
 	} else {
 		/* we failed to fetch the list of trusted domains - restore the old
 		   timestamp */
-		trustdom_cache_store_timestamp(last_check, 
+		trustdom_cache_store_timestamp(last_check,
 					       last_check+TRUSTDOM_UPDATE_INTERVAL);
 	}
 
-done:	
+done:
 	talloc_destroy( mem_ctx );
 
 	return;
-- 
2.1.4


>From ba142487c4384383e96151818d4f776b80d95e46 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 24 Jan 2017 16:17:31 +0100
Subject: [PATCH 10/11] winbind: Fix a signed/unsigned mixup

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/winbindd/winbindd_dual_srv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c
index 49236cd..b0b38a6 100644
--- a/source3/winbindd/winbindd_dual_srv.c
+++ b/source3/winbindd/winbindd_dual_srv.c
@@ -601,7 +601,7 @@ NTSTATUS _wbint_LookupRids(struct pipes_struct *p, struct wbint_LookupRids *r)
 	enum lsa_SidType *types;
 	struct wbint_Principal *result;
 	NTSTATUS status;
-	int i;
+	uint32_t i;
 
 	if (domain == NULL) {
 		return NT_STATUS_REQUEST_NOT_ACCEPTED;
-- 
2.1.4


>From cceb978132c68d25040a27ddad59dd7a55b870d0 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 20 Jan 2017 16:57:11 +0100
Subject: [PATCH 11/11] lib: Avoid an "includes.h"

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/lsa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/source3/lib/lsa.c b/source3/lib/lsa.c
index 6b9015a..1c24a42 100644
--- a/source3/lib/lsa.c
+++ b/source3/lib/lsa.c
@@ -19,7 +19,9 @@
  init_lsa_ref_domain_list - adds a domain if it's not already in, returns index.
 ***************************************************************************/
 
-#include "includes.h"
+#include "replace.h"
+#include "lib/util/data_blob.h"
+#include "lib/util/time.h"
 #include "libcli/security/dom_sid.h"
 #include "librpc/gen_ndr/lsa.h"
 #include "lsa.h"
-- 
2.1.4



More information about the samba-technical mailing list