--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -92,9 +92,11 @@ bool smb_register_ndr_interface(const st
 
 static bool initialize_interfaces(void)
 {
+#ifdef LSA_SUPPORT
 	if (!smb_register_ndr_interface(&ndr_table_lsarpc)) {
 		return false;
 	}
+#endif
 #ifdef ACTIVE_DIRECTORY
 	if (!smb_register_ndr_interface(&ndr_table_dssetup)) {
 		return false;
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -162,7 +162,9 @@ static void exit_server_common(enum serv
 #ifdef SAMR_SUPPORT
 		rpc_samr_shutdown();
 #endif
+#ifdef LSA_SUPPORT
 		rpc_lsarpc_shutdown();
+#endif
 	}
 
 	/*
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -508,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
 	return true;
 }
 
+#ifdef LSA_SUPPORT
 static bool lsarpc_init_cb(void *ptr)
 {
 	struct dcesrv_ep_context *ep_ctx =
@@ -556,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
 
 	return true;
 }
+#endif
 
 #ifdef SAMR_SUPPORT
 static bool samr_init_cb(void *ptr)
@@ -1106,12 +1108,14 @@ bool dcesrv_ep_setup(struct tevent_conte
 	}
 
 
+#ifdef LSA_SUPPORT
 	lsarpc_cb.init         = lsarpc_init_cb;
 	lsarpc_cb.shutdown     = NULL;
 	lsarpc_cb.private_data = ep_ctx;
 	if (!NT_STATUS_IS_OK(rpc_lsarpc_init(&lsarpc_cb))) {
 		return false;
 	}
+#endif
 
 #ifdef SAMR_SUPPORT
 	samr_cb.init         = samr_init_cb;
--- a/source3/rpc_server/rpc_handles.c
+++ b/source3/rpc_server/rpc_handles.c
@@ -63,7 +63,10 @@ static bool is_samr_lsa_pipe(const struc
 #ifdef SAMR_SUPPORT
 		ndr_syntax_id_equal(syntax, &ndr_table_samr.syntax_id) ||
 #endif
-		ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id);
+#ifdef LSA_SUPPORT
+		ndr_syntax_id_equal(syntax, &ndr_table_lsarpc.syntax_id) ||
+#endif
+		false;
 }
 
 size_t num_pipe_handles(struct pipes_struct *p)
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -419,10 +419,12 @@ static bool check_bind_req(struct pipes_
 		context_fns->allow_connect = false;
 	}
 #endif
+#ifdef LSA_SUPPORT
 	ok = ndr_syntax_id_equal(abstract, &ndr_table_lsarpc.syntax_id);
 	if (ok) {
 		context_fns->allow_connect = false;
 	}
+#endif
 #ifdef NETLOGON_SUPPORT
 	ok = ndr_syntax_id_equal(abstract, &ndr_table_netlogon.syntax_id);
 	if (ok) {
