[krbdev.mit.edu #8161] patch for kpropd -t (runonce) full propagation

John Devitofranceschi via RT rt-comment at krbdev.mit.edu
Thu Mar 26 08:24:48 EDT 2015


I've been looking at the code for kpropd and I came up with this patch.

It allows the fullprop child to live, if necessary AND it picks up all the incremental changes to boot!

--- kpropd.c-   2015-02-11 22:16:43.000000000 -0500
+++ kpropd.c    2015-03-25 21:10:17.147687869 -0400
@@ -92,6 +92,7 @@

char *def_realm = NULL;
int runonce = 0;
+int waitfor_do_standalone = 0;

/*
 * This struct simulates the use of _kadm5_server_handle_t
@@ -321,8 +322,15 @@
    default:
        retval = do_iprop();
        /* do_iprop() can return due to failures and runonce. */
-        kill(fullprop_child, SIGHUP);
-        wait(NULL);
+        if (runonce == 1 && waitfor_do_standalone == 1) {
+            int status;
+            (void) waitpid(fullprop_child, &status, 0);
+            waitfor_do_standalone++;
+            retval = main(argc, argv); /* pick up incremental changes, too */
+        } else {
+            kill(fullprop_child, SIGHUP);
+            wait(NULL);
+        }
        if (retval)
            com_err(progname, retval, _("do_iprop failed.\n"));
        else
@@ -841,6 +849,7 @@
                    fprintf(stderr, _("Full resync request granted\n"));
                syslog(LOG_INFO, _("Full resync request granted."));
                backoff_cnt = 0;
+              waitfor_do_standalone++;
                break;

            case UPDATE_BUSY:




Here it is in action:

Needing fullprop:
$ sudo ./kpropd -d -t 
ready
Incremental propagation enabled
waiting for a kprop connection
Initializing kadm5 as client kiprop/topper21.foonon.com at FOONON.COM
kadm5 initialization succeeded
Calling iprop_get_updates_1 (sno=0 sec=1427332239 usec=919246)
Full resync needed
Full resync request granted
Connection from endless.foonon.com
krb5_recvauth(5, kprop5_01, host/topper21.foonon.com at FOONON.COM, ...)
authenticated client: host/endless.foonon.com at FOONON.COM (etype == AES-256 CTS mode with 96-bit SHA-1 HMAC)
Full propagation transfer started.
Full propagation transfer finished.
calling kdb5_util to load database
Load PID is 26490
Database load process for full propagation completed.
ready
Incremental propagation enabled
waiting for a kprop connection
Initializing kadm5 as client kiprop/topper21.foonon.com at FOONON.COM
kadm5 initialization succeeded
Calling iprop_get_updates_1 (sno=1 sec=1427036750 usec=158517)
Got incremental updates (sno=16 sec=1427279653 usec=832057)
Incremental updates: 15 updates / 32778 us

Everything up to date:
$ sudo ./kpropd -d -t 
ready
Incremental propagation enabled
waiting for a kprop connection
Initializing kadm5 as client kiprop/topper21.foonon.com at FOONON.COM
kadm5 initialization succeeded
Calling iprop_get_updates_1 (sno=16 sec=1427279653 usec=832057)
KDC is synchronized with master.



More information about the krb5-bugs mailing list