[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Jan 24 06:52:59 MST 2010


The branch, master has been updated
       via  185815a... s3: Remove some calls to memset -- reduces text size by some bytes for me
       via  96b12e0... libwbclient: Use winbindd_free_response()
       via  5a31373... libwbclient: Remove a pointless talloc_strdup
      from  d69d07c... s4-provision: Added msDS-NcType into samba4Top object class

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


- Log -----------------------------------------------------------------
commit 185815a6472a7a09602b3c51198e20257241dfa7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 24 13:46:59 2010 +0100

    s3: Remove some calls to memset -- reduces text size by some bytes for me

commit 96b12e0d59b27913e915ea28b3edaa7023b765c5
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 19:38:28 2010 +0100

    libwbclient: Use winbindd_free_response()

commit 5a313731f3960120c08a06f2c9e9f6ea56ed9f6f
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 23 19:26:51 2010 +0100

    libwbclient: Remove a pointless talloc_strdup

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

Summary of changes:
 nsswitch/libwbclient/wbc_pam.c  |    7 ++---
 nsswitch/libwbclient/wbc_pwd.c  |   43 ++++++++++----------------------------
 nsswitch/libwbclient/wbc_sid.c  |   22 +++++--------------
 nsswitch/libwbclient/wbclient.c |   17 ++++----------
 source3/auth/auth_util.c        |   11 ++-------
 source3/libsmb/ntlmssp.c        |    7 +----
 6 files changed, 31 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index 00863a0..1f76c0a 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -25,6 +25,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
+#include "../winbind_client.h"
 
 /* Authenticate a username/password pair */
 wbcErr wbcAuthenticateUser(const char *username,
@@ -487,8 +488,7 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
 	}
 
 done:
-	if (response.extra_data.data)
-		free(response.extra_data.data);
+	winbindd_free_response(&response);
 
 	talloc_free(request.extra_data.data);
 
@@ -1107,8 +1107,7 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
 	}
 
 done:
-	if (response.extra_data.data)
-		free(response.extra_data.data);
+	winbindd_free_response(&response);
 
 	return wbc_status;
 }
diff --git a/nsswitch/libwbclient/wbc_pwd.c b/nsswitch/libwbclient/wbc_pwd.c
index 897bf1f..bae6bf9 100644
--- a/nsswitch/libwbclient/wbc_pwd.c
+++ b/nsswitch/libwbclient/wbc_pwd.c
@@ -24,6 +24,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
+#include "../winbind_client.h"
 
 /** @brief The maximum number of pwent structs to get from winbindd
  *
@@ -261,8 +262,7 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
 	BAIL_ON_PTR_ERROR(*grp, wbc_status);
 
  done:
-	if (response.extra_data.data)
-		free(response.extra_data.data);
+	winbindd_free_response(&response);
 
 	return wbc_status;
 }
@@ -296,8 +296,7 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
 	BAIL_ON_PTR_ERROR(*grp, wbc_status);
 
  done:
-	if (response.extra_data.data)
-		free(response.extra_data.data);
+	winbindd_free_response(&response);
 
 	return wbc_status;
 }
@@ -324,9 +323,7 @@ wbcErr wbcSetpwent(void)
 
 	if (pw_cache_size > 0) {
 		pw_cache_idx = pw_cache_size = 0;
-		if (pw_response.extra_data.data) {
-			free(pw_response.extra_data.data);
-		}
+		winbindd_free_response(&pw_response);
 	}
 
 	ZERO_STRUCT(pw_response);
@@ -346,9 +343,7 @@ wbcErr wbcEndpwent(void)
 
 	if (pw_cache_size > 0) {
 		pw_cache_idx = pw_cache_size = 0;
-		if (pw_response.extra_data.data) {
-			free(pw_response.extra_data.data);
-		}
+		winbindd_free_response(&pw_response);
 	}
 
 	wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
@@ -375,10 +370,7 @@ wbcErr wbcGetpwent(struct passwd **pwd)
 
 	pw_cache_idx = 0;
 
-	if (pw_response.extra_data.data) {
-		free(pw_response.extra_data.data);
-		ZERO_STRUCT(pw_response);
-	}
+	winbindd_free_response(&pw_response);
 
 	ZERO_STRUCT(request);
 	request.data.num_entries = MAX_GETPWENT_USERS;
@@ -426,9 +418,7 @@ wbcErr wbcSetgrent(void)
 
 	if (gr_cache_size > 0) {
 		gr_cache_idx = gr_cache_size = 0;
-		if (gr_response.extra_data.data) {
-			free(gr_response.extra_data.data);
-		}
+		winbindd_free_response(&gr_response);
 	}
 
 	ZERO_STRUCT(gr_response);
@@ -448,9 +438,7 @@ wbcErr wbcEndgrent(void)
 
 	if (gr_cache_size > 0) {
 		gr_cache_idx = gr_cache_size = 0;
-		if (gr_response.extra_data.data) {
-			free(gr_response.extra_data.data);
-		}
+		winbindd_free_response(&gr_response);
 	}
 
 	wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
@@ -478,10 +466,7 @@ wbcErr wbcGetgrent(struct group **grp)
 
 	gr_cache_idx = 0;
 
-	if (gr_response.extra_data.data) {
-		free(gr_response.extra_data.data);
-		ZERO_STRUCT(gr_response);
-	}
+	winbindd_free_response(&gr_response);
 
 	ZERO_STRUCT(request);
 	request.data.num_entries = MAX_GETGRENT_GROUPS;
@@ -527,10 +512,8 @@ wbcErr wbcGetgrlist(struct group **grp)
 
 	gr_cache_idx = 0;
 
-	if (gr_response.extra_data.data) {
-		free(gr_response.extra_data.data);
-		ZERO_STRUCT(gr_response);
-	}
+	winbindd_free_response(&gr_response);
+	ZERO_STRUCT(gr_response);
 
 	ZERO_STRUCT(request);
 	request.data.num_entries = MAX_GETGRENT_GROUPS;
@@ -600,9 +583,7 @@ wbcErr wbcGetGroups(const char *account,
 	wbc_status = WBC_ERR_SUCCESS;
 
  done:
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 	if (groups) {
 		talloc_free(groups);
 	}
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c
index 99c9d8e..7aab04b 100644
--- a/nsswitch/libwbclient/wbc_sid.c
+++ b/nsswitch/libwbclient/wbc_sid.c
@@ -24,7 +24,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
-
+#include "../winbind_client.h"
 
 /* Convert a binary SID to a character string */
 wbcErr wbcSidToString(const struct wbcDomainSid *sid,
@@ -396,9 +396,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
 	wbc_status = WBC_ERR_SUCCESS;
 
  done:
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 
 	if (WBC_ERROR_IS_OK(wbc_status)) {
 		*pp_domain_name = domain_name;
@@ -486,9 +484,7 @@ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
 	wbc_status = WBC_ERR_SUCCESS;
 
  done:
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 	if (sids) {
 		talloc_free(sids);
 	}
@@ -624,9 +620,7 @@ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
 	if (extra_data) {
 		talloc_free(extra_data);
 	}
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 	if (rids) {
 		talloc_free(rids);
 	}
@@ -694,9 +688,7 @@ wbcErr wbcListUsers(const char *domain_name,
 	wbc_status = WBC_ERR_SUCCESS;
 
  done:
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 	if (users) {
 		talloc_free(users);
 	}
@@ -762,9 +754,7 @@ wbcErr wbcListGroups(const char *domain_name,
 	wbc_status = WBC_ERR_SUCCESS;
 
  done:
-	if (response.extra_data.data) {
-		free(response.extra_data.data);
-	}
+	winbindd_free_response(&response);
 	if (groups) {
 		talloc_free(groups);
 	}
diff --git a/nsswitch/libwbclient/wbclient.c b/nsswitch/libwbclient/wbclient.c
index 9a1e770..b521567 100644
--- a/nsswitch/libwbclient/wbclient.c
+++ b/nsswitch/libwbclient/wbclient.c
@@ -137,24 +137,17 @@ void wbcFreeMemory(void *p)
 
 wbcErr wbcLibraryDetails(struct wbcLibraryDetails **_details)
 {
-	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 	struct wbcLibraryDetails *info;
 
 	info = talloc(NULL, struct wbcLibraryDetails);
-	BAIL_ON_PTR_ERROR(info, wbc_status);
+	if (info == NULL) {
+		return WBC_ERR_NO_MEMORY;
+	}
 
 	info->major_version = WBCLIENT_MAJOR_VERSION;
 	info->minor_version = WBCLIENT_MINOR_VERSION;
-	info->vendor_version = talloc_strdup(info,
-					     WBCLIENT_VENDOR_VERSION);
-	BAIL_ON_PTR_ERROR(info->vendor_version, wbc_status);
+	info->vendor_version = WBCLIENT_VENDOR_VERSION;
 
 	*_details = info;
-	info = NULL;
-
-	wbc_status = WBC_ERR_SUCCESS;
-
-done:
-	talloc_free(info);
-	return wbc_status;
+	return WBC_ERR_SUCCESS;
 }
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index de552cf..46b7af4 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1267,7 +1267,7 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
 	struct samu *sampass = NULL;
 	DOM_SID guest_sid;
 	bool ret;
-	char zeros[16];
+	static const char zeros[16] = {0, };
 	fstring tmp;
 
 	if ( !(sampass = samu_new( NULL )) ) {
@@ -1302,7 +1302,6 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
 
 	/* annoying, but the Guest really does have a session key, and it is
 	   all zeros! */
-	ZERO_STRUCT(zeros);
 	(*server_info)->user_session_key = data_blob(zeros, sizeof(zeros));
 	(*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros));
 
@@ -1622,7 +1621,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 				struct auth_serversupplied_info **server_info,
 				struct netr_SamInfo3 *info3)
 {
-	char zeros[16];
+	static const char zeros[16] = {0, };
 
 	NTSTATUS nt_status = NT_STATUS_OK;
 	char *found_username = NULL;
@@ -1838,8 +1837,6 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 
 	/* ensure we are never given NULL session keys */
 
-	ZERO_STRUCT(zeros);
-
 	if (memcmp(info3->base.key.key, zeros, sizeof(zeros)) == 0) {
 		result->user_session_key = data_blob_null;
 	} else {
@@ -1873,7 +1870,7 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
 					  const struct wbcAuthUserInfo *info,
 					  struct auth_serversupplied_info **server_info)
 {
-	char zeros[16];
+	static const char zeros[16] = {0, };
 
 	NTSTATUS nt_status = NT_STATUS_OK;
 	char *found_username = NULL;
@@ -2083,8 +2080,6 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
 
 	/* ensure we are never given NULL session keys */
 
-	ZERO_STRUCT(zeros);
-
 	if (memcmp(info->user_session_key, zeros, sizeof(zeros)) == 0) {
 		result->user_session_key = data_blob_null;
 	} else {
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 7fffe7c..1d20ee5 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -803,8 +803,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state,
 							  session_key.data);
 				DEBUG(10,("ntlmssp_server_auth: Created NTLM session key.\n"));
 			} else {
-				uint8 zeros[24];
-				ZERO_STRUCT(zeros);
+				static const uint8 zeros[24] = {0, };
 				session_key = data_blob_talloc(
 					ntlmssp_state, NULL, 16);
 				if (session_key.data == NULL) {
@@ -1062,11 +1061,9 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
 	}
 
 	if (!ntlmssp_state->nt_hash || !ntlmssp_state->lm_hash) {
-		uchar zeros[16];
+		static const uint8_t zeros[16] = {0, };
 		/* do nothing - blobs are zero length */
 
-		ZERO_STRUCT(zeros);
-
 		/* session key is all zeros */
 		session_key = data_blob_talloc(ntlmssp_state, zeros, 16);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list