s3-messaging: use messaging_ctdbd_reinit() in messaging_reinit()
authorRalph Boehme <slow@samba.org>
Sat, 9 Jul 2016 12:33:52 +0000 (14:33 +0200)
committerRalph Boehme <slow@samba.org>
Mon, 11 Jul 2016 21:45:20 +0000 (23:45 +0200)
This is the last step to fix a regression introduced by

  3fe3226daa8488e0fa787c40359c3401b6f05fc0 and
  3fe3226daa8488e0fa787c40359c3401b6f05fc0^

where we pass the ctdb-messaging object conn to db_open() and add a
reference to it to the private db_ctdb_ctx for later use. Unfortunately
reinit_after_fork() destroys conn, leaving us with an invalid reference.

The previous patches added new lower level functions
messaging_ctdbd_reinit() and ctdbd_reinit_connection(), finally use them
them from messaging_reinit(). They preserve the conn object and simply
reinitialize the IPC fd.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jul 11 23:45:20 CEST 2016 on sn-devel-144

source3/lib/messages.c

index 65e975ec788fcbf9ff0ac80c1db606a666d85aad..5d90947678e221b6be44756aaf4a63af7430426b 100644 (file)
@@ -416,11 +416,9 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
                return map_nt_error_from_unix(ret);
        }
 
-       TALLOC_FREE(msg_ctx->remote);
-
        if (lp_clustering()) {
-               ret = messaging_ctdbd_init(msg_ctx, msg_ctx,
-                                          &msg_ctx->remote);
+               ret = messaging_ctdbd_reinit(msg_ctx, msg_ctx,
+                                            msg_ctx->remote);
 
                if (ret != 0) {
                        DEBUG(1, ("messaging_ctdbd_init failed: %s\n",