[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Oct 30 02:15:02 MDT 2014


The branch, master has been updated
       via  e8bd0c0 Don't drop any error codes just because we think there cannot be any errors we didn't think of if the user asked for a level 10 log.
       via  d772b98 spoolss: remove unused fill_job_info3()
       via  5e7ab3d spoolss: fix jobid in level 3 EnumJobs response
       via  45abaf8 spoolss: fix jobid in level 2 GetJob and EnumJobs responses
       via  4d7f5d2 spoolss: fix jobid in level 1 GetJob and EnumJobs responses
       via  3a28ae5 spoolss: fix GetJob jobid lookups
       via  77b5be1 printing: add jobid_to_sysjob helper function
       via  229f8b3 dns: Fix a compile warning by casting explicitly
       via  3c1214d dbwrap: Avoid "includes.h" in dbwrap_cache.c
       via  e6a7f4c dbwrap: Add some required #includes to dbwrap.h
       via  d6a79d2 lib: loadparm.h uses TALLOC_CTX
       via  ab64c46 dbwrap: Avoid an unnecessary #include
      from  ea962a6 torture/spoolss: cleanup print_job_enum test jobs

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


- Log -----------------------------------------------------------------
commit e8bd0c0e93b523dbc65be55e2496953a344e11ab
Author: root <root at localhost.localdomain>
Date:   Wed Oct 29 19:54:56 2014 -0700

    Don't drop any error codes just because we think there cannot be any errors we didn't think of if the user asked for a level 10 log.
    
    Signed-off-by: Richard Sharpe <rsharpe at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Oct 30 09:14:51 CET 2014 on sn-devel-104

commit d772b98283f289917a6a8370808d4d0912899384
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:51 2014 +0100

    spoolss: remove unused fill_job_info3()
    
    This logic has been moved into the previous EnumJobs(level=3) caller.
    The info3 structure only contains two fields that are used, so it
    doesn't make sense to have a separate helper for it.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5e7ab3d2f4f7950099561eb22d6a9a1536297442
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:50 2014 +0100

    spoolss: fix jobid in level 3 EnumJobs response
    
    Until now, these responses have incorrectly carried the printing backend
    job identifier (sysjob), rather than the one allocated and returned by
    Samba on job submission.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10905
    
    Reported-by: Franz Pförtsch <franz.pfoertsch at brose.com>
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 45abaf81c67b62bab571df208931241afa660802
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:49 2014 +0100

    spoolss: fix jobid in level 2 GetJob and EnumJobs responses
    
    Until now, these responses have incorrectly carried the printing backend
    job identifier (sysjob), rather than the one allocated and returned by
    Samba on job submission.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10905
    
    Reported-by: Franz Pförtsch <franz.pfoertsch at brose.com>
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4d7f5d2af6ef6960dccaccf89c6e88947e2591bf
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:48 2014 +0100

    spoolss: fix jobid in level 1 GetJob and EnumJobs responses
    
    Until now, these responses have incorrectly carried the printing backend
    job identifier (sysjob), rather than the one allocated and returned by
    Samba on job submission.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10905
    
    Reported-by: Franz Pförtsch <franz.pfoertsch at brose.com>
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3a28ae56977235d3c9e3abcd1f24b220e536c50d
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:47 2014 +0100

    spoolss: fix GetJob jobid lookups
    
    Clients issue GetJob requests using the jobid assigned by the spoolss
    server. The corresponding printing backend (sysjob) identifier needs to
    be resolved to locate the correct print queue entry.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10905
    
    Reported-by: Franz Pförtsch <franz.pfoertsch at brose.com>
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 77b5be1742ee7aa2733a25bfa6a3af369f5c9401
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Oct 30 01:37:46 2014 +0100

    printing: add jobid_to_sysjob helper function
    
    Samba needs to deal with two types of print job identifiers, those
    allocated by the printing backend (sysjob ids), and those allocated
    by Samba's spoolss server (jobids).
    
    This change adds a helper function to map spoolss jobids to sysjob ids,
    to go alongside the corresponding sysjob to jobid mapping function.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 229f8b324a0f4a77eed5ef5fcdf87a3758a50d66
Author: Kai Blin <kai at samba.org>
Date:   Wed Oct 29 14:18:38 2014 +0100

    dns: Fix a compile warning by casting explicitly
    
    Signed-off-by: Kai Blin <kai at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3c1214ddac65a186f4f65a256728f80605ed3ab1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 29 10:21:16 2014 +0100

    dbwrap: Avoid "includes.h" in dbwrap_cache.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e6a7f4cfaa9f77487ea549a2b6538451d3699e48
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 29 10:20:20 2014 +0100

    dbwrap: Add some required #includes to dbwrap.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d6a79d2d0275b2443b651f4a0e26b1625e535f9a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 29 10:19:43 2014 +0100

    lib: loadparm.h uses TALLOC_CTX
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ab64c4644c8b5a27e0b6ac93450dac934c978bdb
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 29 10:12:02 2014 +0100

    dbwrap: Avoid an unnecessary #include
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/dbwrap/dbwrap.h                         |    3 +
 lib/dbwrap/dbwrap_cache.c                   |    7 +-
 lib/dbwrap/dbwrap_cache.h                   |    6 +-
 lib/param/loadparm.h                        |    1 +
 source3/auth/auth_util.c                    |    3 +
 source3/include/printing.h                  |    1 +
 source3/printing/printing.c                 |   70 +++++++---
 source3/rpc_server/spoolss/srv_spoolss_nt.c |  212 +++++++++++++++++----------
 source4/dns_server/dns_query.c              |    2 +-
 source4/dns_server/dns_update.c             |    8 +-
 10 files changed, 207 insertions(+), 106 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index d289243..e56e036 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -20,6 +20,9 @@
 #ifndef __DBWRAP_H__
 #define __DBWRAP_H__
 
+#include "replace.h"
+#include <talloc.h>
+#include "libcli/util/ntstatus.h"
 #include "tdb.h"
 
 struct db_record;
diff --git a/lib/dbwrap/dbwrap_cache.c b/lib/dbwrap/dbwrap_cache.c
index c5f7cce..724389e 100644
--- a/lib/dbwrap/dbwrap_cache.c
+++ b/lib/dbwrap/dbwrap_cache.c
@@ -17,11 +17,12 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
-#include "lib/dbwrap/dbwrap.h"
+#include "replace.h"
+#include "lib/param/loadparm.h"
+#include "lib/dbwrap/dbwrap_cache.h"
 #include "lib/dbwrap/dbwrap_private.h"
 #include "lib/dbwrap/dbwrap_rbt.h"
-#include "lib/dbwrap/dbwrap_cache.h"
+#include "lib/util/talloc_stack.h"
 
 struct db_cache_ctx {
 	int seqnum;
diff --git a/lib/dbwrap/dbwrap_cache.h b/lib/dbwrap/dbwrap_cache.h
index cd290e1..e69d58e 100644
--- a/lib/dbwrap/dbwrap_cache.h
+++ b/lib/dbwrap/dbwrap_cache.h
@@ -20,11 +20,7 @@
 #ifndef __DBWRAP_CACHE_H__
 #define __DBWRAP_CACHE_H__
 
-#include <talloc.h>
-
-#include "dbwrap/dbwrap_private.h"
-
-struct db_context;
+#include "dbwrap.h"
 
 struct db_context *db_open_cache(TALLOC_CTX *mem_ctx,
 				 struct db_context *backing);
diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h
index 11632de..4d5c54e 100644
--- a/lib/param/loadparm.h
+++ b/lib/param/loadparm.h
@@ -30,6 +30,7 @@
 #ifndef _LOADPARM_H
 #define _LOADPARM_H
 
+#include <talloc.h>
 #include "../lib/util/parmlist.h"
 
 /* the following are used by loadparm for option lists */
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 2986fb4..dbc7d24 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1521,6 +1521,9 @@ bool is_trusted_domain(const char* dom_name)
 			return false;
 		}
 
+		DEBUG(10, ("wb_is_trusted_domain returned error: %s\n",
+			  wbcErrorString(result)));
+
 		/* The only other possible result is that winbind is not up
 		   and running. We need to update the trustdom_cache
 		   ourselves */
diff --git a/source3/include/printing.h b/source3/include/printing.h
index ec5a53b..563659a 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -195,6 +195,7 @@ uint16_t print_spool_rap_jobid(struct print_file_data *print_file);
 
 uint32 sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob);
 uint32 sysjob_to_jobid(int unix_jobid);
+int jobid_to_sysjob_pdb(struct tdb_print_db *pdb, uint32_t jobid);
 bool print_notify_register_pid(int snum);
 bool print_notify_deregister_pid(int snum);
 bool print_job_exists(const char* sharename, uint32 jobid);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index d8b6191..5d053cc 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -501,19 +501,18 @@ err_out:
 	return pjob;
 }
 
-/* Convert a unix jobid to a smb jobid */
-
-struct unixjob_traverse_state {
+struct job_traverse_state {
 	int sysjob;
-	uint32 sysjob_to_jobid_value;
+	uint32_t jobid;
 };
 
-static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
-			       TDB_DATA data, void *private_data)
+/* find spoolss jobid based on sysjob */
+static int sysjob_to_jobid_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
+				       TDB_DATA data, void *private_data)
 {
 	struct printjob *pjob;
-	struct unixjob_traverse_state *state =
-		(struct unixjob_traverse_state *)private_data;
+	struct job_traverse_state *state =
+		(struct job_traverse_state *)private_data;
 
 	if (!data.dptr || data.dsize == 0)
 		return 0;
@@ -523,7 +522,7 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
 		return 0;
 
 	if (state->sysjob == pjob->sysjob) {
-		state->sysjob_to_jobid_value = pjob->jobid;
+		state->jobid = pjob->jobid;
 		return 1;
 	}
 
@@ -532,14 +531,14 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
 
 uint32 sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob)
 {
-	struct unixjob_traverse_state state;
+	struct job_traverse_state state;
 
 	state.sysjob = sysjob;
-	state.sysjob_to_jobid_value = (uint32)-1;
+	state.jobid = (uint32_t)-1;
 
-	tdb_traverse(pdb->tdb, unixjob_traverse_fn, &state);
+	tdb_traverse(pdb->tdb, sysjob_to_jobid_traverse_fn, &state);
 
-	return state.sysjob_to_jobid_value;
+	return state.jobid;
 }
 
 /****************************************************************************
@@ -551,10 +550,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
 {
 	int services = lp_numservices();
 	int snum;
-	struct unixjob_traverse_state state;
+	struct job_traverse_state state;
 
 	state.sysjob = unix_jobid;
-	state.sysjob_to_jobid_value = (uint32)-1;
+	state.jobid = (uint32_t)-1;
 
 	for (snum = 0; snum < services; snum++) {
 		struct tdb_print_db *pdb;
@@ -564,14 +563,49 @@ uint32 sysjob_to_jobid(int unix_jobid)
 		if (!pdb) {
 			continue;
 		}
-		tdb_traverse(pdb->tdb, unixjob_traverse_fn, &state);
+		tdb_traverse(pdb->tdb, sysjob_to_jobid_traverse_fn, &state);
 		release_print_db(pdb);
-		if (state.sysjob_to_jobid_value != (uint32)-1)
-			return state.sysjob_to_jobid_value;
+		if (state.jobid != (uint32_t)-1)
+			return state.jobid;
 	}
 	return (uint32)-1;
 }
 
+/* find sysjob based on spoolss jobid */
+static int jobid_to_sysjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
+				       TDB_DATA data, void *private_data)
+{
+	struct printjob *pjob;
+	struct job_traverse_state *state =
+		(struct job_traverse_state *)private_data;
+
+	if (!data.dptr || data.dsize == 0)
+		return 0;
+
+	pjob = (struct printjob *)data.dptr;
+	if (key.dsize != sizeof(uint32_t))
+		return 0;
+
+	if (state->jobid == pjob->jobid) {
+		state->sysjob = pjob->sysjob;
+		return 1;
+	}
+
+	return 0;
+}
+
+int jobid_to_sysjob_pdb(struct tdb_print_db *pdb, uint32_t jobid)
+{
+	struct job_traverse_state state;
+
+	state.sysjob = -1;
+	state.jobid = jobid;
+
+	tdb_traverse(pdb->tdb, jobid_to_sysjob_traverse_fn, &state);
+
+	return state.sysjob;
+}
+
 /****************************************************************************
  Send notifications based on what has changed after a pjob_store.
 ****************************************************************************/
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 552d4cb..f6fbfda 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -7057,6 +7057,7 @@ fill_job_info1
 static WERROR fill_job_info1(TALLOC_CTX *mem_ctx,
 			     struct spoolss_JobInfo1 *r,
 			     const print_queue_struct *queue,
+			     uint32_t jobid,
 			     int position, int snum,
 			     struct spoolss_PrinterInfo2 *pinfo2)
 {
@@ -7064,7 +7065,7 @@ static WERROR fill_job_info1(TALLOC_CTX *mem_ctx,
 
 	t = gmtime(&queue->time);
 
-	r->job_id		= queue->sysjob;
+	r->job_id		= jobid;
 
 	r->printer_name		= lp_servicename(mem_ctx, snum);
 	W_ERROR_HAVE_NO_MEMORY(r->printer_name);
@@ -7097,6 +7098,7 @@ fill_job_info2
 static WERROR fill_job_info2(TALLOC_CTX *mem_ctx,
 			     struct spoolss_JobInfo2 *r,
 			     const print_queue_struct *queue,
+			     uint32_t jobid,
 			     int position, int snum,
 			     struct spoolss_PrinterInfo2 *pinfo2,
 			     struct spoolss_DeviceMode *devmode)
@@ -7105,7 +7107,7 @@ static WERROR fill_job_info2(TALLOC_CTX *mem_ctx,
 
 	t = gmtime(&queue->time);
 
-	r->job_id		= queue->sysjob;
+	r->job_id		= jobid;
 
 	r->printer_name		= lp_servicename(mem_ctx, snum);
 	W_ERROR_HAVE_NO_MEMORY(r->printer_name);
@@ -7148,27 +7150,6 @@ static WERROR fill_job_info2(TALLOC_CTX *mem_ctx,
 }
 
 /****************************************************************************
-fill_job_info3
-****************************************************************************/
-
-static WERROR fill_job_info3(TALLOC_CTX *mem_ctx,
-			     struct spoolss_JobInfo3 *r,
-			     const print_queue_struct *queue,
-			     const print_queue_struct *next_queue,
-			     int position, int snum,
-			     struct spoolss_PrinterInfo2 *pinfo2)
-{
-	r->job_id		= queue->sysjob;
-	r->next_job_id		= 0;
-	if (next_queue) {
-		r->next_job_id	= next_queue->sysjob;
-	}
-	r->reserved		= 0;
-
-	return WERR_OK;
-}
-
-/****************************************************************************
  Enumjobs at level 1.
 ****************************************************************************/
 
@@ -7182,34 +7163,56 @@ static WERROR enumjobs_level1(TALLOC_CTX *mem_ctx,
 	union spoolss_JobInfo *info;
 	int i;
 	WERROR result = WERR_OK;
+	uint32_t num_filled;
+	struct tdb_print_db *pdb;
 
 	info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues);
-	W_ERROR_HAVE_NO_MEMORY(info);
+	if (info == NULL) {
+		result = WERR_NOMEM;
+		goto err_out;
+	}
 
-	*count = num_queues;
+	pdb = get_print_db_byname(pinfo2->sharename);
+	if (pdb == NULL) {
+		result = WERR_INVALID_PARAM;
+		goto err_info_free;
+	}
+
+	num_filled = 0;
+	for (i = 0; i < num_queues; i++) {
+		uint32_t jobid = sysjob_to_jobid_pdb(pdb, queue[i].sysjob);
+		if (jobid == (uint32_t)-1) {
+			DEBUG(4, ("skipping sysjob %d\n", queue[i].sysjob));
+			continue;
+		}
 
-	for (i=0; i<*count; i++) {
 		result = fill_job_info1(info,
-					&info[i].info1,
+					&info[num_filled].info1,
 					&queue[i],
+					jobid,
 					i,
 					snum,
 					pinfo2);
 		if (!W_ERROR_IS_OK(result)) {
-			goto out;
+			goto err_pdb_drop;
 		}
-	}
 
- out:
-	if (!W_ERROR_IS_OK(result)) {
-		TALLOC_FREE(info);
-		*count = 0;
-		return result;
+		num_filled++;
 	}
 
+	release_print_db(pdb);
 	*info_p = info;
+	*count = num_filled;
 
 	return WERR_OK;
+
+err_pdb_drop:
+	release_print_db(pdb);
+err_info_free:
+	TALLOC_FREE(info);
+err_out:
+	*count = 0;
+	return result;
 }
 
 /****************************************************************************
@@ -7226,45 +7229,65 @@ static WERROR enumjobs_level2(TALLOC_CTX *mem_ctx,
 	union spoolss_JobInfo *info;
 	int i;
 	WERROR result = WERR_OK;
+	uint32_t num_filled;
+	struct tdb_print_db *pdb;
 
 	info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues);
-	W_ERROR_HAVE_NO_MEMORY(info);
+	if (info == NULL) {
+		result = WERR_NOMEM;
+		goto err_out;
+	}
 
-	*count = num_queues;
+	pdb = get_print_db_byname(pinfo2->sharename);
+	if (pdb == NULL) {
+		result = WERR_INVALID_PARAM;
+		goto err_info_free;
+	}
 
-	for (i=0; i<*count; i++) {
+	num_filled = 0;
+	for (i = 0; i< num_queues; i++) {
 		struct spoolss_DeviceMode *devmode;
+		uint32_t jobid = sysjob_to_jobid_pdb(pdb, queue[i].sysjob);
+		if (jobid == (uint32_t)-1) {
+			DEBUG(4, ("skipping sysjob %d\n", queue[i].sysjob));
+			continue;
+		}
 
 		result = spoolss_create_default_devmode(info,
 							pinfo2->printername,
 							&devmode);
 		if (!W_ERROR_IS_OK(result)) {
 			DEBUG(3, ("Can't proceed w/o a devmode!"));
-			goto out;
+			goto err_pdb_drop;
 		}
 
 		result = fill_job_info2(info,
-					&info[i].info2,
+					&info[num_filled].info2,
 					&queue[i],
+					jobid,
 					i,
 					snum,
 					pinfo2,
 					devmode);
 		if (!W_ERROR_IS_OK(result)) {
-			goto out;
+			goto err_pdb_drop;
 		}
+		num_filled++;
 	}
 
- out:
-	if (!W_ERROR_IS_OK(result)) {
-		TALLOC_FREE(info);
-		*count = 0;
-		return result;
-	}
-
+	release_print_db(pdb);
 	*info_p = info;
+	*count = num_filled;
 
 	return WERR_OK;
+
+err_pdb_drop:
+	release_print_db(pdb);
+err_info_free:
+	TALLOC_FREE(info);
+err_out:
+	*count = 0;
+	return result;
 }
 
 /****************************************************************************
@@ -7281,41 +7304,51 @@ static WERROR enumjobs_level3(TALLOC_CTX *mem_ctx,
 	union spoolss_JobInfo *info;
 	int i;
 	WERROR result = WERR_OK;
+	uint32_t num_filled;
+	struct tdb_print_db *pdb;
 
 	info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues);
-	W_ERROR_HAVE_NO_MEMORY(info);
-
-	*count = num_queues;
+	if (info == NULL) {
+		result = WERR_NOMEM;
+		goto err_out;
+	}
 
-	for (i=0; i<*count; i++) {
-		const print_queue_struct *next_queue = NULL;
+	pdb = get_print_db_byname(pinfo2->sharename);
+	if (pdb == NULL) {
+		result = WERR_INVALID_PARAM;
+		goto err_info_free;
+	}
 
-		if (i+1 < *count) {
-			next_queue = &queue[i+1];
+	num_filled = 0;
+	for (i = 0; i < num_queues; i++) {
+		uint32_t jobid = sysjob_to_jobid_pdb(pdb, queue[i].sysjob);
+		if (jobid == (uint32_t)-1) {
+			DEBUG(4, ("skipping sysjob %d\n", queue[i].sysjob));
+			continue;
 		}
 
-		result = fill_job_info3(info,
-					&info[i].info3,
-					&queue[i],
-					next_queue,
-					i,
-					snum,
-					pinfo2);
-		if (!W_ERROR_IS_OK(result)) {
-			goto out;
-		}
-	}
+		info[num_filled].info3.job_id = jobid;
+		/* next_job_id is overwritten on next iteration */
+		info[num_filled].info3.next_job_id = 0;
+		info[num_filled].info3.reserved = 0;
 
- out:
-	if (!W_ERROR_IS_OK(result)) {
-		TALLOC_FREE(info);
-		*count = 0;
-		return result;
+		if (num_filled > 0) {
+			info[num_filled - 1].info3.next_job_id = jobid;
+		}
+		num_filled++;
 	}
 
+	release_print_db(pdb);
 	*info_p = info;
+	*count = num_filled;
 
 	return WERR_OK;
+
+err_info_free:
+	TALLOC_FREE(info);
+err_out:
+	*count = 0;
+	return result;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list