--- /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
+@@ -634,7 +634,9 @@ static struct cmd_set *rpcclient_command
+ epmapper_commands,
+ shutdown_commands,
+ test_commands,
++#ifdef WKSSVC_SUPPORT
+ wkssvc_commands,
++#endif
+ ntsvcs_commands,
+ drsuapi_commands,
+ eventlog_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) {
--- /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;