diff -ruN tpop3d-cvs/password.c tpop3d/password.c --- tpop3d-cvs/password.c 2003-04-03 19:41:57.000000000 +0200 +++ tpop3d/password.c 2003-07-13 14:50:41.000000000 +0200 @@ -240,7 +240,7 @@ /* Helper macro to detect schemes. */ # define IS_SCHEME(hash, scheme, def) \ ((*hash == '{' && strncmp(hash, scheme, strlen(scheme)) == 0) \ - || strcmp(scheme, def) == 0) + || (*hash != '{' && strcmp(scheme, def) == 0)) if (IS_SCHEME(pwhash, "{crypt}", default_crypt_scheme)) { /* Password hashed by system crypt function. */ @@ -274,7 +274,7 @@ * encoding. */ if (strlen(realhash) == 32) { /* Hex. */ - return strcasecmp(realhash, md5_digest_str(pass, strlen(pass), 0)); + return strcasecmp(realhash, md5_digest_str(pass, strlen(pass), 0)) == 0; } else if (strlen(pwhash) == 24) { /* Base 64. */ return strcmp(realhash, md5_digest_str(pass, strlen(pass), 1)) == 0;