
cherokee at cherokee-project
Nov 15, 2009, 2:04 PM
Post #1 of 1
(129 views)
Permalink
|
|
[3823] cherokee/trunk/cherokee/validator_htpasswd.c: Clean up: Generalizes the "password cannot be empty" check.
|
|
Revision: 3823 http://svn.cherokee-project.com/changeset/3823 Author: alo Date: 2009-11-15 23:04:00 +0100 (Sun, 15 Nov 2009) Log Message: ----------- Clean up: Generalizes the "password cannot be empty" check. Modified Paths: -------------- cherokee/trunk/cherokee/validator_htpasswd.c Modified: cherokee/trunk/cherokee/validator_htpasswd.c =================================================================== --- cherokee/trunk/cherokee/validator_htpasswd.c 2009-11-15 21:55:41 UTC (rev 3822) +++ cherokee/trunk/cherokee/validator_htpasswd.c 2009-11-15 22:04:00 UTC (rev 3823) @@ -164,10 +164,6 @@ static ret_t validate_plain (cherokee_connection_t *conn, const char *crypted) { - if (cherokee_buffer_is_empty (&conn->validator->passwd)) { - return ret_error; - } - return (strcmp (conn->validator->passwd.buf, crypted) == 0) ? ret_ok : ret_error; } @@ -178,10 +174,6 @@ ret_t ret; char salt[CRYPT_SALT_LENGTH]; - if (cherokee_buffer_is_empty (&conn->validator->passwd)) { - return ret_error; - } - memcpy (salt, crypted, CRYPT_SALT_LENGTH); ret = check_crypt (conn->validator->passwd.buf, salt, crypted); @@ -196,10 +188,6 @@ char *new_md5_crypt; char space[120]; - if (cherokee_buffer_is_empty (&conn->validator->passwd)) { - return ret_error; - } - new_md5_crypt = md5_crypt (conn->validator->passwd.buf, crypted, magic, space); if (new_md5_crypt == NULL) { return ret_error; @@ -227,10 +215,6 @@ return ret_error; } - if (cherokee_buffer_is_empty (&conn->validator->passwd)) { - return ret_error; - } - /* Decode user */ cherokee_buffer_clean (sha1_buf1); @@ -296,7 +280,8 @@ /* Sanity checks */ if ((conn->validator == NULL) || - cherokee_buffer_is_empty (&conn->validator->user)) + cherokee_buffer_is_empty (&conn->validator->user) || + cherokee_buffer_is_empty (&conn->validator->passwd)) { return ret_error; }
|