Darren Tucker
2003-Aug-03 09:15 UTC
[PATCH] Fix minor breakage on Cygwin: auth-passwd.c and session.c
Hi All. I tried building -current on Cygwin but got a couple of minor errors. The first is in auth-passwd.c where it appears Ben got a bit over-enthusiastic cleaning up :-). The patch restores the relevant "#ifdef HAVE_CYGWIN" fragment. The second is in the send-break code in session.c, which won't compile because Cygwin apparently doesn't have TIOCSBRK and TIOCCBRK ioctls. With the patch session_break_req just returns 0 if TIOCSBRK and TIOCCBRK are not defined (which I think is the right thing to do, but I'm not sure). If either of these are wrong please let me know. -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement. -------------- next part -------------- Index: auth-passwd.c ==================================================================RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/auth-passwd.c,v retrieving revision 1.58 diff -u -r1.58 auth-passwd.c --- auth-passwd.c 2 Aug 2003 12:24:49 -0000 1.58 +++ auth-passwd.c 2 Aug 2003 14:54:06 -0000 @@ -43,6 +43,14 @@ #include "servconf.h" #include "auth.h" #include "openbsd-compat/xcrypt.h" + +# ifdef HAVE_CYGWIN +# undef ERROR +# include <windows.h> +# include <sys/cygwin.h> +# define is_winnt (GetVersion() < 0x80000000) +# endif + #ifdef WITH_AIXAUTHENTICATE # include "buffer.h" # include "canohost.h" Index: session.c ==================================================================RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/session.c,v retrieving revision 1.242 diff -u -r1.242 session.c --- session.c 2 Aug 2003 12:24:50 -0000 1.242 +++ session.c 2 Aug 2003 15:14:18 -0000 @@ -1702,6 +1702,7 @@ break_length = packet_get_int(); packet_check_eom(); +#if defined(TIOCSBRK) && defined(TIOCCBRK) if (s->ttyfd == -1) return 0; /* we will sleep from 500ms to 3000ms */ @@ -1712,6 +1713,9 @@ usleep(break_length * 1000); ioctl(s->ttyfd, TIOCCBRK, NULL); return 1; +#else + return 0; +#endif } static int
Ben Lindstrom
2003-Aug-03 18:35 UTC
[PATCH] Fix minor breakage on Cygwin: auth-passwd.c and session.c
[..] +# ifdef HAVE_CYGWIN +# undef ERROR +# include <windows.h> +# include <sys/cygwin.h> +# define is_winnt (GetVersion() < 0x80000000) +# endif There is enough of this junk laying around in different files it really should be put in an openbsd-compat/port-cygwin.h =) - Ven On Sun, 3 Aug 2003, Darren Tucker wrote:> Hi All. > I tried building -current on Cygwin but got a couple of minor errors. > The first is in auth-passwd.c where it appears Ben got a bit > over-enthusiastic cleaning up :-). The patch restores the relevant > "#ifdef HAVE_CYGWIN" fragment. > > The second is in the send-break code in session.c, which won't compile > because Cygwin apparently doesn't have TIOCSBRK and TIOCCBRK ioctls. With > the patch session_break_req just returns 0 if TIOCSBRK and TIOCCBRK are > not defined (which I think is the right thing to do, but I'm not sure). > > If either of these are wrong please let me know. > > -- > Darren Tucker (dtucker at zip.com.au) > GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 > Good judgement comes with experience. Unfortunately, the experience > usually comes from bad judgement.
Darren Tucker
2003-Aug-04 01:44 UTC
[PATCH] Fix minor breakage on Cygwin: auth-passwd.c and session.c
Ben Lindstrom wrote:> [..] > +# ifdef HAVE_CYGWIN > +# undef ERROR > +# include <windows.h> > +# include <sys/cygwin.h> > +# define is_winnt (GetVersion() < 0x80000000) > +# endif > > There is enough of this junk laying around in different files it really > should be put in an openbsd-compat/port-cygwin.h =)Good point, doing that works too. Did you really mean a new "port-cygwin.h" or the existing "bsd-cygwin_util.h"? The first "#ifdef CYGWIN" block in session.c could go too. -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.