[2661] in Kerberos-V5-bugs
krb5-libs/369: built-in V4 compat code should figure out realm from V5 config file
daemon@ATHENA.MIT.EDU (Ken Hornstein)
Mon Feb 10 22:20:36 1997
Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, kenh@cmf.nrl.navy.mil
Date: Mon, 10 Feb 1997 22:14:14 -0500 (EST)
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
Reply-To: kenh@cmf.nrl.navy.mil
To: krb5-bugs@MIT.EDU
>Number: 369
>Category: krb5-libs
>Synopsis: The V4 compat code can't figure out the realm from V5 config files
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: change-request
>Submitter-Id: unknown
>Arrival-Date: Mon Feb 10 22:15:01 EST 1997
>Last-Modified:
>Originator: Ken Hornstein
>Organization:
Naval Research Lab
>Release: 1.0
>Environment:
System: SunOS nexus 4.1.4 2 sun4m
Architecture: sun4
>Description:
A fair bit of the supplied V4 compat code knows how to talk to various parts
of V5 (they keytab is a good example).
However, the V4 compat code doesn't know about things like the V5 configuration
files, and cannot do things like determine the default realm. If the V4 code
is modified to optionally use the V5 config files for some of this information,
many V4 programs will can work essentially for free.
>How-To-Repeat:
Try to use a V4 telnet client to talk to a V5 telnetd, and notice the problems
you get if your realm isn't ATHENA.MIT.EDU :-)
>Fix:
This makes the V4 code fall back on using V5 to determine the realm if
a krb.conf isn't present.
--- lib/krb4/g_krbrlm.c.orig Mon Feb 10 18:48:33 1997
+++ lib/krb4/g_krbrlm.c Mon Feb 10 19:05:05 1997
@@ -12,6 +12,7 @@
#include <stdio.h>
#include "krb.h"
#include <string.h>
+#include "k5-int.h"
/*
* krb_get_lrealm takes a pointer to a string, and a number, n. It fills
@@ -44,7 +45,23 @@
cnffile = krb__get_cnffile();
if (!cnffile) {
if (n == 1) {
- (void) strcpy(r, KRB_REALM);
+ krb5_context context;
+ krb5_error_code retcode;
+ char *realm = NULL;
+
+ retcode = krb5_init_context(&context);
+
+ if (retcode || krb5_get_default_realm(context, &realm)) {
+ (void) strcpy(r, KRB_REALM);
+ } else {
+ (void) strcpy(r, realm);
+ }
+
+ if (realm)
+ free(realm);
+
+ if (! retcode)
+ krb5_free_context(context);
return(KSUCCESS);
}
else
>Audit-Trail:
>Unformatted: