Skip to content

Commit

Permalink
Add -p, -F, -C options to kadmind
Browse files Browse the repository at this point in the history
New options:

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

These are needed for testing without first having to install.
  • Loading branch information
nicowilliams committed Sep 25, 2012
1 parent 5c94434 commit 0fd8ba6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
15 changes: 15 additions & 0 deletions doc/rst_source/krb_admins/admin_commands/kadmind.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ SYNOPSIS
[**-nofork**]
[**-port** *port-number*]
[**-P** *pid_file*]
[**-p** *kdb5_util_path*]
[**-C** *kprop_path*]
[**-F** *dump_file*]

DESCRIPTION
-----------
Expand Down Expand Up @@ -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.

**-C** *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.

Expand Down
11 changes: 7 additions & 4 deletions src/kadmin/server/ipropd_svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -406,13 +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",
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,
_("%s: exec failed: %s"),
Expand Down
22 changes: 21 additions & 1 deletion src/kadmin/server/ovsec_kadmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[-C 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 "
Expand Down Expand Up @@ -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[])
{
Expand Down Expand Up @@ -299,6 +303,22 @@ int main(int argc, char *argv[])
pid_file = *argv;
} else if (strcmp(*argv, "-W") == 0) {
strong_random = 0;
/* Match usage from kpropd for -p and -F */
} 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, "-C") == 0) {
argc--; argv++;
if (!argc)
usage();
kprop = *argv;
} else
break;
argc--; argv++;
Expand Down

0 comments on commit 0fd8ba6

Please sign in to comment.