Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 May 2015 14:31:18 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: problem with signal handling in core john (was: [core john] [Johnny]
 Windows event loop)

Solar,

On Tue, May 12, 2015 at 04:25:47PM +0300, Shinnok wrote:
> 	iii. We can re-enable CTRL_ events back in JtR. Simple patch to core. SetConsoleCtrlHandler(NULL, FALSE);

Shinnok's experiments seem to reveal a problem or two in core john.

I reattached Shinnok's patch because it was not easily visible in
mutt.

The possible problems:

- SetConsoleCtrlHandler(NULL, FALSE); may be needed to enable ctrl-c
correctly, I guess john core wants to handle ctrl-c,

- __CYGWIN32__ macro may be obsolete in new cygwin and/or 64-bit
cygwin (I don't know) so signal handling does not work there at all.

Thanks!

-- 
Regards,
Aleksey Cherepanov

diff --git a/src/signals.c b/src/signals.c
index b7d0063..b52aad8 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -34,8 +34,9 @@
 #include <dos.h>
 #endif

-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
 #include <windows.h>
+#include <wincon.h>
 #endif

 #include "arch.h"
@@ -203,7 +204,7 @@ static void sig_handle_abort(int signum)
        errno = saved_errno;
 }

-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
 static CALLBACK BOOL sig_handle_abort_ctrl(DWORD ctrltype)
 {
        sig_handle_abort(SIGINT);
@@ -217,7 +218,8 @@ static void sig_install_abort(void)
        setcbrk(1);
 #endif

-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
+       SetConsoleCtrlHandler(NULL, FALSE);
        SetConsoleCtrlHandler(sig_handle_abort_ctrl, TRUE);
 #endif

@@ -233,7 +235,7 @@ static void sig_install_abort(void)

 static void sig_remove_abort(void)
 {
-#ifdef __CYGWIN32__
+#ifdef __CYGWIN__
        SetConsoleCtrlHandler(sig_handle_abort_ctrl, FALSE);
 #endif


Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ