Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/crypto/dist/krb4/lib/krb Pull up rev. 1.2 (approved by ...



details:   https://anonhg.NetBSD.org/src/rev/f19ca7a9dd78
branches:  netbsd-1-5
changeset: 488855:f19ca7a9dd78
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Aug 02 21:14:01 2000 +0000

description:
Pull up rev. 1.2 (approved by jhawk):
In krb_get_default_realm(), before assuming our guessed default
realm is correct, check to see if we can find a KDC for it.  If
not, it can't possibly be the default realm, and we should return
the NO.DEFAULT.REALM error condition.

Per a discussion w/ Thor Simon <tls%netbsd.org@localhost>.

diffstat:

 crypto/dist/krb4/lib/krb/get_krbrlm.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 580cb5b43018 -r f19ca7a9dd78 crypto/dist/krb4/lib/krb/get_krbrlm.c
--- a/crypto/dist/krb4/lib/krb/get_krbrlm.c     Wed Aug 02 20:01:54 2000 +0000
+++ b/crypto/dist/krb4/lib/krb/get_krbrlm.c     Wed Aug 02 21:14:01 2000 +0000
@@ -33,7 +33,7 @@
 
 #include "krb_locl.h"
 
-RCSID("$Id: get_krbrlm.c,v 1.1.1.1 2000/06/16 18:45:53 thorpej Exp $");
+RCSID("$Id: get_krbrlm.c,v 1.1.1.1.2.1 2000/08/02 21:14:01 thorpej Exp $");
 
 /*
  * krb_get_lrealm takes a pointer to a string, and a number, n.  It fills
@@ -130,8 +130,16 @@
 
        gethostname(hostname, sizeof(hostname));
        t = krb_realmofhost(hostname);
-       if (t && strcmp(t, no_default_realm) != 0)
-           strlcpy(local_realm, t, sizeof(local_realm));
+       if (t && strcmp(t, no_default_realm) != 0) {
+           /*
+            * Before just assuming this can be the default
+            * realm, make sure there's a KDC.  If not, it
+            * can't possibly be, and should therefore
+            * return NO.DEFAULT.REALM.
+            */
+           if (krb_get_host(1, t, 0) != NULL)
+               strlcpy(local_realm, t, sizeof(local_realm));
+       }
     }
     return local_realm;
 }



Home | Main Index | Thread Index | Old Index