Default to SYSLOG' when there is no
default' in krb5.conf.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2716 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -205,23 +205,10 @@ open_file(struct facility *fac, char *filename, char *mode,
|
||||
fac->data = fd;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_openlog(krb5_context context,
|
||||
const char *program,
|
||||
krb5_log_facility **fac)
|
||||
static int
|
||||
openlog_int(krb5_context context, const char *program,
|
||||
krb5_log_facility *f, const char *p)
|
||||
{
|
||||
const char *p;
|
||||
const char *logname = program;
|
||||
krb5_log_facility *f;
|
||||
struct facility *fp;
|
||||
krb5_config_binding *binding = NULL;
|
||||
f = calloc(1, sizeof(*f));
|
||||
if(krb5_config_get_string(context->cf, "logging", program, NULL) == NULL)
|
||||
logname = "default";
|
||||
while(p = krb5_config_get_next(context->cf, &binding, STRING,
|
||||
"logging",
|
||||
logname,
|
||||
NULL)){
|
||||
struct facility *fp = NULL;
|
||||
int min = 0, max = -1, n;
|
||||
char c;
|
||||
@@ -237,7 +224,7 @@ krb5_openlog(krb5_context context,
|
||||
}
|
||||
if(n){
|
||||
p = strchr(p, '/');
|
||||
if(p == NULL) continue;
|
||||
if(p == NULL) return 0;
|
||||
p++;
|
||||
}
|
||||
if(strcmp(p, "STDERR") == 0){
|
||||
@@ -278,7 +265,36 @@ krb5_openlog(krb5_context context,
|
||||
fp->min = min;
|
||||
fp->max = max;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_openlog(krb5_context context,
|
||||
const char *program,
|
||||
krb5_log_facility **fac)
|
||||
{
|
||||
const char *p;
|
||||
krb5_log_facility *f = calloc(1, sizeof(*f));
|
||||
krb5_config_binding *binding = NULL;
|
||||
int done = 0;
|
||||
while(p = krb5_config_get_next(context->cf, &binding, STRING,
|
||||
"logging",
|
||||
program,
|
||||
NULL)){
|
||||
openlog_int(context, program, f, p);
|
||||
done = 1;
|
||||
}
|
||||
if(!done){
|
||||
while(p = krb5_config_get_next(context->cf, &binding, STRING,
|
||||
"logging",
|
||||
"default",
|
||||
NULL)){
|
||||
openlog_int(context, program, f, p);
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
if(!done)
|
||||
openlog_int(context, program, f, "SYSLOG");
|
||||
*fac = f;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user