aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-06-18 12:58:39 -0400
committerTom Yu <tlyu@mit.edu>2015-02-06 18:27:26 -0500
commit22252fafbb72653d31e4e9d0027293549e753830 (patch)
treec2f5b93db03ef93596d2ad4c4b9b1686ce1d1306
parent8a9a2d09c93b55ad0dbdd16ae36e952a04f27466 (diff)
downloadkrb5-22252fafbb72653d31e4e9d0027293549e753830.zip
krb5-22252fafbb72653d31e4e9d0027293549e753830.tar.gz
krb5-22252fafbb72653d31e4e9d0027293549e753830.tar.bz2
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. (cherry picked from commit 1776fd19120d230115527febbd22979eb64ee1ff) ticket: 8109 (new) version_fixed: 1.11.6 status: resolved
-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 8a085a2..f71662d 100644
--- a/src/kdc/main.c
+++ b/src/kdc/main.c
@@ -727,9 +727,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':