]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Use context profile for libkadm5 configuration
authorGreg Hudson <ghudson@mit.edu>
Mon, 9 May 2022 14:41:47 +0000 (10:41 -0400)
committerGreg Hudson <ghudson@mit.edu>
Wed, 18 May 2022 20:54:45 +0000 (16:54 -0400)
In kadm5_get_config_params(), uxe the context profile instead of
creating a new one with krb5_aprof_init().

In kproplog, obtain the context with kadm5_init_krb5_context() so that
KDC configuration is used.

ticket: 9059 (new)

src/kprop/kproplog.c
src/lib/kadm5/admin.h
src/lib/kadm5/alt_prof.c

index 9d3a910707028b5c806d10c62c43ec1287b25afb..06af2a1d60160067c3c88118fab1ca94e5d7fd17 100644 (file)
@@ -458,7 +458,7 @@ main(int argc, char **argv)
         }
     }
 
-    if (krb5_init_context(&context)) {
+    if (kadm5_init_krb5_context(&context)) {
         fprintf(stderr, _("Unable to initialize Kerberos\n\n"));
         exit(1);
     }
index 7268be44ed9d45e845a88a0bfe94eb531247abfa..296c86fa61cd3372408284ccd0a856ab2836457e 100644 (file)
@@ -291,6 +291,8 @@ typedef struct _kadm5_key_data {
  * functions
  */
 
+/* The use_kdc_config parameter is no longer used, as configuration is
+ * retrieved from the context profile. */
 krb5_error_code kadm5_get_config_params(krb5_context context,
                                         int use_kdc_config,
                                         kadm5_config_params *params_in,
index d166f0aba61fd26f706b1778e5cadca018e3f139..b3ed8a139ed2cde08dfd224b4f287adfd842705a 100644 (file)
@@ -510,8 +510,8 @@ krb5_error_code kadm5_get_config_params(krb5_context context,
                                         kadm5_config_params *params_in,
                                         kadm5_config_params *params_out)
 {
-    char *filename, *envname, *lrealm, *svalue, *sp, *ep, *tp;
-    krb5_pointer aprofile = 0;
+    char *lrealm, *svalue, *sp, *ep, *tp;
+    krb5_pointer aprofile = context->profile;
     const char *hierarchy[4];
     krb5_int32 ivalue;
     kadm5_config_params params, empty_params;
@@ -543,25 +543,6 @@ krb5_error_code kadm5_get_config_params(krb5_context context,
         params.kvno = params_in->kvno;
         params.mask |= KADM5_CONFIG_KVNO;
     }
-    /*
-     * XXX These defaults should to work on both client and
-     * server.  kadm5_get_config_params can be implemented as a
-     * wrapper function in each library that provides correct
-     * defaults for NULL values.
-     */
-    if (use_kdc_config) {
-        filename = DEFAULT_KDC_PROFILE;
-        envname = KDC_PROFILE_ENV;
-    } else {
-        filename = DEFAULT_PROFILE_PATH;
-        envname = "KRB5_CONFIG";
-    }
-    if (context->profile_secure == TRUE)
-        envname = NULL;
-
-    ret = krb5_aprof_init(filename, envname, &aprofile);
-    if (ret)
-        goto cleanup;
 
     /* Initialize realm parameters. */
     hierarchy[0] = KRB5_CONF_REALMS;
@@ -814,7 +795,6 @@ krb5_error_code kadm5_get_config_params(krb5_context context,
     *params_out = params;
 
 cleanup:
-    krb5_aprof_finish(aprofile);
     if (ret) {
         kadm5_free_config_params(context, &params);
         params_out->mask = 0;