From: Ken Raeburn Date: Tue, 4 Oct 2005 20:27:33 +0000 (+0000) Subject: * kdb5.c (kdb_get_conf_section): If the default realm is null, return null. X-Git-Tag: ms-bug-test-20060525~131 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b592dede6b1c04c0da2cd326a0f5ef163931876a;p=krb5.git * kdb5.c (kdb_get_conf_section): If the default realm is null, return null. (krb5_db_open): Don't pass null pointer to sprintf if default_realm is null. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17402 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index cf4127b1d..7107c50f2 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,10 @@ +2005-10-04 Ken Raeburn + + * kdb5.c (kdb_get_conf_section): If the default realm is null, + return null. + (krb5_db_open): Don't pass null pointer to sprintf if + default_realm is null. + 2005-09-22 Ken Raeburn * kdb_db2: Directory moved to modules/kdb/db2. diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index 82bcf8f32..67f03e02f 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -171,7 +171,10 @@ kdb_get_conf_section(krb5_context kcontext) char *result = NULL; char *value = NULL; - /* profile has to be initialized. If profile is not initialized, expect nothing less than a crash */ + if (kcontext->default_realm == NULL) + return NULL; + /* The profile has to have been initialized. If the profile was + not initialized, expect nothing less than a crash. */ status = profile_get_string(kcontext->profile, /* realms */ KDB_REALM_SECTION, @@ -638,7 +641,7 @@ krb5_db_open(krb5_context kcontext, char **db_args, int mode) if (section == NULL) { sprintf(buf, "unable to determine configuration section for realm %s\n", - kcontext->default_realm); + kcontext->default_realm ? kcontext->default_realm : "[UNSET]"); status = -1; krb5_set_err(kcontext, krb5_err_have_str, status, buf); goto clean_n_exit;