From 01b6db9dc2170f8a31a5f52b737c157e24871d07 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Apr 24 2020 17:30:59 +0000 Subject: template_profile, issuer and MS certificat template are single-value These can only be single valued so trying to retrieve them as multi-value will always return NULL. Use the single API instead to correctly retrieve and display the values. --- diff --git a/src/getcert.c b/src/getcert.c index 0d434c3..bd270fa 100644 --- a/src/getcert.c +++ b/src/getcert.c @@ -3891,23 +3891,21 @@ list(const char *argv0, int argc, const char **argv) printf("\t\t%s\n", as[j]); } } - as = query_prop_as(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, - CM_DBUS_PROP_TEMPLATE_PROFILE, - verbose, globals.tctx); - if (as != NULL) { - printf(_("\tprofile: %s\n"), as); + s1 = query_prop_s(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, + CM_DBUS_PROP_TEMPLATE_PROFILE, verbose, globals.tctx); + if (s1 != NULL && strlen(s1) > 0) { + printf(_("\tprofile: %s\n"), s1); } - as = query_prop_as(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, - CM_DBUS_PROP_TEMPLATE_MS_CERTIFICATE_TEMPLATE, - verbose, globals.tctx); - if (as != NULL) { - printf(_("\tms v2 template: %s\n"), as); + s1 = query_prop_s(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, + CM_DBUS_PROP_TEMPLATE_MS_CERTIFICATE_TEMPLATE, + verbose, globals.tctx); + if (s1 != NULL && strlen(s1) > 0) { + printf(_("\tms v2 template: %s\n"), s1); } - as = query_prop_as(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, - CM_DBUS_PROP_TEMPLATE_ISSUER, - verbose, globals.tctx); - if (as != NULL) { - printf(_("\tissuer template: %s\n"), as); + s1 = query_prop_s(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, + CM_DBUS_PROP_TEMPLATE_ISSUER, verbose, globals.tctx); + if (s1 != NULL && strlen(s1) > 0) { + printf(_("\tissuer template: %s\n"), s1); } printf(_("\tpre-save command: %s\n"), query_prop_s(bus, requests[i], CM_DBUS_REQUEST_INTERFACE, diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out index 9f05e0e..4d6a9a5 100644 --- a/tests/028-dbus/expected.out +++ b/tests/028-dbus/expected.out @@ -17,6 +17,7 @@ Request ID 'Buddy': key usage: digitalSignature,dataEncipherment eku: id-kp-serverAuth certificate template/profile: SomeProfileName + profile: SomeProfileName pre-save command: echo Pre post-save command: echo Post track: yes