mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
Return 401 error on cookie authentication failure.
This commit is contained in:
@@ -1375,8 +1375,15 @@ static int connect_handler(worker_st * ws)
|
||||
ret = auth_cookie(ws, ws->cookie, ws->cookie_size);
|
||||
if (ret < 0) {
|
||||
oclog(ws, LOG_INFO, "failed cookie authentication attempt");
|
||||
tls_puts(ws->session,
|
||||
"HTTP/1.1 503 Service Unavailable\r\n\r\n");
|
||||
if (ret == ERR_AUTH_FAIL) {
|
||||
tls_puts(ws->session,
|
||||
"HTTP/1.1 401 Unauthorized\r\n\r\n");
|
||||
tls_puts(ws->session,
|
||||
"X-Reason: Cookie is not acceptable\r\n\r\n");
|
||||
} else {
|
||||
tls_puts(ws->session,
|
||||
"HTTP/1.1 503 Service Unavailable\r\n\r\n");
|
||||
}
|
||||
tls_fatal_close(ws->session, GNUTLS_A_ACCESS_DENIED);
|
||||
exit_worker(ws);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user