[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Mar 29 09:01:02 MDT 2011


The branch, master has been updated
       via  52ff0dd s3-libsmb: remove duplicate NTSTATUS variable.
       via  6a27928 s3-waf: fix spoolssd compile.
       via  2cb7974 s3-rpc_server: Fixed rpc_pipe_open_internal documentation.
       via  8dc5805 s3-rpc_server: Only allow embedded, daemon and external server type.
       via  991fa3a s3-spoolssd: Start the spoolss service correctly.
       via  28b2046 s3-spoolssd: Register spoolssd endpoints.
       via  8c635b6 s3-epmap: Make rpc_ep_setup_register an internal function.
       via  80fe8fa s3-spoolssd: Fixed logfile creation.
       via  a956c57 s3-spoolssd: Added missing include.
       via  c1b7c0c s3-spoolssd: Pass down event and messanging context.
       via  851f95b s3-spoolssd: Fixed reopening of logs.
       via  fe0e079 s3:spoolssd Start spoolss from smbd
       via  0439427 s3:spoolssd Initialize the spoolss rpc interfaces
       via  0c13010 s3:spoolssd Add spoolss own signal handlers
       via  0b7b841 s3:spoolssd handle smb.conf reloads directly
       via  2d333ae s3:spoolssd Create our own log file
       via  99941eb s3:spoolssd Add skeleton for spoolss daemon
       via  1d33474 s3:printing Make print_queue_receive public
      from  bd9b272 ldb: detect eof on ldif files

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


- Log -----------------------------------------------------------------
commit 52ff0dde37d2333b21f4e81e2c125c45a88a2eea
Author: Günther Deschner <gd at samba.org>
Date:   Tue Mar 29 12:50:38 2011 +0200

    s3-libsmb: remove duplicate NTSTATUS variable.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Tue Mar 29 17:00:26 CEST 2011 on sn-devel-104

commit 6a27928cedf31e7e76572775a7f6d4a9e2f01c95
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 28 16:42:21 2011 +0200

    s3-waf: fix spoolssd compile.
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 2cb797456a3fa016dff31b92bf846b316d47b8a2
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 29 12:51:45 2011 +0200

    s3-rpc_server: Fixed rpc_pipe_open_internal documentation.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8dc58057382806d0ac5702321e5b0d4a5186bf6b
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 29 10:58:05 2011 +0200

    s3-rpc_server: Only allow embedded, daemon and external server type.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 991fa3a5fecc05a01b2d3696fe23cba109de10c0
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Mar 29 10:52:32 2011 +0200

    s3-spoolssd: Start the spoolss service correctly.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 28b204601556105ad57d7ac69210eb75f248f764
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Mar 28 14:18:23 2011 +0200

    s3-spoolssd: Register spoolssd endpoints.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 8c635b669c557cfe6fb5de2bd90302ada54b0fb9
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Mar 28 14:18:00 2011 +0200

    s3-epmap: Make rpc_ep_setup_register an internal function.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 80fe8fa8d0d2ec787e4d70a3553c1d4e066f4163
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Mar 28 14:30:29 2011 +0200

    s3-spoolssd: Fixed logfile creation.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit a956c57cf939d0a4cdd5793b129e1fa87e63fffd
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 24 10:22:57 2011 +0100

    s3-spoolssd: Added missing include.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit c1b7c0c2b78417aac4365a03e858397324728605
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 20 18:59:40 2011 +0100

    s3-spoolssd: Pass down event and messanging context.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 851f95b121f2fc16ef5cc532b8ad818f5c32e69f
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Aug 25 10:15:47 2010 +0200

    s3-spoolssd: Fixed reopening of logs.
    
    Everytime the log was reopened a .spoolssd has been appended which
    resulted in long file names.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit fe0e079bc12ebe2e9204ca492337dc754e13832b
Author: Simo Sorce <ssorce at redhat.com>
Date:   Thu May 20 08:33:14 2010 -0400

    s3:spoolssd Start spoolss from smbd
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 043942720c8bbf8f00476da097a266f162f2edd9
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jun 15 18:39:27 2010 -0400

    s3:spoolssd Initialize the spoolss rpc interfaces
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 0c130105f5b70803daf784bd9a3c86ed34295338
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jun 16 13:03:32 2010 -0400

    s3:spoolssd Add spoolss own signal handlers
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 0b7b8414ddb94ea05c633ec655493db4ffcad3cd
Author: Simo Sorce <idra at samba.org>
Date:   Wed Jun 16 15:36:06 2010 -0400

    s3:spoolssd handle smb.conf reloads directly
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 2d333ae8bc42a5aab7df6985b1432e3a480e74dc
Author: Simo Sorce <idra at samba.org>
Date:   Tue Jun 15 18:38:44 2010 -0400

    s3:spoolssd Create our own log file
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 99941eb92b2fa5b6c80649abc36b159802241088
Author: Simo Sorce <ssorce at redhat.com>
Date:   Thu May 20 08:48:18 2010 -0400

    s3:spoolssd Add skeleton for spoolss daemon
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 1d33474dad5a101666044f58a00f33bd6a134080
Author: Simo Sorce <ssorce at redhat.com>
Date:   Thu May 20 08:49:50 2010 -0400

    s3:printing Make print_queue_receive public
    
    Signed-off-by: Günther Deschner <gd at samba.org>

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

Summary of changes:
 source3/Makefile.in               |    2 +-
 source3/include/printing.h        |    5 +
 source3/libsmb/ntlmssp.c          |    1 -
 source3/printing/printing.c       |    2 +-
 source3/printing/spoolssd.c       |  242 +++++++++++++++++++++++++++++++++++++
 source3/rpc_server/rpc_ep_setup.c |   32 +++--
 source3/rpc_server/rpc_ep_setup.h |   24 ++++
 source3/rpc_server/rpc_ncacn_np.c |   26 +++-
 source3/smbd/server.c             |   17 +++
 source3/wscript_build             |    2 +-
 10 files changed, 331 insertions(+), 22 deletions(-)
 create mode 100644 source3/printing/spoolssd.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 565e52c..b2f4594 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -886,7 +886,7 @@ SMBD_OBJ_SRV = smbd/server_reload.o \
                smbd/posix_acls.o lib/sysacls.o \
 	       smbd/process.o smbd/service.o smbd/error.o \
 	       rpc_server/epmd.o \
-	       printing/printspoolss.o \
+	       printing/printspoolss.o printing/spoolssd.o \
 	       lib/sysquotas.o lib/sysquotas_linux.o \
 	       lib/sysquotas_xfs.o lib/sysquotas_4A.o \
 	       lib/sysquotas_nfs.o \
diff --git a/source3/include/printing.h b/source3/include/printing.h
index 3752b9c..084c699 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -251,4 +251,9 @@ void release_print_db( struct tdb_print_db *pdb);
 void close_all_print_db(void);
 TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist);
 
+void print_queue_receive(struct messaging_context *msg,
+				void *private_data,
+				uint32_t msg_type,
+				struct server_id server_id,
+				DATA_BLOB *data);
 #endif /* PRINTING_H_ */
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index e0bccca..619e5d4 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -406,7 +406,6 @@ static NTSTATUS ntlmssp_client_initial(struct ntlmssp_state *ntlmssp_state,
 		struct NEGOTIATE_MESSAGE *negotiate = talloc(
 			talloc_tos(), struct NEGOTIATE_MESSAGE);
 		if (negotiate != NULL) {
-			NTSTATUS status;
 			status = ntlmssp_pull_NEGOTIATE_MESSAGE(
 				next_request, negotiate, negotiate);
 			if (NT_STATUS_IS_OK(status)) {
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index b1aff3e..177048d 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1560,7 +1560,7 @@ static void print_queue_update_with_lock( struct tevent_context *ev,
 /****************************************************************************
 this is the receive function of the background lpq updater
 ****************************************************************************/
-static void print_queue_receive(struct messaging_context *msg,
+void print_queue_receive(struct messaging_context *msg,
 				void *private_data,
 				uint32_t msg_type,
 				struct server_id server_id,
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
new file mode 100644
index 0000000..94694fc
--- /dev/null
+++ b/source3/printing/spoolssd.c
@@ -0,0 +1,242 @@
+/*
+   Unix SMB/Netbios implementation.
+   SPOOLSS Daemon
+   Copyright (C) Simo Sorce 2010
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "includes.h"
+#include "serverid.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"
+#include "rpc_server/rpc_ep_setup.h"
+
+#define SPOOLSS_PIPE_NAME "spoolss"
+#define DAEMON_NAME "spoolssd"
+
+void start_spoolssd(struct tevent_context *ev_ctx,
+		    struct messaging_context *msg_ctx);
+
+static void spoolss_reopen_logs(void)
+{
+	char *lfile = lp_logfile();
+	int rc;
+
+	if (lfile == NULL || lfile[0] == '\0') {
+		rc = asprintf(&lfile, "%s/log.%s", get_dyn_LOGFILEBASE(), DAEMON_NAME);
+		if (rc > 0) {
+			lp_set_logfile(lfile);
+			SAFE_FREE(lfile);
+		}
+	} else {
+		if (strstr(lfile, DAEMON_NAME) == NULL) {
+			rc = asprintf(&lfile, "%s.%s", lp_logfile(), DAEMON_NAME);
+			if (rc > 0) {
+				lp_set_logfile(lfile);
+				SAFE_FREE(lfile);
+			}
+		}
+	}
+
+	reopen_logs();
+}
+
+static void smb_conf_updated(struct messaging_context *msg,
+			     void *private_data,
+			     uint32_t msg_type,
+			     struct server_id server_id,
+			     DATA_BLOB *data)
+{
+	struct tevent_context *ev_ctx = talloc_get_type_abort(private_data,
+							     struct tevent_context);
+
+	DEBUG(10, ("Got message saying smb.conf was updated. Reloading.\n"));
+	change_to_root_user();
+	reload_printers(ev_ctx, msg);
+	spoolss_reopen_logs();
+}
+
+static void spoolss_sig_term_handler(struct tevent_context *ev,
+				     struct tevent_signal *se,
+				     int signum,
+				     int count,
+				     void *siginfo,
+				     void *private_data)
+{
+	exit_server_cleanly("termination signal");
+}
+
+static void spoolss_setup_sig_term_handler(struct tevent_context *ev_ctx)
+{
+	struct tevent_signal *se;
+
+	se = tevent_add_signal(ev_ctx,
+			       ev_ctx,
+			       SIGTERM, 0,
+			       spoolss_sig_term_handler,
+			       NULL);
+	if (!se) {
+		exit_server("failed to setup SIGTERM handler");
+	}
+}
+
+static void spoolss_sig_hup_handler(struct tevent_context *ev,
+				    struct tevent_signal *se,
+				    int signum,
+				    int count,
+				    void *siginfo,
+				    void *private_data)
+{
+	struct messaging_context *msg_ctx = talloc_get_type_abort(private_data,
+								  struct messaging_context);
+
+	change_to_root_user();
+	DEBUG(1,("Reloading printers after SIGHUP\n"));
+	reload_printers(ev, msg_ctx);
+	spoolss_reopen_logs();
+}
+
+static void spoolss_setup_sig_hup_handler(struct tevent_context *ev_ctx,
+					  struct messaging_context *msg_ctx)
+{
+	struct tevent_signal *se;
+
+	se = tevent_add_signal(ev_ctx,
+			       ev_ctx,
+			       SIGHUP, 0,
+			       spoolss_sig_hup_handler,
+			       msg_ctx);
+	if (!se) {
+		exit_server("failed to setup SIGHUP handler");
+	}
+}
+
+static bool spoolss_init_cb(void *ptr)
+{
+	struct messaging_context *msg_ctx = talloc_get_type_abort(
+		ptr, struct messaging_context);
+
+	return nt_printing_tdb_migrate(msg_ctx);
+}
+
+static bool spoolss_shutdown_cb(void *ptr)
+{
+	srv_spoolss_cleanup();
+
+	return true;
+}
+
+void start_spoolssd(struct tevent_context *ev_ctx,
+		    struct messaging_context *msg_ctx)
+{
+	struct rpc_srv_callbacks spoolss_cb;
+	pid_t pid;
+	NTSTATUS status;
+	int ret;
+
+	DEBUG(1, ("Forking SPOOLSS Daemon\n"));
+
+	pid = sys_fork();
+
+	if (pid == -1) {
+		DEBUG(0, ("Failed to fork SPOOLSS [%s], aborting ...\n",
+			   strerror(errno)));
+		exit(1);
+	}
+
+	if (pid) {
+		/* parent */
+		return;
+	}
+
+	/* child */
+	close_low_fds(false);
+
+	status = reinit_after_fork(msg_ctx,
+				   ev_ctx,
+				   procid_self(), true);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(0,("reinit_after_fork() failed\n"));
+		smb_panic("reinit_after_fork() failed");
+	}
+
+	spoolss_reopen_logs();
+
+	spoolss_setup_sig_term_handler(ev_ctx);
+	spoolss_setup_sig_hup_handler(ev_ctx, msg_ctx);
+
+	if (!serverid_register(procid_self(),
+				FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+				|FLAG_MSG_PRINT_GENERAL)) {
+		exit(1);
+	}
+
+	if (!locking_init()) {
+		exit(1);
+	}
+
+	messaging_register(msg_ctx, NULL,
+			   MSG_PRINTER_UPDATE, print_queue_receive);
+	messaging_register(msg_ctx, ev_ctx,
+			   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 = spoolss_shutdown_cb;
+	spoolss_cb.private_data = msg_ctx;
+
+	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, ev_ctx)) {
+		exit(1);
+	}
+
+	status = rpc_ep_setup_register(ev_ctx, msg_ctx, &ndr_table_spoolss, NULL, 0);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(0, ("Failed to register spoolss endpoint! (%s)\n",
+			  nt_errstr(status)));
+		exit(1);
+	}
+
+	DEBUG(1, ("SPOOLSS Daemon Started (%d)\n", getpid()));
+
+	/* loop forever */
+	ret = tevent_loop_wait(ev_ctx);
+
+	/* should not be reached */
+	DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n",
+		 ret, (ret == 0) ? "out of events" : strerror(errno)));
+	exit(1);
+}
diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c
index 9bed63d..d517bb8 100644
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -149,11 +149,11 @@ struct rpc_ep_regsiter_state {
 	uint32_t wait_time;
 };
 
-static NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx,
-				      struct messaging_context *msg_ctx,
-				      const struct ndr_interface_table *iface,
-				      const char *ncalrpc,
-				      uint16_t port)
+NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx,
+			       struct messaging_context *msg_ctx,
+			       const struct ndr_interface_table *iface,
+			       const char *ncalrpc,
+			       uint16_t port)
 {
 	struct rpc_ep_regsiter_state *state;
 	struct tevent_req *req;
@@ -1103,14 +1103,24 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 		return false;
 	}
 
-	spoolss_cb.init         = spoolss_init_cb;
-	spoolss_cb.shutdown     = spoolss_shutdown_cb;
-	spoolss_cb.private_data = ep_ctx;
-	if (!NT_STATUS_IS_OK(rpc_spoolss_init(&spoolss_cb))) {
-		return false;
+	rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
+					   "rpc_server",
+					   "spoolss",
+					   "embedded");
+	if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
+		spoolss_cb.init         = spoolss_init_cb;
+		spoolss_cb.shutdown     = spoolss_shutdown_cb;
+		spoolss_cb.private_data = ep_ctx;
+		if (!NT_STATUS_IS_OK(rpc_spoolss_init(&spoolss_cb))) {
+			return false;
+		}
+	} else if (StrCaseCmp(rpcsrv_type, "daemon") == 0 ||
+		   StrCaseCmp(rpcsrv_type, "external") == 0) {
+		if (!NT_STATUS_IS_OK(rpc_spoolss_init(NULL))) {
+			return false;
+		}
 	}
 
-
 	svcctl_cb.init         = svcctl_init_cb;
 	svcctl_cb.shutdown     = svcctl_shutdown_cb;
 	svcctl_cb.private_data = ep_ctx;
diff --git a/source3/rpc_server/rpc_ep_setup.h b/source3/rpc_server/rpc_ep_setup.h
index 272910a..b96de36 100644
--- a/source3/rpc_server/rpc_ep_setup.h
+++ b/source3/rpc_server/rpc_ep_setup.h
@@ -22,6 +22,30 @@
 #ifndef _SMBD_RPC_CALLBACKS_H
 #define _SMBD_RPC_CALLBACKS_H
 
+/**
+ * @brief Register an endpoint at the endpoint mapper.
+ *
+ * This just sets up a register and monitor loop to try to regsiter the
+ * endpoint at the endpoint mapper.
+ *
+ * @param[in] ev_ctx    The event context to setup the loop.
+ *
+ * @param[in] msg_ctx   The messaging context to use for the connnection.
+ *
+ * @param[in] iface     The interface table to register.
+ *
+ * @param[in] ncalrpc   The name of the ncalrpc pipe or NULL.
+ *
+ * @param[in] port      The tcpip port or 0.
+ *
+ * @return              NT_STATUS_OK on success or a corresponding error code.
+ */
+NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx,
+			       struct messaging_context *msg_ctx,
+			       const struct ndr_interface_table *iface,
+			       const char *ncalrpc,
+			       uint16_t port);
+
 bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
 		     struct messaging_context *msg_ctx);
 
diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
index 41985e4..df9799b 100644
--- a/source3/rpc_server/rpc_ncacn_np.c
+++ b/source3/rpc_server/rpc_ncacn_np.c
@@ -510,18 +510,24 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
 }
 
 /**
- * @brief Create a new RPC client context which uses a local dispatch function.
+ * @internal
+ *
+ * @brief Create a new RPC client context which uses a local transport.
+ *
+ * This creates a local transport. It is a shortcut to directly call the server
+ * functions and avoid marschalling.
  *
  * @param[in]  mem_ctx  The memory context to use.
  *
  * @param[in]  abstract_syntax Normally the syntax_id of the autogenerated
  *                             ndr_table_<name>.
  *
- * @param[in]  dispatch The corresponding autogenerated dispatch function
- *                      rpc_<name>_dispatch.
- *
  * @param[in]  serversupplied_info The server supplied authentication function.
  *
+ * @param[in]  client_id The client address information.
+ *
+ * @param[in]  msg_ctx  The messaging context to use.
+ *
  * @param[out] presult  A pointer to store the connected rpc client pipe.
  *
  * @return              NT_STATUS_OK on success, a corresponding NT status if an
@@ -533,8 +539,8 @@ NTSTATUS rpcint_binding_handle(TALLOC_CTX *mem_ctx,
  *
  *   status = rpc_pipe_open_internal(tmp_ctx,
  *                                   &ndr_table_winreg.syntax_id,
- *                                   rpc_winreg_dispatch,
  *                                   p->session_info,
+ *                                   client_id,
  *                                   &winreg_pipe);
  * @endcode
  */
@@ -875,7 +881,8 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
 		if (!NT_STATUS_IS_OK(status)) {
 			goto done;
 		}
-	} else {
+	} else if (StrCaseCmp(server_type, "daemon") == 0 ||
+		   StrCaseCmp(server_type, "external") == 0) {
 		/* It would be nice to just use rpc_pipe_open_ncalrpc() but
 		 * for now we need to use the special proxy setup to connect
 		 * to spoolssd. */
@@ -887,7 +894,12 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
 		if (!NT_STATUS_IS_OK(status)) {
 			goto done;
 		}
-	}
+	} else {
+		status = NT_STATUS_NOT_IMPLEMENTED;
+		DEBUG(0, ("Wrong servertype specified in config file: %s",
+			  nt_errstr(status)));
+		goto done;
+        }
 
 	status = NT_STATUS_OK;
 done:
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 17762e3..8c7b146 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -40,6 +40,9 @@
 extern void start_epmd(struct tevent_context *ev_ctx,
 		       struct messaging_context *msg_ctx);
 
+extern void start_spoolssd(struct event_context *ev_ctx,
+			   struct messaging_context *msg_ctx);
+
 #ifdef WITH_DFS
 extern int dcelogin_atmost_once;
 #endif /* WITH_DFS */
@@ -1242,6 +1245,20 @@ extern void build_options(bool screen);
 				       smbd_messaging_context());
 	}
 
+	if (is_daemon && !_lp_disable_spoolss()) {
+		const char *rpcsrv_type;
+
+		/* start spoolss daemon */
+		/* start as a separate daemon only if enabled */
+		rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
+						   "rpc_server", "spoolss",
+						   "embedded");
+		if (StrCaseCmp(rpcsrv_type, "daemon") == 0) {
+			start_spoolssd(smbd_event_context(),
+				       smbd_messaging_context());
+		}
+	}
+
 	if (!is_daemon) {
 		/* inetd mode */
 		TALLOC_FREE(frame);
diff --git a/source3/wscript_build b/source3/wscript_build
index d314a2a..3e71e94 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -357,7 +357,7 @@ SMBD_SRC_SRV = '''smbd/server_reload.c smbd/files.c smbd/connection.c
                smbd/vfs.c smbd/perfcount.c smbd/statcache.c smbd/seal.c
                smbd/posix_acls.c lib/sysacls.c
                smbd/process.c smbd/service.c smbd/error.c
-               printing/printspoolss.c
+               printing/printspoolss.c printing/spoolssd.c
                lib/sysquotas.c lib/sysquotas_linux.c


-- 
Samba Shared Repository


More information about the samba-cvs mailing list