[comp.protocols.kerberos] kadmin bug + fix

lunt@CTT.BELLCORE.COM (Steve Lunt) (03/14/91)

	When executing kadmin, if I did a "cap" (change_admin_password) it
would core dump.  This was because the realm (krbrlm) wasn't being set for this case.  The following diff to kadmin/kadmin.c fixes this.

-- Steve

       Steven J. Lunt         |  lunt@ctt.bellcore.com  |  RRC 1L-213
Computer Security Technology  |-------------------------|  444 Hoes Lane
          Bellcore            |     (908) 699-4244      |  Piscataway, NJ 08854


*** kadmin.c.old	Wed Mar 13 13:24:54 1991
--- kadmin.c		Wed Mar 13 13:26:22 1991
***************
*** 447,461 ****
  	if (krb_get_lrealm(default_realm, 1) != KSUCCESS)
  	    strcpy(default_realm, KRB_REALM);
  
- 	/* 
- 	 * If we can reach the local realm, initialize to it.  Otherwise,
- 	 * don't initialize.
- 	 */
- 	if (kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm) != KADM_SUCCESS)
- 	    bzero(krbrlm, sizeof(krbrlm));
- 	else
- 	    strcpy(krbrlm, default_realm);
- 
  	while ((c = getopt(argc, argv, OPTION_STRING)) != EOF) 
  	    switch (c) {
  	      case 'u':
--- 447,452 ----
***************
*** 485,490 ****
--- 476,490 ----
  	    }
  	    (void) strcpy(myname, pw->pw_name);
  	}
+ 
+ 	/* 
+ 	 * If we can reach the local realm, initialize to it.  Otherwise,
+ 	 * don't initialize.
+ 	 */
+ 	strcpy(krbrlm, default_realm);
+ 	if (kadm_init_link(PWSERV_NAME, KRB_MASTER, krbrlm) != KADM_SUCCESS)
+ 	    bzero(krbrlm, sizeof(krbrlm));
+ 
  	inited = 1;
      }
  }