s3-rpc_server: Disable listening on tcpip ports by default.
[samba.git] / source3 / rpc_server / rpc_service_setup.c
index f5716cdab900661141e2cc2374c9e8721fbe8928..a9633fb35522411f6e78cf23f837bc0abcb653aa 100644 (file)
@@ -972,6 +972,7 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
                     struct messaging_context *msg_ctx)
 {
        struct dcerpc_binding_vector *v;
+       const char *rpcsrv_type;
        TALLOC_CTX *tmp_ctx;
        NTSTATUS status;
        bool ok;
@@ -993,14 +994,22 @@ bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
                goto done;
        }
 
-       status = rpc_setup_tcpip_sockets(ev_ctx,
-                                        msg_ctx,
-                                        &ndr_table_winreg,
-                                        v,
-                                        0);
-       if (!NT_STATUS_IS_OK(status)) {
-               ok = false;
-               goto done;
+       rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
+                                          "rpc_server",
+                                          "tcpip",
+                                          "no");
+
+       if (strcasecmp_m(rpcsrv_type, "yes") == 0 ||
+           strcasecmp_m(rpcsrv_type, "true") == 0) {
+               status = rpc_setup_tcpip_sockets(ev_ctx,
+                                                msg_ctx,
+                                                &ndr_table_winreg,
+                                                v,
+                                                0);
+               if (!NT_STATUS_IS_OK(status)) {
+                       ok = false;
+                       goto done;
+               }
        }
 
        ok = rpc_setup_winreg(ev_ctx, msg_ctx, v);