]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Issue OC_CMD_DETACH instead of OC_CMD_CANCEL on Ctrl+Break
authorTim De Baets <10608063-tdebaets@users.noreply.gitlab.com>
Wed, 12 Jan 2022 17:20:09 +0000 (18:20 +0100)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 13 Jan 2022 18:20:53 +0000 (10:20 -0800)
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

diff --git a/main.c b/main.c
index 1dcf1f1f3c9ed61dccda843b30d88ee667280988..308876ed9c60f53429a753bcdc92b217c934d518 100644 (file)
--- 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;
        }