From b608c48ed9815e88c2f26e695016c3b4b266aca4 Mon Sep 17 00:00:00 2001 From: Dan Breslau Date: Fri, 12 Aug 2016 15:32:37 -0400 Subject: [PATCH] Fixed compilation error and error handling. --- src/moonshot-id.vala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/moonshot-id.vala b/src/moonshot-id.vala index df5dd18..46fd088 100644 --- a/src/moonshot-id.vala +++ b/src/moonshot-id.vala @@ -108,10 +108,13 @@ public class TrustAnchor : Object return 0; } - public string? get_expiration_date() + public string? get_expiration_date(out string? err_out=null) { if (this.ca_cert == "") { - return null; + if (&err_out != null) { + err_out = "Trust anchor does not have a ca_certificate"; + return null; + } } string cert = this.ca_cert; @@ -127,14 +130,17 @@ public class TrustAnchor : Object IdCard.logger.trace(@"get_expiration_date: Sending " + cert); char buf[64]; - string err = (string) read_cert_expiration(cert, cert.length, buf, 64); + string err = (string) get_cert_valid_before(cert, cert.length, buf, 64); if (err != "") { - IdCard.logger.error(@"get_expiration_date: got back '$err'"); - return err; + IdCard.logger.error(@"get_expiration_date: get_cert_valid_before returned '$err'"); + if (&err_out != null) { + err_out = err; + } + return null; } string date = (string) buf; - IdCard.logger.trace(@"get_expiration_date: got back '$date'"); + IdCard.logger.trace(@"get_expiration_date: get_cert_valid_before returned '$date'"); return date; } -- 2.1.4