allow more crypted password types

This commit is contained in:
leitner
2018-01-05 10:26:27 +00:00
parent e122a756a1
commit f2bbd7c53a

3
auth.c
View File

@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <alloca.h>
#include <string.h>
#include <ctype.h>
#include "ldap.h"
#include "auth.h"
#include <libowfat/str.h>
@@ -31,7 +32,7 @@ int check_password(const char* fromdb,struct string* plaintext) {
if (str_equal(md5,fromdb+5))
return 1;
}
if (plaintext->l<100 && (str_start(fromdb,"$1$") || strlen(fromdb)==13)) {
if (plaintext->l<100 && ((fromdb[0]=='$' && fromdb[2]=='$' && isdigit(fromdb[1])) || strlen(fromdb)==13)) {
char* c=alloca(plaintext->l+1);
byte_copy(c,plaintext->l,plaintext->s);
c[plaintext->l]=0;