mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-13 18:12:03 +08:00
Added proc_st status PS_AUTH_FAILED to prevent users that failed authentication to leave a zombie proc_st.
This commit is contained in:
@@ -510,6 +510,8 @@ static int append_user_info(DBusMessageIter * subs, struct proc_st *ctmp)
|
|||||||
strtmp = "zombie";
|
strtmp = "zombie";
|
||||||
else if (ctmp->status == PS_AUTH_INACTIVE)
|
else if (ctmp->status == PS_AUTH_INACTIVE)
|
||||||
strtmp = "pre-auth";
|
strtmp = "pre-auth";
|
||||||
|
else if (ctmp->status == PS_AUTH_FAILED)
|
||||||
|
strtmp = "auth failed";
|
||||||
else
|
else
|
||||||
strtmp = "unknown";
|
strtmp = "unknown";
|
||||||
if (dbus_message_iter_append_basic
|
if (dbus_message_iter_append_basic
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
|
|||||||
if (cont != 0 && result == ERR_AUTH_CONTINUE) {
|
if (cont != 0 && result == ERR_AUTH_CONTINUE) {
|
||||||
ret = send_auth_reply_msg(s, proc);
|
ret = send_auth_reply_msg(s, proc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
proc->status = PS_AUTH_FAILED;
|
||||||
mslog(s, proc, LOG_ERR,
|
mslog(s, proc, LOG_ERR,
|
||||||
"could not send reply auth cmd.");
|
"could not send reply auth cmd.");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -408,10 +409,12 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
|
|||||||
}
|
}
|
||||||
proc->status = PS_AUTH_COMPLETED;
|
proc->status = PS_AUTH_COMPLETED;
|
||||||
} else if (result < 0) {
|
} else if (result < 0) {
|
||||||
|
proc->status = PS_AUTH_FAILED;
|
||||||
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);
|
||||||
ret = result;
|
ret = result;
|
||||||
} else {
|
} else {
|
||||||
|
proc->status = PS_AUTH_FAILED;
|
||||||
mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result);
|
mslog(s, proc, LOG_ERR, "unexpected auth result: %d\n", result);
|
||||||
ret = ERR_BAD_COMMAND;
|
ret = ERR_BAD_COMMAND;
|
||||||
}
|
}
|
||||||
@@ -422,6 +425,8 @@ static int handle_auth_res(main_server_st * s, struct proc_st *proc,
|
|||||||
else {
|
else {
|
||||||
/* no script was called. Handle it as a successful script call. */
|
/* no script was called. Handle it as a successful script call. */
|
||||||
ret = handle_script_exit(s, proc, ret);
|
ret = handle_script_exit(s, proc, ret);
|
||||||
|
if (ret < 0)
|
||||||
|
proc->status = PS_AUTH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ struct script_wait_st {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PS_AUTH_INACTIVE, /* no comm with worker */
|
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_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_ZOMBIE, /* in INIT state but worker has disconnected! - only present when cisco-client-compat is set */
|
||||||
PS_AUTH_COMPLETED, /* successful authentication */
|
PS_AUTH_COMPLETED, /* successful authentication */
|
||||||
|
|||||||
Reference in New Issue
Block a user