Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/krb4/lib/krb In krb_get_default_realm(), before ...



details:   https://anonhg.NetBSD.org/src/rev/c27bd8119c4c
branches:  trunk
changeset: 495630:c27bd8119c4c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Aug 02 05:24:37 2000 +0000

description:
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 bae57fb46a1b -r c27bd8119c4c crypto/dist/krb4/lib/krb/get_krbrlm.c
--- a/crypto/dist/krb4/lib/krb/get_krbrlm.c     Wed Aug 02 03:36:39 2000 +0000
+++ b/crypto/dist/krb4/lib/krb/get_krbrlm.c     Wed Aug 02 05:24:37 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.2 2000/08/02 05:24:37 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