diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-10-06 14:22:27 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-10-06 14:22:27 +0200 |
commit | cf85e1319b7072a3a166ad1949a047eab610a4a6 (patch) | |
tree | 57a4d07ad164a79365c5c1e0b2ffafcc4c53fd9f /src/libstrongswan/plugins/x509/x509_ac.c | |
parent | afdaa9e5bf465848ba24f983f01f0320cecaac8b (diff) | |
download | strongswan-cf85e1319b7072a3a166ad1949a047eab610a4a6.tar.bz2 strongswan-cf85e1319b7072a3a166ad1949a047eab610a4a6.tar.xz |
streamlined output from get_validity()
Diffstat (limited to 'src/libstrongswan/plugins/x509/x509_ac.c')
-rw-r--r-- | src/libstrongswan/plugins/x509/x509_ac.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/libstrongswan/plugins/x509/x509_ac.c b/src/libstrongswan/plugins/x509/x509_ac.c index 5e8ea2e71..79ff80933 100644 --- a/src/libstrongswan/plugins/x509/x509_ac.c +++ b/src/libstrongswan/plugins/x509/x509_ac.c @@ -798,16 +798,8 @@ static private_x509_ac_t* get_ref(private_x509_ac_t *this) static bool get_validity(private_x509_ac_t *this, time_t *when, time_t *not_before, time_t *not_after) { - time_t t; + time_t t = when ? *when : time(NULL); - if (when) - { - t = *when; - } - else - { - t = time(NULL); - } if (not_before) { *not_before = this->notBefore; @@ -816,19 +808,7 @@ static bool get_validity(private_x509_ac_t *this, time_t *when, { *not_after = this->notAfter; } - if (t < this->notBefore) - { - DBG1("attribute certificate is not valid before %T", - this->notBefore, TRUE); - return FALSE; - } - if (t > this->notAfter) - { - DBG1("attribute certificate expired on %T", - this->notAfter, TRUE); - return FALSE; - } - return TRUE; + return (t >= this->notBefore && t <= this->notAfter); } /** @@ -844,7 +824,7 @@ static bool is_newer(private_x509_ac_t *this, ac_t *that) this_cert->get_validity(this_cert, &now, &this_update, NULL); that_cert->get_validity(that_cert, &now, &that_update, NULL); new = this_update > that_update; - DBG1(" attr cert from %T is %s - existing attr_cert from %T %s", + DBG1(" attr cert from %T is %s - existing attr cert from %T %s", &this_update, FALSE, new ? "newer":"not newer", &that_update, FALSE, new ? "replaced":"retained"); return new; |