mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-06 21:03:12 +02:00
add autodetect for AUTHTYPE_SSL_CLIENTCERTFP
This commit is contained in:
+17
@@ -66,6 +66,23 @@ int Auth_AutoDetectHashType(char *hash)
|
||||
char *saltstr, *hashstr;
|
||||
int bits;
|
||||
|
||||
if (!strchr(hash, '$'))
|
||||
{
|
||||
/* SHA256 SSL fingerprint perhaps?
|
||||
* These are exactly 64 bytes (00112233..etc..) or 95 bytes (00:11:22:33:etc) in size.
|
||||
*/
|
||||
if ((strlen(hash) == 64) || (strlen(hash) == 95))
|
||||
{
|
||||
char *p;
|
||||
char hexchars[16] = "0123456789abcdef";
|
||||
for (p = hash; *p; p++)
|
||||
if ((*hash != ':') && !strchr(hexchars, *p))
|
||||
return AUTHTYPE_PLAINTEXT; /* not hex and not colon */
|
||||
|
||||
return AUTHTYPE_SSL_CLIENTCERTFP;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*hash != '$') || !strchr(hash+1, '$'))
|
||||
return AUTHTYPE_PLAINTEXT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user