diff options
author | Greg Hudson <ghudson@mit.edu> | 2022-05-09 10:55:41 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2022-05-18 16:55:17 -0400 |
commit | 6448bb43cb2ff02b3b9716b953c39a05f3b0569b (patch) | |
tree | 2bb6a84fcbd4a6660910f912af06e92b81b9fc67 | |
parent | 49a857808b918440793daa81c8fe352326623fef (diff) | |
download | krb5-6448bb43cb2ff02b3b9716b953c39a05f3b0569b.zip krb5-6448bb43cb2ff02b3b9716b953c39a05f3b0569b.tar.gz krb5-6448bb43cb2ff02b3b9716b953c39a05f3b0569b.tar.bz2 |
Remove krb5_aprof_init() and krb5_aprof_finish()
These functions are not part of the API, as they are prototyped in the
internal header adm_proto.h. Stop using them in kdc/main.c (instead
using the context profile) and stop defining them.
-rw-r--r-- | src/include/adm_proto.h | 2 | ||||
-rw-r--r-- | src/kdc/main.c | 68 | ||||
-rw-r--r-- | src/lib/kadm5/alt_prof.c | 62 | ||||
-rw-r--r-- | src/lib/kadm5/clnt/libkadm5clnt_mit.exports | 2 | ||||
-rw-r--r-- | src/lib/kadm5/srv/libkadm5srv_mit.exports | 2 |
5 files changed, 32 insertions, 104 deletions
diff --git a/src/include/adm_proto.h b/src/include/adm_proto.h index 70a3bdf..5d876aa 100644 --- a/src/include/adm_proto.h +++ b/src/include/adm_proto.h @@ -58,7 +58,6 @@ int krb5_klog_syslog(int, const char *, ...) void krb5_klog_reopen (krb5_context); /* alt_prof.c */ -krb5_error_code krb5_aprof_init(char *, char *, krb5_pointer *); krb5_error_code krb5_aprof_getvals(krb5_pointer, const char **, char ***); krb5_error_code krb5_aprof_get_boolean(krb5_pointer, const char **, int, krb5_boolean *); @@ -70,7 +69,6 @@ krb5_error_code krb5_aprof_get_string_all(krb5_pointer, const char **, char **); krb5_error_code krb5_aprof_get_int32(krb5_pointer, const char **, krb5_boolean, krb5_int32 *); -krb5_error_code krb5_aprof_finish(krb5_pointer); /* str_conv.c */ krb5_error_code krb5_flagspec_to_mask(const char *, diff --git a/src/kdc/main.c b/src/kdc/main.c index 074680d..be6e361 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -608,7 +608,7 @@ initialize_realms(krb5_context kcontext, int argc, char **argv, krb5_boolean def_restrict_anon; char *def_udp_listen = NULL; char *def_tcp_listen = NULL; - krb5_pointer aprof = NULL; + krb5_pointer aprof = kcontext->profile; const char *hierarchy[3]; char *no_referral = NULL; char *hostbased = NULL; @@ -617,40 +617,38 @@ initialize_realms(krb5_context kcontext, int argc, char **argv, extern char *optarg; - if (!krb5_aprof_init(DEFAULT_KDC_PROFILE, KDC_PROFILE_ENV, &aprof)) { - hierarchy[0] = KRB5_CONF_KDCDEFAULTS; - hierarchy[1] = KRB5_CONF_KDC_LISTEN; - hierarchy[2] = (char *) NULL; - if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_udp_listen)) { - hierarchy[1] = KRB5_CONF_KDC_PORTS; - if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_udp_listen)) - def_udp_listen = NULL; - } - hierarchy[1] = KRB5_CONF_KDC_TCP_LISTEN; - if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_tcp_listen)) { - hierarchy[1] = KRB5_CONF_KDC_TCP_PORTS; - if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_tcp_listen)) - def_tcp_listen = NULL; - } - hierarchy[1] = KRB5_CONF_KDC_MAX_DGRAM_REPLY_SIZE; - if (krb5_aprof_get_int32(aprof, hierarchy, TRUE, &max_dgram_reply_size)) - max_dgram_reply_size = MAX_DGRAM_SIZE; - if (tcp_listen_backlog_out != NULL) { - hierarchy[1] = KRB5_CONF_KDC_TCP_LISTEN_BACKLOG; - if (krb5_aprof_get_int32(aprof, hierarchy, TRUE, - tcp_listen_backlog_out)) - *tcp_listen_backlog_out = DEFAULT_TCP_LISTEN_BACKLOG; - } - hierarchy[1] = KRB5_CONF_RESTRICT_ANONYMOUS_TO_TGT; - if (krb5_aprof_get_boolean(aprof, hierarchy, TRUE, &def_restrict_anon)) - def_restrict_anon = FALSE; - hierarchy[1] = KRB5_CONF_NO_HOST_REFERRAL; - if (krb5_aprof_get_string_all(aprof, hierarchy, &no_referral)) - no_referral = 0; - hierarchy[1] = KRB5_CONF_HOST_BASED_SERVICES; - if (krb5_aprof_get_string_all(aprof, hierarchy, &hostbased)) - hostbased = 0; + hierarchy[0] = KRB5_CONF_KDCDEFAULTS; + hierarchy[1] = KRB5_CONF_KDC_LISTEN; + hierarchy[2] = NULL; + if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_udp_listen)) { + hierarchy[1] = KRB5_CONF_KDC_PORTS; + if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_udp_listen)) + def_udp_listen = NULL; + } + hierarchy[1] = KRB5_CONF_KDC_TCP_LISTEN; + if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_tcp_listen)) { + hierarchy[1] = KRB5_CONF_KDC_TCP_PORTS; + if (krb5_aprof_get_string(aprof, hierarchy, TRUE, &def_tcp_listen)) + def_tcp_listen = NULL; + } + hierarchy[1] = KRB5_CONF_KDC_MAX_DGRAM_REPLY_SIZE; + if (krb5_aprof_get_int32(aprof, hierarchy, TRUE, &max_dgram_reply_size)) + max_dgram_reply_size = MAX_DGRAM_SIZE; + if (tcp_listen_backlog_out != NULL) { + hierarchy[1] = KRB5_CONF_KDC_TCP_LISTEN_BACKLOG; + if (krb5_aprof_get_int32(aprof, hierarchy, TRUE, + tcp_listen_backlog_out)) + *tcp_listen_backlog_out = DEFAULT_TCP_LISTEN_BACKLOG; } + hierarchy[1] = KRB5_CONF_RESTRICT_ANONYMOUS_TO_TGT; + if (krb5_aprof_get_boolean(aprof, hierarchy, TRUE, &def_restrict_anon)) + def_restrict_anon = FALSE; + hierarchy[1] = KRB5_CONF_NO_HOST_REFERRAL; + if (krb5_aprof_get_string_all(aprof, hierarchy, &no_referral)) + no_referral = 0; + hierarchy[1] = KRB5_CONF_HOST_BASED_SERVICES; + if (krb5_aprof_get_string_all(aprof, hierarchy, &hostbased)) + hostbased = 0; if (def_udp_listen == NULL) { def_udp_listen = strdup(DEFAULT_KDC_UDP_PORTLIST); @@ -836,8 +834,6 @@ initialize_realms(krb5_context kcontext, int argc, char **argv, free(hostbased); if (no_referral) free(no_referral); - if (aprof) - krb5_aprof_finish(aprof); return; } diff --git a/src/lib/kadm5/alt_prof.c b/src/lib/kadm5/alt_prof.c index b3ed8a1..e8c1f51 100644 --- a/src/lib/kadm5/alt_prof.c +++ b/src/lib/kadm5/alt_prof.c @@ -50,52 +50,6 @@ copy_key_salt_tuple(krb5_key_salt_tuple *ksalt, krb5_int32 len) } /* - * krb5_aprof_init() - Initialize alternate profile context. - * - * Parameters: - * fname - default file name of the profile. - * envname - environment variable which can override fname - * acontextp - Pointer to opaque context for alternate profile - * - * Returns: - * error codes from profile_init() - */ -krb5_error_code -krb5_aprof_init(char *fname, char *envname, krb5_pointer *acontextp) -{ - krb5_error_code ret; - profile_t profile; - const char *kdc_config; - char **filenames; - int i; - struct k5buf buf; - - ret = krb5_get_default_config_files(&filenames); - if (ret) - return ret; - if (envname == NULL || (kdc_config = secure_getenv(envname)) == NULL) - kdc_config = fname; - k5_buf_init_dynamic(&buf); - if (kdc_config) - k5_buf_add(&buf, kdc_config); - for (i = 0; filenames[i] != NULL; i++) { - if (buf.len > 0) - k5_buf_add(&buf, ":"); - k5_buf_add(&buf, filenames[i]); - } - krb5_free_config_files(filenames); - if (k5_buf_status(&buf) != 0) - return ENOMEM; - profile = (profile_t) NULL; - ret = profile_init_path(buf.data, &profile); - k5_buf_free(&buf); - if (ret) - return ret; - *acontextp = profile; - return 0; -} - -/* * krb5_aprof_getvals() - Get values from alternate profile. * * Parameters: @@ -345,22 +299,6 @@ krb5_aprof_get_int32(krb5_pointer acontext, const char **hierarchy, } /* - * krb5_aprof_finish() - Finish alternate profile context. - * - * Parameter: - * acontext - opaque context for alternate profile. - * - * Returns: - * 0 on success, something else on failure. - */ -krb5_error_code -krb5_aprof_finish(krb5_pointer acontext) -{ - profile_release(acontext); - return 0; -} - -/* * Returns nonzero if it found something to copy; the caller may still need to * check the output field or mask to see if the copy (allocation) was * successful. Returns zero if nothing was found to copy, and thus the caller diff --git a/src/lib/kadm5/clnt/libkadm5clnt_mit.exports b/src/lib/kadm5/clnt/libkadm5clnt_mit.exports index e41c8e4..9ed7d52 100644 --- a/src/lib/kadm5/clnt/libkadm5clnt_mit.exports +++ b/src/lib/kadm5/clnt/libkadm5clnt_mit.exports @@ -45,13 +45,11 @@ kadm5_setkey_principal kadm5_setkey_principal_3 kadm5_setkey_principal_4 kadm5_unlock -krb5_aprof_finish krb5_aprof_get_boolean krb5_aprof_get_deltat krb5_aprof_get_int32 krb5_aprof_get_string krb5_aprof_getvals -krb5_aprof_init krb5_flagnum_to_string krb5_flagspec_to_mask krb5_flags_to_strings diff --git a/src/lib/kadm5/srv/libkadm5srv_mit.exports b/src/lib/kadm5/srv/libkadm5srv_mit.exports index 6804f1e..14c02a7 100644 --- a/src/lib/kadm5/srv/libkadm5srv_mit.exports +++ b/src/lib/kadm5/srv/libkadm5srv_mit.exports @@ -51,14 +51,12 @@ kdb_init_hist kdb_init_master kdb_iter_entry kdb_put_entry -krb5_aprof_finish krb5_aprof_get_boolean krb5_aprof_get_deltat krb5_aprof_get_int32 krb5_aprof_get_string krb5_aprof_get_string_all krb5_aprof_getvals -krb5_aprof_init krb5_copy_key_data_contents krb5_flagnum_to_string krb5_flagspec_to_mask |