Sync OpenBSD patchset 308:

When incorrect passwords are entered, behave similarly to login(1) and backoff
for a bit. Based on a diff from martynas@.
This commit is contained in:
Tiago Cunha
2009-09-03 20:44:38 +00:00
parent 3b944fe7e8
commit f796336a12
5 changed files with 60 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server-msg.c,v 1.82 2009-08-24 16:24:18 tcunha Exp $ */
/* $Id: server-msg.c,v 1.83 2009-09-03 20:44:38 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -99,8 +99,15 @@ server_msg_dispatch(struct client *c)
memcpy(&unlockdata, imsg.data, sizeof unlockdata);
unlockdata.pass[(sizeof unlockdata.pass) - 1] = '\0';
if (server_unlock(unlockdata.pass) != 0)
switch (server_unlock(unlockdata.pass)) {
case -1:
server_write_error(c, "bad password");
break;
case -2:
server_write_error(c,
"too many bad passwords, sleeping");
break;
}
memset(&unlockdata, 0, sizeof unlockdata);
server_write_client(c, MSG_EXIT, NULL, 0);
break;