[985] in Kerberos-V5-bugs

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

Correction to code for guessing KDC in unknown realm

tytso@ATHENA.MIT.EDU (tytso@ATHENA.MIT.EDU)
Fri Dec 9 14:09:34 1994

Date: Sat, 3 Dec 1994 13:01:17 -0800
From: Clifford Neuman <bcn@ISI.EDU>
To: bug-kerberos@MIT.EDU

Unfortunately, there was a bug in the module that I sent on 1
december.  This is the revised enhancement to the locate_kdc function,
that if included should probably be surrounded by an #ifdef of your
choice.

What it does is it tells the locate_kdc function that if it can not
find the krb.conf file, or if it finds the file but cant find a line
for the requested realm, to make a guess that the KDC for the realm
is:

KERBEROS.<realm-name>

With this in place, you should be able to run clients on hosts that
don't have a configuration file.  We made the change to our libraries
because we needed it for our NetCheque software.

---
*** locate_kdc.c.orig	Wed Jun 22 12:51:28 1994
--- locate_kdc.c	Fri Dec  2 14:02:05 1994
***************
*** 73,82 ****
  #endif
  
      hostlist = 0;
      
!     if (code = krb5_get_krbhst (realm, &hostlist))
! 	return(code);
  
  #ifdef KRB5_USE_INET
      if (sp = getservbyname(krb5_kdc_udp_portname, "udp"))
  	udpport = sp->s_port;
--- 73,106 ----
  #endif
  
      hostlist = 0;
      
!     if (code = krb5_get_krbhst (realm, &hostlist)) {
! 	/* Can't get it from file, let's make it ourselves */
! 	char tempbuf[BUFSIZ];
! 	char tempbuf1[BUFSIZ];
! 
! 	register char **rethlist = 0;
! 	int hlindex = 0;
! 	int hlsize = 2;
! 
! 	rethlist = (char **)calloc(hlsize, sizeof (*rethlist));
! 
! 	memcpy(tempbuf1, realm->data, realm->length);        
!         tempbuf1[realm->length] = '\0'; 
! 
!         sprintf(tempbuf,"KERBEROS.%s",tempbuf1);
! 
! 	rethlist[0] = strdup(tempbuf);
! 	if (!rethlist[0]) {
! 	    krb5_xfree(rethlist);
! 	    rethlist = 0;
! 	    return(code);
! 	}
! 	rethlist[1] = 0;
! 	hostlist = rethlist;
!     }
!     
  
  #ifdef KRB5_USE_INET
      if (sp = getservbyname(krb5_kdc_udp_portname, "udp"))
  	udpport = sp->s_port;

--[0676]--

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