From 8774d89b6734219f6fb1abed67980e0a85db43c7 Mon Sep 17 00:00:00 2001 From: Tim De Baets <10608063-tdebaets@users.noreply.gitlab.com> Date: Wed, 12 Jan 2022 18:20:09 +0100 Subject: [PATCH] Issue OC_CMD_DETACH instead of OC_CMD_CANCEL on Ctrl+Break If the user terminates OpenConnect with Ctrl+C, the session will be logged off (OC_CMD_CANCEL), and with Ctrl+Break the session will NOT be logged off (OC_CMD_DETACH). Either way, the vpnc-script will still be invoked with reason=disconnect. Signed-off-by: Tim De Baets <10608063-tdebaets@users.noreply.gitlab.com> --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 1dcf1f1f..308876ed 100644 --- a/main.c +++ b/main.c @@ -854,12 +854,14 @@ static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) switch (dwCtrlType) { case CTRL_C_EVENT: - case CTRL_BREAK_EVENT: case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: cmd = OC_CMD_CANCEL; break; + case CTRL_BREAK_EVENT: + cmd = OC_CMD_DETACH; + break; default: return FALSE; } -- 2.50.1