summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-06-18 12:58:39 -0400
committerGreg Hudson <ghudson@mit.edu>2014-06-27 16:02:46 -0400
commit1776fd19120d230115527febbd22979eb64ee1ff (patch)
tree778b2b3e2853837af3652b2a80fc90aefbc4c22a
parent7a9990d73537dcdd95bf9b280ebfd560adf8342d (diff)
downloadkrb5-1776fd19120d230115527febbd22979eb64ee1ff.tar.gz
krb5-1776fd19120d230115527febbd22979eb64ee1ff.tar.xz
krb5-1776fd19120d230115527febbd22979eb64ee1ff.zip
Fix KDC worker process argument parsing
To create worker processes, the KDC shuts down realms, forks off the worker processes, then reinitializes realms in each child. Reinitializing realms requires making a second pass over the command-line arguments. To do this with getopt, optind must be reinitialized to 1 for each pass; otherwise, no options will be seen the second time around. ticket: 7945 target_version: 1.12.2 tags: pullup
-rw-r--r--src/kdc/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kdc/main.c b/src/kdc/main.c
index c2bc6c2f0..c3b7b802e 100644
--- a/src/kdc/main.c
+++ b/src/kdc/main.c
@@ -665,9 +665,11 @@ initialize_realms(krb5_context kcontext, int argc, char **argv)
}
/*
- * Loop through the option list. Each time we encounter a realm name,
- * use the previously scanned options to fill in for defaults.
+ * Loop through the option list. Each time we encounter a realm name, use
+ * the previously scanned options to fill in for defaults. We do this
+ * twice if worker processes are used, so we must initialize optind.
*/
+ optind = 1;
while ((c = getopt(argc, argv, "x:r:d:mM:k:R:e:P:p:s:nw:4:T:X3")) != -1) {
switch(c) {
case 'x':