diff options
| author | Zhanna Tsitkov <tsitkova@mit.edu> | 2012-02-03 19:22:44 +0000 |
|---|---|---|
| committer | Zhanna Tsitkov <tsitkova@mit.edu> | 2012-02-03 19:22:44 +0000 |
| commit | 766d43105fd4f15fdc7be9c236f14f237cf7f6a6 (patch) | |
| tree | bbbdb35fdcc6b742e6d655ca7a5f9ca460034bcf /src/util/profile | |
| parent | cc587e04483345509a8f5f21edd3de6e52e33a35 (diff) | |
| download | krb5-766d43105fd4f15fdc7be9c236f14f237cf7f6a6.tar.gz krb5-766d43105fd4f15fdc7be9c236f14f237cf7f6a6.tar.xz krb5-766d43105fd4f15fdc7be9c236f14f237cf7f6a6.zip | |
Added a new trace logging message TRACE_PROFILE_ERR to improve the diagnostics of the potential misconfiguration.
Added profile_get_(string/integer/boolean)_nodef functions to the profile library to get the typed values from the configuration
files (without setting these values to the defaults).
Used TRACE_PROFILE_ERR for the configuration diagnostics in krb5_init_context_profile API.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25669 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile')
| -rw-r--r-- | src/util/profile/libprofile.exports | 5 | ||||
| -rw-r--r-- | src/util/profile/prof_get.c | 59 | ||||
| -rw-r--r-- | src/util/profile/profile.hin | 9 |
3 files changed, 71 insertions, 2 deletions
diff --git a/src/util/profile/libprofile.exports b/src/util/profile/libprofile.exports index 3f02b4f4f4..743bc4901e 100644 --- a/src/util/profile/libprofile.exports +++ b/src/util/profile/libprofile.exports @@ -7,8 +7,11 @@ profile_flush profile_free_list profile_get_boolean profile_get_integer -profile_get_relation_names profile_get_string +profile_get_boolean_nodef +profile_get_integer_nodef +profile_get_string_nodef +profile_get_relation_names profile_get_subsection_names profile_get_values profile_init diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 3eba787222..b4f6ee82bc 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -280,6 +280,23 @@ profile_get_string(profile_t profile, const char *name, const char *subname, return 0; } +errcode_t KRB5_CALLCONV +profile_get_string_nodef(profile_t profile, const char **names, char **ret_string) +{ + char *value = NULL; + errcode_t retval = 0; + + if (profile == 0) + return 0; + + retval = profile_get_value(profile, names, &value); + if (retval == 0) { + *ret_string = value; + return 0; + } else if (retval != PROF_NO_SECTION && retval != PROF_NO_RELATION) + return retval; +} + static errcode_t parse_int(const char *value, int *ret_int) { @@ -334,11 +351,30 @@ profile_get_integer(profile_t profile, const char *name, const char *subname, return retval; } +errcode_t KRB5_CALLCONV +profile_get_integer_nodef(profile_t profile, const char **names, int *ret_int) +{ + char *value = NULL; + errcode_t retval = 0; + + if (profile == 0) + return 0; + + retval = profile_get_value(profile, names, &value); + if (retval == PROF_NO_SECTION || retval == PROF_NO_RELATION) { + return retval; + } else if (retval) + return retval; + + retval = parse_int(value, ret_int); + free(value); + return retval; +} + static const char *const conf_yes[] = { "y", "yes", "true", "t", "1", "on", 0, }; - static const char *const conf_no[] = { "n", "no", "false", "nil", "0", "off", 0, @@ -398,6 +434,27 @@ profile_get_boolean(profile_t profile, const char *name, const char *subname, return retval; } +errcode_t KRB5_CALLCONV +profile_get_boolean_nodef(profile_t profile, const char **names, + int *ret_boolean) +{ + char *value = NULL; + errcode_t retval = 0; + + if (profile == 0) + return 0; + + retval = profile_get_value(profile, names, &value); + if (retval == PROF_NO_SECTION || retval == PROF_NO_RELATION) { + return retval; + } else if (retval) + return retval; + + retval = profile_parse_boolean(value, ret_boolean); + free(value); + return retval; +} + /* * This function will return the list of the names of subections in the * under the specified section name. diff --git a/src/util/profile/profile.hin b/src/util/profile/profile.hin index 45ad55430b..db437d6aa7 100644 --- a/src/util/profile/profile.hin +++ b/src/util/profile/profile.hin @@ -91,6 +91,15 @@ long KRB5_CALLCONV profile_get_boolean const char *subsubname, int def_val, int *ret_default); +long KRB5_CALLCONV profile_get_string_nodef + (profile_t profile, const char **names, char **ret_string); + +long KRB5_CALLCONV profile_get_integer_nodef + (profile_t profile, const char **names, int *ret_default); + +long KRB5_CALLCONV profile_get_boolean_nodef + (profile_t profile, const char **names, int *ret_default); + long KRB5_CALLCONV profile_get_relation_names (profile_t profile, const char **names, char ***ret_names); |
