From 6647e77c34b9c55d53ea54e3a80b6831fb8628e1 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Apr 09 2015 22:23:10 +0000 Subject: Expose certificate validity as D-Bus properties Expose the not-valid-before and not-valid-after info that we read from certificates as D-Bus properties (ticket #41). While we're updating the D-Bus property tests, set a profile name and pre- and post-save commands, so that we can also verify that we can read those. --- diff --git a/src/tdbus.h b/src/tdbus.h index 1fe80df..edfb36b 100644 --- a/src/tdbus.h +++ b/src/tdbus.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009,2011,2012,2014 Red Hat, Inc. + * Copyright (C) 2009,2011,2012,2014,2015 Red Hat, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,6 +47,8 @@ #define CM_DBUS_PROP_CERT_ISSUER "issuer" #define CM_DBUS_PROP_CERT_SERIAL "serial" #define CM_DBUS_PROP_CERT_SUBJECT "subject" +#define CM_DBUS_PROP_CERT_NOT_VALID_BEFORE "not-valid-before" +#define CM_DBUS_PROP_CERT_NOT_VALID_AFTER "not-valid-after" #define CM_DBUS_PROP_CERT_EMAIL "email" #define CM_DBUS_PROP_CERT_KU "ku" #define CM_DBUS_PROP_CERT_EKU "eku" diff --git a/src/tdbush.c b/src/tdbush.c index a77cd60..f333c35 100644 --- a/src/tdbush.c +++ b/src/tdbush.c @@ -6155,6 +6155,22 @@ cm_tdbush_iface_request(void) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), make_interface_item(cm_tdbush_interface_property, + make_property(CM_DBUS_PROP_CERT_NOT_VALID_BEFORE, + cm_tdbush_property_number, + cm_tdbush_property_read, + cm_tdbush_property_time_t, + offsetof(struct cm_store_entry, cm_cert_not_before), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL), + make_interface_item(cm_tdbush_interface_property, + make_property(CM_DBUS_PROP_CERT_NOT_VALID_AFTER, + cm_tdbush_property_number, + cm_tdbush_property_read, + cm_tdbush_property_time_t, + offsetof(struct cm_store_entry, cm_cert_not_after), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL), + make_interface_item(cm_tdbush_interface_property, make_property(CM_DBUS_PROP_CERT_EMAIL, cm_tdbush_property_strings, cm_tdbush_property_read, @@ -6855,7 +6871,7 @@ cm_tdbush_iface_request(void) make_interface_item(cm_tdbush_interface_signal, make_signal(CM_DBUS_SIGNAL_REQUEST_CERT_SAVED, NULL), - NULL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + NULL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); } return ret; } diff --git a/tests/028-dbus/entry b/tests/028-dbus/entry index b4148db..ae1a8af 100644 --- a/tests/028-dbus/entry +++ b/tests/028-dbus/entry @@ -16,7 +16,11 @@ template_is_ca=0 template_ca_path_length=0 template_no_ocsp_check=0 template_ns_comment=Comments For Everyone -template_profile=Left +template_profile=SomeProfileName +pre_certsave_command=echo Pre +pre_certsave_uid=0 +post_certsave_command=echo Post +post_certsave_uid=0 ca_name=local autorenew=1 monitor=1 diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out index 90e5e1f..6acde1c 100644 --- a/tests/028-dbus/expected.out +++ b/tests/028-dbus/expected.out @@ -15,8 +15,9 @@ Request ID 'Buddy': principal name: host/localhost@LOCALHOST key usage: digitalSignature,dataEncipherment eku: id-kp-serverAuth - pre-save command: - post-save command: + certificate template/profile: SomeProfileName + pre-save command: echo Pre + post-save command: echo Post track: yes auto-renew: yes CA 'local': @@ -273,6 +274,8 @@ OK + +