[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Nov 17 05:03:02 MST 2010


The branch, master has been updated
       via  d1c1aae s3: Remove a reference to "winbindd_cli_state" from append_auth_data
       via  bdf830a s3: Remove a reference to "winbindd_cli_state" from append_info3_as_txt
       via  75f41c3 s3: Remove a reference to "winbindd_cli_state" from append_afs_token
       via  5b0724d s3: Remove a reference to "winbindd_cli_state" from append_info3_as_ndr
       via  3bfe676 s3: Remove a reference to "winbindd_cli_state" from append_unix_username
       via  240edd0 s3: Remove a reference to "winbindd_cli_state" from append_auth_data
       via  fd9ea77 "bool ? true : false" is a bit pointless
       via  0a19617 s3: Move parse_sidlist to the only calling file
       via  705d93d s3: Remove some unused code
      from  3e055cc ldb:ldb_dn.c - ldb_dn_explode - free also the extended components on error cases

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


- Log -----------------------------------------------------------------
commit d1c1aaeb8b9ca662f57e74546c56c9213c7e3920
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:58:10 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_auth_data
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Wed Nov 17 12:02:34 UTC 2010 on sn-devel-104

commit bdf830ac6171020d18c0a07787c305b766e0ec61
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:56:21 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_info3_as_txt

commit 75f41c304a8ae65dbb81752d123cf95770a40d1a
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:52:31 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_afs_token

commit 5b0724d2289fbf14813636f1d5791ed76d56710e
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:50:16 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_info3_as_ndr

commit 3bfe6765b20904a47b81d9fa7df6d6385f144ceb
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:44:08 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_unix_username

commit 240edd07b30b20e9914de147d2773a36bc7a3a32
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 17:07:33 2010 +0100

    s3: Remove a reference to "winbindd_cli_state" from append_auth_data

commit fd9ea77a7169070d869713ba0bde226ce653ad20
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 16:22:32 2010 +0100

    "bool ? true : false" is a bit pointless

commit 0a19617c9785425e3328f82d022930d3fa91e7b3
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 16:11:14 2010 +0100

    s3: Move parse_sidlist to the only calling file

commit 705d93d2ad3fffbe69fe19d521631bf6e249e4f1
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 16 16:09:04 2010 +0100

    s3: Remove some unused code

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

Summary of changes:
 source3/winbindd/winbindd_async.c         |   60 --------------
 source3/winbindd/winbindd_dual.c          |    3 +-
 source3/winbindd/winbindd_getsidaliases.c |   42 ++++++++++
 source3/winbindd/winbindd_pam.c           |  125 +++++++++++++++--------------
 source3/winbindd/winbindd_proto.h         |    7 --
 5 files changed, 106 insertions(+), 131 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c
index 8e53892..75dfa0e 100644
--- a/source3/winbindd/winbindd_async.c
+++ b/source3/winbindd/winbindd_async.c
@@ -27,66 +27,6 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
-bool print_sidlist(TALLOC_CTX *mem_ctx, const struct dom_sid *sids,
-		   uint32_t num_sids, char **result, ssize_t *len)
-{
-	size_t i;
-	size_t buflen = 0;
-
-	*len = 0;
-	*result = NULL;
-	for (i=0; i<num_sids; i++) {
-		fstring tmp;
-		sprintf_append(mem_ctx, result, len, &buflen,
-			       "%s\n", sid_to_fstring(tmp, &sids[i]));
-	}
-
-	if ((num_sids != 0) && (*result == NULL)) {
-		return False;
-	}
-
-	return True;
-}
-
-bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
-		   struct dom_sid **sids, uint32_t *num_sids)
-{
-	const char *p, *q;
-
-	p = sidstr;
-	if (p == NULL)
-		return False;
-
-	while (p[0] != '\0') {
-		fstring tmp;
-		size_t sidlen;
-		struct dom_sid sid;
-		q = strchr(p, '\n');
-		if (q == NULL) {
-			DEBUG(0, ("Got invalid sidstr: %s\n", p));
-			return False;
-		}
-		sidlen = PTR_DIFF(q, p);
-		if (sidlen >= sizeof(tmp)-1) {
-			return false;
-		}
-		memcpy(tmp, p, sidlen);
-		tmp[sidlen] = '\0';
-		q += 1;
-		if (!string_to_sid(&sid, tmp)) {
-			DEBUG(0, ("Could not parse sid %s\n", p));
-			return False;
-		}
-		if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids,
-						      num_sids)))
-		{
-			return False;
-		}
-		p = q;
-	}
-	return True;
-}
-
 enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain,
 					struct winbindd_cli_state *state)
 {
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 5058788..cc9d6de 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -236,8 +236,7 @@ struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx,
 		/* The primary domain has to find the DC name itself */
 		state->init_req->cmd = WINBINDD_INIT_CONNECTION;
 		fstrcpy(state->init_req->domain_name, domain->name);
-		state->init_req->data.init_conn.is_primary =
-			domain->primary ? true : false;
+		state->init_req->data.init_conn.is_primary = domain->primary;
 		fstrcpy(state->init_req->data.init_conn.dcname, "");
 
 		subreq = wb_child_request_send(state, ev, &domain->child,
diff --git a/source3/winbindd/winbindd_getsidaliases.c b/source3/winbindd/winbindd_getsidaliases.c
index f01dac9..ebaaf4d 100644
--- a/source3/winbindd/winbindd_getsidaliases.c
+++ b/source3/winbindd/winbindd_getsidaliases.c
@@ -27,6 +27,9 @@ struct winbindd_getsidaliases_state {
 	uint32_t *aliases;
 };
 
+static bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
+			  struct dom_sid **sids, uint32_t *num_sids);
+
 static void winbindd_getsidaliases_done(struct tevent_req *subreq);
 
 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
@@ -152,3 +155,42 @@ NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req,
 	response->data.num_entries = state->num_aliases;
 	return NT_STATUS_OK;
 }
+
+static bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
+			  struct dom_sid **sids, uint32_t *num_sids)
+{
+	const char *p, *q;
+
+	p = sidstr;
+	if (p == NULL)
+		return False;
+
+	while (p[0] != '\0') {
+		fstring tmp;
+		size_t sidlen;
+		struct dom_sid sid;
+		q = strchr(p, '\n');
+		if (q == NULL) {
+			DEBUG(0, ("Got invalid sidstr: %s\n", p));
+			return False;
+		}
+		sidlen = PTR_DIFF(q, p);
+		if (sidlen >= sizeof(tmp)-1) {
+			return false;
+		}
+		memcpy(tmp, p, sidlen);
+		tmp[sidlen] = '\0';
+		q += 1;
+		if (!string_to_sid(&sid, tmp)) {
+			DEBUG(0, ("Could not parse sid %s\n", p));
+			return False;
+		}
+		if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids,
+						      num_sids)))
+		{
+			return False;
+		}
+		p = q;
+	}
+	return True;
+}
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
index b4a1b9d..0053b7f 100644
--- a/source3/winbindd/winbindd_pam.c
+++ b/source3/winbindd/winbindd_pam.c
@@ -41,57 +41,57 @@
 #define LOGON_KRB5_FAIL_CLOCK_SKEW	0x02000000
 
 static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
-				    struct winbindd_cli_state *state,
+				    struct winbindd_response *resp,
 				    struct netr_SamInfo3 *info3)
 {
 	char *ex;
 	uint32_t i;
 
-	state->response->data.auth.info3.logon_time =
+	resp->data.auth.info3.logon_time =
 		nt_time_to_unix(info3->base.last_logon);
-	state->response->data.auth.info3.logoff_time =
+	resp->data.auth.info3.logoff_time =
 		nt_time_to_unix(info3->base.last_logoff);
-	state->response->data.auth.info3.kickoff_time =
+	resp->data.auth.info3.kickoff_time =
 		nt_time_to_unix(info3->base.acct_expiry);
-	state->response->data.auth.info3.pass_last_set_time =
+	resp->data.auth.info3.pass_last_set_time =
 		nt_time_to_unix(info3->base.last_password_change);
-	state->response->data.auth.info3.pass_can_change_time =
+	resp->data.auth.info3.pass_can_change_time =
 		nt_time_to_unix(info3->base.allow_password_change);
-	state->response->data.auth.info3.pass_must_change_time =
+	resp->data.auth.info3.pass_must_change_time =
 		nt_time_to_unix(info3->base.force_password_change);
 
-	state->response->data.auth.info3.logon_count = info3->base.logon_count;
-	state->response->data.auth.info3.bad_pw_count = info3->base.bad_password_count;
+	resp->data.auth.info3.logon_count = info3->base.logon_count;
+	resp->data.auth.info3.bad_pw_count = info3->base.bad_password_count;
 
-	state->response->data.auth.info3.user_rid = info3->base.rid;
-	state->response->data.auth.info3.group_rid = info3->base.primary_gid;
-	sid_to_fstring(state->response->data.auth.info3.dom_sid, info3->base.domain_sid);
+	resp->data.auth.info3.user_rid = info3->base.rid;
+	resp->data.auth.info3.group_rid = info3->base.primary_gid;
+	sid_to_fstring(resp->data.auth.info3.dom_sid, info3->base.domain_sid);
 
-	state->response->data.auth.info3.num_groups = info3->base.groups.count;
-	state->response->data.auth.info3.user_flgs = info3->base.user_flags;
+	resp->data.auth.info3.num_groups = info3->base.groups.count;
+	resp->data.auth.info3.user_flgs = info3->base.user_flags;
 
-	state->response->data.auth.info3.acct_flags = info3->base.acct_flags;
-	state->response->data.auth.info3.num_other_sids = info3->sidcount;
+	resp->data.auth.info3.acct_flags = info3->base.acct_flags;
+	resp->data.auth.info3.num_other_sids = info3->sidcount;
 
-	fstrcpy(state->response->data.auth.info3.user_name,
+	fstrcpy(resp->data.auth.info3.user_name,
 		info3->base.account_name.string);
-	fstrcpy(state->response->data.auth.info3.full_name,
+	fstrcpy(resp->data.auth.info3.full_name,
 		info3->base.full_name.string);
-	fstrcpy(state->response->data.auth.info3.logon_script,
+	fstrcpy(resp->data.auth.info3.logon_script,
 		info3->base.logon_script.string);
-	fstrcpy(state->response->data.auth.info3.profile_path,
+	fstrcpy(resp->data.auth.info3.profile_path,
 		info3->base.profile_path.string);
-	fstrcpy(state->response->data.auth.info3.home_dir,
+	fstrcpy(resp->data.auth.info3.home_dir,
 		info3->base.home_directory.string);
-	fstrcpy(state->response->data.auth.info3.dir_drive,
+	fstrcpy(resp->data.auth.info3.dir_drive,
 		info3->base.home_drive.string);
 
-	fstrcpy(state->response->data.auth.info3.logon_srv,
+	fstrcpy(resp->data.auth.info3.logon_srv,
 		info3->base.logon_server.string);
-	fstrcpy(state->response->data.auth.info3.logon_dom,
+	fstrcpy(resp->data.auth.info3.logon_dom,
 		info3->base.domain.string);
 
-	ex = talloc_strdup(state->mem_ctx, "");
+	ex = talloc_strdup(mem_ctx, "");
 	NT_STATUS_HAVE_NO_MEMORY(ex);
 
 	for (i=0; i < info3->base.groups.count; i++) {
@@ -115,14 +115,14 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
 		talloc_free(sid);
 	}
 
-	state->response->extra_data.data = ex;
-	state->response->length += talloc_get_size(ex);
+	resp->extra_data.data = ex;
+	resp->length += talloc_get_size(ex);
 
 	return NT_STATUS_OK;
 }
 
 static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
-				    struct winbindd_cli_state *state,
+				    struct winbindd_response *resp,
 				    struct netr_SamInfo3 *info3)
 {
 	DATA_BLOB blob;
@@ -135,14 +135,14 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
 		return ndr_map_error2ntstatus(ndr_err);
 	}
 
-	state->response->extra_data.data = blob.data;
-	state->response->length += blob.length;
+	resp->extra_data.data = blob.data;
+	resp->length += blob.length;
 
 	return NT_STATUS_OK;
 }
 
 static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
-				     struct winbindd_cli_state *state,
+				     struct winbindd_response *resp,
 				     const struct netr_SamInfo3 *info3,
 				     const char *name_domain,
 				     const char *name_user)
@@ -166,17 +166,17 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
 		nt_username = name_user;
 	}
 
-	fill_domain_username(state->response->data.auth.unix_username,
+	fill_domain_username(resp->data.auth.unix_username,
 			     nt_domain, nt_username, true);
 
-	DEBUG(5,("Setting unix username to [%s]\n",
-		state->response->data.auth.unix_username));
+	DEBUG(5, ("Setting unix username to [%s]\n",
+		  resp->data.auth.unix_username));
 
 	return NT_STATUS_OK;
 }
 
 static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
-				 struct winbindd_cli_state *state,
+				 struct winbindd_response *resp,
 				 const struct netr_SamInfo3 *info3,
 				 const char *name_domain,
 				 const char *name_user)
@@ -230,13 +230,11 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
 	if (token == NULL) {
 		return NT_STATUS_OK;
 	}
-	state->response->extra_data.data = talloc_strdup(state->mem_ctx,
-							 token);
-	if (state->response->extra_data.data == NULL) {
+	resp->extra_data.data = talloc_strdup(mem_ctx, token);
+	if (resp->extra_data.data == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}
-	state->response->length +=
-		strlen((const char *)state->response->extra_data.data)+1;
+	resp->length += strlen((const char *)resp->extra_data.data)+1;
 
 	return NT_STATUS_OK;
 }
@@ -715,31 +713,32 @@ bool check_request_flags(uint32_t flags)
 /****************************************************************
 ****************************************************************/
 
-static NTSTATUS append_auth_data(struct winbindd_cli_state *state,
+static NTSTATUS append_auth_data(TALLOC_CTX *mem_ctx,
+				 struct winbindd_response *resp,
+				 uint32_t request_flags,
 				 struct netr_SamInfo3 *info3,
 				 const char *name_domain,
 				 const char *name_user)
 {
 	NTSTATUS result;
-	uint32_t flags = state->request->flags;
 
-	if (flags & WBFLAG_PAM_USER_SESSION_KEY) {
-		memcpy(state->response->data.auth.user_session_key,
+	if (request_flags & WBFLAG_PAM_USER_SESSION_KEY) {
+		memcpy(resp->data.auth.user_session_key,
 		       info3->base.key.key,
-		       sizeof(state->response->data.auth.user_session_key)
+		       sizeof(resp->data.auth.user_session_key)
 		       /* 16 */);
 	}
 
-	if (flags & WBFLAG_PAM_LMKEY) {
-		memcpy(state->response->data.auth.first_8_lm_hash,
+	if (request_flags & WBFLAG_PAM_LMKEY) {
+		memcpy(resp->data.auth.first_8_lm_hash,
 		       info3->base.LMSessKey.key,
-		       sizeof(state->response->data.auth.first_8_lm_hash)
+		       sizeof(resp->data.auth.first_8_lm_hash)
 		       /* 8 */);
 	}
 
-	if (flags & WBFLAG_PAM_UNIX_NAME) {
-		result = append_unix_username(state->mem_ctx, state, info3,
-					      name_domain, name_user);
+	if (request_flags & WBFLAG_PAM_UNIX_NAME) {
+		result = append_unix_username(mem_ctx, resp,
+					      info3, name_domain, name_user);
 		if (!NT_STATUS_IS_OK(result)) {
 			DEBUG(10,("Failed to append Unix Username: %s\n",
 				nt_errstr(result)));
@@ -749,8 +748,8 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state,
 
 	/* currently, anything from here on potentially overwrites extra_data. */
 
-	if (flags & WBFLAG_PAM_INFO3_NDR) {
-		result = append_info3_as_ndr(state->mem_ctx, state, info3);
+	if (request_flags & WBFLAG_PAM_INFO3_NDR) {
+		result = append_info3_as_ndr(mem_ctx, resp, info3);
 		if (!NT_STATUS_IS_OK(result)) {
 			DEBUG(10,("Failed to append INFO3 (NDR): %s\n",
 				nt_errstr(result)));
@@ -758,8 +757,8 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state,
 		}
 	}
 
-	if (flags & WBFLAG_PAM_INFO3_TEXT) {
-		result = append_info3_as_txt(state->mem_ctx, state, info3);
+	if (request_flags & WBFLAG_PAM_INFO3_TEXT) {
+		result = append_info3_as_txt(mem_ctx, resp, info3);
 		if (!NT_STATUS_IS_OK(result)) {
 			DEBUG(10,("Failed to append INFO3 (TXT): %s\n",
 				nt_errstr(result)));
@@ -767,9 +766,9 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state,
 		}
 	}
 
-	if (flags & WBFLAG_PAM_AFS_TOKEN) {
-		result = append_afs_token(state->mem_ctx, state, info3,
-					  name_domain, name_user);
+	if (request_flags & WBFLAG_PAM_AFS_TOKEN) {
+		result = append_afs_token(mem_ctx, resp,
+					  info3, name_domain, name_user);
 		if (!NT_STATUS_IS_OK(result)) {
 			DEBUG(10,("Failed to append AFS token: %s\n",
 				nt_errstr(result)));
@@ -1574,8 +1573,9 @@ process_result:
 			goto done;
 		}
 
-		result = append_auth_data(state, info3, name_domain,
-					  name_user);
+		result = append_auth_data(state->mem_ctx, state->response,
+					  state->request->flags, info3,
+					  name_domain, name_user);
 		if (!NT_STATUS_IS_OK(result)) {
 			goto done;
 		}
@@ -1781,8 +1781,9 @@ process_result:
 			goto done;
 		}
 
-		result = append_auth_data(state, info3, name_domain,
-					  name_user);
+		result = append_auth_data(state->mem_ctx, state->response,
+					  state->request->flags, info3,
+					  name_domain, name_user);
 		if (!NT_STATUS_IS_OK(result)) {
 			goto done;
 		}
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 52e6bfe..dc56a72 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -55,13 +55,6 @@ NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx,
 			       struct dom_sid **sids,
 			       enum lsa_SidType **types);
 
-/* The following definitions come from winbindd/winbindd_async.c  */
-
-bool print_sidlist(TALLOC_CTX *mem_ctx, const struct dom_sid *sids,
-		   uint32_t num_sids, char **result, ssize_t *len);
-bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr,
-		   struct dom_sid **sids, uint32_t *num_sids);
-
 /* The following definitions come from winbindd/winbindd_cache.c  */
 
 struct cache_entry *centry_start(struct winbindd_domain *domain, NTSTATUS status);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list