]> granicus.if.org Git - icinga2/commitdiff
Build fix for OpenSSL < 1.0.2
authorGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 12 Sep 2017 11:09:16 +0000 (13:09 +0200)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 12 Sep 2017 11:09:16 +0000 (13:09 +0200)
refs #5450

lib/cli/calistcommand.cpp
lib/remote/pkiutility.cpp

index e44717188a551a5dbd97ca568cc9db1de8656bf6..fff0115d030dd4d0ac49196bcc296549940081d3 100644 (file)
@@ -62,15 +62,16 @@ int CAListCommand::Run(const boost::program_options::variables_map& vm, const st
        else {
                ObjectLock olock(requests);
 
-               std::cout << "Fingerprint                                                      | Timestamp           | Signed | Subject\n";
-               std::cout << "-----------------------------------------------------------------|---------------------|--------|--------\n";
+               std::cout << "Fingerprint                                                      | Timestamp                | Signed | Subject\n";
+               std::cout << "-----------------------------------------------------------------|--------------------------|--------|--------\n";
 
                for (auto& kv : requests) {
                        Dictionary::Ptr request = kv.second;
 
                        std::cout << kv.first
                            << " | "
-                           << Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", request->Get("timestamp"))
+/*                         << Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", request->Get("timestamp")) */
+                           << request->Get("timestamp")
                            << " | "
                            << (request->Contains("cert_response") ? "*" : " ") << "     "
                            << " | "
index c3d9917557f396865f1745cf8208973c09a89377..6e8443bd55d4c9c2428b7a3a153a74588986316e 100644 (file)
@@ -393,6 +393,7 @@ static void CollectRequestHandler(const Dictionary::Ptr& requests, const String&
 
        boost::shared_ptr<X509> certRequest = StringToCertificate(certRequestText);
 
+/* XXX (requires OpenSSL >= 1.0.0)
        time_t now;
        time(&now);
        ASN1_TIME *tm = ASN1_TIME_adj(NULL, now, 0, 0);
@@ -400,15 +401,23 @@ static void CollectRequestHandler(const Dictionary::Ptr& requests, const String&
        int day, sec;
        ASN1_TIME_diff(&day, &sec, tm, X509_get_notBefore(certRequest.get()));
 
-       result->Set("timestamp",  static_cast<double>(now) + day * 24 * 60 * 60 + sec);
+       result->Set("timestamp",  static_cast<double>(now) + day * 24 * 60 * 60 + sec); */
 
        BIO *out = BIO_new(BIO_s_mem());
-       X509_NAME_print_ex(out, X509_get_subject_name(certRequest.get()), 0, XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB);
+       ASN1_TIME_print(out, X509_get_notBefore(certRequest.get()));
 
        char *data;
        long length;
        length = BIO_get_mem_data(out, &data);
 
+       result->Set("timestamp", String(data, data + length));
+       BIO_free(out);
+
+       out = BIO_new(BIO_s_mem());
+       X509_NAME_print_ex(out, X509_get_subject_name(certRequest.get()), 0, XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB);
+
+       length = BIO_get_mem_data(out, &data);
+
        result->Set("subject", String(data, data + length));
        BIO_free(out);