From 7b065fba15777024e62855151da1f70d92bf3f36 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Sep 03 2019 14:31:05 +0000 Subject: Allow principal to be set during start-tracking It was previously silently dropped by start-tracking. This is handy in an IPA environment for tracking certificates that don't have the principal encoded into the certificate itself. https://pagure.io/certmonger/issue/127 --- diff --git a/src/getcert.c b/src/getcert.c index 432871a..dd08c38 100644 --- a/src/getcert.c +++ b/src/getcert.c @@ -1575,6 +1575,7 @@ add_basic_request(enum cm_tdbus_type bus, char *id, char *cpass, char *cpassfile, char *ca, char *profile, char *issuer, char *ms_template_spec, + char **principal, char *precommand, char *postcommand, char **anchor_dbs, char **anchor_files, int is_ca, int path_length, @@ -1583,8 +1584,8 @@ add_basic_request(enum cm_tdbus_type bus, char *id, { DBusMessage *req, *rep; int i; - struct cm_tdbusm_dict param[30]; - const struct cm_tdbusm_dict *params[30]; + struct cm_tdbusm_dict param[31]; + const struct cm_tdbusm_dict *params[31]; dbus_bool_t b; const char *capath; char *p; @@ -1756,6 +1757,13 @@ add_basic_request(enum cm_tdbus_type bus, char *id, params[i] = ¶m[i]; i++; } + if (principal != NULL) { + param[i].key = CM_DBUS_PROP_TEMPLATE_PRINCIPAL; + param[i].value_type = cm_tdbusm_dict_as; + param[i].value.as = principal; + params[i] = ¶m[i]; + i++; + } if (issuer != NULL) { param[i].key = CM_DBUS_PROP_TEMPLATE_ISSUER; param[i].value_type = cm_tdbusm_dict_s; @@ -2436,6 +2444,7 @@ set_tracking(const char *argv0, const char *category, cpass, cpassfile, ca, profile, issuer, ms_template_spec, + principal, precommand, postcommand, anchor_dbs, anchor_files, is_ca, path_length,