+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
#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()
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");
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;