mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 00:54:30 +02:00
parent
578dcbe861
commit
80421e4619
@ -62,15 +62,16 @@ int CAListCommand::Run(const boost::program_options::variables_map& vm, const st
|
|||||||
else {
|
else {
|
||||||
ObjectLock olock(requests);
|
ObjectLock olock(requests);
|
||||||
|
|
||||||
std::cout << "Fingerprint | Timestamp | Signed | Subject\n";
|
std::cout << "Fingerprint | Timestamp | Signed | Subject\n";
|
||||||
std::cout << "-----------------------------------------------------------------|---------------------|--------|--------\n";
|
std::cout << "-----------------------------------------------------------------|--------------------------|--------|--------\n";
|
||||||
|
|
||||||
for (auto& kv : requests) {
|
for (auto& kv : requests) {
|
||||||
Dictionary::Ptr request = kv.second;
|
Dictionary::Ptr request = kv.second;
|
||||||
|
|
||||||
std::cout << kv.first
|
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") ? "*" : " ") << " "
|
<< (request->Contains("cert_response") ? "*" : " ") << " "
|
||||||
<< " | "
|
<< " | "
|
||||||
|
@ -393,6 +393,7 @@ static void CollectRequestHandler(const Dictionary::Ptr& requests, const String&
|
|||||||
|
|
||||||
boost::shared_ptr<X509> certRequest = StringToCertificate(certRequestText);
|
boost::shared_ptr<X509> certRequest = StringToCertificate(certRequestText);
|
||||||
|
|
||||||
|
/* XXX (requires OpenSSL >= 1.0.0)
|
||||||
time_t now;
|
time_t now;
|
||||||
time(&now);
|
time(&now);
|
||||||
ASN1_TIME *tm = ASN1_TIME_adj(NULL, now, 0, 0);
|
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;
|
int day, sec;
|
||||||
ASN1_TIME_diff(&day, &sec, tm, X509_get_notBefore(certRequest.get()));
|
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());
|
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;
|
char *data;
|
||||||
long length;
|
long length;
|
||||||
length = BIO_get_mem_data(out, &data);
|
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));
|
result->Set("subject", String(data, data + length));
|
||||||
BIO_free(out);
|
BIO_free(out);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user