diff options
| author | Mark Eichin <eichin@mit.edu> | 1995-11-13 01:40:31 +0000 |
|---|---|---|
| committer | Mark Eichin <eichin@mit.edu> | 1995-11-13 01:40:31 +0000 |
| commit | d8fca0e8e14a71a185addde608859af725e44a0e (patch) | |
| tree | 17691daf406fac28883e6ac9ed8d83bca83c9a41 /src/lib | |
| parent | f62b855a72c221335f157501d7a05ca1923a41a8 (diff) | |
| download | krb5-d8fca0e8e14a71a185addde608859af725e44a0e.tar.gz krb5-d8fca0e8e14a71a185addde608859af725e44a0e.tar.xz krb5-d8fca0e8e14a71a185addde608859af725e44a0e.zip | |
* g_cnffile.c (krb__get_srvtabname): new function, looks up
[libdefaults]krb4_srvtab for use where KEYFILE used to be.
* g_cnffile.c (krb__v5_get_file): new function, looks up argument
in [libdefaults] and tries to open it as a filename. Returns
filehandle (or NULL, if fopen failed.)
(krb__get_cnffile, krb__get_realmsfile): use krb__v5_get_file to
look up "krb4_config" or "krb4_realms" respectively. Also add
$KRB_REALMS override for realms file.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7096 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb4/ChangeLog | 11 | ||||
| -rw-r--r-- | src/lib/krb4/g_cnffile.c | 69 |
2 files changed, 76 insertions, 4 deletions
diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog index 6405146e2..8a090da68 100644 --- a/src/lib/krb4/ChangeLog +++ b/src/lib/krb4/ChangeLog @@ -1,3 +1,14 @@ +Sun Nov 12 05:26:08 1995 Mark W. Eichin <eichin@cygnus.com> + + * g_cnffile.c (krb__get_srvtabname): new function, looks up + [libdefaults]krb4_srvtab for use where KEYFILE used to be. + * g_cnffile.c (krb__v5_get_file): new function, looks up argument + in [libdefaults] and tries to open it as a filename. Returns + filehandle (or NULL, if fopen failed.) + (krb__get_cnffile, krb__get_realmsfile): use krb__v5_get_file to + look up "krb4_config" or "krb4_realms" respectively. Also add + $KRB_REALMS override for realms file. + Mon Oct 2 11:12:05 1995 Ezra Peisach <epeisach@kangaroo.mit.edu> * configure.in (V5_MAKE_SHARED_LIB): Change rule to install diff --git a/src/lib/krb4/g_cnffile.c b/src/lib/krb4/g_cnffile.c index b1d38efdf..a212beb12 100644 --- a/src/lib/krb4/g_cnffile.c +++ b/src/lib/krb4/g_cnffile.c @@ -17,6 +17,59 @@ #include <stdio.h> #include <krb.h> +#include "k5-int.h" + +static FILE* +krb__v5_get_file(s) + char *s; +{ + FILE *cnffile = 0; + krb5_context context; + const char* names[3]; + char **full_name = 0, **cpp; + krb5_error_code retval; + + krb5_init_context(&context); + names[0] = "libdefaults"; + names[1] = s; + names[2] = 0; + retval = profile_get_values(context->profile, names, &full_name); + if (retval == 0 && full_name && full_name[0]) { + cnffile = fopen(full_name[0],"r"); + for (cpp = full_name; *cpp; cpp++) + krb5_xfree(*cpp); + krb5_xfree(full_name); + } + krb5_free_context(context); + return cnffile; +} + +char * +krb__get_srvtabname(default_srvtabname) + char *default_srvtabname; +{ + krb5_context context; + const char* names[3]; + char **full_name = 0, **cpp; + krb5_error_code retval; + char *retname; + + krb5_init_context(&context); + names[0] = "libdefaults"; + names[1] = "krb4_srvtab"; + names[2] = 0; + retval = profile_get_values(context->profile, names, &full_name); + if (retval == 0 && full_name && full_name[0]) { + retname = strdup(full_name[0]); + for (cpp = full_name; *cpp; cpp++) + krb5_xfree(*cpp); + krb5_xfree(full_name); + } else { + retname = strdup(default_srvtabname); + } + krb5_free_context(context); + return retname; +} FILE* krb__get_cnffile() @@ -25,8 +78,12 @@ krb__get_cnffile() FILE *cnffile = 0; extern char *getenv(); + /* standard V4 override first */ s = getenv("KRB_CONF"); if (s) cnffile = fopen(s,"r"); + /* if that's wrong, use V5 config */ + if (!cnffile) cnffile = krb__v5_get_file("krb4_config"); + /* and if V5 config doesn't have it, go to hard-coded values */ if (!cnffile) cnffile = fopen(KRB_CONF,"r"); #ifdef ATHENA_CONF_FALLBACK if (!cnffile) cnffile = fopen(KRB_FB_CONF,"r"); @@ -38,13 +95,17 @@ krb__get_cnffile() FILE* krb__get_realmsfile() { - FILE *realmsfile; + FILE *realmsfile = 0; + char *s; - realmsfile = fopen(KRB_RLM_TRANS, "r"); + /* standard (not really) V4 override first */ + s = getenv("KRB_REALMS"); + if (s) realmsfile = fopen(s,"r"); + if (!realmsfile) realmsfile = krb__v5_get_file("krb4_realms"); + if (!realmsfile) realmsfile = fopen(KRB_RLM_TRANS, "r"); #ifdef ATHENA_CONF_FALLBACK - if (realmsfile == (FILE *) 0) - realmsfile = fopen(KRB_FB_RLM_TRANS, "r"); + if (!realmsfile) realmsfile = fopen(KRB_FB_RLM_TRANS, "r"); #endif return realmsfile; |
