[28753] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit [krb5-1.11]: Fix KDC worker process argument parsing

daemon@ATHENA.MIT.EDU (Tom Yu)
Fri Feb 6 18:44:43 2015

Date: Fri, 6 Feb 2015 18:44:37 -0500
From: Tom Yu <tlyu@mit.edu>
Message-Id: <201502062344.t16NibwW001146@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/22252fafbb72653d31e4e9d0027293549e753830
commit 22252fafbb72653d31e4e9d0027293549e753830
Author: Greg Hudson <ghudson@mit.edu>
Date:   Wed Jun 18 12:58:39 2014 -0400

    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

 src/kdc/main.c |    6 ++++--
 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':
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post