diff options
Diffstat (limited to 'src/charon/plugins/stroke')
-rw-r--r-- | src/charon/plugins/stroke/stroke_attribute.c | 1 | ||||
-rw-r--r-- | src/charon/plugins/stroke/stroke_cred.c | 7 | ||||
-rw-r--r-- | src/charon/plugins/stroke/stroke_list.c | 42 |
3 files changed, 28 insertions, 22 deletions
diff --git a/src/charon/plugins/stroke/stroke_attribute.c b/src/charon/plugins/stroke/stroke_attribute.c index 7591a1e27..f850b5320 100644 --- a/src/charon/plugins/stroke/stroke_attribute.c +++ b/src/charon/plugins/stroke/stroke_attribute.c @@ -307,6 +307,7 @@ static bool release_address(private_stroke_attribute_t *this, { DBG1(DBG_CFG, "lease %H of %D went offline", address, id); pool->offline->put(pool->offline, id, (void*)offset); + found = TRUE; } } } diff --git a/src/charon/plugins/stroke/stroke_cred.c b/src/charon/plugins/stroke/stroke_cred.c index 07e0ca768..434aec22b 100644 --- a/src/charon/plugins/stroke/stroke_cred.c +++ b/src/charon/plugins/stroke/stroke_cred.c @@ -804,7 +804,7 @@ static void load_secrets(private_stroke_cred_t *this) } else if (match("PIN", &token)) { - chunk_t sc = chunk_empty; + chunk_t sc = chunk_empty, secret = chunk_empty; char smartcard[32], keyid[22], pin[32]; private_key_t *key; u_int slot; @@ -847,13 +847,13 @@ static void load_secrets(private_stroke_cred_t *this) DBG1(DBG_CFG, "line %d: expected PIN", line_nr); goto error; } - ugh = extract_secret(&chunk, &line); + ugh = extract_secret(&secret, &line); if (ugh != NULL) { DBG1(DBG_CFG, "line %d: malformed PIN: %s", line_nr, ugh); goto error; } - snprintf(pin, sizeof(pin), "%.*s", chunk.len, chunk.ptr); + snprintf(pin, sizeof(pin), "%.*s", secret.len, secret.ptr); pin[sizeof(pin) - 1] = '\0'; /* we assume an RSA key */ @@ -867,6 +867,7 @@ static void load_secrets(private_stroke_cred_t *this) this->private->insert_last(this->private, key); } memset(pin, 0, sizeof(pin)); + chunk_clear(&secret); } else if ((match("PSK", &token) && (type = SHARED_IKE)) || (match("EAP", &token) && (type = SHARED_EAP)) || diff --git a/src/charon/plugins/stroke/stroke_list.c b/src/charon/plugins/stroke/stroke_list.c index 8042875c9..94b3def3a 100644 --- a/src/charon/plugins/stroke/stroke_list.c +++ b/src/charon/plugins/stroke/stroke_list.c @@ -88,7 +88,7 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all) time_t established; established = ike_sa->get_statistic(ike_sa, STAT_ESTABLISHED); - fprintf(out, " %#V ago", &now, &established); + fprintf(out, " %V ago", &now, &established); } fprintf(out, ", %H[%D]...%H[%D]\n", @@ -116,11 +116,11 @@ static void log_ike_sa(FILE *out, ike_sa_t *ike_sa, bool all) if (rekey) { - fprintf(out, ", rekeying in %#V", &rekey, &now); + fprintf(out, ", rekeying in %V", &rekey, &now); } if (reauth) { - fprintf(out, ", %N reauthentication in %#V", auth_class_names, + fprintf(out, ", %N reauthentication in %V", auth_class_names, get_auth_class(ike_sa->get_peer_cfg(ike_sa)), &reauth, &now); } @@ -212,7 +212,7 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all) rekey = child_sa->get_lifetime(child_sa, FALSE); if (rekey) { - fprintf(out, "in %#V", &now, &rekey); + fprintf(out, "in %V", &now, &rekey); } else { @@ -265,12 +265,12 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo char *plugin, *pool; host_t *host; u_int32_t dpd; - time_t uptime = time(NULL) - this->uptime; + time_t now = time(NULL); bool first = TRUE; u_int size, online, offline; fprintf(out, "Performance:\n"); - fprintf(out, " uptime: %V, since %#T\n", &uptime, &this->uptime, FALSE); + fprintf(out, " uptime: %V, since %T\n", &now, &this->uptime, &this->uptime, FALSE); fprintf(out, " worker threads: %d idle of %d,", charon->processor->get_idle_threads(charon->processor), charon->processor->get_total_threads(charon->processor)); @@ -290,6 +290,10 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo enumerator = this->attribute->create_pool_enumerator(this->attribute); while (enumerator->enumerate(enumerator, &pool, &size, &online, &offline)) { + if (name && !streq(name, pool)) + { + continue; + } if (first) { first = FALSE; @@ -655,26 +659,26 @@ static void stroke_list_certs(linked_list_t *list, char *label, /* list validity */ cert->get_validity(cert, &now, ¬Before, ¬After); - fprintf(out, " validity: not before %#T, ", ¬Before, utc); + fprintf(out, " validity: not before %T, ", ¬Before, utc); if (now < notBefore) { - fprintf(out, "not valid yet (valid in %#V)\n", &now, ¬Before); + fprintf(out, "not valid yet (valid in %V)\n", &now, ¬Before); } else { fprintf(out, "ok\n"); } - fprintf(out, " not after %#T, ", ¬After, utc); + fprintf(out, " not after %T, ", ¬After, utc); if (now > notAfter) { - fprintf(out, "expired (%#V ago)\n", &now, ¬After); + fprintf(out, "expired (%V ago)\n", &now, ¬After); } else { fprintf(out, "ok"); if (now > notAfter - CERT_WARNING_INTERVAL * 60 * 60 * 24) { - fprintf(out, " (expires in %#V)", &now, ¬After); + fprintf(out, " (expires in %V)", &now, ¬After); } fprintf(out, " \n"); } @@ -755,18 +759,18 @@ static void stroke_list_acerts(linked_list_t *list, bool utc, FILE *out) /* list validity */ cert->get_validity(cert, &now, &thisUpdate, &nextUpdate); - fprintf(out, " updates: this %#T\n", &thisUpdate, utc); - fprintf(out, " next %#T, ", &nextUpdate, utc); + fprintf(out, " updates: this %T\n", &thisUpdate, utc); + fprintf(out, " next %T, ", &nextUpdate, utc); if (now > nextUpdate) { - fprintf(out, "expired (%#V ago)\n", &now, &nextUpdate); + fprintf(out, "expired (%V ago)\n", &now, &nextUpdate); } else { fprintf(out, "ok"); if (now > nextUpdate - AC_WARNING_INTERVAL * 60 * 60 * 24) { - fprintf(out, " (expires in %#V)", &now, &nextUpdate); + fprintf(out, " (expires in %V)", &now, &nextUpdate); } fprintf(out, " \n"); } @@ -828,18 +832,18 @@ static void stroke_list_crls(linked_list_t *list, bool utc, FILE *out) /* list validity */ cert->get_validity(cert, &now, &thisUpdate, &nextUpdate); - fprintf(out, " updates: this %#T\n", &thisUpdate, utc); - fprintf(out, " next %#T, ", &nextUpdate, utc); + fprintf(out, " updates: this %T\n", &thisUpdate, utc); + fprintf(out, " next %T, ", &nextUpdate, utc); if (now > nextUpdate) { - fprintf(out, "expired (%#V ago)\n", &now, &nextUpdate); + fprintf(out, "expired (%V ago)\n", &now, &nextUpdate); } else { fprintf(out, "ok"); if (now > nextUpdate - CRL_WARNING_INTERVAL * 60 * 60 * 24) { - fprintf(out, " (expires in %#V)", &now, &nextUpdate); + fprintf(out, " (expires in %V)", &now, &nextUpdate); } fprintf(out, " \n"); } |