[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-965-gd5bd2ec

Volker Lendecke vlendec at samba.org
Sat Oct 3 16:14:44 MDT 2009


The branch, master has been updated
       via  d5bd2ec25188988149e52bac1e301a0648cb01f7 (commit)
       via  c83b80435bc88983dac75af084be853bdbd4093e (commit)
      from  6a4efccb38109423e22714ce071d8357073bf5ce (commit)

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


- Log -----------------------------------------------------------------
commit d5bd2ec25188988149e52bac1e301a0648cb01f7
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 3 17:10:53 2009 +0200

    s3:winbind: use wb_fill_pwent in wb_getpwsid

commit c83b80435bc88983dac75af084be853bdbd4093e
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 3 17:11:43 2009 +0200

    s3:winbind: No point in using strequal to detect a 0-length string

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

Summary of changes:
 source3/winbindd/wb_getpwsid.c   |   89 ++++---------------------------------
 source3/winbindd/winbindd_user.c |    4 +-
 2 files changed, 12 insertions(+), 81 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/wb_getpwsid.c b/source3/winbindd/wb_getpwsid.c
index 1295d5b..4ccc51a 100644
--- a/source3/winbindd/wb_getpwsid.c
+++ b/source3/winbindd/wb_getpwsid.c
@@ -31,8 +31,7 @@ struct wb_getpwsid_state {
 
 static void wb_getpwsid_queryuser_done(struct tevent_req *subreq);
 static void wb_getpwsid_lookupsid_done(struct tevent_req *subreq);
-static void wb_getpwsid_sid2uid_done(struct tevent_req *subreq);
-static void wb_getpwsid_sid2gid_done(struct tevent_req *subreq);
+static void wb_getpwsid_done(struct tevent_req *subreq);
 
 struct tevent_req *wb_getpwsid_send(TALLOC_CTX *mem_ctx,
 				    struct tevent_context *ev,
@@ -83,14 +82,14 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
 	    && (state->userinfo->acct_name[0] != '\0')) {
 		/*
 		 * QueryUser got us a name, let's got directly to the
-		 * sid2uid step
+		 * fill_pwent step
 		 */
-		subreq = wb_sid2uid_send(state, state->ev,
-					 &state->userinfo->user_sid);
+		subreq = wb_fill_pwent_send(state, state->ev, state->userinfo,
+					    state->pw);
 		if (tevent_req_nomem(subreq, req)) {
 			return;
 		}
-		tevent_req_set_callback(subreq, wb_getpwsid_sid2uid_done, req);
+		tevent_req_set_callback(subreq, wb_getpwsid_done, req);
 		return;
 	}
 
@@ -122,93 +121,25 @@ static void wb_getpwsid_lookupsid_done(struct tevent_req *subreq)
 		tevent_req_nterror(req, status);
 		return;
 	}
-	subreq = wb_sid2uid_send(state, state->ev, &state->userinfo->user_sid);
+	subreq = wb_fill_pwent_send(state, state->ev, state->userinfo,
+				    state->pw);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
-	tevent_req_set_callback(subreq, wb_getpwsid_sid2uid_done, req);
+	tevent_req_set_callback(subreq, wb_getpwsid_done, req);
 }
 
-static void wb_getpwsid_sid2uid_done(struct tevent_req *subreq)
+static void wb_getpwsid_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
-	struct wb_getpwsid_state *state = tevent_req_data(
-		req, struct wb_getpwsid_state);
-	NTSTATUS status;
-
-	status = wb_sid2uid_recv(subreq, &state->pw->pw_uid);
-	TALLOC_FREE(subreq);
-	if (!NT_STATUS_IS_OK(status)) {
-		tevent_req_nterror(req, status);
-		return;
-	}
-	subreq = wb_sid2gid_send(state, state->ev,
-				 &state->userinfo->group_sid);
-	if (tevent_req_nomem(subreq, req)) {
-		return;
-	}
-	tevent_req_set_callback(subreq, wb_getpwsid_sid2gid_done, req);
-}
-
-static void wb_getpwsid_sid2gid_done(struct tevent_req *subreq)
-{
-	struct tevent_req *req = tevent_req_callback_data(
-		subreq, struct tevent_req);
-	struct wb_getpwsid_state *state = tevent_req_data(
-		req, struct wb_getpwsid_state);
 	NTSTATUS status;
-	char *username;
-	char *mapped_name;
 
-	status = wb_sid2gid_recv(subreq, &state->pw->pw_gid);
-	TALLOC_FREE(subreq);
+	status = wb_fill_pwent_recv(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
 		tevent_req_nterror(req, status);
 		return;
 	}
-
-	username = talloc_strdup_lower(state, state->userinfo->acct_name);
-	if (tevent_req_nomem(username, req)) {
-		return;
-	}
-
-	status = normalize_name_map(state, state->user_domain, username,
-				    &mapped_name);
-
-	if (NT_STATUS_IS_OK(status)
-	    || NT_STATUS_EQUAL(status, NT_STATUS_FILE_RENAMED)) {
-		/*
-		 * normalize_name_map did something
-		 */
-		fstrcpy(state->pw->pw_name, mapped_name);
-		TALLOC_FREE(mapped_name);
-	} else {
-		fill_domain_username(state->pw->pw_name,
-				     state->user_domain->name,
-				     username, True);
-	}
-	fstrcpy(state->pw->pw_passwd, "*");
-	fstrcpy(state->pw->pw_gecos, state->userinfo->full_name);
-
-	if (!fillup_pw_field(lp_template_homedir(), username,
-			     state->user_domain->name, state->pw->pw_uid,
-			     state->pw->pw_gid, state->userinfo->homedir,
-			     state->pw->pw_dir)) {
-		DEBUG(5, ("Could not compose homedir\n"));
-		tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
-		return;
-	}
-
-	if (!fillup_pw_field(lp_template_shell(), state->pw->pw_name,
-			     state->user_domain->name, state->pw->pw_uid,
-			     state->pw->pw_gid, state->userinfo->shell,
-			     state->pw->pw_shell)) {
-		DEBUG(5, ("Could not compose shell\n"));
-		tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
-		return;
-	}
-
 	tevent_req_done(req);
 }
 
diff --git a/source3/winbindd/winbindd_user.c b/source3/winbindd/winbindd_user.c
index 7af2d6d..b709f4c 100644
--- a/source3/winbindd/winbindd_user.c
+++ b/source3/winbindd/winbindd_user.c
@@ -46,10 +46,10 @@ bool fillup_pw_field(const char *lp_template,
 	   been set in the nss_info backend), then use that.
 	   Otherwise use the template value passed in. */
 
-	if ( in && !strequal(in,"") && lp_security() == SEC_ADS ) {
+	if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) {
 		templ = talloc_sub_specified(talloc_tos(), in,
 					     username, domname,
-				     uid, gid);
+					     uid, gid);
 	} else {
 		templ = talloc_sub_specified(talloc_tos(), lp_template,
 					     username, domname,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list