[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue May 11 23:46:01 UTC 2021


The branch, master has been updated
       via  4d54b602bde printing: Avoid a few references to background_lpq_updater_pid
       via  bad19e208ce printing: Introduce samba-bgqd
       via  ecf9ba381e7 lib: Add str_list_add_printf()
       via  695938b6332 lib: Add parent_watch_fd()
       via  46d47994ee5 printing: Factor out register_printing_bq_handlers()
       via  b180ca8cd35 param: Enable including source3/param/param_proto.h without vfs.h
       via  f7181ec7e2e printing: Simplify calling print commands
       via  5212464bf1c lib: Simplify str_list_make_empty()
       via  e33db55266e smbd: Make share_mode_lock.h includable on its own
       via  209a4bb364e printing: Consolidate add_to_jobs_list()
      from  33f45491f8d s3: smbd: Remove a STAT/LSTAT call on the parent pathname in a hot code path.

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


- Log -----------------------------------------------------------------
commit 4d54b602bde941313590f12364d4ed348673264e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 30 21:52:00 2021 +0200

    printing: Avoid a few references to background_lpq_updater_pid
    
    We have the bgqd in the pidfile now
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue May 11 23:45:21 UTC 2021 on sn-devel-184

commit bad19e208ce3b0ff5a9b99245b815423c3f469bd
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 22 13:39:31 2021 +0200

    printing: Introduce samba-bgqd
    
    This is a separate binary executed from start_background_queue(). As
    such it does not really gain much, but the idea is to move all the
    code this runs out of the smbd and spoolssd binaries to just link
    here.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ecf9ba381e7bd2691d0c8a674f519516c63600ff
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 4 12:30:02 2021 +0200

    lib: Add str_list_add_printf()
    
    Build up execv argument lists
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 695938b6332277031b8f55bef0c7ae79c3942d98
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 27 18:03:57 2021 +0200

    lib: Add parent_watch_fd()
    
    Make the parent watcher pipe used in reinit_after_fork() available for
    external users that can't call reinit_after_fork().
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 46d47994ee5c15636151aa661317fd9f905d30d5
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 23 10:32:43 2021 +0200

    printing: Factor out register_printing_bq_handlers()
    
    The printing background jobs can be provided independently of the
    start_background_queue() implementation.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b180ca8cd353366e686be030b9369acd677e77e2
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Apr 22 15:44:10 2021 +0200

    param: Enable including source3/param/param_proto.h without vfs.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f7181ec7e2e7fc998341c04dcdf927c5b5046148
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 30 12:12:40 2021 +0200

    printing: Simplify calling print commands
    
    We have fstr_sprintf for this
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5212464bf1ca8cb96ab44163d2843ce8f812f651
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 27 11:38:53 2021 +0200

    lib: Simplify str_list_make_empty()
    
    We have talloc_zero_array() for this.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e33db55266ec103983730fdbe8bbf2682c9afea0
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 27 18:01:33 2021 +0200

    smbd: Make share_mode_lock.h includable on its own
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 209a4bb364e9997ee3e2cc0929abe414efc21b4d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Apr 30 10:36:57 2021 +0200

    printing: Consolidate add_to_jobs_list()
    
    add_to_jobs_changed() and add_to_jobs_added() only differed in the key
    string.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 .../{vfs_dirsort.8.xml => samba-bgqd.8.xml}        |  43 +--
 docs-xml/wscript_build                             |   1 +
 lib/util/tests/strlist.c                           |  29 +-
 lib/util/util_strlist.c                            |  61 +++-
 lib/util/util_strlist.h                            |   6 +
 librpc/idl/messaging.idl                           |   2 +
 script/generate_param.py                           |   2 +
 source3/include/proto.h                            |   1 +
 source3/lib/util.c                                 |  19 +
 source3/locking/share_mode_lock.h                  |  17 +-
 source3/printing/nt_printing.c                     |  15 +-
 source3/printing/print_generic.c                   |  10 +-
 source3/printing/printing.c                        |  52 +--
 source3/printing/queue_process.c                   | 250 +++++++------
 source3/printing/queue_process.h                   |   9 +
 source3/printing/samba-bgqd.c                      | 406 +++++++++++++++++++++
 source3/printing/spoolssd.c                        |   3 +-
 source3/wscript_build                              |  10 +
 18 files changed, 728 insertions(+), 208 deletions(-)
 copy docs-xml/manpages/{vfs_dirsort.8.xml => samba-bgqd.8.xml} (51%)
 create mode 100644 source3/printing/samba-bgqd.c


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_dirsort.8.xml b/docs-xml/manpages/samba-bgqd.8.xml
similarity index 51%
copy from docs-xml/manpages/vfs_dirsort.8.xml
copy to docs-xml/manpages/samba-bgqd.8.xml
index 586e3889dc9..ef50a542a9e 100644
--- a/docs-xml/manpages/vfs_dirsort.8.xml
+++ b/docs-xml/manpages/samba-bgqd.8.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
-<refentry id="vfs_dirsort.8">
+<refentry id="samba-bgqd.8">
 
 <refmeta>
-	<refentrytitle>vfs_dirsort</refentrytitle>
+	<refentrytitle>samba-bgqd</refentrytitle>
 	<manvolnum>8</manvolnum>
 	<refmiscinfo class="source">Samba</refmiscinfo>
 	<refmiscinfo class="manual">System Administration tools</refmiscinfo>
@@ -12,48 +12,28 @@
 
 
 <refnamediv>
-	<refname>vfs_dirsort</refname>
-	<refpurpose>Sort directory contents</refpurpose>
+	<refname>samba-bgqd</refname>
+	<refpurpose>This is an internal helper program performing
+	asynchronous printing-related jobs.</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
 	<cmdsynopsis>
-		<command>vfs objects = dirsort</command>
+		<command>samba-bgqd</command>
 	</cmdsynopsis>
 </refsynopsisdiv>
 
 <refsect1>
 	<title>DESCRIPTION</title>
 
-	<para>This VFS module is part of the
+	<para>This tool is part of the
 	<citerefentry><refentrytitle>samba</refentrytitle>
 	<manvolnum>7</manvolnum></citerefentry> suite.</para>
 
-	<para>The <command>vfs_dirsort</command> module sorts directory
-	entries alphabetically before sending them to the client.</para>
-
-	<para>Please be aware that adding this module might have negative
-	performance implications for large directories.</para>
-
-</refsect1>
-
-<refsect1>
-	<title>EXAMPLES</title>
-
-	<para>Sort directories for all shares:</para>
-
-<programlisting>
-        <smbconfsection name="[global]"/>
-	<smbconfoption name="vfs objects">dirsort</smbconfoption>
-</programlisting>
-
-</refsect1>
-
-<refsect1>
-	<title>VERSION</title>
-
-	<para>This man page is part of version &doc.version; of the Samba suite.
-	</para>
+	<para>samba-bgqd is an helper program to be spawned by smbd or
+	spoolssd to perform jobs like updating the printer list or
+	other management tasks asynchronously on demand. It is not
+	intended to be called by users or administrators.</para>
 </refsect1>
 
 <refsect1>
@@ -63,7 +43,6 @@
 	were created by Andrew Tridgell. Samba is now developed
 	by the Samba Team as an Open Source project similar
 	to the way the Linux kernel is developed.</para>
-
 </refsect1>
 
 </refentry>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index c2986ed6cd5..492a9ad70bd 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -44,6 +44,7 @@ manpages='''
          manpages/smbpasswd.8
          manpages/smbspool_krb5_wrapper.8
          manpages/smbspool.8
+         manpages/samba-bgqd.8
          manpages/smbstatus.1
          manpages/smbtar.1
          manpages/smbtree.1
diff --git a/lib/util/tests/strlist.c b/lib/util/tests/strlist.c
index 17184990d2c..a9306b82f53 100644
--- a/lib/util/tests/strlist.c
+++ b/lib/util/tests/strlist.c
@@ -493,10 +493,32 @@ static bool test_list_append_const(struct torture_context *tctx)
 	return true;
 }
 
+static bool test_list_add_printf_NULL(struct torture_context *tctx)
+{
+	char **list = NULL;
+	str_list_add_printf(&list, "x=%d", 1);
+	torture_assert(tctx, list==NULL, "str_list_add_printf must keep NULL");
+	return true;
+}
+
+static bool test_list_add_printf(struct torture_context *tctx)
+{
+	const char *list2[] = { "foo", "bar=baz", NULL };
+	char **list = str_list_make_empty(tctx);
+	str_list_add_printf(&list, "foo");
+	str_list_add_printf(&list, "bar=%s", "baz");
+	torture_assert(
+		tctx,
+		str_list_equal((const char * const *)list, list2),
+		"str_list_add_printf failed");
+	TALLOC_FREE(list);
+	return true;
+}
+
 struct torture_suite *torture_local_util_strlist(TALLOC_CTX *mem_ctx)
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "strlist");
-	int i;
+	size_t i;
 
 	for (i = 0; i < ARRAY_SIZE(test_lists_shell_strings); i++) {
 		char *name;
@@ -528,6 +550,9 @@ struct torture_suite *torture_local_util_strlist(TALLOC_CTX *mem_ctx)
 	torture_suite_add_simple_test(suite, "list_unique_2", test_list_unique_2);
 	torture_suite_add_simple_test(suite, "list_append", test_list_append);
 	torture_suite_add_simple_test(suite, "list_append_const", test_list_append_const);
-
+	torture_suite_add_simple_test(
+		suite, "list_add_printf_NULL", test_list_add_printf_NULL);
+	torture_suite_add_simple_test(
+		suite, "list_add_printf", test_list_add_printf);
 	return suite;
 }
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
index 9462e9c6ad4..b56e17379cb 100644
--- a/lib/util/util_strlist.c
+++ b/lib/util/util_strlist.c
@@ -36,15 +36,7 @@
 */
 _PUBLIC_ char **str_list_make_empty(TALLOC_CTX *mem_ctx)
 {
-	char **ret = NULL;
-
-	ret = talloc_array(mem_ctx, char *, 1);
-	if (ret == NULL) {
-		return NULL;
-	}
-
-	ret[0] = NULL;
-
+	char **ret = talloc_zero_array(mem_ctx, char *, 1);
 	return ret;
 }
 
@@ -307,6 +299,57 @@ _PUBLIC_ const char **str_list_add(const char **list, const char *s)
 	return ret;
 }
 
+/**
+ * @brief Extend a talloc'ed string list with a printf'ed string
+ *
+ * str_list_add_printf() does nothing if *plist is NULL and it sets
+ * *plist to NULL on failure. It is designed to avoid intermediate
+ * NULL checks:
+ *
+ *     argv = str_list_make_empty(ctx);
+ *     str_list_add_printf(&argv, "smbstatus");
+ *     str_list_add_printf(&argv, "--configfile=%s", config);
+ *     if (argv == NULL) {
+ *        goto nomem;
+ *     }
+ *
+ * @param[in,out] plist The talloc'ed list to extend
+ * @param[in] fmt The format string
+ */
+void str_list_add_printf(char ***plist, const char *fmt, ...)
+{
+	char **list = *plist;
+	size_t len;
+	char **tmp = NULL;
+	va_list ap;
+
+	if (list == NULL) {
+		return;
+	}
+	len = str_list_length((const char * const *)list);
+
+	tmp = talloc_realloc(NULL, list, char *, len+2);
+	if (tmp == NULL) {
+		goto fail;
+	}
+	list = tmp;
+	list[len+1] = NULL;
+
+	va_start(ap, fmt);
+	list[len] = talloc_vasprintf(list, fmt, ap);
+	va_end(ap);
+
+	if (list[len] == NULL) {
+		goto fail;
+	}
+	*plist = list;
+
+	return;
+fail:
+	TALLOC_FREE(list);
+	*plist = NULL;
+}
+
 /**
   remove an entry from a string list
 */
diff --git a/lib/util/util_strlist.h b/lib/util/util_strlist.h
index 116303424c2..5c3a7ee1f37 100644
--- a/lib/util/util_strlist.h
+++ b/lib/util/util_strlist.h
@@ -87,6 +87,12 @@ bool str_list_equal(const char * const *list1,
 */
 const char **str_list_add(const char **list, const char *s);
 
+/*
+ * Extend a list with a printf'ed string
+ */
+void str_list_add_printf(char ***plist, const char *fmt, ...)
+	PRINTF_ATTRIBUTE(2,3);
+
 /**
   remove an entry from a string list
 */
diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl
index 06a72520f8b..a2070e27b46 100644
--- a/librpc/idl/messaging.idl
+++ b/librpc/idl/messaging.idl
@@ -48,6 +48,8 @@ interface messaging
 		MSG_REQ_RINGBUF_LOG		= 0x0033,
 		MSG_RINGBUF_LOG			= 0x0034,
 
+		MSG_DAEMON_READY_FD             = 0x0035,
+
 		/* nmbd messages */
 		MSG_FORCE_ELECTION		= 0x0101,
 		MSG_WINS_NEW_ENTRY		= 0x0102,
diff --git a/script/generate_param.py b/script/generate_param.py
index c29a29df57e..4a4f7fec878 100644
--- a/script/generate_param.py
+++ b/script/generate_param.py
@@ -173,6 +173,8 @@ def make_s3_param_proto(path_in, path_out):
         header = get_header(path_out)
         file_out.write("#ifndef %s\n" % header)
         file_out.write("#define %s\n\n" % header)
+        file_out.write("struct share_params;\n")
+        file_out.write("struct loadparm_substitution;\n")
         for parameter in iterate_all(path_in):
             # filter out parameteric options
             if ':' in parameter['name']:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index dd262529212..f9bffb3aa59 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -326,6 +326,7 @@ char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
 char *clean_name(TALLOC_CTX *ctx, const char *s);
 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, off_t pos);
 NTSTATUS init_before_fork(void);
+int parent_watch_fd(void);
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
 			   struct tevent_context *ev_ctx,
 			   bool parent_longlived,
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 0cd5c8e6698..1a0bc5003cd 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -21,6 +21,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/**
+ * @brief  Small functions that don't fit anywhere else
+ * @file   util.c
+ */
+
 #include "includes.h"
 #include "system/passwd.h"
 #include "system/filesys.h"
@@ -387,6 +392,20 @@ NTSTATUS init_before_fork(void)
 	return NT_STATUS_OK;
 }
 
+/**
+ * @brief Get a fd to watch for our parent process to exit
+ *
+ * Samba parent processes open a pipe that naturally closes when the
+ * parent exits. Child processes can watch the read end of the pipe
+ * for readability: Readability with 0 bytes to read means the parent
+ * has exited and the child process might also want to exit.
+ */
+
+int parent_watch_fd(void)
+{
+	return reinit_after_fork_pipe[0];
+}
+
 /**
  * Detect died parent by detecting EOF on the pipe
  */
diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h
index f2fe3d51a16..bd4e98ccecd 100644
--- a/source3/locking/share_mode_lock.h
+++ b/source3/locking/share_mode_lock.h
@@ -16,8 +16,16 @@
 #ifndef __LOCKING_SHARE_MODE_LOCK_H__
 #define __LOCKING_SHARE_MODE_LOCK_H__
 
+#include "replace.h"
+#include <tevent.h>
+#include "librpc/gen_ndr/file_id.h"
+#include "lib/util/time.h"
+
 struct share_mode_data;
 struct share_mode_lock;
+struct share_mode_entry;
+struct smb_filename;
+struct files_struct;
 
 bool locking_init(void);
 bool locking_init_readonly(void);
@@ -30,9 +38,12 @@ struct share_mode_lock *get_share_mode_lock(
 	const struct smb_filename *smb_fname,
 	const struct timespec *old_write_time);
 
-bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
-bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
-bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+bool del_share_mode(struct share_mode_lock *lck,
+		    struct files_struct *fsp);
+bool downgrade_share_oplock(struct share_mode_lock *lck,
+			    struct files_struct *fsp);
+bool remove_share_oplock(struct share_mode_lock *lck,
+			 struct files_struct *fsp);
 bool file_has_read_lease(struct files_struct *fsp);
 
 bool set_share_mode(
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 65b66130a9b..b172ed92c6e 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "printing/nt_printing_tdb.h"
+#include "printing/queue_process.h"
 #include "../librpc/gen_ndr/ndr_spoolss.h"
 #include "rpc_server/spoolss/srv_spoolss_util.h"
 #include "nt_printing.h"
@@ -29,7 +30,6 @@
 #include "../libcli/security/security.h"
 #include "passdb/machine_sid.h"
 #include "smbd/smbd.h"
-#include "smbd/globals.h"
 #include "auth.h"
 #include "messages.h"
 #include "rpc_server/spoolss/srv_spoolss_nt.h"
@@ -201,18 +201,7 @@ static void forward_drv_upgrade_printer_msg(struct messaging_context *msg,
 				struct server_id server_id,
 				DATA_BLOB *data)
 {
-	extern pid_t background_lpq_updater_pid;
-
-	if (background_lpq_updater_pid == -1) {
-		DEBUG(3,("no background lpq queue updater\n"));
-		return;
-	}
-
-	messaging_send_buf(msg,
-			pid_to_procid(background_lpq_updater_pid),
-			MSG_PRINTER_DRVUPGRADE,
-			data->data,
-			data->length);
+	send_to_bgqd(msg, msg_type, data->data, data->length);
 }
 
 /****************************************************************************
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index 075382780d4..743c311bbd5 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -108,7 +108,7 @@ static int generic_job_delete( const char *sharename, const char *lprm_command,
 	fstring jobstr;
 
 	/* need to delete the spooled entry */
-	slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
+	fstr_sprintf(jobstr, "%d", pjob->sysjob);
 	return print_run_command( -1, sharename, False, lprm_command, NULL,
 		   "%j", jobstr,
 		   "%T", http_timestring(talloc_tos(), pjob->starttime),
@@ -125,7 +125,7 @@ static int generic_job_pause(int snum, struct printjob *pjob)
 	fstring jobstr;
 	
 	/* need to pause the spooled entry */
-	slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
+	fstr_sprintf(jobstr, "%d", pjob->sysjob);
 	return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
 				 lp_lppause_command(snum), NULL,
 				 "%j", jobstr,
@@ -142,7 +142,7 @@ static int generic_job_resume(int snum, struct printjob *pjob)
 	fstring jobstr;
 
 	/* need to pause the spooled entry */
-	slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
+	fstr_sprintf(jobstr, "%d", pjob->sysjob);
 	return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
 				 lp_lpresume_command(snum), NULL,
 				 "%j", jobstr,
@@ -263,8 +263,8 @@ static int generic_job_submit(int snum, struct printjob *pjob,
 		ret = -1;
 		goto out;
 	}
-	slprintf(job_page_count, sizeof(job_page_count)-1, "%d", pjob->page_count);
-	slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size);
+	fstr_sprintf(job_page_count, "%d", pjob->page_count);
+	fstr_sprintf(job_size, "%zu", pjob->size);
 
 	/* send it to the system spooler */
 	ret = print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 6c13a5e74fb..982eb4f9cdd 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -498,22 +498,24 @@ static uint32_t map_to_spoolss_status(uint32_t lpq_status)
 }
 
 /***************************************************************************
- Append a jobid to the 'jobs changed' list.
+ Append a jobid to a list
 ***************************************************************************/
 
-static bool add_to_jobs_changed(struct tdb_print_db *pdb, uint32_t jobid)
+static bool add_to_jobs_list(
+	struct tdb_print_db *pdb, uint32_t jobid, const char *key)
 {
-	TDB_DATA data;
-	uint32_t store_jobid;
+	uint8_t store_jobid[sizeof(uint32_t)];
+	TDB_DATA data = {
+		.dptr = store_jobid, .dsize = sizeof(store_jobid)
+	};
+	int ret;
 
 	SIVAL(&store_jobid, 0, jobid);
-	data.dptr = (uint8_t *) &store_jobid;
-	data.dsize = 4;
 
-	DEBUG(10,("add_to_jobs_added: Added jobid %u\n", (unsigned int)jobid ));
+	DBG_DEBUG("Added jobid %"PRIu32" to %s\n", jobid, key);
 
-	return (tdb_append(pdb->tdb, string_tdb_data("INFO/jobs_changed"),
-			   data) == 0);
+	ret = tdb_append(pdb->tdb, string_tdb_data(key), data);
+	return ret == 0;
 }
 
 /***************************************************************************
@@ -725,7 +727,10 @@ static bool pjob_store(struct tevent_context *ev,
 						  pjob,
 						  &changed);
 				if (changed) {
-					add_to_jobs_changed(pdb, jobid);
+					add_to_jobs_list(
+						pdb,
+						jobid,
+						"INFO/jobs_changed");
 				}
 			}
 			talloc_free(tmp_ctx);
@@ -1548,8 +1553,6 @@ void print_queue_receive(struct messaging_context *msg,
 update the internal database from the system print queue for a queue
 ****************************************************************************/
 
-extern pid_t background_lpq_updater_pid;
-
 static void print_queue_update(struct messaging_context *msg_ctx,
 			       int snum, bool force)
 {
@@ -1674,8 +1677,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
 
 	/* finally send the message */
 
-	messaging_send_buf(msg_ctx, pid_to_procid(background_lpq_updater_pid),


-- 
Samba Shared Repository



More information about the samba-cvs mailing list