kike: fix fingerprint generation and checking

This commit is contained in:
Přemysl Eric Janouch 2014-08-08 10:52:08 +02:00
parent 38887df202
commit e3010f2d6d

View File

@ -227,7 +227,7 @@ irc_is_valid_key (const char *key)
static bool static bool
irc_is_valid_fingerprint (const char *fp) irc_is_valid_fingerprint (const char *fp)
{ {
return irc_regex_match ("^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){20}$", fp); return irc_regex_match ("^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){19}$", fp);
} }
// --- Application data -------------------------------------------------------- // --- Application data --------------------------------------------------------
@ -798,7 +798,7 @@ client_get_ssl_cert_fingerprint (struct client *c)
struct str fingerprint; struct str fingerprint;
str_init (&fingerprint); str_init (&fingerprint);
str_append_printf (&fingerprint, "%02X", hash[0]); str_append_printf (&fingerprint, "%02X", hash[0]);
for (size_t i = 0; i < sizeof hash; i++) for (size_t i = 1; i < sizeof hash; i++)
str_append_printf (&fingerprint, ":%02X", hash[i]); str_append_printf (&fingerprint, ":%02X", hash[i]);
return str_steal (&fingerprint); return str_steal (&fingerprint);
} }