--- /dev/null
+--- a/source3/Makefile.in
++++ b/source3/Makefile.in
+@@ -214,7 +214,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_P
+
+ # Note that all executable programs now provide for an optional executable suffix.
+
+-SBIN_PROGS = bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
++SBIN_PROGS = bin/samba_multicall@EXEEXT@ bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
+
+ BIN_PROGS1 = bin/smbclient@EXEEXT@ bin/net@EXEEXT@ bin/smbspool@EXEEXT@ \
+ bin/testparm@EXEEXT@ bin/smbstatus@EXEEXT@ bin/smbget@EXEEXT@ \
+@@ -1774,6 +1774,42 @@ bin/.dummy:
+ dir=bin $(MAKEDIR); fi
+ @: >> $@ || : > $@ # what a fancy emoticon!
+
++smbd/server_multicall.o: smbd/server.c smbd/server.o
++ @echo Compiling $<.c
++ @$(COMPILE_CC_PATH) -Dmain=smbd_main && exit 0;\
++ echo "The following command failed:" 1>&2;\
++ echo "$(COMPILE_CC_PATH)" 1>&2;\
++ $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/nmbd.o
++ @echo Compiling $<.c
++ @$(COMPILE_CC_PATH) -Dmain=nmbd_main && exit 0;\
++ echo "The following command failed:" 1>&2;\
++ echo "$(COMPILE_CC_PATH)" 1>&2;\
++ $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++utils/smbpasswd_multicall.o: utils/smbpasswd.c utils/smbpasswd.o
++ @echo Compiling $<.c
++ @$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\
++ echo "The following command failed:" 1>&2;\
++ echo "$(COMPILE_CC_PATH)" 1>&2;\
++ $(COMPILE_CC_PATH) >/dev/null 2>&1
++
++SMBD_MULTI_O = $(patsubst smbd/server.o,smbd/server_multicall.o,$(SMBD_OBJ))
++NMBD_MULTI_O = $(patsubst nmbd/nmbd.o,nmbd/nmbd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(NMBD_OBJ)))
++SMBPASSWD_MULTI_O = $(patsubst utils/smbpasswd.o,utils/smbpasswd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(SMBPASSWD_OBJ)))
++MULTI_O = multi.o
++
++MULTICALL_O = $(sort $(SMBD_MULTI_O) $(NMBD_MULTI_O) $(SMBPASSWD_MULTI_O) $(MULTI_O))
++
++bin/samba_multicall@EXEEXT@: $(BINARY_PREREQS) $(MULTICALL_O) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
++ @echo Linking $@
++ @$(CC) -o $@ $(MULTICALL_O) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
++ $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
++ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) $(AVAHI_LIBS) \
++ $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
++ $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
++
+ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
+ @echo Linking $@
+ @$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
+--- /dev/null
++++ b/source3/multi.c
+@@ -0,0 +1,35 @@
++#include <stdio.h>
++#include <string.h>
++
++extern int smbd_main(int argc, char **argv);
++extern int nmbd_main(int argc, char **argv);
++extern int smbpasswd_main(int argc, char **argv);
++
++static struct {
++ const char *name;
++ int (*func)(int argc, char **argv);
++} multicall[] = {
++ { "smbd", smbd_main },
++ { "nmbd", nmbd_main },
++ { "smbpasswd", smbpasswd_main },
++};
++
++#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
++
++int main(int argc, char **argv)
++{
++ int i;
++
++ for (i = 0; i < ARRAY_SIZE(multicall); i++) {
++ if (strstr(argv[0], multicall[i].name))
++ return multicall[i].func(argc, argv);
++ }
++
++ fprintf(stderr, "Invalid multicall command, available commands:");
++ for (i = 0; i < ARRAY_SIZE(multicall); i++)
++ fprintf(stderr, " %s", multicall[i].name);
++
++ fprintf(stderr, "\n");
++
++ return 1;
++}
+++ /dev/null
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -1110,6 +1110,10 @@ bool dcesrv_ep_setup(struct tevent_conte
- "rpc_server",
- "spoolss",
- "embedded");
-+#ifndef PRINTER_SUPPORT
-+ if (1) {
-+ } else
-+#endif
- if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
- spoolss_cb.init = spoolss_init_cb;
- spoolss_cb.shutdown = spoolss_shutdown_cb;
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -624,7 +624,9 @@ static struct cmd_set *rpcclient_command
- lsarpc_commands,
- ds_commands,
- samr_commands,
-+#ifdef PRINTER_SUPPORT
- spoolss_commands,
-+#endif
- netlogon_commands,
- srvsvc_commands,
- dfs_commands,
---- a/source3/printing/spoolssd.c
-+++ b/source3/printing/spoolssd.c
-@@ -153,6 +153,10 @@ void start_spoolssd(struct tevent_contex
- NTSTATUS status;
- int ret;
-
-+#ifndef PRINTER_SUPPORT
-+ return;
-+#endif
-+
- DEBUG(1, ("Forking SPOOLSS Daemon\n"));
-
- pid = sys_fork();
---- a/source3/utils/net_rpc.c
-+++ b/source3/utils/net_rpc.c
-@@ -7791,6 +7791,10 @@ int net_rpc_printer(struct net_context *
- {NULL, NULL, 0, NULL, NULL}
- };
-
-+#ifndef PRINTER_SUPPORT
-+ return 0;
-+#endif
-+
- if (argc == 0) {
- if (c->display_usage) {
- d_printf(_("Usage:\n"));
---- a/source3/smbd/reply.c
-+++ b/source3/smbd/reply.c
-@@ -5194,7 +5194,11 @@ void reply_printopen(struct smb_request
- return;
- }
-
-- if (!CAN_PRINT(conn)) {
-+
-+#ifdef PRINTER_SUPPORT
-+ if (!CAN_PRINT(conn))
-+#endif
-+ {
- reply_nterror(req, NT_STATUS_ACCESS_DENIED);
- END_PROFILE(SMBsplopen);
- return;
-@@ -5300,7 +5304,10 @@ void reply_printqueue(struct smb_request
- is really quite gross and only worked when there was only
- one printer - I think we should now only accept it if they
- get it right (tridge) */
-- if (!CAN_PRINT(conn)) {
-+#ifdef PRINTER_SUPPORT
-+ if (!CAN_PRINT(conn))
-+#endif
-+ {
- reply_nterror(req, NT_STATUS_ACCESS_DENIED);
- END_PROFILE(SMBsplretq);
- return;
---- a/source3/smbd/lanman.c
-+++ b/source3/smbd/lanman.c
-@@ -784,6 +784,10 @@ static bool api_DosPrintQGetInfo(struct
- union spoolss_JobInfo *job_info = NULL;
- union spoolss_PrinterInfo printer_info;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -999,6 +1003,10 @@ static bool api_DosPrintQEnum(struct smb
- union spoolss_DriverInfo *driver_info;
- union spoolss_JobInfo **job_info;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!param_format || !output_format1 || !p) {
- return False;
- }
-@@ -3350,6 +3358,10 @@ static bool api_RDosPrintJobDel(struct s
- struct spoolss_DevmodeContainer devmode_ctr;
- enum spoolss_JobControl command;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -3483,6 +3495,10 @@ static bool api_WPrintQueueCtrl(struct s
- struct sec_desc_buf secdesc_ctr;
- enum spoolss_PrinterControl command;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !QueueName) {
- return False;
- }
-@@ -3649,6 +3665,10 @@ static bool api_PrintJobInfo(struct smbd
- union spoolss_JobInfo info;
- struct spoolss_SetJobInfo1 info1;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -4792,6 +4812,10 @@ static bool api_WPrintJobGetInfo(struct
- struct spoolss_DevmodeContainer devmode_ctr;
- union spoolss_JobInfo info;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -4930,6 +4954,10 @@ static bool api_WPrintJobEnumerate(struc
- uint32_t count = 0;
- union spoolss_JobInfo *info;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -5135,6 +5163,10 @@ static bool api_WPrintDestGetInfo(struct
- struct spoolss_DevmodeContainer devmode_ctr;
- union spoolss_PrinterInfo info;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -5271,6 +5303,10 @@ static bool api_WPrintDestEnum(struct sm
- union spoolss_PrinterInfo *info;
- uint32_t count;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -5374,6 +5410,10 @@ static bool api_WPrintDriverEnum(struct
- int succnt;
- struct pack_desc desc;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -5438,6 +5478,10 @@ static bool api_WPrintQProcEnum(struct s
- int succnt;
- struct pack_desc desc;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -5502,6 +5546,10 @@ static bool api_WPrintPortEnum(struct sm
- int succnt;
- struct pack_desc desc;
-
-+#ifndef PRINTER_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -142,7 +142,9 @@ static void exit_server_common(enum serv
- rpc_eventlog_shutdown();
- rpc_ntsvcs_shutdown();
- rpc_svcctl_shutdown();
-+#ifdef PRINTER_SUPPORT
- rpc_spoolss_shutdown();
-+#endif
-
- rpc_srvsvc_shutdown();
- rpc_winreg_shutdown();
---- a/source3/smbd/open.c
-+++ b/source3/smbd/open.c
-@@ -1556,6 +1556,9 @@ static NTSTATUS open_file_ntcreate(conne
- * Most of the passed parameters are ignored.
- */
-
-+#ifndef PRINTER_SUPPORT
-+ return NT_STATUS_ACCESS_DENIED;
-+#endif
- if (pinfo) {
- *pinfo = FILE_WAS_CREATED;
- }
---- a/source3/smbd/close.c
-+++ b/source3/smbd/close.c
-@@ -638,6 +638,9 @@ static NTSTATUS close_normal_file(struct
- status = ntstatus_keeperror(status, tmp);
-
- if (fsp->print_file) {
-+#ifndef PRINTER_SUPPORT
-+ return NT_STATUS_OK;
-+#endif
- /* FIXME: return spool errors */
- print_spool_end(fsp, close_type);
- file_free(req, fsp);
---- a/source3/smbd/fileio.c
-+++ b/source3/smbd/fileio.c
-@@ -298,6 +298,10 @@ ssize_t write_file(struct smb_request *r
- uint32_t t;
- int ret;
-
-+#ifndef PRINTER_SUPPORT
-+ return -1;
-+#endif
-+
- ret = print_spool_write(fsp, data, n, pos, &t);
- if (ret) {
- errno = ret;
---- a/source3/smbd/smb2_create.c
-+++ b/source3/smbd/smb2_create.c
-@@ -485,7 +485,10 @@ static struct tevent_req *smbd_smb2_crea
- info = FILE_WAS_OPENED;
- } else if (CAN_PRINT(smb1req->conn)) {
- status = file_new(smb1req, smb1req->conn, &result);
-- if(!NT_STATUS_IS_OK(status)) {
-+#ifdef PRINTER_SUPPORT
-+ if(!NT_STATUS_IS_OK(status))
-+#endif
-+ {
- tevent_req_nterror(req, status);
- return tevent_req_post(req, ev);
- }
---- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
-+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
-@@ -85,9 +85,11 @@ bool init_service_op_table( void )
-
- /* add builtin services */
-
-+#ifdef PRINTER_SUPPORT
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "Spooler" );
- svcctl_ops[i].ops = &spoolss_svc_ops;
- i++;
-+#endif
-
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
- svcctl_ops[i].ops = &netlogon_svc_ops;
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -113,9 +113,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_winreg)) {
- return false;
- }
-+#ifdef PRINTER_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
- return false;
- }
---- a/source3/smbd/process.c
-+++ b/source3/smbd/process.c
-@@ -2475,8 +2475,10 @@ static bool housekeeping_fn(const struct
-
- change_to_root_user();
-
-+#ifdef PRINTER_SUPPORT
- /* update printer queue caches if necessary */
- update_monitored_printq_cache(sconn->msg_ctx);
-+#endif
-
- /* check if we need to reload services */
- check_reload(sconn, time_mono(NULL));
---- a/source3/smbd/server.c
-+++ b/source3/smbd/server.c
-@@ -126,7 +126,9 @@ static void smb_pcap_updated(struct mess
- {
- struct tevent_context *ev_ctx =
- talloc_get_type_abort(private_data, struct tevent_context);
--
-+#ifndef PRINTER_SUPPORT
-+ return;
-+#endif
- DEBUG(10,("Got message saying pcap was updated. Reloading.\n"));
- change_to_root_user();
- reload_printers(ev_ctx, msg);
-@@ -1211,8 +1213,10 @@ extern void build_options(bool screen);
- if (!W_ERROR_IS_OK(registry_init_full()))
- exit(1);
-
-+#ifdef PRINTER_SUPPORT
- if (!print_backend_init(smbd_messaging_context()))
- exit(1);
-+#endif
-
- /* Open the share_info.tdb here, so we don't have to open
- after the fork on every single connection. This is a small
-@@ -1256,6 +1260,7 @@ extern void build_options(bool screen);
- exit(1);
- }
-
-+#ifdef PRINTER_SUPPORT
- /* Publish nt printers, this requires a working winreg pipe */
- pcap_cache_reload(server_event_context(), smbd_messaging_context(),
- &reload_printers);
-@@ -1284,6 +1289,7 @@ extern void build_options(bool screen);
- smbd_messaging_context());
- }
- }
-+#endif
-
- if (!is_daemon) {
- /* inetd mode */
--- /dev/null
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -119,9 +119,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
+ return false;
+ }
++#ifdef DEVELOPER
+ if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
+ return false;
+ }
++#endif
+ if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
+ return false;
+ }
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -628,7 +628,9 @@ static struct cmd_set *rpcclient_command
+ netlogon_commands,
+ srvsvc_commands,
+ dfs_commands,
++#ifdef DEVELOPER
+ echo_commands,
++#endif
+ epmapper_commands,
+ shutdown_commands,
+ test_commands,
+++ /dev/null
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -95,9 +95,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
- return false;
- }
-+#ifdef ACTIVE_DIRECTORY
- if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_samr)) {
- return false;
- }
-@@ -139,9 +141,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
- return false;
- }
-+#ifdef ACTIVE_DIRECTORY
- if (!smb_register_ndr_interface(&ndr_table_drsuapi)) {
- return false;
- }
-+#endif
- return true;
- }
-
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -918,6 +918,7 @@ static bool netdfs_init_cb(void *ptr)
- return true;
- }
-
-+#ifdef ACTIVE_DIRECTORY
- static bool dssetup_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -966,6 +967,7 @@ static bool dssetup_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool wkssvc_init_cb(void *ptr)
- {
-@@ -1172,12 +1174,14 @@ bool dcesrv_ep_setup(struct tevent_conte
- }
- #endif
-
-+#ifdef ACTIVE_DIRECTORY
- dssetup_cb.init = dssetup_init_cb;
- dssetup_cb.shutdown = NULL;
- dssetup_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_dssetup_init(&dssetup_cb))) {
- return false;
- }
-+#endif
-
- wkssvc_cb.init = wkssvc_init_cb;
- wkssvc_cb.shutdown = NULL;
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -133,7 +133,9 @@ static void exit_server_common(enum serv
-
- if (am_parent) {
- rpc_wkssvc_shutdown();
-+#ifdef ACTIVE_DIRECTORY
- rpc_dssetup_shutdown();
-+#endif
- #ifdef DEVELOPER
- rpc_rpcecho_shutdown();
- #endif
---- a/source3/rpc_client/cli_pipe.c
-+++ b/source3/rpc_client/cli_pipe.c
-@@ -2874,12 +2874,14 @@ NTSTATUS cli_rpc_pipe_open_noauth_transp
- status = rpc_pipe_bind(result, auth);
- if (!NT_STATUS_IS_OK(status)) {
- int lvl = 0;
-+#ifdef ACTIVE_DIRECTORY
- if (ndr_syntax_id_equal(interface,
- &ndr_table_dssetup.syntax_id)) {
- /* non AD domains just don't have this pipe, avoid
- * level 0 statement in that case - gd */
- lvl = 3;
- }
-+#endif
- DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
- "%s failed with error %s\n",
- get_pipe_name_from_syntax(talloc_tos(), interface),
+++ /dev/null
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -129,6 +129,7 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
- return false;
- }
-+#ifdef EXTRA_SERVICES
- if (!smb_register_ndr_interface(&ndr_table_svcctl)) {
- return false;
- }
-@@ -138,6 +139,7 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
- return false;
- }
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -697,6 +697,7 @@ static bool spoolss_shutdown_cb(void *pt
- return true;
- }
-
-+#ifdef EXTRA_SERVICES
- static bool svcctl_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -733,6 +734,7 @@ static bool svcctl_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool svcctl_shutdown_cb(void *ptr)
- {
-@@ -741,6 +743,8 @@ static bool svcctl_shutdown_cb(void *ptr
- return true;
- }
-
-+#ifdef EXTRA_SERVICES
-+
- static bool ntsvcs_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -802,6 +806,7 @@ static bool eventlog_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool initshutdown_init_cb(void *ptr)
- {
-@@ -1130,6 +1135,7 @@ bool dcesrv_ep_setup(struct tevent_conte
- }
- }
-
-+#ifdef EXTRA_SERVICES
- svcctl_cb.init = svcctl_init_cb;
- svcctl_cb.shutdown = svcctl_shutdown_cb;
- svcctl_cb.private_data = ep_ctx;
-@@ -1150,6 +1156,7 @@ bool dcesrv_ep_setup(struct tevent_conte
- if (!NT_STATUS_IS_OK(rpc_eventlog_init(&eventlog_cb))) {
- return false;
- }
-+#endif
-
- initshutdown_cb.init = initshutdown_init_cb;
- initshutdown_cb.shutdown = NULL;
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -141,9 +141,11 @@ static void exit_server_common(enum serv
- #endif
- rpc_netdfs_shutdown();
- rpc_initshutdown_shutdown();
-+#ifdef EXTRA_SERVICES
- rpc_eventlog_shutdown();
-- rpc_ntsvcs_shutdown();
- rpc_svcctl_shutdown();
-+ rpc_ntsvcs_shutdown();
-+#endif
- #ifdef PRINTER_SUPPORT
- rpc_spoolss_shutdown();
- #endif
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -635,9 +635,11 @@ static struct cmd_set *rpcclient_command
- shutdown_commands,
- test_commands,
- wkssvc_commands,
-+#ifdef EXTRA_SERVICES
- ntsvcs_commands,
- drsuapi_commands,
- eventlog_commands,
-+#endif
- winreg_commands,
- NULL
- };
+++ /dev/null
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -409,6 +409,7 @@ static bool epmapper_shutdown_cb(void *p
- return true;
- }
-
-+#ifdef WINREG_SUPPORT
- static bool winreg_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -456,6 +457,7 @@ static bool winreg_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool srvsvc_init_cb(void *ptr)
- {
-@@ -710,10 +712,12 @@ static bool svcctl_init_cb(void *ptr)
- "epmapper",
- "none");
-
-+#ifdef WINREG_SUPPORT
- ok = svcctl_init_winreg(ep_ctx->msg_ctx);
- if (!ok) {
- return false;
- }
-+#endif
-
- /* initialize the control hooks */
- init_service_op_table();
-@@ -785,10 +789,12 @@ static bool eventlog_init_cb(void *ptr)
- "epmapper",
- "none");
-
-+#ifdef WINREG_SUPPORT
- ok = eventlog_init_winreg(ep_ctx->msg_ctx);
- if (!ok) {
- return false;
- }
-+#endif
-
- if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
- StrCaseCmp(rpcsrv_type, "daemon") == 0) {
-@@ -1077,12 +1083,14 @@ bool dcesrv_ep_setup(struct tevent_conte
- }
- }
-
-+#ifdef WINREG_SUPPORT
- winreg_cb.init = winreg_init_cb;
- winreg_cb.shutdown = NULL;
- winreg_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_winreg_init(&winreg_cb))) {
- return false;
- }
-+#endif
-
- srvsvc_cb.init = srvsvc_init_cb;
- srvsvc_cb.shutdown = NULL;
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -151,7 +151,9 @@ static void exit_server_common(enum serv
- #endif
-
- rpc_srvsvc_shutdown();
-+#ifdef WINREG_SUPPORT
- rpc_winreg_shutdown();
-+#endif
-
- rpc_netlogon_shutdown();
- rpc_samr_shutdown();
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -112,9 +112,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
- return false;
- }
-+#ifdef WINREG_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_winreg)) {
- return false;
- }
-+#endif
- #ifdef PRINTER_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
- return false;
---- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
-+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
-@@ -95,9 +95,11 @@ bool init_service_op_table( void )
- svcctl_ops[i].ops = &netlogon_svc_ops;
- i++;
-
-+#ifdef WINREG_SUPPORT
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
- svcctl_ops[i].ops = &winreg_svc_ops;
- i++;
-+#endif
-
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "WINS" );
- svcctl_ops[i].ops = &wins_svc_ops;
---- a/source3/services/svc_winreg_glue.c
-+++ b/source3/services/svc_winreg_glue.c
-@@ -88,6 +88,10 @@ struct security_descriptor *svcctl_get_s
- NTSTATUS status;
- WERROR result = WERR_OK;
-
-+#ifndef WINREG_SUPPORT
-+ return NULL;
-+#endif
-+
- key = talloc_asprintf(mem_ctx,
- "%s\\%s\\Security",
- TOP_LEVEL_SERVICES_KEY, name);
-@@ -161,6 +165,10 @@ bool svcctl_set_secdesc(struct messaging
- NTSTATUS status;
- WERROR result = WERR_OK;
-
-+#ifndef WINREG_SUPPORT
-+ return false;
-+#endif
-+
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return false;
-@@ -272,6 +280,10 @@ const char *svcctl_get_string_value(TALL
- NTSTATUS status;
- WERROR result = WERR_OK;
-
-+#ifndef WINREG_SUPPORT
-+ return NULL;
-+#endif
-+
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NULL;
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -640,7 +640,9 @@ static struct cmd_set *rpcclient_command
- drsuapi_commands,
- eventlog_commands,
- #endif
-+#ifdef WINREG_SUPPORT
- winreg_commands,
-+#endif
- NULL
- };
-
+++ /dev/null
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -881,6 +881,7 @@ static bool rpcecho_init_cb(void *ptr) {
-
- #endif
-
-+#ifdef DFS_SUPPORT
- static bool netdfs_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -928,6 +929,7 @@ static bool netdfs_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- #ifdef ACTIVE_DIRECTORY
- static bool dssetup_init_cb(void *ptr)
-@@ -1173,12 +1175,14 @@ bool dcesrv_ep_setup(struct tevent_conte
- return false;
- }
-
-+#ifdef DFS_SUPPORT
- netdfs_cb.init = netdfs_init_cb;
- netdfs_cb.shutdown = NULL;
- netdfs_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_netdfs_init(&netdfs_cb))) {
- return false;
- }
-+#endif
-
- #ifdef DEVELOPER
- rpcecho_cb.init = rpcecho_init_cb;
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -122,9 +122,11 @@ static bool initialize_interfaces(void)
- return false;
- }
- #endif
-+#ifdef DFS_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
- return false;
- }
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -139,7 +139,9 @@ static void exit_server_common(enum serv
- #ifdef DEVELOPER
- rpc_rpcecho_shutdown();
- #endif
-+#ifdef DFS_SUPPORT
- rpc_netdfs_shutdown();
-+#endif
- rpc_initshutdown_shutdown();
- #ifdef EXTRA_SERVICES
- rpc_eventlog_shutdown();
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -629,7 +629,9 @@ static struct cmd_set *rpcclient_command
- #endif
- netlogon_commands,
- srvsvc_commands,
-+#ifdef DFS_SUPPORT
- dfs_commands,
-+#endif
- echo_commands,
- epmapper_commands,
- shutdown_commands,
+++ /dev/null
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -127,9 +127,11 @@ static bool initialize_interfaces(void)
- return false;
- }
- #endif
-+#ifdef DEVELOPER
- if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
- return false;
- }
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -632,7 +632,9 @@ static struct cmd_set *rpcclient_command
- #ifdef DFS_SUPPORT
- dfs_commands,
- #endif
-+#ifdef DEVELOPER
- echo_commands,
-+#endif
- epmapper_commands,
- shutdown_commands,
- test_commands,
+++ /dev/null
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -132,7 +132,9 @@ static void exit_server_common(enum serv
- #endif
-
- if (am_parent) {
-+#ifdef WKSSVC_SUPPORT
- rpc_wkssvc_shutdown();
-+#endif
- #ifdef ACTIVE_DIRECTORY
- rpc_dssetup_shutdown();
- #endif
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -982,6 +982,7 @@ static bool dssetup_init_cb(void *ptr)
- }
- #endif
-
-+#ifdef WKSSVC_SUPPORT
- static bool wkssvc_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -1029,6 +1030,7 @@ static bool wkssvc_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx)
-@@ -1202,12 +1204,14 @@ bool dcesrv_ep_setup(struct tevent_conte
- }
- #endif
-
-+#ifdef WKSSVC_SUPPORT
- wkssvc_cb.init = wkssvc_init_cb;
- wkssvc_cb.shutdown = NULL;
- wkssvc_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_wkssvc_init(&wkssvc_cb))) {
- return false;
- }
-+#endif
-
- return true;
- }
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -109,9 +109,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
- return false;
- }
-+#ifdef WKSSVC_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
- return false;
- }
-+#endif
- #ifdef WINREG_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_winreg)) {
- return false;
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -638,7 +638,9 @@ static struct cmd_set *rpcclient_command
- epmapper_commands,
- shutdown_commands,
- test_commands,
-+#ifdef WKSSVC_SUPPORT
- wkssvc_commands,
-+#endif
- #ifdef EXTRA_SERVICES
- ntsvcs_commands,
- drsuapi_commands,
+++ /dev/null
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -606,6 +606,7 @@ static bool samr_init_cb(void *ptr)
- return true;
- }
-
-+#ifdef NETLOGON_SUPPORT
- static bool netlogon_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -654,6 +655,7 @@ static bool netlogon_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool spoolss_init_cb(void *ptr)
- {
-@@ -1118,12 +1120,15 @@ bool dcesrv_ep_setup(struct tevent_conte
- return false;
- }
-
-+#ifdef NETLOGON_SUPPORT
- netlogon_cb.init = netlogon_init_cb;
- netlogon_cb.shutdown = NULL;
- netlogon_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_netlogon_init(&netlogon_cb))) {
- return false;
- }
-+#endif
-+
-
- rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
- "rpc_server",
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -103,9 +103,11 @@ static bool initialize_interfaces(void)
- if (!smb_register_ndr_interface(&ndr_table_samr)) {
- return false;
- }
-+#ifdef NETLOGON_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
- return false;
- }
-+#endif
- if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
- return false;
- }
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -159,7 +159,9 @@ static void exit_server_common(enum serv
- rpc_winreg_shutdown();
- #endif
-
-+#ifdef NETLOGON_SUPPORT
- rpc_netlogon_shutdown();
-+#endif
- rpc_samr_shutdown();
- rpc_lsarpc_shutdown();
- }
---- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
-+++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
-@@ -91,9 +91,11 @@ bool init_service_op_table( void )
- i++;
- #endif
-
-+#ifdef NETLOGON_SUPPORT
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
- svcctl_ops[i].ops = &netlogon_svc_ops;
- i++;
-+#endif
-
- #ifdef WINREG_SUPPORT
- svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
---- a/source3/nmbd/nmbd_processlogon.c
-+++ b/source3/nmbd/nmbd_processlogon.c
-@@ -320,6 +320,10 @@ void process_logon_packet(struct packet_
- NTSTATUS status;
- const char *pdc_name;
-
-+#ifndef NETLOGON_SUPPORT
-+ return;
-+#endif
-+
- in_addr_to_sockaddr_storage(&ss, p->ip);
- pss = iface_ip((struct sockaddr *)&ss);
- if (!pss) {
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -627,7 +627,9 @@ static struct cmd_set *rpcclient_command
- #ifdef PRINTER_SUPPORT
- spoolss_commands,
- #endif
-+#ifdef NETLOGON_SUPPORT
- netlogon_commands,
-+#endif
- srvsvc_commands,
- #ifdef DFS_SUPPORT
- dfs_commands,
+++ /dev/null
---- a/source3/smbd/server_exit.c
-+++ b/source3/smbd/server_exit.c
-@@ -154,7 +154,9 @@ static void exit_server_common(enum serv
- rpc_spoolss_shutdown();
- #endif
-
-+#ifdef SRVSVC_SUPPORT
- rpc_srvsvc_shutdown();
-+#endif
- #ifdef WINREG_SUPPORT
- rpc_winreg_shutdown();
- #endif
---- a/source3/librpc/rpc/rpc_common.c
-+++ b/source3/librpc/rpc/rpc_common.c
-@@ -108,9 +108,11 @@ static bool initialize_interfaces(void)
- return false;
- }
- #endif
-+#ifdef SRVSVC_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
- return false;
- }
-+#endif
- #ifdef WKSSVC_SUPPORT
- if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
- return false;
---- a/source3/rpc_server/rpc_ep_setup.c
-+++ b/source3/rpc_server/rpc_ep_setup.c
-@@ -459,6 +459,7 @@ static bool winreg_init_cb(void *ptr)
- }
- #endif
-
-+#ifdef SRVSVC_SUPPORT
- static bool srvsvc_init_cb(void *ptr)
- {
- struct dcesrv_ep_context *ep_ctx =
-@@ -507,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
-
- return true;
- }
-+#endif
-
- static bool lsarpc_init_cb(void *ptr)
- {
-@@ -1098,13 +1100,14 @@ bool dcesrv_ep_setup(struct tevent_conte
- }
- #endif
-
-+#ifdef SRVSVC_SUPPORT
- srvsvc_cb.init = srvsvc_init_cb;
- srvsvc_cb.shutdown = NULL;
- srvsvc_cb.private_data = ep_ctx;
- if (!NT_STATUS_IS_OK(rpc_srvsvc_init(&srvsvc_cb))) {
- return false;
- }
--
-+#endif
-
- lsarpc_cb.init = lsarpc_init_cb;
- lsarpc_cb.shutdown = NULL;
---- a/source3/rpcclient/rpcclient.c
-+++ b/source3/rpcclient/rpcclient.c
-@@ -630,7 +630,9 @@ static struct cmd_set *rpcclient_command
- #ifdef NETLOGON_SUPPORT
- netlogon_commands,
- #endif
-+#ifdef SRVSVC_SUPPORT
- srvsvc_commands,
-+#endif
- #ifdef DFS_SUPPORT
- dfs_commands,
- #endif
---- a/source3/smbd/lanman.c
-+++ b/source3/smbd/lanman.c
-@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
- struct srvsvc_NetShareInfo2 info2;
- struct dcerpc_binding_handle *b;
-
-+#ifndef SRVSVC_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
-@@ -3818,10 +3822,7 @@ static bool api_RNetServerGetInfo(struct
- NTSTATUS status;
- WERROR werr;
- TALLOC_CTX *mem_ctx = talloc_tos();
-- struct rpc_pipe_client *cli = NULL;
-- union srvsvc_NetSrvInfo info;
- int errcode;
-- struct dcerpc_binding_handle *b;
-
- if (!str1 || !str2 || !p) {
- return False;
-@@ -3884,66 +3885,16 @@ static bool api_RNetServerGetInfo(struct
- p = *rdata;
- p2 = p + struct_len;
-
-- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
-- conn->session_info,
-- &conn->sconn->client_id,
-- conn->sconn->msg_ctx,
-- &cli);
-- if (!NT_STATUS_IS_OK(status)) {
-- DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
-- nt_errstr(status)));
-- errcode = W_ERROR_V(ntstatus_to_werror(status));
-- goto out;
-- }
--
-- b = cli->binding_handle;
--
-- status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
-- NULL,
-- 101,
-- &info,
-- &werr);
-- if (!NT_STATUS_IS_OK(status)) {
-- errcode = W_ERROR_V(ntstatus_to_werror(status));
-- goto out;
-- }
-- if (!W_ERROR_IS_OK(werr)) {
-- errcode = W_ERROR_V(werr);
-- goto out;
-- }
--
-- if (info.info101 == NULL) {
-- errcode = W_ERROR_V(WERR_INVALID_PARAM);
-- goto out;
-- }
--
- if (uLevel != 20) {
-- srvstr_push(NULL, 0, p, info.info101->server_name, 16,
-+ srvstr_push(NULL, 0, p, global_myname(), 16,
- STR_ASCII|STR_UPPER|STR_TERMINATE);
-- }
-+ }
- p += 16;
- if (uLevel > 0) {
-- SCVAL(p,0,info.info101->version_major);
-- SCVAL(p,1,info.info101->version_minor);
-- SIVAL(p,2,info.info101->server_type);
--
-- if (mdrcnt == struct_len) {
-- SIVAL(p,6,0);
-- } else {
-- SIVAL(p,6,PTR_DIFF(p2,*rdata));
-- if (mdrcnt - struct_len <= 0) {
-- return false;
-- }
-- push_ascii(p2,
-- info.info101->comment,
-- MIN(mdrcnt - struct_len,
-- MAX_SERVER_STRING_LENGTH),
-- STR_TERMINATE);
-- p2 = skip_string(*rdata,*rdata_len,p2);
-- if (!p2) {
-- return False;
-- }
-- }
-+ SCVAL(p,0,lp_major_announce_version());
-+ SCVAL(p,1,lp_minor_announce_version());
-+ SIVAL(p,2,lp_default_server_announce());
-+ SIVAL(p,6,0);
- }
-
- if (uLevel > 1) {
-@@ -5630,6 +5581,10 @@ static bool api_RNetSessionEnum(struct s
- uint32_t totalentries, resume_handle = 0;
- uint32_t count = 0;
-
-+#ifndef SRVSVC_SUPPORT
-+ return False;
-+#endif
-+
- if (!str1 || !str2 || !p) {
- return False;
- }
+++ /dev/null
---- a/source3/Makefile.in
-+++ b/source3/Makefile.in
-@@ -214,7 +214,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_P
-
- # Note that all executable programs now provide for an optional executable suffix.
-
--SBIN_PROGS = bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
-+SBIN_PROGS = bin/samba_multicall@EXEEXT@ bin/smbd@EXEEXT@ bin/nmbd@EXEEXT@ @SWAT_SBIN_TARGETS@ @EXTRA_SBIN_PROGS@
-
- BIN_PROGS1 = bin/smbclient@EXEEXT@ bin/net@EXEEXT@ bin/smbspool@EXEEXT@ \
- bin/testparm@EXEEXT@ bin/smbstatus@EXEEXT@ bin/smbget@EXEEXT@ \
-@@ -1774,6 +1774,42 @@ bin/.dummy:
- dir=bin $(MAKEDIR); fi
- @: >> $@ || : > $@ # what a fancy emoticon!
-
-+smbd/server_multicall.o: smbd/server.c smbd/server.o
-+ @echo Compiling $<.c
-+ @$(COMPILE_CC_PATH) -Dmain=smbd_main && exit 0;\
-+ echo "The following command failed:" 1>&2;\
-+ echo "$(COMPILE_CC_PATH)" 1>&2;\
-+ $(COMPILE_CC_PATH) >/dev/null 2>&1
-+
-+nmbd/nmbd_multicall.o: nmbd/nmbd.c nmbd/nmbd.o
-+ @echo Compiling $<.c
-+ @$(COMPILE_CC_PATH) -Dmain=nmbd_main && exit 0;\
-+ echo "The following command failed:" 1>&2;\
-+ echo "$(COMPILE_CC_PATH)" 1>&2;\
-+ $(COMPILE_CC_PATH) >/dev/null 2>&1
-+
-+utils/smbpasswd_multicall.o: utils/smbpasswd.c utils/smbpasswd.o
-+ @echo Compiling $<.c
-+ @$(COMPILE_CC_PATH) -Dmain=smbpasswd_main && exit 0;\
-+ echo "The following command failed:" 1>&2;\
-+ echo "$(COMPILE_CC_PATH)" 1>&2;\
-+ $(COMPILE_CC_PATH) >/dev/null 2>&1
-+
-+SMBD_MULTI_O = $(patsubst smbd/server.o,smbd/server_multicall.o,$(SMBD_OBJ))
-+NMBD_MULTI_O = $(patsubst nmbd/nmbd.o,nmbd/nmbd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(NMBD_OBJ)))
-+SMBPASSWD_MULTI_O = $(patsubst utils/smbpasswd.o,utils/smbpasswd_multicall.o,$(filter-out $(LIB_DUMMY_OBJ),$(SMBPASSWD_OBJ)))
-+MULTI_O = multi.o
-+
-+MULTICALL_O = $(sort $(SMBD_MULTI_O) $(NMBD_MULTI_O) $(SMBPASSWD_MULTI_O) $(MULTI_O))
-+
-+bin/samba_multicall@EXEEXT@: $(BINARY_PREREQS) $(MULTICALL_O) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
-+ @echo Linking $@
-+ @$(CC) -o $@ $(MULTICALL_O) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
-+ $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
-+ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) $(AVAHI_LIBS) \
-+ $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
-+ $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
-+
- bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT) @BUILD_POPT@
- @echo Linking $@
- @$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) @SMBD_FAM_LIBS@ \
---- /dev/null
-+++ b/source3/multi.c
-@@ -0,0 +1,35 @@
-+#include <stdio.h>
-+#include <string.h>
-+
-+extern int smbd_main(int argc, char **argv);
-+extern int nmbd_main(int argc, char **argv);
-+extern int smbpasswd_main(int argc, char **argv);
-+
-+static struct {
-+ const char *name;
-+ int (*func)(int argc, char **argv);
-+} multicall[] = {
-+ { "smbd", smbd_main },
-+ { "nmbd", nmbd_main },
-+ { "smbpasswd", smbpasswd_main },
-+};
-+
-+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-+
-+int main(int argc, char **argv)
-+{
-+ int i;
-+
-+ for (i = 0; i < ARRAY_SIZE(multicall); i++) {
-+ if (strstr(argv[0], multicall[i].name))
-+ return multicall[i].func(argc, argv);
-+ }
-+
-+ fprintf(stderr, "Invalid multicall command, available commands:");
-+ for (i = 0; i < ARRAY_SIZE(multicall); i++)
-+ fprintf(stderr, " %s", multicall[i].name);
-+
-+ fprintf(stderr, "\n");
-+
-+ return 1;
-+}
--- /dev/null
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -1110,6 +1110,10 @@ bool dcesrv_ep_setup(struct tevent_conte
+ "rpc_server",
+ "spoolss",
+ "embedded");
++#ifndef PRINTER_SUPPORT
++ if (1) {
++ } else
++#endif
+ if (StrCaseCmp(rpcsrv_type, "embedded") == 0) {
+ spoolss_cb.init = spoolss_init_cb;
+ spoolss_cb.shutdown = spoolss_shutdown_cb;
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -624,7 +624,9 @@ static struct cmd_set *rpcclient_command
+ lsarpc_commands,
+ ds_commands,
+ samr_commands,
++#ifdef PRINTER_SUPPORT
+ spoolss_commands,
++#endif
+ netlogon_commands,
+ srvsvc_commands,
+ dfs_commands,
+--- a/source3/printing/spoolssd.c
++++ b/source3/printing/spoolssd.c
+@@ -153,6 +153,10 @@ void start_spoolssd(struct tevent_contex
+ NTSTATUS status;
+ int ret;
+
++#ifndef PRINTER_SUPPORT
++ return;
++#endif
++
+ DEBUG(1, ("Forking SPOOLSS Daemon\n"));
+
+ pid = sys_fork();
+--- a/source3/utils/net_rpc.c
++++ b/source3/utils/net_rpc.c
+@@ -7791,6 +7791,10 @@ int net_rpc_printer(struct net_context *
+ {NULL, NULL, 0, NULL, NULL}
+ };
+
++#ifndef PRINTER_SUPPORT
++ return 0;
++#endif
++
+ if (argc == 0) {
+ if (c->display_usage) {
+ d_printf(_("Usage:\n"));
+--- a/source3/smbd/reply.c
++++ b/source3/smbd/reply.c
+@@ -5194,7 +5194,11 @@ void reply_printopen(struct smb_request
+ return;
+ }
+
+- if (!CAN_PRINT(conn)) {
++
++#ifdef PRINTER_SUPPORT
++ if (!CAN_PRINT(conn))
++#endif
++ {
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+ END_PROFILE(SMBsplopen);
+ return;
+@@ -5300,7 +5304,10 @@ void reply_printqueue(struct smb_request
+ is really quite gross and only worked when there was only
+ one printer - I think we should now only accept it if they
+ get it right (tridge) */
+- if (!CAN_PRINT(conn)) {
++#ifdef PRINTER_SUPPORT
++ if (!CAN_PRINT(conn))
++#endif
++ {
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
+ END_PROFILE(SMBsplretq);
+ return;
+--- a/source3/smbd/lanman.c
++++ b/source3/smbd/lanman.c
+@@ -784,6 +784,10 @@ static bool api_DosPrintQGetInfo(struct
+ union spoolss_JobInfo *job_info = NULL;
+ union spoolss_PrinterInfo printer_info;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -999,6 +1003,10 @@ static bool api_DosPrintQEnum(struct smb
+ union spoolss_DriverInfo *driver_info;
+ union spoolss_JobInfo **job_info;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!param_format || !output_format1 || !p) {
+ return False;
+ }
+@@ -3350,6 +3358,10 @@ static bool api_RDosPrintJobDel(struct s
+ struct spoolss_DevmodeContainer devmode_ctr;
+ enum spoolss_JobControl command;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -3483,6 +3495,10 @@ static bool api_WPrintQueueCtrl(struct s
+ struct sec_desc_buf secdesc_ctr;
+ enum spoolss_PrinterControl command;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !QueueName) {
+ return False;
+ }
+@@ -3649,6 +3665,10 @@ static bool api_PrintJobInfo(struct smbd
+ union spoolss_JobInfo info;
+ struct spoolss_SetJobInfo1 info1;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -4792,6 +4812,10 @@ static bool api_WPrintJobGetInfo(struct
+ struct spoolss_DevmodeContainer devmode_ctr;
+ union spoolss_JobInfo info;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -4930,6 +4954,10 @@ static bool api_WPrintJobEnumerate(struc
+ uint32_t count = 0;
+ union spoolss_JobInfo *info;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -5135,6 +5163,10 @@ static bool api_WPrintDestGetInfo(struct
+ struct spoolss_DevmodeContainer devmode_ctr;
+ union spoolss_PrinterInfo info;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -5271,6 +5303,10 @@ static bool api_WPrintDestEnum(struct sm
+ union spoolss_PrinterInfo *info;
+ uint32_t count;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -5374,6 +5410,10 @@ static bool api_WPrintDriverEnum(struct
+ int succnt;
+ struct pack_desc desc;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -5438,6 +5478,10 @@ static bool api_WPrintQProcEnum(struct s
+ int succnt;
+ struct pack_desc desc;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+@@ -5502,6 +5546,10 @@ static bool api_WPrintPortEnum(struct sm
+ int succnt;
+ struct pack_desc desc;
+
++#ifndef PRINTER_SUPPORT
++ return False;
++#endif
++
+ if (!str1 || !str2 || !p) {
+ return False;
+ }
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -142,7 +142,9 @@ static void exit_server_common(enum serv
+ rpc_eventlog_shutdown();
+ rpc_ntsvcs_shutdown();
+ rpc_svcctl_shutdown();
++#ifdef PRINTER_SUPPORT
+ rpc_spoolss_shutdown();
++#endif
+
+ rpc_srvsvc_shutdown();
+ rpc_winreg_shutdown();
+--- a/source3/smbd/open.c
++++ b/source3/smbd/open.c
+@@ -1556,6 +1556,9 @@ static NTSTATUS open_file_ntcreate(conne
+ * Most of the passed parameters are ignored.
+ */
+
++#ifndef PRINTER_SUPPORT
++ return NT_STATUS_ACCESS_DENIED;
++#endif
+ if (pinfo) {
+ *pinfo = FILE_WAS_CREATED;
+ }
+--- a/source3/smbd/close.c
++++ b/source3/smbd/close.c
+@@ -638,6 +638,9 @@ static NTSTATUS close_normal_file(struct
+ status = ntstatus_keeperror(status, tmp);
+
+ if (fsp->print_file) {
++#ifndef PRINTER_SUPPORT
++ return NT_STATUS_OK;
++#endif
+ /* FIXME: return spool errors */
+ print_spool_end(fsp, close_type);
+ file_free(req, fsp);
+--- a/source3/smbd/fileio.c
++++ b/source3/smbd/fileio.c
+@@ -298,6 +298,10 @@ ssize_t write_file(struct smb_request *r
+ uint32_t t;
+ int ret;
+
++#ifndef PRINTER_SUPPORT
++ return -1;
++#endif
++
+ ret = print_spool_write(fsp, data, n, pos, &t);
+ if (ret) {
+ errno = ret;
+--- a/source3/smbd/smb2_create.c
++++ b/source3/smbd/smb2_create.c
+@@ -485,7 +485,10 @@ static struct tevent_req *smbd_smb2_crea
+ info = FILE_WAS_OPENED;
+ } else if (CAN_PRINT(smb1req->conn)) {
+ status = file_new(smb1req, smb1req->conn, &result);
+- if(!NT_STATUS_IS_OK(status)) {
++#ifdef PRINTER_SUPPORT
++ if(!NT_STATUS_IS_OK(status))
++#endif
++ {
+ tevent_req_nterror(req, status);
+ return tevent_req_post(req, ev);
+ }
+--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
++++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
+@@ -85,9 +85,11 @@ bool init_service_op_table( void )
+
+ /* add builtin services */
+
++#ifdef PRINTER_SUPPORT
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "Spooler" );
+ svcctl_ops[i].ops = &spoolss_svc_ops;
+ i++;
++#endif
+
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
+ svcctl_ops[i].ops = &netlogon_svc_ops;
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -113,9 +113,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_winreg)) {
+ return false;
+ }
++#ifdef PRINTER_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
+ return false;
+ }
++#endif
+ if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
+ return false;
+ }
+--- a/source3/smbd/process.c
++++ b/source3/smbd/process.c
+@@ -2475,8 +2475,10 @@ static bool housekeeping_fn(const struct
+
+ change_to_root_user();
+
++#ifdef PRINTER_SUPPORT
+ /* update printer queue caches if necessary */
+ update_monitored_printq_cache(sconn->msg_ctx);
++#endif
+
+ /* check if we need to reload services */
+ check_reload(sconn, time_mono(NULL));
+--- a/source3/smbd/server.c
++++ b/source3/smbd/server.c
+@@ -126,7 +126,9 @@ static void smb_pcap_updated(struct mess
+ {
+ struct tevent_context *ev_ctx =
+ talloc_get_type_abort(private_data, struct tevent_context);
+-
++#ifndef PRINTER_SUPPORT
++ return;
++#endif
+ DEBUG(10,("Got message saying pcap was updated. Reloading.\n"));
+ change_to_root_user();
+ reload_printers(ev_ctx, msg);
+@@ -1211,8 +1213,10 @@ extern void build_options(bool screen);
+ if (!W_ERROR_IS_OK(registry_init_full()))
+ exit(1);
+
++#ifdef PRINTER_SUPPORT
+ if (!print_backend_init(smbd_messaging_context()))
+ exit(1);
++#endif
+
+ /* Open the share_info.tdb here, so we don't have to open
+ after the fork on every single connection. This is a small
+@@ -1256,6 +1260,7 @@ extern void build_options(bool screen);
+ exit(1);
+ }
+
++#ifdef PRINTER_SUPPORT
+ /* Publish nt printers, this requires a working winreg pipe */
+ pcap_cache_reload(server_event_context(), smbd_messaging_context(),
+ &reload_printers);
+@@ -1284,6 +1289,7 @@ extern void build_options(bool screen);
+ smbd_messaging_context());
+ }
+ }
++#endif
+
+ if (!is_daemon) {
+ /* inetd mode */
--- /dev/null
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -95,9 +95,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
+ return false;
+ }
++#ifdef ACTIVE_DIRECTORY
+ if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
+ return false;
+ }
++#endif
+ if (!smb_register_ndr_interface(&ndr_table_samr)) {
+ return false;
+ }
+@@ -141,9 +143,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
+ return false;
+ }
++#ifdef ACTIVE_DIRECTORY
+ if (!smb_register_ndr_interface(&ndr_table_drsuapi)) {
+ return false;
+ }
++#endif
+ return true;
+ }
+
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -918,6 +918,7 @@ static bool netdfs_init_cb(void *ptr)
+ return true;
+ }
+
++#ifdef ACTIVE_DIRECTORY
+ static bool dssetup_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -966,6 +967,7 @@ static bool dssetup_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ static bool wkssvc_init_cb(void *ptr)
+ {
+@@ -1172,12 +1174,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+ }
+ #endif
+
++#ifdef ACTIVE_DIRECTORY
+ dssetup_cb.init = dssetup_init_cb;
+ dssetup_cb.shutdown = NULL;
+ dssetup_cb.private_data = ep_ctx;
+ if (!NT_STATUS_IS_OK(rpc_dssetup_init(&dssetup_cb))) {
+ return false;
+ }
++#endif
+
+ wkssvc_cb.init = wkssvc_init_cb;
+ wkssvc_cb.shutdown = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -133,7 +133,9 @@ static void exit_server_common(enum serv
+
+ if (am_parent) {
+ rpc_wkssvc_shutdown();
++#ifdef ACTIVE_DIRECTORY
+ rpc_dssetup_shutdown();
++#endif
+ #ifdef DEVELOPER
+ rpc_rpcecho_shutdown();
+ #endif
+--- a/source3/rpc_client/cli_pipe.c
++++ b/source3/rpc_client/cli_pipe.c
+@@ -2874,12 +2874,14 @@ NTSTATUS cli_rpc_pipe_open_noauth_transp
+ status = rpc_pipe_bind(result, auth);
+ if (!NT_STATUS_IS_OK(status)) {
+ int lvl = 0;
++#ifdef ACTIVE_DIRECTORY
+ if (ndr_syntax_id_equal(interface,
+ &ndr_table_dssetup.syntax_id)) {
+ /* non AD domains just don't have this pipe, avoid
+ * level 0 statement in that case - gd */
+ lvl = 3;
+ }
++#endif
+ DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
+ "%s failed with error %s\n",
+ get_pipe_name_from_syntax(talloc_tos(), interface),
--- /dev/null
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -131,6 +131,7 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
+ return false;
+ }
++#ifdef EXTRA_SERVICES
+ if (!smb_register_ndr_interface(&ndr_table_svcctl)) {
+ return false;
+ }
+@@ -140,6 +141,7 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) {
+ return false;
+ }
++#endif
+ if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
+ return false;
+ }
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -697,6 +697,7 @@ static bool spoolss_shutdown_cb(void *pt
+ return true;
+ }
+
++#ifdef EXTRA_SERVICES
+ static bool svcctl_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -733,6 +734,7 @@ static bool svcctl_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ static bool svcctl_shutdown_cb(void *ptr)
+ {
+@@ -741,6 +743,8 @@ static bool svcctl_shutdown_cb(void *ptr
+ return true;
+ }
+
++#ifdef EXTRA_SERVICES
++
+ static bool ntsvcs_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -802,6 +806,7 @@ static bool eventlog_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ static bool initshutdown_init_cb(void *ptr)
+ {
+@@ -1130,6 +1135,7 @@ bool dcesrv_ep_setup(struct tevent_conte
+ }
+ }
+
++#ifdef EXTRA_SERVICES
+ svcctl_cb.init = svcctl_init_cb;
+ svcctl_cb.shutdown = svcctl_shutdown_cb;
+ svcctl_cb.private_data = ep_ctx;
+@@ -1150,6 +1156,7 @@ bool dcesrv_ep_setup(struct tevent_conte
+ if (!NT_STATUS_IS_OK(rpc_eventlog_init(&eventlog_cb))) {
+ return false;
+ }
++#endif
+
+ initshutdown_cb.init = initshutdown_init_cb;
+ initshutdown_cb.shutdown = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -141,9 +141,11 @@ static void exit_server_common(enum serv
+ #endif
+ rpc_netdfs_shutdown();
+ rpc_initshutdown_shutdown();
++#ifdef EXTRA_SERVICES
+ rpc_eventlog_shutdown();
+- rpc_ntsvcs_shutdown();
+ rpc_svcctl_shutdown();
++ rpc_ntsvcs_shutdown();
++#endif
+ #ifdef PRINTER_SUPPORT
+ rpc_spoolss_shutdown();
+ #endif
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -637,9 +637,11 @@ static struct cmd_set *rpcclient_command
+ shutdown_commands,
+ test_commands,
+ wkssvc_commands,
++#ifdef EXTRA_SERVICES
+ ntsvcs_commands,
+ drsuapi_commands,
+ eventlog_commands,
++#endif
+ winreg_commands,
+ NULL
+ };
--- /dev/null
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -409,6 +409,7 @@ static bool epmapper_shutdown_cb(void *p
+ return true;
+ }
+
++#ifdef WINREG_SUPPORT
+ static bool winreg_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -456,6 +457,7 @@ static bool winreg_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ static bool srvsvc_init_cb(void *ptr)
+ {
+@@ -710,10 +712,12 @@ static bool svcctl_init_cb(void *ptr)
+ "epmapper",
+ "none");
+
++#ifdef WINREG_SUPPORT
+ ok = svcctl_init_winreg(ep_ctx->msg_ctx);
+ if (!ok) {
+ return false;
+ }
++#endif
+
+ /* initialize the control hooks */
+ init_service_op_table();
+@@ -785,10 +789,12 @@ static bool eventlog_init_cb(void *ptr)
+ "epmapper",
+ "none");
+
++#ifdef WINREG_SUPPORT
+ ok = eventlog_init_winreg(ep_ctx->msg_ctx);
+ if (!ok) {
+ return false;
+ }
++#endif
+
+ if (StrCaseCmp(rpcsrv_type, "embedded") == 0 ||
+ StrCaseCmp(rpcsrv_type, "daemon") == 0) {
+@@ -1077,12 +1083,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+ }
+ }
+
++#ifdef WINREG_SUPPORT
+ winreg_cb.init = winreg_init_cb;
+ winreg_cb.shutdown = NULL;
+ winreg_cb.private_data = ep_ctx;
+ if (!NT_STATUS_IS_OK(rpc_winreg_init(&winreg_cb))) {
+ return false;
+ }
++#endif
+
+ srvsvc_cb.init = srvsvc_init_cb;
+ srvsvc_cb.shutdown = NULL;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -151,7 +151,9 @@ static void exit_server_common(enum serv
+ #endif
+
+ rpc_srvsvc_shutdown();
++#ifdef WINREG_SUPPORT
+ rpc_winreg_shutdown();
++#endif
+
+ rpc_netlogon_shutdown();
+ rpc_samr_shutdown();
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -112,9 +112,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
+ return false;
+ }
++#ifdef WINREG_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_winreg)) {
+ return false;
+ }
++#endif
+ #ifdef PRINTER_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_spoolss)) {
+ return false;
+--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
++++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
+@@ -95,9 +95,11 @@ bool init_service_op_table( void )
+ svcctl_ops[i].ops = &netlogon_svc_ops;
+ i++;
+
++#ifdef WINREG_SUPPORT
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
+ svcctl_ops[i].ops = &winreg_svc_ops;
+ i++;
++#endif
+
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "WINS" );
+ svcctl_ops[i].ops = &wins_svc_ops;
+--- a/source3/services/svc_winreg_glue.c
++++ b/source3/services/svc_winreg_glue.c
+@@ -88,6 +88,10 @@ struct security_descriptor *svcctl_get_s
+ NTSTATUS status;
+ WERROR result = WERR_OK;
+
++#ifndef WINREG_SUPPORT
++ return NULL;
++#endif
++
+ key = talloc_asprintf(mem_ctx,
+ "%s\\%s\\Security",
+ TOP_LEVEL_SERVICES_KEY, name);
+@@ -161,6 +165,10 @@ bool svcctl_set_secdesc(struct messaging
+ NTSTATUS status;
+ WERROR result = WERR_OK;
+
++#ifndef WINREG_SUPPORT
++ return false;
++#endif
++
+ tmp_ctx = talloc_stackframe();
+ if (tmp_ctx == NULL) {
+ return false;
+@@ -272,6 +280,10 @@ const char *svcctl_get_string_value(TALL
+ NTSTATUS status;
+ WERROR result = WERR_OK;
+
++#ifndef WINREG_SUPPORT
++ return NULL;
++#endif
++
+ tmp_ctx = talloc_stackframe();
+ if (tmp_ctx == NULL) {
+ return NULL;
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -642,7 +642,9 @@ static struct cmd_set *rpcclient_command
+ drsuapi_commands,
+ eventlog_commands,
+ #endif
++#ifdef WINREG_SUPPORT
+ winreg_commands,
++#endif
+ NULL
+ };
+
--- /dev/null
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -881,6 +881,7 @@ static bool rpcecho_init_cb(void *ptr) {
+
+ #endif
+
++#ifdef DFS_SUPPORT
+ static bool netdfs_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -928,6 +929,7 @@ static bool netdfs_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ #ifdef ACTIVE_DIRECTORY
+ static bool dssetup_init_cb(void *ptr)
+@@ -1173,12 +1175,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+ return false;
+ }
+
++#ifdef DFS_SUPPORT
+ netdfs_cb.init = netdfs_init_cb;
+ netdfs_cb.shutdown = NULL;
+ netdfs_cb.private_data = ep_ctx;
+ if (!NT_STATUS_IS_OK(rpc_netdfs_init(&netdfs_cb))) {
+ return false;
+ }
++#endif
+
+ #ifdef DEVELOPER
+ rpcecho_cb.init = rpcecho_init_cb;
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -122,9 +122,11 @@ static bool initialize_interfaces(void)
+ return false;
+ }
+ #endif
++#ifdef DFS_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
+ return false;
+ }
++#endif
+ #ifdef DEVELOPER
+ if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
+ return false;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -139,7 +139,9 @@ static void exit_server_common(enum serv
+ #ifdef DEVELOPER
+ rpc_rpcecho_shutdown();
+ #endif
++#ifdef DFS_SUPPORT
+ rpc_netdfs_shutdown();
++#endif
+ rpc_initshutdown_shutdown();
+ #ifdef EXTRA_SERVICES
+ rpc_eventlog_shutdown();
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -629,7 +629,9 @@ static struct cmd_set *rpcclient_command
+ #endif
+ netlogon_commands,
+ srvsvc_commands,
++#ifdef DFS_SUPPORT
+ dfs_commands,
++#endif
+ #ifdef DEVELOPER
+ echo_commands,
+ #endif
--- /dev/null
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -606,6 +606,7 @@ static bool samr_init_cb(void *ptr)
+ return true;
+ }
+
++#ifdef NETLOGON_SUPPORT
+ static bool netlogon_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -654,6 +655,7 @@ static bool netlogon_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ static bool spoolss_init_cb(void *ptr)
+ {
+@@ -1116,12 +1118,15 @@ bool dcesrv_ep_setup(struct tevent_conte
+ return false;
+ }
+
++#ifdef NETLOGON_SUPPORT
+ netlogon_cb.init = netlogon_init_cb;
+ netlogon_cb.shutdown = NULL;
+ netlogon_cb.private_data = ep_ctx;
+ if (!NT_STATUS_IS_OK(rpc_netlogon_init(&netlogon_cb))) {
+ return false;
+ }
++#endif
++
+
+ rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
+ "rpc_server",
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -103,9 +103,11 @@ static bool initialize_interfaces(void)
+ if (!smb_register_ndr_interface(&ndr_table_samr)) {
+ return false;
+ }
++#ifdef NETLOGON_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
+ return false;
+ }
++#endif
+ if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
+ return false;
+ }
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -157,7 +157,9 @@ static void exit_server_common(enum serv
+ rpc_winreg_shutdown();
+ #endif
+
++#ifdef NETLOGON_SUPPORT
+ rpc_netlogon_shutdown();
++#endif
+ rpc_samr_shutdown();
+ rpc_lsarpc_shutdown();
+ }
+--- a/source3/rpc_server/svcctl/srv_svcctl_nt.c
++++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c
+@@ -91,9 +91,11 @@ bool init_service_op_table( void )
+ i++;
+ #endif
+
++#ifdef NETLOGON_SUPPORT
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "NETLOGON" );
+ svcctl_ops[i].ops = &netlogon_svc_ops;
+ i++;
++#endif
+
+ #ifdef WINREG_SUPPORT
+ svcctl_ops[i].name = talloc_strdup( svcctl_ops, "RemoteRegistry" );
+--- a/source3/nmbd/nmbd_processlogon.c
++++ b/source3/nmbd/nmbd_processlogon.c
+@@ -320,6 +320,10 @@ void process_logon_packet(struct packet_
+ NTSTATUS status;
+ const char *pdc_name;
+
++#ifndef NETLOGON_SUPPORT
++ return;
++#endif
++
+ in_addr_to_sockaddr_storage(&ss, p->ip);
+ pss = iface_ip((struct sockaddr *)&ss);
+ if (!pss) {
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -627,7 +627,9 @@ static struct cmd_set *rpcclient_command
+ #ifdef PRINTER_SUPPORT
+ spoolss_commands,
+ #endif
++#ifdef NETLOGON_SUPPORT
+ netlogon_commands,
++#endif
+ srvsvc_commands,
+ #ifdef DFS_SUPPORT
+ dfs_commands,
+--- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
++++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
+@@ -820,6 +820,10 @@ WERROR _wkssvc_NetrJoinDomain2(struct pi
+ WERROR werr;
+ struct security_token *token = p->session_info->security_token;
+
++#ifndef NETLOGON_SUPPORT
++ return WERR_NOT_SUPPORTED;
++#endif
++
+ if (!r->in.domain_name) {
+ return WERR_INVALID_PARAM;
+ }
+@@ -897,6 +901,10 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct
+ WERROR werr;
+ struct security_token *token = p->session_info->security_token;
+
++#ifndef NETLOGON_SUPPORT
++ return WERR_NOT_SUPPORTED;
++#endif
++
+ if (!r->in.account || !r->in.encrypted_password) {
+ return WERR_INVALID_PARAM;
+ }
--- /dev/null
+--- a/source3/librpc/rpc/rpc_common.c
++++ b/source3/librpc/rpc/rpc_common.c
+@@ -100,9 +100,11 @@ static bool initialize_interfaces(void)
+ return false;
+ }
+ #endif
++#ifdef SAMR_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_samr)) {
+ return false;
+ }
++#endif
+ #ifdef NETLOGON_SUPPORT
+ if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
+ return false;
+--- a/source3/rpc_server/rpc_ep_setup.c
++++ b/source3/rpc_server/rpc_ep_setup.c
+@@ -557,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
+ return true;
+ }
+
++#ifdef SAMR_SUPPORT
+ static bool samr_init_cb(void *ptr)
+ {
+ struct dcesrv_ep_context *ep_ctx =
+@@ -605,6 +606,7 @@ static bool samr_init_cb(void *ptr)
+
+ return true;
+ }
++#endif
+
+ #ifdef NETLOGON_SUPPORT
+ static bool netlogon_init_cb(void *ptr)
+@@ -1111,12 +1113,14 @@ bool dcesrv_ep_setup(struct tevent_conte
+ return false;
+ }
+
++#ifdef SAMR_SUPPORT
+ samr_cb.init = samr_init_cb;
+ samr_cb.shutdown = NULL;
+ samr_cb.private_data = ep_ctx;
+ if (!NT_STATUS_IS_OK(rpc_samr_init(&samr_cb))) {
+ return false;
+ }
++#endif
+
+ #ifdef NETLOGON_SUPPORT
+ netlogon_cb.init = netlogon_init_cb;
+--- a/source3/smbd/server_exit.c
++++ b/source3/smbd/server_exit.c
+@@ -160,7 +160,9 @@ static void exit_server_common(enum serv
+ #ifdef NETLOGON_SUPPORT
+ rpc_netlogon_shutdown();
+ #endif
++#ifdef SAMR_SUPPORT
+ rpc_samr_shutdown();
++#endif
+ rpc_lsarpc_shutdown();
+ }
+
+--- a/source3/rpcclient/rpcclient.c
++++ b/source3/rpcclient/rpcclient.c
+@@ -623,7 +623,9 @@ static struct cmd_set *rpcclient_command
+ rpcclient_commands,
+ lsarpc_commands,
+ ds_commands,
++#ifdef SAMR_SUPPORT
+ samr_commands,
++#endif
+ #ifdef PRINTER_SUPPORT
+ spoolss_commands,
+ #endif
--- /dev/null
+--- a/source3/lib/smbconf/smbconf_init.c
++++ b/source3/lib/smbconf/smbconf_init.c
+@@ -68,9 +68,12 @@ sbcErr smbconf_init(TALLOC_CTX *mem_ctx,
+ }
+ }
+
++#ifdef REGISTRY_BACKEND
+ if (strequal(backend, "registry") || strequal(backend, "reg")) {
+ err = smbconf_init_reg(mem_ctx, conf_ctx, path);
+- } else if (strequal(backend, "file") || strequal(backend, "txt")) {
++ } else
++#endif
++ if (strequal(backend, "file") || strequal(backend, "txt")) {
+ err = smbconf_init_txt(mem_ctx, conf_ctx, path);
+ } else if (sep == NULL) {
+ /*
+--- a/source3/lib/netapi/serverinfo.c
++++ b/source3/lib/netapi/serverinfo.c
+@@ -557,7 +557,10 @@ static WERROR NetServerSetInfo_l_1005(st
+ return WERR_INVALID_PARAM;
+ }
+
+- if (!lp_config_backend_is_registry()) {
++#ifdef REGISTRY_BACKEND
++ if (!lp_config_backend_is_registry())
++#endif
++ {
+ libnetapi_set_error_string(ctx,
+ "Configuration manipulation requested but not "
+ "supported by backend");