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

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


The branch, v4-1-test has been updated
       via  9d44b17 s3-libnet: Use a const char for realm.
       via  c0eb9ee s3-vfs: Make glfs_set_preopened() static.
       via  8875b80 s3-vfs: Remove unused variable in vfs_glusterfs.
       via  e0bd27b examples: Fix scanf format in perf_writer_disk.
       via  8c059c0 s3-libsmb: Fix scanf format in parse_ace().
       via  41fc4a4 s3-utils: Fix scanf format in sharesec.
       via  25ba5fb s3-utils: Fix scanf format in smbacls.
       via  eabee6b testsuit: Fix fprintf format.
       via  e1826b8 s3-libsmb: Use the right macro to set uint16_t attr.
       via  03f9a7a printing: always store sytem job-ID in queue state
       via  15cd0e0 spoolss: return the spoolss job ID in notifications
       via  eb9fde4 s3-winbind: Pass the group name to fillup_pw_field().
       via  1788e66 s3-lib: Add grpname to talloc_sub_specified().
      from  e99d701 spoolss: accept XPS_PASS datatype used by Windows 8

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


- Log -----------------------------------------------------------------
commit 9d44b17573297d277904818d3f230ae423f5b4ea
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:20 2013 +0100

    s3-libnet: Use a const char for realm.
    
    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 15 23:11:54 CET 2013 on sn-devel-104
    
    (cherry picked from commit d02d70251f98ea2e7db4aea36f372cb0f65c04c5)
    
    The last 9 patches address bug #10274 - Fix several issues and warnings from
    analyzer tools.
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Tue Nov 26 22:33:13 CET 2013 on sn-devel-104

commit c0eb9ee4e96da56e17dee7634264a82845d05990
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:19 2013 +0100

    s3-vfs: Make glfs_set_preopened() static.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4deb00a60f484824217a9683ec9cc2838deae8e0)

commit 8875b804d919563f07558b27db1948454523770b
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:18 2013 +0100

    s3-vfs: Remove unused variable in vfs_glusterfs.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9e7e83e9d07e967ac966b1cc17f21cb75c81a774)

commit e0bd27b9e055231c003164523b8adcab8ca5dccf
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:17 2013 +0100

    examples: Fix scanf format in perf_writer_disk.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f71b5e44e7a705096e4fdd7aa3d0e22df994e363)

commit 8c059c05ed9d606cd2c919e5149c6ad68a72955e
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:16 2013 +0100

    s3-libsmb: Fix scanf format in parse_ace().
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1214e3345c655a4c7dc98c69c4e018e47558f639)

commit 41fc4a45ee0845e1bd8b7e67b23e023d4a961a8a
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:15 2013 +0100

    s3-utils: Fix scanf format in sharesec.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 278899f5a763af7e7603f05f07048b7d8d4e9972)

commit 25ba5fb7ee93f6a4616b740f7a437d1b36d4ead1
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:14 2013 +0100

    s3-utils: Fix scanf format in smbacls.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4c98b9ce8f8de5883796aa38f1193e04a0ee4e58)

commit eabee6bc3a9458ea4e0601ac39e72995d4c45d36
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:13 2013 +0100

    testsuit: Fix fprintf format.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 69b3a0cb3f2736e98c20dabb43c201af0c004f67)

commit e1826b874bd11e3af5c78c684a91804e6d4e71d5
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Nov 15 17:02:12 2013 +0100

    s3-libsmb: Use the right macro to set uint16_t attr.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f8ab594d0253920cefc441587a55fddb688be550)

commit 03f9a7a2b7602e3e731bdd0f3fa9d6ca799b1abb
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)

commit 15cd0e09fa85cf148975b0db5fe7be06f16d7702
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 eb9fde4097c1911bce3fbedc1d0e2555f6e3e7b2
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 1788e6651c9c6e7b8eeec2e19499e3009ee2885a
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:
 examples/perfcounter/perf_writer_disk.c     |    8 ++--
 source3/include/printing.h                  |    1 +
 source3/include/proto.h                     |    1 +
 source3/lib/substitute.c                    |   31 +++++++++--
 source3/libnet/libnet_join.c                |    2 +-
 source3/libsmb/cli_smb2_fnum.c              |    2 +-
 source3/libsmb/libsmb_xattr.c               |    6 +-
 source3/modules/vfs_glusterfs.c             |    3 +-
 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/utils/sharesec.c                    |    6 +-
 source3/utils/smbcacls.c                    |    6 +-
 source3/winbindd/wb_fill_pwent.c            |   73 ++++++++++++++++-----------
 testsuite/nsswitch/getgrent_r.c             |    2 +-
 18 files changed, 164 insertions(+), 90 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/perfcounter/perf_writer_disk.c b/examples/perfcounter/perf_writer_disk.c
index 15188d2..18a63a4 100644
--- a/examples/perfcounter/perf_writer_disk.c
+++ b/examples/perfcounter/perf_writer_disk.c
@@ -132,7 +132,7 @@ void get_diskinfo(PERF_DATA_BLOCK *data)
 	int status, num;
 	char buf[LARGE_BUF], *start;
 	FILE *diskstats;
-	long reads, writes, discard;
+	unsigned long reads, writes, discard;
 
 	diskstats = fopen("/proc/diskstats", "r");
 	rewind(diskstats);
@@ -147,10 +147,10 @@ void get_diskinfo(PERF_DATA_BLOCK *data)
 		p->freeMegs = (statfsbuf.f_bfree*statfsbuf.f_bsize)/1048576;
 		start = strstr(buf, data->diskInfo.mdata[i].name);
 		start += strlen(data->diskInfo.mdata[i].name) + 1;
-		num = sscanf(start, "%u %u %u %u",
+		num = sscanf(start, "%lu %lu %lu %lu",
 			     &reads,
-			     &discard, 
-			     &writes, 
+			     &discard,
+			     &writes,
 			     &discard);
 		p->writesPerSec = writes;
 		p->readsPerSec = reads;
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 ddf3fab..a42faf8 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/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 96f7a98..7edccd1 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -449,7 +449,7 @@ static ADS_STATUS libnet_join_set_machine_upn(TALLOC_CTX *mem_ctx,
 	}
 
 	if (!r->in.upn) {
-		char *realm = r->out.dns_domain_name;
+		const char *realm = r->out.dns_domain_name;
 
 		/* in case we are about to generate a keytab during the join
 		 * make sure the default upn we create is usable with kinit -k.
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index d10e1d2..1e2047e 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -1313,7 +1313,7 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli,
 	inbuf.length = sizeof(inbuf_store);
 	data_blob_clear(&inbuf);
 
-	SIVAL(inbuf.data,32,attr);
+	SSVAL(inbuf.data, 32, attr);
 	if (mtime != 0) {
 		put_long_date((char *)inbuf.data + 16,mtime);
 	}
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 22ffa8f..7d34290 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -303,7 +303,7 @@ parse_ace(struct cli_state *ipc_cli,
 	p++;
 	/* Try to parse numeric form */
 
-	if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 &&
+	if (sscanf(p, "%u/%u/%u", &atype, &aflags, &amask) == 3 &&
 	    convert_string_to_sid(ipc_cli, pol, numeric, &sid, str)) {
 		goto done;
 	}
@@ -333,7 +333,7 @@ parse_ace(struct cli_state *ipc_cli,
 	/* Only numeric form accepted for flags at present */
 
 	if (!(next_token_talloc(frame, &cp, &tok, "/") &&
-	      sscanf(tok, "%i", &aflags))) {
+	      sscanf(tok, "%u", &aflags))) {
 		TALLOC_FREE(frame);
 		return false;
 	}
@@ -344,7 +344,7 @@ parse_ace(struct cli_state *ipc_cli,
 	}
 
 	if (strncmp(tok, "0x", 2) == 0) {
-		if (sscanf(tok, "%i", &amask) != 1) {
+		if (sscanf(tok, "%u", &amask) != 1) {
 			TALLOC_FREE(frame);
 			return false;
 		}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index e5c691e..ca7d790 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -145,7 +145,7 @@ static struct glfs_preopened {
 } *glfs_preopened;
 
 
-int glfs_set_preopened(const char *volume, glfs_t *fs)
+static int glfs_set_preopened(const char *volume, glfs_t *fs)
 {
 	struct glfs_preopened *entry = NULL;
 
@@ -1397,7 +1397,6 @@ static int vfs_gluster_sys_acl_set_fd(struct vfs_handle_struct *handle,
 				      SMB_ACL_T theacl)
 {
 	int ret;
-	char *key;
 	char *buf;
 	ssize_t size;
 
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 d7db4d8..bb0d3b3 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -5316,11 +5316,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 43f75e5..b126bd5 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -519,7 +519,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;
 
@@ -3051,7 +3051,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) {
@@ -3095,7 +3095,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,
@@ -3117,7 +3117,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;
 
@@ -3130,7 +3130,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;
@@ -3145,32 +3145,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;
@@ -3180,8 +3179,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);
@@ -3200,7 +3201,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 b13f8b0..7359cb2 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -3611,6 +3611,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"));
 
@@ -3634,13 +3635,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;
 	}
 
 	/*
@@ -3649,10 +3656,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) {
@@ -3671,12 +3679,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);
 			}
 
@@ -3701,7 +3718,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 ee51a4d..b7badc6 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -6553,7 +6553,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 3a752ce..b7b76e8 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/utils/sharesec.c b/source3/utils/sharesec.c
index 38c11e0..2b1e435 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -186,7 +186,7 @@ static bool parse_ace(struct security_ace *ace, const char *orig_str)
 	p++;
 	/* Try to parse numeric form */
 
-	if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 &&
+	if (sscanf(p, "%u/%u/%u", &atype, &aflags, &amask) == 3 &&
 	    string_to_sid(&sid, str)) {
 		goto done;
 	}
@@ -226,7 +226,7 @@ static bool parse_ace(struct security_ace *ace, const char *orig_str)
 	/* no flags on share permissions */
 
 	if (!(next_token_talloc(frame, &cp, &tok, "/") &&
-	      sscanf(tok, "%i", &aflags) && aflags == 0)) {
+	      sscanf(tok, "%u", &aflags) && aflags == 0)) {
 		fprintf(stderr, "ACE '%s': bad integer flags entry at '%s'\n",
 			orig_str, tok);
 		SAFE_FREE(str);
@@ -243,7 +243,7 @@ static bool parse_ace(struct security_ace *ace, const char *orig_str)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list