diff --git a/src/auth.c b/src/auth.c index 69dd3c3..6d94b46 100644 --- a/src/auth.c +++ b/src/auth.c @@ -552,14 +552,14 @@ int acl_password_verify(struct acl_handle* acl, struct user* user, const char* p uint64_t tiger_res[3]; if (!password || !user || strlen(password) != MAX_CID_LEN) - return password_invalid; + return 0; access = acl_get_access_info(acl, user->id.nick); if (!access || !access->password) - return password_invalid; + return 0; if (TIGERSIZE+strlen(access->password) >= 1024) - return password_invalid; + return 0; challenge = acl_password_generate_challenge(acl, user); @@ -574,9 +574,9 @@ int acl_password_verify(struct acl_handle* acl, struct user* user, const char* p if (strcasecmp(password, password_calc) == 0) { - return password_ok; + return 1; } - return password_invalid; + return 0; } diff --git a/src/auth.h b/src/auth.h index e3c57d1..09ddb7c 100644 --- a/src/auth.h +++ b/src/auth.h @@ -24,18 +24,6 @@ struct hub_config; struct user; struct ip_addr_encap; -enum password_status -{ - password_invalid = 0, - password_ok = 1, -}; - -enum acl_status -{ - acl_not_found = 0, - acl_found = 1, -}; - enum user_credentials { cred_none, /**<<< "User has no credentials (not yet logged in)" */ @@ -93,6 +81,13 @@ extern int acl_user_unban_cid(struct acl_handle* handle, const char* cid); extern int acl_check_ip_range(struct ip_addr_encap* addr, struct ip_ban_record* info); extern const char* acl_password_generate_challenge(struct acl_handle* acl, struct user* user); + +/** + * Verify a password. + * + * @param password the hashed password (based on the nonce). + * @return 1 if the password matches, or 0 if the password is incorrect. + */ extern int acl_password_verify(struct acl_handle* acl, struct user* user, const char* password); #endif /* HAVE_UHUB_ACL_H */