Navigation Menu

Skip to content

Commit

Permalink
Prevent msg commands from functioning without a password set. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg authored and thommey committed Apr 8, 2016
2 parents da6fffe + d584c2f commit 5042a32
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/userrec.c
Expand Up @@ -355,7 +355,12 @@ struct userrec *get_user_by_equal_host(char *host)
}

/* Try: pass_match_by_host("-",host)
* will return 1 if no password is set for that host
* If a '-' is sent as the password, it denotes the intent
* to merely check if a password is set for that user.
* Returns 0 if password is set and does not match
* Returns 1 if password matches, or if we are
* checking if a password is set and it is not
* (via the '-' char).
*/
int u_pass_match(struct userrec *u, char *pass)
{
Expand All @@ -364,8 +369,11 @@ int u_pass_match(struct userrec *u, char *pass)
if (!u)
return 0;
cmp = get_user(&USERENTRY_PASS, u);
if (!cmp && (!pass[0] || (pass[0] == '-')))
if (!cmp && (pass[0] == '-'))
return 1;
/* If password is not set in userrecord, or password
* is not sent, or '-' is sent
*/
if (!cmp || !pass || !pass[0] || (pass[0] == '-'))
return 0;
if (u->flags & USER_BOT) {
Expand Down

0 comments on commit 5042a32

Please sign in to comment.