1--- a/source3/librpc/rpc/rpc_common.c
2+++ b/source3/librpc/rpc/rpc_common.c
3@@ -131,6 +131,7 @@ static bool initialize_interfaces(void)
4 	if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
5 		return false;
6 	}
7+#ifdef EXTRA_SERVICES
8 	if (!smb_register_ndr_interface(&ndr_table_svcctl)) {
9 		return false;
10 	}
11@@ -140,6 +141,7 @@ static bool initialize_interfaces(void)
12 	if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) {
13 		return false;
14 	}
15+#endif
16 	if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
17 		return false;
18 	}
19--- a/source3/rpc_server/rpc_ep_setup.c
20+++ b/source3/rpc_server/rpc_ep_setup.c
21@@ -697,6 +697,7 @@ static bool spoolss_shutdown_cb(void *pt
22 	return true;
23 }
24 
25+#ifdef EXTRA_SERVICES
26 static bool svcctl_init_cb(void *ptr)
27 {
28 	struct dcesrv_ep_context *ep_ctx =
29@@ -733,6 +734,7 @@ static bool svcctl_init_cb(void *ptr)
30 
31 	return true;
32 }
33+#endif
34 
35 static bool svcctl_shutdown_cb(void *ptr)
36 {
37@@ -741,6 +743,8 @@ static bool svcctl_shutdown_cb(void *ptr
38 	return true;
39 }
40 
41+#ifdef EXTRA_SERVICES
42+
43 static bool ntsvcs_init_cb(void *ptr)
44 {
45 	struct dcesrv_ep_context *ep_ctx =
46@@ -802,6 +806,7 @@ static bool eventlog_init_cb(void *ptr)
47 
48 	return true;
49 }
50+#endif
51 
52 static bool initshutdown_init_cb(void *ptr)
53 {
54@@ -1130,6 +1135,7 @@ bool dcesrv_ep_setup(struct tevent_conte
55 		}
56 	}
57 
58+#ifdef EXTRA_SERVICES
59 	svcctl_cb.init         = svcctl_init_cb;
60 	svcctl_cb.shutdown     = svcctl_shutdown_cb;
61 	svcctl_cb.private_data = ep_ctx;
62@@ -1150,6 +1156,7 @@ bool dcesrv_ep_setup(struct tevent_conte
63 	if (!NT_STATUS_IS_OK(rpc_eventlog_init(&eventlog_cb))) {
64 		return false;
65 	}
66+#endif
67 
68 	initshutdown_cb.init         = initshutdown_init_cb;
69 	initshutdown_cb.shutdown     = NULL;
70--- a/source3/smbd/server_exit.c
71+++ b/source3/smbd/server_exit.c
72@@ -140,9 +140,11 @@ static void exit_server_common(enum serv
73 #endif
74 		rpc_netdfs_shutdown();
75 		rpc_initshutdown_shutdown();
76+#ifdef EXTRA_SERVICES
77 		rpc_eventlog_shutdown();
78-		rpc_ntsvcs_shutdown();
79 		rpc_svcctl_shutdown();
80+		rpc_ntsvcs_shutdown();
81+#endif
82 #ifdef PRINTER_SUPPORT
83 		rpc_spoolss_shutdown();
84 #endif
85--- a/source3/rpcclient/rpcclient.c
86+++ b/source3/rpcclient/rpcclient.c
87@@ -637,9 +637,11 @@ static struct cmd_set *rpcclient_command
88 	shutdown_commands,
89  	test_commands,
90 	wkssvc_commands,
91+#ifdef EXTRA_SERVICES
92 	ntsvcs_commands,
93 	drsuapi_commands,
94 	eventlog_commands,
95+#endif
96 	winreg_commands,
97 	NULL
98 };
99