send auth reply failure when needed.

This commit is contained in:
Nikos Mavrogiannopoulos
2014-01-18 16:06:37 +01:00
parent ef537d6846
commit 90a9286b88
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 Nikos Mavrogiannopoulos * Copyright (C) 2013, 2014 Nikos Mavrogiannopoulos
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
+6 -5
View File
@@ -404,20 +404,19 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
} else if (result == 0) { } else if (result == 0) {
ret = accept_user(s, proc, cmd); ret = accept_user(s, proc, cmd);
if (ret < 0) { if (ret < 0) {
goto auth_ok; goto finished;
} }
proc->status = PS_AUTH_COMPLETED; proc->status = PS_AUTH_COMPLETED;
goto auth_ok;
} else if (result < 0) { } else if (result < 0) {
add_to_ip_ban_list(s, &proc->remote_addr, add_to_ip_ban_list(s, &proc->remote_addr,
proc->remote_addr_len); proc->remote_addr_len);
return result; ret = result;
} else { } else {
mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result); mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result);
return ERR_BAD_COMMAND; ret = ERR_BAD_COMMAND;
} }
auth_ok: finished:
if (ret == ERR_WAIT_FOR_SCRIPT) if (ret == ERR_WAIT_FOR_SCRIPT)
ret = 0; ret = 0;
else { else {
@@ -687,6 +686,8 @@ int handle_commands(main_server_st * s, struct proc_st *proc)
goto cleanup; goto cleanup;
} }
break;
case AUTH_REQ: case AUTH_REQ:
if (proc->status != PS_AUTH_INIT) { if (proc->status != PS_AUTH_INIT) {
mslog(s, proc, LOG_ERR, mslog(s, proc, LOG_ERR,