summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-06-15 18:39:27 -0400
committerGünther Deschner <gd@samba.org>2011-03-29 16:03:51 +0200
commit043942720c8bbf8f00476da097a266f162f2edd9 (patch)
tree61753a1d9cfaa900ecd75cd9cc15214934fec953
parent0c130105f5b70803daf784bd9a3c86ed34295338 (diff)
downloadsamba-043942720c8bbf8f00476da097a266f162f2edd9.tar.gz
samba-043942720c8bbf8f00476da097a266f162f2edd9.tar.bz2
samba-043942720c8bbf8f00476da097a266f162f2edd9.zip
s3:spoolssd Initialize the spoolss rpc interfaces
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r--source3/printing/spoolssd.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index a7b64c9e61..0ba0a95435 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -19,6 +19,9 @@
#include "includes.h"
#include "librpc/gen_ndr/messaging.h"
#include "include/printing.h"
+#include "printing/nt_printing_migrate.h"
+#include "librpc/gen_ndr/srv_winreg.h"
+#include "librpc/gen_ndr/srv_spoolss.h"
#include "rpc_server/rpc_server.h"
#define SPOOLSS_PIPE_NAME "spoolss"
@@ -100,8 +103,14 @@ static void spoolss_setup_sig_hup_handler(void)
}
}
+static bool spoolss_init_cb(void *ptr)
+{
+ return nt_printing_tdb_migrate(server_messaging_context());
+}
+
void start_spoolssd(void)
{
+ struct rpc_srv_callbacks spoolss_cb;
pid_t pid;
NTSTATUS status;
int ret;
@@ -152,10 +161,34 @@ void start_spoolssd(void)
messaging_register(server_messaging_context(), NULL,
MSG_SMB_CONF_UPDATED, smb_conf_updated);
+ /*
+ * Initialize spoolss with an init function to convert printers first.
+ * static_init_rpc will try to initialize the spoolss server too but you
+ * can't register it twice.
+ */
+ spoolss_cb.init = spoolss_init_cb;
+ spoolss_cb.shutdown = NULL;
+
+ status = rpc_winreg_init(NULL);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("Failed to register winreg rpc inteface! (%s)\n",
+ nt_errstr(status)));
+ exit(1);
+ }
+
+ status = rpc_spoolss_init(&spoolss_cb);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("Failed to register spoolss rpc inteface! (%s)\n",
+ nt_errstr(status)));
+ exit(1);
+ }
+
if (!setup_named_pipe_socket(SPOOLSS_PIPE_NAME, server_event_context())) {
exit(1);
}
+ DEBUG(1, ("SPOOLSS Daemon Started (%d)\n", getpid()));
+
/* loop forever */
ret = tevent_loop_wait(server_event_context());