Added proc_st status PS_AUTH_FAILED to prevent users that failed authentication to leave a zombie proc_st.

This commit is contained in:
Nikos Mavrogiannopoulos
2014-01-19 04:14:56 +01:00
parent add57c5d32
commit baf12348d4
3 changed files with 8 additions and 0 deletions
+2
View File
@@ -510,6 +510,8 @@ static int append_user_info(DBusMessageIter * subs, struct proc_st *ctmp)
strtmp = "zombie";
else if (ctmp->status == PS_AUTH_INACTIVE)
strtmp = "pre-auth";
else if (ctmp->status == PS_AUTH_FAILED)
strtmp = "auth failed";
else
strtmp = "unknown";
if (dbus_message_iter_append_basic
+5
View File
@@ -396,6 +396,7 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
if (cont != 0 && result == ERR_AUTH_CONTINUE) {
ret = send_auth_reply_msg(s, proc);
if (ret < 0) {
proc->status = PS_AUTH_FAILED;
mslog(s, proc, LOG_ERR,
"could not send reply auth cmd.");
return ret;
@@ -408,10 +409,12 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
}
proc->status = PS_AUTH_COMPLETED;
} else if (result < 0) {
proc->status = PS_AUTH_FAILED;
add_to_ip_ban_list(s, &proc->remote_addr,
proc->remote_addr_len);
ret = result;
} else {
proc->status = PS_AUTH_FAILED;
mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result);
ret = ERR_BAD_COMMAND;
}
@@ -422,6 +425,8 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
else {
/* no script was called. Handle it as a successful script call. */
ret = handle_script_exit(s, proc, ret);
if (ret < 0)
proc->status = PS_AUTH_FAILED;
}
return ret;
+1
View File
@@ -66,6 +66,7 @@ struct script_wait_st {
enum {
PS_AUTH_INACTIVE, /* no comm with worker */
PS_AUTH_FAILED, /* no tried authenticated but failed */
PS_AUTH_INIT, /* worker has sent an auth init msg */
PS_AUTH_ZOMBIE, /* in INIT state but worker has disconnected! - only present when cisco-client-compat is set */
PS_AUTH_COMPLETED, /* successful authentication */