summaryrefslogtreecommitdiffstats
path: root/src/lib/krb4/g_cnffile.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1998-11-13 20:44:06 +0000
committerTheodore Tso <tytso@mit.edu>1998-11-13 20:44:06 +0000
commit759d9842b70ef7923f49c82cd65d7d261a2cb051 (patch)
tree3b73a9a64ee56b13f477279ec3b556756452e19f /src/lib/krb4/g_cnffile.c
parent02945421829aabe975f3b58220fd1db4f7360743 (diff)
downloadkrb5-759d9842b70ef7923f49c82cd65d7d261a2cb051.tar.gz
krb5-759d9842b70ef7923f49c82cd65d7d261a2cb051.tar.xz
krb5-759d9842b70ef7923f49c82cd65d7d261a2cb051.zip
Makefile.in: Set the myfulldir and mydir variables (which are relative
to buildtop and thisconfigdir, respectively.) configure.in: Remove KRB5_POSIX_LOCKS test. win_store.c (krb__get_srvtabname): g_cnffile.c: Use krb5__krb4_context instead of init'ing and free'ing a krb5_context each time we need to read data from the configuration file. We also define krb5__krb4_context in g_cnnfile.c, since it's a likely that any use of the krb4 library will pull in that file. tf_util.c (tf_init): Use krb5_lock_file instead of trying to roll our own flock emulation. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11026 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb4/g_cnffile.c')
-rw-r--r--src/lib/krb4/g_cnffile.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/krb4/g_cnffile.c b/src/lib/krb4/g_cnffile.c
index 569789f89..c50cd50e4 100644
--- a/src/lib/krb4/g_cnffile.c
+++ b/src/lib/krb4/g_cnffile.c
@@ -19,29 +19,31 @@
#include "krb.h"
#include "k5-int.h"
+krb5_context krb5__krb4_context = 0;
+
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);
+ if (!krb5__krb4_context)
+ krb5_init_context(&krb5__krb4_context);
names[0] = "libdefaults";
names[1] = s;
names[2] = 0;
- if (context) {
- retval = profile_get_values(context->profile, names, &full_name);
+ if (krb5__krb4_context) {
+ retval = profile_get_values(krb5__krb4_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;
}
@@ -50,18 +52,19 @@ 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);
+ if (!krb5__krb4_context)
+ krb5_init_context(&krb5__krb4_context);
names[0] = "libdefaults";
names[1] = "krb4_srvtab";
names[2] = 0;
- if (context &&
- (retval = profile_get_values(context->profile, names, &full_name))
+ if (krb5__krb4_context &&
+ (retval = profile_get_values(krb5__krb4_context->profile, names,
+ &full_name))
&& retval == 0 && full_name && full_name[0]) {
retname = strdup(full_name[0]);
for (cpp = full_name; *cpp; cpp++)
@@ -70,8 +73,6 @@ krb__get_srvtabname(default_srvtabname)
}else {
retname = strdup(default_srvtabname);
}
- if (context != NULL)
- krb5_free_context(context);
return retname;
}