krb5: Add krb5_set_config() for test_cc

This commit is contained in:
Nicolas Williams
2020-03-11 13:40:02 -05:00
parent 86bb80d7cf
commit bc5070d36f
3 changed files with 38 additions and 0 deletions

View File

@@ -764,6 +764,42 @@ krb5_set_config_files(krb5_context context, char **filenames)
return ret;
}
#ifndef HEIMDAL_SMALLER
/**
* Reinit the context from configuration file contents in a C string.
* This should only be used in tests.
*
* @param context context to add configuration too.
* @param config configuration.
*
* @return Returns 0 to indicate success. Otherwise an kerberos et
* error code is returned, see krb5_get_error_message().
*
* @ingroup krb5
*/
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_set_config(krb5_context context, const char *config)
{
krb5_error_code ret;
krb5_config_binding *tmp = NULL;
if ((ret = krb5_config_parse_string_multi(context, config, &tmp)))
return ret;
#if 0
/* with this enabled and if there are no config files, Kerberos is
considererd disabled */
if(tmp == NULL)
return ENXIO;
#endif
krb5_config_file_free(context, context->cf);
context->cf = tmp;
ret = init_context_from_config_file(context);
return ret;
}
#endif
static krb5_error_code
add_file(char ***pfilenames, int *len, char *file)
{

View File

@@ -601,6 +601,7 @@ EXPORTS
krb5_sendto_ctx_set_type
krb5_sendto_kdc
krb5_sendto_kdc_flags
krb5_set_config
krb5_set_config_files
krb5_set_debug_dest
krb5_set_default_in_tkt_etypes

View File

@@ -594,6 +594,7 @@ HEIMDAL_KRB5_2.0 {
krb5_sendto_ctx_set_type;
krb5_sendto_kdc;
krb5_sendto_kdc_flags;
krb5_set_config;
krb5_set_config_files;
krb5_set_debug_dest;
krb5_set_default_in_tkt_etypes;