smbd/winbindd: Do an early check if ctdbd is functional
[mat/samba.git] / source3 / smbd / server.c
index d3cd33ec90bd1e3421a4b43351ba50b388c823a5..3536f18cf4983aab738212e5e793fd110f3b242d 100644 (file)
@@ -1214,6 +1214,17 @@ extern void build_options(bool screen);
                exit(1);
        }
 
+       if (lp_clustering()) {
+               NTSTATUS status;
+
+               status = ctdbd_probe();
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("clustering=yes but ctdbd connect failed: "
+                                 "%s\n", nt_errstr(status)));
+                       exit(1);
+               }
+       }
+
        /* Init the security context and global current_user */
        init_sec_ctx();