]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Add -p, -F, -K options to kadmind
authorNicolas Williams <nico@cryptonector.com>
Mon, 24 Sep 2012 18:38:20 +0000 (13:38 -0500)
committerGreg Hudson <ghudson@mit.edu>
Fri, 5 Oct 2012 18:11:06 +0000 (14:11 -0400)
New options:

    -p path-to-kdb5_util
    -K path-to-kprop
    -F dump-file

These are needed for testing without first having to install.

ticket: 7372

doc/rst_source/krb_admins/admin_commands/kadmind.rst
src/kadmin/server/ipropd_svc.c
src/kadmin/server/ovsec_kadmd.c

index 573e7a12407ecd3b6f41e438ad280f7b1bd118d8..10fc672cbec2021090a61a386d3998abab2aeba0 100644 (file)
@@ -13,6 +13,9 @@ SYNOPSIS
 [**-nofork**]
 [**-port** *port-number*]
 [**-P** *pid_file*]
+[**-p** *kdb5_util_path*]
+[**-K** *kprop_path*]
+[**-F** *dump_file*]
 
 DESCRIPTION
 -----------
@@ -82,6 +85,18 @@ OPTIONS
     whether kadmind is still running and to allow init scripts to stop
     the correct process.
 
+**-p** *kdb5_util_path*
+    specifies the path to the kdb5_util command to use when dumping the
+    KDB in response to full resync requests when iprop is enabled.
+
+**-K** *kprop_path*
+    specifies the path to the kprop command to use to send full dumps
+    to slaves in response to full resync requests.
+
+**-F** *dump_file*
+    specifies the file path to be used for dumping the KDB in response
+    to full resync requests when iprop is enabled.
+
 **-x** *db_args*
     specifies database-specific arguments.
 
index ffbd02a95fbc5a1a7757abecbcfaa62df7243017..6509474edee392341cc8d13d75aceab927aca18e 100644 (file)
@@ -35,6 +35,9 @@ extern gss_name_t rqst2name(struct svc_req *rqstp);
 extern void *global_server_handle;
 extern int nofork;
 extern short l_port;
+extern char *kdb5_util;
+extern char *kprop;
+extern char *dump_file;
 static char abuf[33];
 
 /* Result is stored in a static buffer and is invalidated by the next call. */
@@ -57,12 +60,12 @@ static char *reply_unknown_str      = "<UNKNOWN_CODE>";
 #ifdef DPRINT
 #undef DPRINT
 #endif
-#define        DPRINT(i, ...)              \
-    do {                                 \
-       if (nofork) {                \
-           fprintf(stderr, __VA_ARGS__); \
-           fflush(stderr);            \
-       }                                \
+#define        DPRINT(i, ...)                          \
+    do {                                       \
+       if (nofork) {                           \
+           fprintf(stderr, __VA_ARGS__);       \
+           fflush(stderr);                     \
+       }                                       \
     } while (0)
 
 
@@ -351,7 +354,7 @@ ipropx_resync(uint32_t vers, struct svc_req *rqstp)
      * subsequent updates very iprop).
      */
     if (asprintf(&ubuf, "%s dump -i%d -c %s",
-                KPROPD_DEFAULT_KDB5_UTIL, vers, KPROP_DEFAULT_FILE) < 0) {
+                kdb5_util, vers, dump_file) < 0) {
        krb5_klog_syslog(LOG_ERR,
                         _("%s: cannot construct kdb5 util dump string too long; out of memory"),
                         whoami);
@@ -406,15 +409,13 @@ ipropx_resync(uint32_t vers, struct svc_req *rqstp)
        }
 
        DPRINT("%s: exec `kprop -f %s %s' ...\n",
-               whoami, KPROP_DEFAULT_FILE, clhost);
+               whoami, dump_file, clhost);
        /* XXX Yuck!  */
        if (getenv("KPROP_PORT")) {
-           pret = execl(KPROP_DEFAULT_FILE, "kprop", "-f",
-                        KPROP_DEFAULT_FILE, "-P", getenv("KPROP_PORT"),
-                        clhost, NULL);
+           pret = execl(kprop, "kprop", "-f", dump_file, "-P",
+                        getenv("KPROP_PORT"), clhost, NULL);
        } else {
-           pret = execl(KPROP_DEFAULT_FILE, "kprop", "-f",
-                        KPROP_DEFAULT_FILE, clhost, NULL);
+           pret = execl(kprop, "kprop", "-f", dump_file, clhost, NULL);
        }
        perror(whoami);
        krb5_klog_syslog(LOG_ERR,
index b77e765619312576145db11660c2a878c81a4951..60a2afbb9ce1e565a8015643b1a0af6cfcacd91a 100644 (file)
@@ -108,7 +108,8 @@ static void usage()
 {
     fprintf(stderr, _("Usage: kadmind [-x db_args]* [-r realm] [-m] [-nofork] "
                       "[-port port-number]\n"
-                      "\t\t[-P pid_file]\n"
+                      "\t\t[-p path-to-kdb5_util] [-F dump-file]\n"
+                      "\t\t[-K path-to-kprop] [-P pid_file]\n"
                       "\nwhere,\n\t[-x db_args]* - any number of database "
                       "specific arguments.\n"
                       "\t\t\tLook at each database documentation for "
@@ -203,6 +204,9 @@ static krb5_context context;
 static krb5_context hctx;
 
 int nofork = 0;
+char *kdb5_util = KPROPD_DEFAULT_KDB5_UTIL;
+char *kprop = KPROPD_DEFAULT_KPROP;
+char *dump_file = KPROP_DEFAULT_FILE;
 
 int main(int argc, char *argv[])
 {
@@ -299,6 +303,21 @@ int main(int argc, char *argv[])
             pid_file = *argv;
         } else if (strcmp(*argv, "-W") == 0) {
             strong_random = 0;
+        } else if (strcmp(*argv, "-p") == 0) {
+            argc--; argv++;
+            if (!argc)
+                usage();
+            kdb5_util = *argv;
+        } else if (strcmp(*argv, "-F") == 0) {
+            argc--; argv++;
+            if (!argc)
+                usage();
+            dump_file = *argv;
+        } else if (strcmp(*argv, "-K") == 0) {
+            argc--; argv++;
+            if (!argc)
+                usage();
+            kprop = *argv;
         } else
             break;
         argc--; argv++;