Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 May 2015 15:27:46 +0300
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: problem with signal handling in core john (was: [core john] [Johnny] Windows event loop)

Aleksey, Shinnok -

On Wed, May 13, 2015 at 02:31:18PM +0300, Aleksey Cherepanov wrote:
> The possible problems:
> 
> - SetConsoleCtrlHandler(NULL, FALSE); may be needed to enable ctrl-c
> correctly, I guess john core wants to handle ctrl-c,

I haven't been following the discussion closely, I'm not into Windows
programming, and IIRC it's been something between 15 and 20 years since
I put the SetConsoleCtrlHandler() calls currently in signals.c in there.
So I don't really know whether/which change might be needed.  However,
last time I checked, which wasn't that long ago, Ctrl-C still worked
fine to correctly terminate "john" on Windows.  Does it no longer work
in console on some combination of Windows and Cygwin versions?  Or is
the problem specific to just usage from Johnny?

> - __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.

IIRC, I deliberately used a weird mix of __CYGWIN__ and __CYGWIN32__
checks in JtR source code to deal with portability problems across some
now-ancient Cygwin versions.  One of these macros was introduced later
than the other, so I used them to distinguish Cygwin versions. %-)  See
e.g. this kludge in recovery.c:

#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
extern int ftruncate(int fd, size_t length);
#endif

x86-64 and Win64 weren't around back then.  (There was Windows NT for
Alpha architecture, which was 64-bit, but we didn't support it and IIRC
there was no Cygwin for it.)  So these weird checks have nothing to do
with 32- vs. 64-bitness.

I agree that we should probably switch to checking __CYGWIN__ only now.
I will likely commit changes like this, for all uses of these macros in
core (not just to signals.c).

Your comment that "signal handling does not work there at all" probably
applies only to Cygwin for Win64 (for which we don't even have a make
target in core), not to "new cygwin" for Win32.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.