Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 08 Mar 2014 17:29:48 +0100
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Fwd:  was Re: [john-users] Fwd: jtr cygwin64

On 2014-03-08 16:02, jfoug@....net wrote:
> I have made this change in tty.c:
>
> #if defined (__CYGWIN32__)
> 		FD_ZERO(&set); FD_SET(tty_fd, &set);
> 		tv.tv_sec = 0; tv.tv_usec = 0;
> 		//if (select(tty_fd + 1, &set, NULL, NULL, &tv) <= 0)
> 		if (!(select(tty_fd + 1, &set, NULL, NULL, &tv) && FD_ISSET(tty_fd, &set)))
> 			return -1;
> #endif
>
> and the problem goes away for both cygwin64 and cygwin32.  HOWEVER, I am not sure exactly why.  They select (without the !) was something I found online about doing a cvygwin replacement of kbhit() function (visual C specific).  I think our checking of <= 0 is where the problem is, but I am not sure exactly why, nor why it was happy in cygwin32, but fails in cygwin64.  Possibly we have not fully setup raw mode, or something else.   I do not have time to dig in too much today, but with the above 'simple' change, things are working, but I am just not sure it is right.    Heck, you can even comment out the select and it works fine also, so again, without digging in deeper, I am not sure what that select is intended to do.

The original line should return -1 if tty_fd is not ready OR if an error 
occured. The new line should return -1 if an error occured, but only 
then (and written in a way very hard to follow). My conclusion is you 
don't want the select() at all for Cygwin64 so just revert it and 
exclude it:

#if defined(__CYGWIN32__) && !defined(__CYGWIN64__)
		FD_ZERO(&set); FD_SET(tty_fd, &set);
		tv.tv_sec = 0; tv.tv_usec = 0;
		if (select(tty_fd + 1, &set, NULL, NULL, &tv) <= 0)
			return -1;
#endif

and same "#if (...)" copied to the declarations above it. I bet this 
will work just fine.


BTW never cc me on list replies, it has terrible side effects.

magnum

Powered by blists - more mailing lists

Your e-mail address:

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