[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Tue Nov 26 14:35:04 MST 2013


The branch, v4-0-test has been updated
       via  9ad3d28 printing: always store sytem job-ID in queue state
       via  0fa726b spoolss: return the spoolss job ID in notifications
       via  68f0047 s3-winbind: Pass the group name to fillup_pw_field().
       via  ff8c218 s3-lib: Add grpname to talloc_sub_specified().
      from  be0a7af spoolss: accept XPS_PASS datatype used by Windows 8

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 9ad3d28ab37b49fb9297c6bef7fad265edd1b599
Author: David Disseldorp <ddiss at samba.org>
Date:   Fri Oct 18 13:09:23 2013 +0200

    printing: always store sytem job-ID in queue state
    
    Print jobs have multiple identifiers: the regular spoolss jobid, which
    is allocated by spoolss on job submission, and the system jobid, which
    is assigned by the printing back-end.
    Currently these identifiers are incorrectly mixed in print job queue
    tracking. Fix this by ensuring that only the system jobid is stored in
    the print queue state structure.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10271
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Mon Nov 18 18:03:41 CET 2013 on sn-devel-104
    (cherry picked from commit b7da5a5b00f6c78e41279415e33c091dcc0a773b)
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Tue Nov 26 22:34:24 CET 2013 on sn-devel-104

commit 0fa726b270607ea79cd38401e2c204a36c331d7a
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Sep 19 20:31:37 2013 -0700

    spoolss: return the spoolss job ID in notifications
    
    Print job notifications currently carry the system print job identifier
    from the queue structure. Instead, the spoolss job identifier should be
    resolved and returned.
    
    Print clients can use notification job-ids in subsequent spoolss SetJob
    requests. Returning an incorrect identifier can result in the failure of
    such requests, e.g. spoolss_SetJob(SPOOLSS_JOB_CONTROL_DELETE).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10271
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 24d025f85d6eea272bff5e1040d4fd2ba0e6b8f3)

commit 68f00471a945ccc9c58120db90eeb475e04a0c90
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 18 14:58:14 2013 +0100

    s3-winbind: Pass the group name to fillup_pw_field().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Nov 22 02:04:54 CET 2013 on sn-devel-104
    
    (cherry picked from commit 000172a5ab7e4bfac7ef618d0d78ec7fe95d0e2a)

commit ff8c2181af02caa574be96757b02bb2e50d89a62
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Nov 18 14:58:04 2013 +0100

    s3-lib: Add grpname to talloc_sub_specified().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6366ebb79bb72d9dcb12f8fe8d6e35611fcff150)

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

Summary of changes:
 source3/include/printing.h                  |    1 +
 source3/include/proto.h                     |    1 +
 source3/lib/substitute.c                    |   31 +++++++++--
 source3/passdb/passdb.c                     |    8 ++--
 source3/passdb/pdb_ldap.c                   |   24 ++++++++-
 source3/printing/printing.c                 |   45 ++++++++--------
 source3/rpc_server/spoolss/srv_spoolss_nt.c |   32 ++++++++++--
 source3/torture/torture.c                   |    2 +-
 source3/utils/net_sam.c                     |    2 +
 source3/winbindd/wb_fill_pwent.c            |   73 ++++++++++++++++-----------
 10 files changed, 147 insertions(+), 72 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/printing.h b/source3/include/printing.h
index 391fb7a..ec5a53b 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -193,6 +193,7 @@ uint16_t print_spool_rap_jobid(struct print_file_data *print_file);
 
 /* The following definitions come from printing/printing.c  */
 
+uint32 sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob);
 uint32 sysjob_to_jobid(int unix_jobid);
 bool print_notify_register_pid(int snum);
 bool print_notify_deregister_pid(int snum);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0defbc9..0276244 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -222,6 +222,7 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
 			const char *input_string,
 			const char *username,
+			const char *grpname,
 			const char *domain,
 			uid_t uid,
 			gid_t gid);
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index a254bca..ca2ac79 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -613,6 +613,7 @@ done:
 char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
 			const char *input_string,
 			const char *username,
+			const char *grpname,
 			const char *domain,
 			uid_t uid,
 			gid_t gid)
@@ -648,9 +649,18 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
 			break;
 		case 'G' :
 			if (gid != -1) {
-				a_string = talloc_string_sub(
-					tmp_ctx, a_string, "%G",
-					gidtoname(gid));
+				const char *name;
+
+				if (grpname != NULL) {
+					name = grpname;
+				} else {
+					name = gidtoname(gid);
+				}
+
+				a_string = talloc_string_sub(tmp_ctx,
+							     a_string,
+							     "%G",
+							     name);
 			} else {
 				a_string = talloc_string_sub(
 					tmp_ctx, a_string,
@@ -659,9 +669,18 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
 			break;
 		case 'g' :
 			if (gid != -1) {
-				a_string = talloc_string_sub(
-					tmp_ctx, a_string, "%g",
-					gidtoname(gid));
+				const char *name;
+
+				if (grpname != NULL) {
+					name = grpname;
+				} else {
+					name = gidtoname(gid);
+				}
+
+				a_string = talloc_string_sub(tmp_ctx,
+							     a_string,
+							     "%g",
+							     name);
 			} else {
 				a_string = talloc_string_sub(
 					tmp_ctx, a_string, "%g", "NO_GROUP");
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 379d858..5a4620f 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -228,16 +228,16 @@ static NTSTATUS samu_set_unix_internal(struct pdb_methods *methods,
 		/* set some basic attributes */
 
 		pdb_set_profile_path(user, talloc_sub_specified(user, 
-			lp_logon_path(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), 
+			lp_logon_path(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
 			PDB_DEFAULT);		
 		pdb_set_homedir(user, talloc_sub_specified(user, 
-			lp_logon_home(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid),
+			lp_logon_home(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
 			PDB_DEFAULT);
 		pdb_set_dir_drive(user, talloc_sub_specified(user, 
-			lp_logon_drive(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid),
+			lp_logon_drive(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
 			PDB_DEFAULT);
 		pdb_set_logon_script(user, talloc_sub_specified(user, 
-			lp_logon_script(), pwd->pw_name, domain, pwd->pw_uid, pwd->pw_gid), 
+			lp_logon_script(), pwd->pw_name, NULL, domain, pwd->pw_uid, pwd->pw_gid),
 			PDB_DEFAULT);
 	}
 
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 7ae9056..a9db3fa 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -5343,11 +5343,29 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
 
 		if (is_machine) {
 			/* TODO: choose a more appropriate default for machines */
-			homedir = talloc_sub_specified(tmp_ctx, lp_template_homedir(), "SMB_workstations_home", ldap_state->domain_name, uid, gid);
+			homedir = talloc_sub_specified(tmp_ctx,
+						       lp_template_homedir(),
+						       "SMB_workstations_home",
+						       NULL,
+						       ldap_state->domain_name,
+						       uid,
+						       gid);
 			shell = talloc_strdup(tmp_ctx, "/bin/false");
 		} else {
-			homedir = talloc_sub_specified(tmp_ctx, lp_template_homedir(), name, ldap_state->domain_name, uid, gid);
-			shell = talloc_sub_specified(tmp_ctx, lp_template_shell(), name, ldap_state->domain_name, uid, gid);
+			homedir = talloc_sub_specified(tmp_ctx,
+						       lp_template_homedir(),
+						       name,
+						       NULL,
+						       ldap_state->domain_name,
+						       uid,
+						       gid);
+			shell = talloc_sub_specified(tmp_ctx,
+						     lp_template_shell(),
+						     name,
+						     NULL,
+						     ldap_state->domain_name,
+						     uid,
+						     gid);
 		}
 		uidstr = talloc_asprintf(tmp_ctx, "%u", (unsigned int)uid);
 		gidstr = talloc_asprintf(tmp_ctx, "%u", (unsigned int)gid);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 23b143b..5a35ad0 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -514,7 +514,7 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
 	return 0;
 }
 
-static uint32 sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob)
+uint32 sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob)
 {
 	struct unixjob_traverse_state state;
 
@@ -3043,7 +3043,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 	size_t len = 0;
 	uint32 i;
 	int max_reported_jobs = lp_max_reported_jobs(snum);
-	bool ret = False;
+	bool ret = false;
 	const char* sharename = lp_servicename(talloc_tos(), snum);
 	TALLOC_CTX *tmp_ctx = talloc_new(msg_ctx);
 	if (tmp_ctx == NULL) {
@@ -3087,7 +3087,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 
 	/* Retrieve the linearised queue data. */
 
-	for( i  = 0; i < qcount; i++) {
+	for(i = 0; i < qcount; i++) {
 		uint32 qjob, qsize, qpage_count, qstatus, qpriority, qtime;
 		len += tdb_unpack(data.dptr + len, data.dsize - len, "ddddddff",
 				&qjob,
@@ -3109,7 +3109,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 	total_count = qcount;
 
 	/* Add new jobids to the queue. */
-	for( i  = 0; i < extra_count; i++) {
+	for (i = 0; i < extra_count; i++) {
 		uint32 jobid;
 		struct printjob *pjob;
 
@@ -3122,7 +3122,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 			continue;
 		}
 
-		queue[total_count].sysjob = jobid;
+		queue[total_count].sysjob = pjob->sysjob;
 		queue[total_count].size = pjob->size;
 		queue[total_count].page_count = pjob->page_count;
 		queue[total_count].status = pjob->status;
@@ -3137,32 +3137,31 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 	/* Update the changed jobids. */
 	for (i = 0; i < changed_count; i++) {
 		uint32_t jobid = IVAL(jcdata.dptr, i * 4);
+		struct printjob *pjob;
 		uint32_t j;
 		bool found = false;
 
+		pjob = print_job_find(tmp_ctx, sharename, jobid);
+		if (pjob == NULL) {
+			DEBUG(5,("get_stored_queue_info: failed to find "
+				 "changed job = %u\n",
+				 (unsigned int)jobid));
+			remove_from_jobs_changed(sharename, jobid);
+			continue;
+		}
+
 		for (j = 0; j < total_count; j++) {
-			if (queue[j].sysjob == jobid) {
+			if (queue[j].sysjob == pjob->sysjob) {
 				found = true;
 				break;
 			}
 		}
 
 		if (found) {
-			struct printjob *pjob;
-
 			DEBUG(5,("get_stored_queue_info: changed job: %u\n",
-				 (unsigned int) jobid));
-
-			pjob = print_job_find(tmp_ctx, sharename, jobid);
-			if (pjob == NULL) {
-				DEBUG(5,("get_stored_queue_info: failed to find "
-					 "changed job = %u\n",
-					 (unsigned int) jobid));
-				remove_from_jobs_changed(sharename, jobid);
-				continue;
-			}
+				 (unsigned int)jobid));
 
-			queue[j].sysjob = jobid;
+			queue[j].sysjob = pjob->sysjob;
 			queue[j].size = pjob->size;
 			queue[j].page_count = pjob->page_count;
 			queue[j].status = pjob->status;
@@ -3172,8 +3171,10 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 			fstrcpy(queue[j].fs_file, pjob->jobname);
 			talloc_free(pjob);
 
-			DEBUG(5,("get_stored_queue_info: updated queue[%u], jobid: %u, jobname: %s\n",
-				 (unsigned int) j, (unsigned int) jobid, pjob->jobname));
+			DEBUG(5,("updated queue[%u], jobid: %u, sysjob: %u, "
+				 "jobname: %s\n",
+				 (unsigned int)j, (unsigned int)jobid,
+				 (unsigned int)queue[j].sysjob, pjob->jobname));
 		}
 
 		remove_from_jobs_changed(sharename, jobid);
@@ -3192,7 +3193,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
 	*ppqueue = queue;
 	*pcount = total_count;
 
-	ret = True;
+	ret = true;
 
   out:
 
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index fa5f022..3703349 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -3601,6 +3601,7 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 	print_status_struct status;
 	struct spoolss_PrinterInfo2 *pinfo2 = NULL;
 	WERROR result;
+	struct tdb_print_db *pdb;
 
 	DEBUG(4,("printer_notify_info\n"));
 
@@ -3624,13 +3625,19 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 		return WERR_BADFID;
 	}
 
+	pdb = get_print_db_byname(Printer->sharename);
+	if (pdb == NULL) {
+		return WERR_BADFID;
+	}
+
 	/* Maybe we should use the SYSTEM session_info here... */
 	result = winreg_get_printer_internal(mem_ctx,
 				    get_session_info_system(),
 				    p->msg_ctx,
 				    lp_servicename(talloc_tos(), snum), &pinfo2);
 	if (!W_ERROR_IS_OK(result)) {
-		return WERR_BADFID;
+		result = WERR_BADFID;
+		goto err_pdb_drop;
 	}
 
 	/*
@@ -3639,10 +3646,11 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 	 */
 	pinfo2->servername = talloc_strdup(pinfo2, Printer->servername);
 	if (pinfo2->servername == NULL) {
-		return WERR_NOMEM;
+		result = WERR_NOMEM;
+		goto err_pdb_drop;
 	}
 
-	for (i=0; i<option->count; i++) {
+	for (i = 0; i < option->count; i++) {
 		option_type = option->types[i];
 
 		switch (option_type.type) {
@@ -3661,12 +3669,21 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 			count = print_queue_status(p->msg_ctx, snum, &queue,
 						   &status);
 
-			for (j=0; j<count; j++) {
+			for (j = 0; j < count; j++) {
+				uint32_t jobid;
+				jobid = sysjob_to_jobid_pdb(pdb,
+							    queue[j].sysjob);
+				if (jobid == (uint32_t)-1) {
+					DEBUG(2, ("ignoring untracked job %d\n",
+						  queue[j].sysjob));
+					continue;
+				}
+				/* FIXME check return value */
 				construct_notify_jobs_info(p->msg_ctx,
 							   &queue[j], info,
 							   pinfo2, snum,
 							   &option_type,
-							   queue[j].sysjob,
+							   jobid,
 							   mem_ctx);
 			}
 
@@ -3691,7 +3708,10 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 	*/
 
 	talloc_free(pinfo2);
-	return WERR_OK;
+	result = WERR_OK;
+err_pdb_drop:
+	release_print_db(pdb);
+	return result;
 }
 
 /****************************************************************
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 107106c..a33deb9 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -6552,7 +6552,7 @@ static bool subst_test(const char *str, const char *user, const char *domain,
 	char *subst;
 	bool result = true;
 
-	subst = talloc_sub_specified(talloc_tos(), str, user, domain, uid, gid);
+	subst = talloc_sub_specified(talloc_tos(), str, user, NULL, domain, uid, gid);
 
 	if (strcmp(subst, expected) != 0) {
 		printf("sub_specified(%s, %s, %s, %d, %d) returned [%s], expected "
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index d33c354..b1c4e9b 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -1873,10 +1873,12 @@ doma_done:
 		gidstr = talloc_asprintf(tc, "%u", (unsigned int)domadmins_gid);
 		dir = talloc_sub_specified(tc, lp_template_homedir(),
 						"Administrator",
+						NULL,
 						get_global_sam_name(),
 						uid, domadmins_gid);
 		shell = talloc_sub_specified(tc, lp_template_shell(),
 						"Administrator",
+						NULL,
 						get_global_sam_name(),
 						uid, domadmins_gid);
 
diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index 688afc6..9d0abbd 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -29,6 +29,7 @@ struct wb_fill_pwent_state {
 
 static bool fillup_pw_field(const char *lp_template,
 			    const char *username,
+			    const char *grpname,
 			    const char *domname,
 			    uid_t uid,
 			    gid_t gid,
@@ -36,7 +37,7 @@ static bool fillup_pw_field(const char *lp_template,
 			    fstring out);
 
 static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq);
-static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq);
+static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq);
 
 struct tevent_req *wb_fill_pwent_send(TALLOC_CTX *mem_ctx,
 				      struct tevent_context *ev,
@@ -90,47 +91,45 @@ static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq)
 
 	state->pw->pw_uid = (uid_t)xid.id;
 
-	subreq = wb_sids2xids_send(state, state->ev, &state->info->group_sid, 1);
+	subreq = wb_getgrsid_send(state, state->ev, &state->info->group_sid, 1);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
-	tevent_req_set_callback(subreq, wb_fill_pwent_sid2gid_done, req);
+	tevent_req_set_callback(subreq, wb_fill_pwent_getgrsid_done, req);
 }
 
-static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq)
+static void wb_fill_pwent_getgrsid_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
 	struct wb_fill_pwent_state *state = tevent_req_data(
 		req, struct wb_fill_pwent_state);
 	struct winbindd_domain *domain;
-	char *dom_name;
+	const char *dom_name;
+	const char *grp_name;
 	fstring user_name, output_username;
 	char *mapped_name = NULL;
+	struct talloc_dict *members;
+	TALLOC_CTX *tmp_ctx = talloc_stackframe();
 	NTSTATUS status;
-	struct unixid xid;
-
-	status = wb_sids2xids_recv(subreq, &xid);
+	bool ok;
+
+	/* xid handling is done in getgrsid() */
+	status = wb_getgrsid_recv(subreq,
+				  tmp_ctx,
+				  &dom_name,
+				  &grp_name,
+				  &state->pw->pw_gid,
+				  &members);
 	TALLOC_FREE(subreq);
 	if (tevent_req_nterror(req, status)) {
+		talloc_free(tmp_ctx);
 		return;
 	}
 
-	/*
-	 * We are filtering further down in sids2xids, but that filtering
-	 * depends on the actual type of the sid handed in (as determined
-	 * by lookupsids). Here we need to filter for the type of object
-	 * actually requested, in this case gid.
-	 */
-	if (!(xid.type == ID_TYPE_GID || xid.type == ID_TYPE_BOTH)) {
-		tevent_req_nterror(req, NT_STATUS_NONE_MAPPED);
-		return;
-	}
-
-	state->pw->pw_gid = (gid_t)xid.id;
-
 	domain = find_domain_from_sid_noinit(&state->info->user_sid);
 	if (domain == NULL) {
+		talloc_free(tmp_ctx);
 		tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER);
 		return;
 	}
@@ -166,17 +165,30 @@ static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq)
 	fstrcpy(state->pw->pw_gecos, state->info->full_name);
 
 	/* Home directory and shell */
-
-	if (!fillup_pw_field(lp_template_homedir(), user_name, dom_name,
-			     state->pw->pw_uid, state->pw->pw_gid,
-			     state->info->homedir, state->pw->pw_dir)) {
+	ok = fillup_pw_field(lp_template_homedir(),
+			     user_name,
+			     grp_name,
+			     dom_name,
+			     state->pw->pw_uid,
+			     state->pw->pw_gid,
+			     state->info->homedir,
+			     state->pw->pw_dir);
+	if (!ok) {
+		talloc_free(tmp_ctx);
 		tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER);
 		return;
 	}
 
-	if (!fillup_pw_field(lp_template_shell(), user_name, dom_name,
-			     state->pw->pw_uid, state->pw->pw_gid,
-			     state->info->shell, state->pw->pw_shell)) {
+	ok = fillup_pw_field(lp_template_shell(),
+			     user_name,
+			     grp_name,
+			     dom_name,
+			     state->pw->pw_uid,
+			     state->pw->pw_gid,
+			     state->info->shell,
+			     state->pw->pw_shell);
+	talloc_free(tmp_ctx);
+	if (!ok) {
 		tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER);
 		return;
 	}
@@ -195,6 +207,7 @@ NTSTATUS wb_fill_pwent_recv(struct tevent_req *req)
 
 static bool fillup_pw_field(const char *lp_template,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list