smbd/winbindd: Do an early check if ctdbd is functional
[nivanova/samba-autobuild/.git] / source3 / lib / ctdbd_conn.c
index 70833cb91d042b9fff7eb0134bb2cc1d004a36ee..6ab4bbe70466e5e875fa18d8f27698fe51ec59a6 100644 (file)
@@ -1822,8 +1822,32 @@ NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn)
        return status;
 }
 
+NTSTATUS ctdbd_probe(void)
+{
+       /*
+        * Do a very early check if ctdbd is around to avoid an abort and core
+        * later
+        */
+       struct ctdbd_connection *conn = NULL;
+       NTSTATUS status;
+
+       status = ctdbd_messaging_connection(talloc_tos(), &conn);
+
+       /*
+        * We only care if we can connect.
+        */
+       TALLOC_FREE(conn);
+
+       return status;
+}
+
 #else
 
+NTSTATUS ctdbd_probe(void)
+{
+       return NT_STATUS_OK;
+}
+
 NTSTATUS ctdbd_messaging_send_blob(struct ctdbd_connection *conn,
                                   uint32_t dst_vnn, uint64_t dst_srvid,
                                   const uint8_t *buf, size_t buflen)