1--- a/source3/librpc/rpc/rpc_common.c
2+++ b/source3/librpc/rpc/rpc_common.c
3@@ -92,9 +92,11 @@ bool smb_register_ndr_interface(const st
4 
5 static bool initialize_interfaces(void)
6 {
7+#ifdef LSA_SUPPORT
8 	if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
9 		return false;
10 	}
11+#endif
12 #ifdef ACTIVE_DIRECTORY
13 	if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
14 		return false;
15--- a/source3/smbd/server_exit.c
16+++ b/source3/smbd/server_exit.c
17@@ -162,7 +162,9 @@ static void exit_server_common(enum serv
18 #ifdef SAMR_SUPPORT
19 		rpc_samr_shutdown();
20 #endif
21+#ifdef LSA_SUPPORT
22 		rpc_lsarpc_shutdown();
23+#endif
24 	}
25 
26 	/*
27--- a/source3/rpc_server/rpc_ep_setup.c
28+++ b/source3/rpc_server/rpc_ep_setup.c
29@@ -508,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
30 	return true;
31 }
32 
33+#ifdef LSA_SUPPORT
34 static bool lsarpc_init_cb(void *ptr)
35 {
36 	struct dcesrv_ep_context *ep_ctx =
37@@ -556,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
38 
39 	return true;
40 }
41+#endif
42 
43 #ifdef SAMR_SUPPORT
44 static bool samr_init_cb(void *ptr)
45@@ -1106,12 +1108,14 @@ bool dcesrv_ep_setup(struct tevent_conte
46 	}
47 
48 
49+#ifdef LSA_SUPPORT
50 	lsarpc_cb.init         = lsarpc_init_cb;
51 	lsarpc_cb.shutdown     = NULL;
52 	lsarpc_cb.private_data = ep_ctx;
53 	if (!NT_STATUS_IS_OK(rpc_lsarpc_init(&lsarpc_cb))) {
54 		return false;
55 	}
56+#endif
57 
58 #ifdef SAMR_SUPPORT
59 	samr_cb.init         = samr_init_cb;
60--- a/source3/rpc_server/rpc_handles.c
61+++ b/source3/rpc_server/rpc_handles.c
62@@ -63,7 +63,10 @@ static bool is_samr_lsa_pipe(const struc
63 #ifdef SAMR_SUPPORT
64 		ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
65 #endif
66-		ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
67+#ifdef LSA_SUPPORT
68+		ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id) ||
69+#endif
70+		false;
71 }
72 
73 size_t num_pipe_handles(struct pipes_struct *p)
74--- a/source3/rpc_server/srv_pipe.c
75+++ b/source3/rpc_server/srv_pipe.c
76@@ -419,10 +419,12 @@ static bool check_bind_req(struct pipes_
77 		context_fns->allow_connect = false;
78 	}
79 #endif
80+#ifdef LSA_SUPPORT
81 	ok = ndr_syntax_id_equal(abstract, &ndr_table_lsarpc.syntax_id);
82 	if (ok) {
83 		context_fns->allow_connect = false;
84 	}
85+#endif
86 #ifdef NETLOGON_SUPPORT
87 	ok = ndr_syntax_id_equal(abstract, &ndr_table_netlogon.syntax_id);
88 	if (ok) {
89