Bugzilla – Attachment 2268 Details for
Bug 2104
Windows/win32/mingw support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
win32.patch
win32-2.patch (text/plain), 123.76 KB, created by
Pierre Ossman
on 2013-05-15 22:09:16 AEST
(
hide
)
Description:
win32.patch
Filename:
MIME Type:
Creator:
Pierre Ossman
Created:
2013-05-15 22:09:16 AEST
Size:
123.76 KB
patch
obsolete
>? win32-2.patch >? win32.patch >Index: aclocal.m4 >=================================================================== >RCS file: /cvs/openssh/aclocal.m4,v >retrieving revision 1.8 >diff -u -r1.8 aclocal.m4 >--- aclocal.m4 20 May 2011 01:45:25 -0000 1.8 >+++ aclocal.m4 15 May 2013 12:02:17 -0000 >@@ -88,7 +88,13 @@ > AC_MSG_RESULT($curl_cv_socklen_t_equiv) > AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, > [type to use in place of socklen_t if not defined])], >- [#include <sys/types.h> >-#include <sys/socket.h>]) >+ [ >+#include <sys/types.h> >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#else >+# include <sys/socket.h> >+#endif >+ ]) > ]) > >Index: addrmatch.c >=================================================================== >RCS file: /cvs/openssh/addrmatch.c,v >retrieving revision 1.6 >diff -u -r1.6 addrmatch.c >--- addrmatch.c 29 Jun 2012 22:32:29 -0000 1.6 >+++ addrmatch.c 15 May 2013 12:02:17 -0000 >@@ -19,11 +19,19 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #include <string.h> > #include <stdlib.h> > #include <stdio.h> >Index: atomicio.c >=================================================================== >RCS file: /cvs/openssh/atomicio.c,v >retrieving revision 1.40 >diff -u -r1.40 atomicio.c >--- atomicio.c 24 Sep 2010 12:15:11 -0000 1.40 >+++ atomicio.c 15 May 2013 12:02:17 -0000 >@@ -29,7 +29,9 @@ > #include "includes.h" > > #include <sys/param.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > > #include <errno.h> > #ifdef HAVE_POLL_H >Index: authfd.c >=================================================================== >RCS file: /cvs/openssh/authfd.c,v >retrieving revision 1.83 >diff -u -r1.83 authfd.c >--- authfd.c 5 Aug 2011 20:16:00 -0000 1.83 >+++ authfd.c 15 May 2013 12:02:18 -0000 >@@ -38,8 +38,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/un.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_UN_H >+# include <sys/un.h> >+#endif >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #include <openssl/evp.h> > >Index: authfile.c >=================================================================== >RCS file: /cvs/openssh/authfile.c,v >retrieving revision 1.100 >diff -u -r1.100 authfile.c >--- authfile.c 23 Apr 2013 09:24:32 -0000 1.100 >+++ authfile.c 15 May 2013 12:02:19 -0000 >@@ -41,7 +41,9 @@ > #include <sys/types.h> > #include <sys/stat.h> > #include <sys/param.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > > #include <openssl/err.h> > #include <openssl/evp.h> >Index: canohost.c >=================================================================== >RCS file: /cvs/openssh/canohost.c,v >retrieving revision 1.77 >diff -u -r1.77 canohost.c >--- canohost.c 12 Oct 2010 02:28:12 -0000 1.77 >+++ canohost.c 15 May 2013 12:02:19 -0000 >@@ -15,14 +15,22 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <ctype.h> > #include <errno.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >Index: channels.c >=================================================================== >RCS file: /cvs/openssh/channels.c,v >retrieving revision 1.311 >diff -u -r1.311 channels.c >--- channels.c 23 Apr 2013 05:20:43 -0000 1.311 >+++ channels.c 15 May 2013 12:02:19 -0000 >@@ -42,23 +42,37 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/ioctl.h> >-#include <sys/un.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif >+#ifdef HAVE_SYS_UN_H >+# include <sys/un.h> >+#endif >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > #ifdef HAVE_SYS_TIME_H > # include <sys/time.h> > #endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <errno.h> > #include <fcntl.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > #include <unistd.h> > #include <stdarg.h> > >@@ -2142,6 +2156,7 @@ > channel_prepare_select(fd_set **readsetp, fd_set **writesetp, int *maxfdp, > u_int *nallocp, time_t *minwait_secs, int rekeying) > { >+#ifdef NFDBITS > u_int n, sz, nfdset; > > n = MAX(*maxfdp, channel_max_fd); >@@ -2161,6 +2176,16 @@ > *maxfdp = n; > memset(*readsetp, 0, sz); > memset(*writesetp, 0, sz); >+#else >+ if (*readsetp == NULL) >+ *readsetp = xmalloc(sizeof(fd_set)); >+ if (*writesetp == NULL) >+ *writesetp = xmalloc(sizeof(fd_set)); >+ *maxfdp = MAX(*maxfdp, channel_max_fd); >+ *nallocp = sizeof(fd_set); >+ memset(*readsetp, 0, sizeof(fd_set)); >+ memset(*writesetp, 0, sizeof(fd_set)); >+#endif > > if (!rekeying) > channel_handler(channel_pre, *readsetp, *writesetp, >Index: clientloop.c >=================================================================== >RCS file: /cvs/openssh/clientloop.c,v >retrieving revision 1.237 >diff -u -r1.237 clientloop.c >--- clientloop.c 9 Jan 2013 04:55:51 -0000 1.237 >+++ clientloop.c 15 May 2013 12:02:19 -0000 >@@ -62,7 +62,9 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/ioctl.h> >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif > #include <sys/param.h> > #ifdef HAVE_SYS_STAT_H > # include <sys/stat.h> >@@ -70,7 +72,9 @@ > #ifdef HAVE_SYS_TIME_H > # include <sys/time.h> > #endif >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #include <ctype.h> > #include <errno.h> >@@ -82,8 +86,12 @@ > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >-#include <termios.h> >-#include <pwd.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <unistd.h> > > #include "openbsd-compat/sys-queue.h" >Index: clientloop.h >=================================================================== >RCS file: /cvs/openssh/clientloop.h,v >retrieving revision 1.30 >diff -u -r1.30 clientloop.h >--- clientloop.h 6 Sep 2012 11:19:05 -0000 1.30 >+++ clientloop.h 15 May 2013 12:02:19 -0000 >@@ -35,7 +35,9 @@ > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > > /* Client side main loop for the interactive session. */ > int client_loop(int, int, int); >Index: configure.ac >=================================================================== >RCS file: /cvs/openssh/configure.ac,v >retrieving revision 1.523 >diff -u -r1.523 configure.ac >--- configure.ac 10 May 2013 08:53:14 -0000 1.523 >+++ configure.ac 15 May 2013 12:02:20 -0000 >@@ -296,6 +296,8 @@ > ) > > AC_CHECK_HEADERS([ \ >+ arpa/inet.h \ >+ arpa/nameser.h \ > bstring.h \ > crypt.h \ > crypto/sha2.h \ >@@ -307,6 +309,7 @@ > floatingpoint.h \ > getopt.h \ > glob.h \ >+ grp.h \ > ia.h \ > iaf.h \ > limits.h \ >@@ -314,12 +317,16 @@ > maillock.h \ > ndir.h \ > net/if_tun.h \ >+ netinet/in.h \ >+ netinet/in_systm.h \ >+ netinet/tcp.h \ > netdb.h \ > netgroup.h \ > pam/pam_appl.h \ > paths.h \ > poll.h \ > pty.h \ >+ pwd.h \ > readpassphrase.h \ > rpc/types.h \ > security/pam_appl.h \ >@@ -334,12 +341,15 @@ > sys/bsdtty.h \ > sys/cdefs.h \ > sys/dir.h \ >+ sys/ioctl.h \ > sys/mman.h \ > sys/ndir.h \ > sys/poll.h \ > sys/prctl.h \ > sys/pstat.h \ >+ sys/resource.h \ > sys/select.h \ >+ sys/socket.h \ > sys/stat.h \ > sys/stream.h \ > sys/stropts.h \ >@@ -348,7 +358,11 @@ > sys/sysmacros.h \ > sys/time.h \ > sys/timers.h \ >+ sys/uio.h \ > sys/un.h \ >+ sys/wait.h \ >+ syslog.h \ >+ termios.h \ > time.h \ > tmpdir.h \ > ttyent.h \ >@@ -505,6 +519,17 @@ > AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size]) > AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters]) > ;; >+*-*-mingw32*) >+ LIBS="$LIBS -lws2_32 -lntdll -lsecur32" >+ # These are stdcall, which makes AC_CHECK_FUNCS fail >+ AC_DEFINE([HAVE_FREEADDRINFO]) >+ AC_DEFINE([HAVE_GAI_STRERROR]) >+ AC_DEFINE([HAVE_GETADDRINFO]) >+ AC_DEFINE([HAVE_GETNAMEINFO]) >+ AC_DEFINE([HAVE_INET_NTOA]) >+ # Not really broken, but disabled and prints an error >+ AC_DEFINE([IP_TOS_IS_BROKEN]) >+ ;; > *-*-dgux*) > AC_DEFINE([IP_TOS_IS_BROKEN], [1], > [Define if your system choked on IP TOS setting]) >@@ -1395,6 +1420,9 @@ > #include <stdio.h> > #include <stdlib.h> > #include <stdint.h> >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#endif > #include <ldns/ldns.h> > int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); } > ]]) >@@ -3171,7 +3199,12 @@ > AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef WIN32 >+# include <winsock2.h> >+#endif > ]], [[ struct sockaddr_storage s; ]])], > [ ac_cv_have_struct_sockaddr_storage="yes" ], > [ ac_cv_have_struct_sockaddr_storage="no" >@@ -3185,7 +3218,12 @@ > AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ > #include <sys/types.h> >-#include <netinet/in.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#endif > ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])], > [ ac_cv_have_struct_sockaddr_in6="yes" ], > [ ac_cv_have_struct_sockaddr_in6="no" >@@ -3199,7 +3237,12 @@ > AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ > #include <sys/types.h> >-#include <netinet/in.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#endif > ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])], > [ ac_cv_have_struct_in6_addr="yes" ], > [ ac_cv_have_struct_in6_addr="no" >@@ -3215,15 +3258,27 @@ > #ifdef HAVE_SYS_TYPES_H > #include <sys/types.h> > #endif >-#include <netinet/in.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#endif > ]) > fi > > AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [ > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ > #include <sys/types.h> >-#include <sys/socket.h> >-#include <netdb.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif >+#ifdef WIN32 >+# include <ws2tcpip.h> >+#endif > ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])], > [ ac_cv_have_struct_addrinfo="yes" ], > [ ac_cv_have_struct_addrinfo="no" >@@ -3638,7 +3693,17 @@ > KRB5ROOT=${withval} > fi > >- AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support]) >+ case "$host" in >+ *-*-mingw32*) >+ # Windows has libraries for emulating GSSAPI, >+ # but not direct Kerberos 5. >+ AC_DEFINE([GSSAPI]) >+ ;; >+ *) >+ AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support]) >+ ;; >+ esac >+ > KRB5_MSG="yes" > > AC_PATH_PROG([KRB5CONF], [krb5-config], >Index: defines.h >=================================================================== >RCS file: /cvs/openssh/defines.h,v >retrieving revision 1.171 >diff -u -r1.171 defines.h >--- defines.h 7 Mar 2013 09:06:13 -0000 1.171 >+++ defines.h 15 May 2013 12:02:20 -0000 >@@ -45,8 +45,12 @@ > /* > * Definitions for IP type of service (ip_tos) > */ >-#include <netinet/in_systm.h> >-#include <netinet/ip.h> >+#ifdef HAVE_NETINET_IN_SYSTM_H >+# include <netinet/in_systm.h> >+#endif >+#ifdef HAVE_NETINET_IP_H >+# include <netinet/ip.h> >+#endif > #ifndef IPTOS_LOWDELAY > # define IPTOS_LOWDELAY 0x10 > # define IPTOS_THROUGHPUT 0x08 >@@ -143,7 +147,7 @@ > # define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) > #endif /* S_ISREG */ > >-#ifndef S_ISLNK >+#if !defined(S_ISLNK) && defined(S_IFLNK) > # define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) > #endif /* S_ISLNK */ > >@@ -184,6 +188,10 @@ > #define INADDR_LOOPBACK ((u_long)0x7f000001) > #endif > >+#ifndef IN_LOOPBACKNET >+#define IN_LOOPBACKNET 127 >+#endif >+ > /* Types */ > > /* If sys/types.h does not supply intXX_t, supply them ourselves */ >@@ -524,6 +532,15 @@ > > #if defined(HAVE_DECL_OFFSETOF) && HAVE_DECL_OFFSETOF == 0 > # define offsetof(type, member) ((size_t) &((type *)0)->member) >+#endif >+ >+#ifndef FD_SET_SIZE >+# ifdef NFDBITS >+# define FD_SET_SIZE(maxfd) \ >+ (howmany(maxfd + 1 , NFDBITS) * sizeof(fd_mask)) >+# else >+# define FD_SET_SIZE(maxfd) sizeof(fd_set) >+# endif > #endif > > /* Set up BSD-style BYTE_ORDER definition if it isn't there already */ >Index: dns.c >=================================================================== >RCS file: /cvs/openssh/dns.c,v >retrieving revision 1.30 >diff -u -r1.30 dns.c >--- dns.c 20 Jun 2012 11:51:11 -0000 1.30 >+++ dns.c 15 May 2013 12:02:20 -0000 >@@ -28,9 +28,13 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #include <stdarg.h> > #include <stdio.h> > #include <string.h> >Index: entropy.c >=================================================================== >RCS file: /cvs/openssh/entropy.c,v >retrieving revision 1.63 >diff -u -r1.63 entropy.c >--- entropy.c 30 Mar 2012 00:34:27 -0000 1.63 >+++ entropy.c 15 May 2013 12:02:20 -0000 >@@ -25,13 +25,19 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > #ifdef HAVE_SYS_UN_H > # include <sys/un.h> > #endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <errno.h> > #include <signal.h> >Index: gss-genr.c >=================================================================== >RCS file: /cvs/openssh/gss-genr.c,v >retrieving revision 1.22 >diff -u -r1.22 gss-genr.c >--- gss-genr.c 22 Jun 2009 06:11:07 -0000 1.22 >+++ gss-genr.c 15 May 2013 12:02:20 -0000 >@@ -34,6 +34,7 @@ > #include <stdarg.h> > #include <string.h> > #include <unistd.h> >+#include <stdio.h> > > #include "xmalloc.h" > #include "buffer.h" >Index: hostfile.c >=================================================================== >RCS file: /cvs/openssh/hostfile.c,v >retrieving revision 1.48 >diff -u -r1.48 hostfile.c >--- hostfile.c 4 Dec 2010 22:03:31 -0000 1.48 >+++ hostfile.c 15 May 2013 12:02:20 -0000 >@@ -40,12 +40,16 @@ > > #include <sys/types.h> > >-#include <netinet/in.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif > > #include <openssl/hmac.h> > #include <openssl/sha.h> > >-#include <resolv.h> >+#ifdef HAVE_RESOLV_H >+# include <resolv.h> >+#endif > #include <stdarg.h> > #include <stdio.h> > #include <stdlib.h> >Index: includes.h >=================================================================== >RCS file: /cvs/openssh/includes.h,v >retrieving revision 1.134 >diff -u -r1.134 includes.h >--- includes.h 22 Mar 2013 01:51:09 -0000 1.134 >+++ includes.h 15 May 2013 12:02:20 -0000 >@@ -22,8 +22,19 @@ > #define _GNU_SOURCE /* activate extra prototypes for glibc */ > #endif > >+#ifdef WIN32 >+# define WIN32_LEAN_AND_MEAN >+# define _WIN32_WINNT 0x0501 >+# define _WIN32_IE 0x0600 >+# include <winsock2.h> >+# include <ws2tcpip.h> >+# include <windows.h> >+#endif >+ > #include <sys/types.h> >-#include <sys/socket.h> /* For CMSG_* */ >+#ifdef HAVE_SOCKET_H >+# include <sys/socket.h> /* For CMSG_* */ >+#endif > > #ifdef HAVE_LIMITS_H > # include <limits.h> /* For PATH_MAX */ >@@ -85,7 +96,9 @@ > #ifdef HAVE_STDINT_H > # include <stdint.h> > #endif >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > #ifdef HAVE_SYS_BITYPES_H > # include <sys/bitypes.h> /* For u_intXX_t */ > #endif >@@ -111,8 +124,12 @@ > #include <sys/ptms.h> /* for grantpt() and friends */ > #endif > >-#include <netinet/in.h> >-#include <netinet/in_systm.h> /* For typedefs */ >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_NETINET_IN_SYSTM_H >+# include <netinet/in_systm.h> /* For typedefs */ >+#endif > #ifdef HAVE_RPC_TYPES_H > # include <rpc/types.h> /* For INADDR_LOOPBACK */ > #endif >Index: log.c >=================================================================== >RCS file: /cvs/openssh/log.c,v >retrieving revision 1.58 >diff -u -r1.58 log.c >--- log.c 23 Apr 2013 05:21:07 -0000 1.58 >+++ log.c 15 May 2013 12:02:21 -0000 >@@ -43,7 +43,9 @@ > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >-#include <syslog.h> >+#ifdef HAVE_SYSLOG_H >+# include <syslog.h> >+#endif > #include <unistd.h> > #include <errno.h> > #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) >Index: misc.c >=================================================================== >RCS file: /cvs/openssh/misc.c,v >retrieving revision 1.112 >diff -u -r1.112 misc.c >--- misc.c 23 Apr 2013 04:25:53 -0000 1.112 >+++ misc.c 15 May 2013 12:02:21 -0000 >@@ -27,8 +27,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/ioctl.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > #include <sys/param.h> > > #include <stdarg.h> >@@ -38,14 +42,24 @@ > #include <time.h> > #include <unistd.h> > >-#include <netinet/in.h> >-#include <netinet/in_systm.h> >-#include <netinet/ip.h> >-#include <netinet/tcp.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_NETINET_IN_SYSTM_H >+# include <netinet/in_systm.h> >+#endif >+#ifdef HAVE_NETINET_IP_H >+# include <netinet/ip.h> >+#endif >+#ifdef HAVE_NETINET_TCP_H >+# include <netinet/tcp.h> >+#endif > > #include <errno.h> > #include <fcntl.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #ifdef HAVE_PATHS_H > # include <paths.h> > #include <pwd.h> >Index: monitor_fdpass.c >=================================================================== >RCS file: /cvs/openssh/monitor_fdpass.c,v >retrieving revision 1.30 >diff -u -r1.30 monitor_fdpass.c >--- monitor_fdpass.c 12 Jan 2010 23:54:46 -0000 1.30 >+++ monitor_fdpass.c 15 May 2013 12:02:22 -0000 >@@ -27,8 +27,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > #ifdef HAVE_SYS_UN_H > #include <sys/un.h> > #endif >Index: msg.c >=================================================================== >RCS file: /cvs/openssh/msg.c,v >retrieving revision 1.16 >diff -u -r1.16 msg.c >--- msg.c 5 Aug 2006 02:39:40 -0000 1.16 >+++ msg.c 15 May 2013 12:02:22 -0000 >@@ -26,7 +26,9 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > > #include <errno.h> > #include <stdio.h> >Index: mux.c >=================================================================== >RCS file: /cvs/openssh/mux.c,v >retrieving revision 1.46 >diff -u -r1.46 mux.c >--- mux.c 23 Apr 2013 09:25:49 -0000 1.46 >+++ mux.c 15 May 2013 12:02:22 -0000 >@@ -35,8 +35,12 @@ > #include <sys/types.h> > #include <sys/param.h> > #include <sys/stat.h> >-#include <sys/socket.h> >-#include <sys/un.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_SYS_UN_H >+# include <sys/un.h> >+#endif > > #include <errno.h> > #include <fcntl.h> >Index: nchan.c >=================================================================== >RCS file: /cvs/openssh/nchan.c,v >retrieving revision 1.62 >diff -u -r1.62 nchan.c >--- nchan.c 26 Jan 2010 02:26:22 -0000 1.62 >+++ nchan.c 15 May 2013 12:02:22 -0000 >@@ -26,7 +26,9 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #include <errno.h> > #include <string.h> >Index: packet.c >=================================================================== >RCS file: /cvs/openssh/packet.c,v >retrieving revision 1.190 >diff -u -r1.190 packet.c >--- packet.c 23 Apr 2013 09:24:32 -0000 1.190 >+++ packet.c 15 May 2013 12:02:22 -0000 >@@ -42,14 +42,22 @@ > #include <sys/types.h> > #include "openbsd-compat/sys-queue.h" > #include <sys/param.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > #ifdef HAVE_SYS_TIME_H > # include <sys/time.h> > #endif > >-#include <netinet/in.h> >-#include <netinet/ip.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_NETINET_IP_H >+# include <netinet/ip.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <errno.h> > #include <stdarg.h> >@@ -1048,8 +1056,7 @@ > > DBG(debug("packet_read()")); > >- setp = (fd_set *)xcalloc(howmany(active_state->connection_in + 1, >- NFDBITS), sizeof(fd_mask)); >+ setp = (fd_set *)xcalloc(1, FD_SET_SIZE(active_state->connection_in)); > > /* Since we are blocking, ensure that all written packets have been sent. */ > packet_write_wait(); >@@ -1073,8 +1080,7 @@ > * Otherwise, wait for some data to arrive, add it to the > * buffer, and try again. > */ >- memset(setp, 0, howmany(active_state->connection_in + 1, >- NFDBITS) * sizeof(fd_mask)); >+ memset(setp, 0, FD_SET_SIZE(active_state->connection_in)); > FD_SET(active_state->connection_in, setp); > > if (active_state->packet_timeout_ms > 0) { >@@ -1735,12 +1741,10 @@ > int ret, ms_remain; > struct timeval start, timeout, *timeoutp = NULL; > >- setp = (fd_set *)xcalloc(howmany(active_state->connection_out + 1, >- NFDBITS), sizeof(fd_mask)); >+ setp = (fd_set *)xcalloc(1, FD_SET_SIZE(active_state->connection_out)); > packet_write_poll(); > while (packet_have_data_to_write()) { >- memset(setp, 0, howmany(active_state->connection_out + 1, >- NFDBITS) * sizeof(fd_mask)); >+ memset(setp, 0, FD_SET_SIZE(active_state->connection_out)); > FD_SET(active_state->connection_out, setp); > > if (active_state->packet_timeout_ms > 0) { >Index: packet.h >=================================================================== >RCS file: /cvs/openssh/packet.h,v >retrieving revision 1.60 >diff -u -r1.60 packet.h >--- packet.h 10 Feb 2012 21:19:21 -0000 1.60 >+++ packet.h 15 May 2013 12:02:22 -0000 >@@ -16,7 +16,9 @@ > #ifndef PACKET_H > #define PACKET_H > >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > > #include <openssl/bn.h> > #ifdef OPENSSL_HAS_ECC >Index: platform.h >=================================================================== >RCS file: /cvs/openssh/platform.h,v >retrieving revision 1.8 >diff -u -r1.8 platform.h >--- platform.h 12 Mar 2013 00:31:05 -0000 1.8 >+++ platform.h 15 May 2013 12:02:22 -0000 >@@ -18,7 +18,11 @@ > > #include <sys/types.h> > >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif >+ >+struct passwd; > > void platform_pre_listen(void); > void platform_pre_fork(void); >Index: progressmeter.c >=================================================================== >RCS file: /cvs/openssh/progressmeter.c,v >retrieving revision 1.38 >diff -u -r1.38 progressmeter.c >--- progressmeter.c 5 Aug 2006 02:39:40 -0000 1.38 >+++ progressmeter.c 15 May 2013 12:02:22 -0000 >@@ -26,8 +26,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/ioctl.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > > #include <errno.h> > #include <signal.h> >Index: readconf.c >=================================================================== >RCS file: /cvs/openssh/readconf.c,v >retrieving revision 1.177 >diff -u -r1.177 readconf.c >--- readconf.c 23 Apr 2013 05:17:12 -0000 1.177 >+++ readconf.c 15 May 2013 12:02:22 -0000 >@@ -16,15 +16,25 @@ > > #include <sys/types.h> > #include <sys/stat.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <netinet/in.h> >-#include <netinet/in_systm.h> >-#include <netinet/ip.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_NETINET_IN_SYSTM_H >+# include <netinet/in_systm.h> >+#endif >+#ifdef HAVE_NETINET_IP_H >+# include <netinet/ip.h> >+#endif > > #include <ctype.h> > #include <errno.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #include <signal.h> > #include <stdarg.h> > #include <stdio.h> >Index: readpass.c >=================================================================== >RCS file: /cvs/openssh/readpass.c,v >retrieving revision 1.47 >diff -u -r1.47 readpass.c >--- readpass.c 6 Jan 2011 11:43:45 -0000 1.47 >+++ readpass.c 15 May 2013 12:02:22 -0000 >@@ -26,7 +26,9 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/wait.h> >+#ifdef HAVE_SYS_WAIT_H >+# include <sys/wait.h> >+#endif > > #include <errno.h> > #include <fcntl.h> >Index: roaming_client.c >=================================================================== >RCS file: /cvs/openssh/roaming_client.c,v >retrieving revision 1.7 >diff -u -r1.7 roaming_client.c >--- roaming_client.c 18 Dec 2011 23:52:52 -0000 1.7 >+++ roaming_client.c 15 May 2013 12:02:23 -0000 >@@ -19,7 +19,9 @@ > > #include "openbsd-compat/sys-queue.h" > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #ifdef HAVE_INTTYPES_H > #include <inttypes.h> >Index: roaming_common.c >=================================================================== >RCS file: /cvs/openssh/roaming_common.c,v >retrieving revision 1.8 >diff -u -r1.8 roaming_common.c >--- roaming_common.c 18 Dec 2011 23:52:52 -0000 1.8 >+++ roaming_common.c 15 May 2013 12:02:23 -0000 >@@ -18,8 +18,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >-#include <sys/uio.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+#endif > > #include <errno.h> > #ifdef HAVE_INTTYPES_H >Index: ssh.c >=================================================================== >RCS file: /cvs/openssh/ssh.c,v >retrieving revision 1.373 >diff -u -r1.373 ssh.c >--- ssh.c 23 Apr 2013 09:25:00 -0000 1.373 >+++ ssh.c 15 May 2013 12:02:24 -0000 >@@ -46,20 +46,32 @@ > #ifdef HAVE_SYS_STAT_H > # include <sys/stat.h> > #endif >-#include <sys/resource.h> >-#include <sys/ioctl.h> >+#ifdef HAVE_SYS_RESOURCE_H >+# include <sys/resource.h> >+#endif >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif > #include <sys/param.h> >-#include <sys/socket.h> >-#include <sys/wait.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_SYS_WAIT_H >+# include <sys/wait.h> >+#endif > > #include <ctype.h> > #include <errno.h> > #include <fcntl.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #ifdef HAVE_PATHS_H > #include <paths.h> > #endif >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <signal.h> > #include <stdarg.h> > #include <stddef.h> >@@ -68,8 +80,12 @@ > #include <string.h> > #include <unistd.h> > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <openssl/evp.h> > #include <openssl/err.h> >@@ -248,6 +264,24 @@ > > struct servent *sp; > Forward fwd; >+ >+#ifdef WIN32 >+ WSADATA wsa_data; >+ >+ WSAStartup(MAKEWORD(2, 2), &wsa_data); >+ >+ /* Unlike Unix, stderr is buffered on Windows */ >+ if (setvbuf(stderr, NULL, _IONBF, 0)) >+ perror("setvbuf"); >+ >+ /* And make sure \r isn't filtered out */ >+ if (_setmode(STDIN_FILENO, _O_BINARY) == -1) >+ perror("_setmode"); >+ if (_setmode(STDOUT_FILENO, _O_BINARY) == -1) >+ perror("_setmode"); >+ if (_setmode(STDERR_FILENO, _O_BINARY) == -1) >+ perror("_setmode"); >+#endif > > /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ > sanitise_stdfd(); >Index: sshconnect.c >=================================================================== >RCS file: /cvs/openssh/sshconnect.c,v >retrieving revision 1.210 >diff -u -r1.210 sshconnect.c >--- sshconnect.c 5 Apr 2013 00:20:00 -0000 1.210 >+++ sshconnect.c 15 May 2013 12:02:25 -0000 >@@ -16,24 +16,36 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/wait.h> >+#ifdef HAVE_SYS_WAIT_H >+# include <sys/wait.h> >+#endif > #include <sys/stat.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > #ifdef HAVE_SYS_TIME_H > # include <sys/time.h> > #endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <ctype.h> > #include <errno.h> > #include <fcntl.h> >-#include <netdb.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif > #ifdef HAVE_PATHS_H > #include <paths.h> > #endif >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <signal.h> > #include <stdarg.h> > #include <stdio.h> >@@ -61,6 +73,7 @@ > #include "roaming.h" > #include "ssh2.h" > #include "version.h" >+#include "uuencode.h" > > char *client_version_string = NULL; > char *server_version_string = NULL; >@@ -274,8 +287,7 @@ > goto done; > } > >- fdset = (fd_set *)xcalloc(howmany(sockfd + 1, NFDBITS), >- sizeof(fd_mask)); >+ fdset = (fd_set *)xcalloc(1, FD_SET_SIZE(sockfd)); > FD_SET(sockfd, fdset); > ms_to_timeval(&tv, *timeoutp); > >@@ -472,8 +484,7 @@ > struct timeval t_start, t_remaining; > fd_set *fdset; > >- fdsetsz = howmany(connection_in + 1, NFDBITS) * sizeof(fd_mask); >- fdset = xcalloc(1, fdsetsz); >+ fdset = xcalloc(1, FD_SET_SIZE(connection_in)); > > /* > * If we are SSH2-only then we can send the banner immediately and >Index: sshconnect1.c >=================================================================== >RCS file: /cvs/openssh/sshconnect1.c,v >retrieving revision 1.72 >diff -u -r1.72 sshconnect1.c >--- sshconnect1.c 7 Nov 2006 12:14:42 -0000 1.72 >+++ sshconnect1.c 15 May 2013 12:02:25 -0000 >@@ -16,7 +16,9 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #include <openssl/bn.h> > #include <openssl/md5.h> >@@ -26,7 +28,9 @@ > #include <stdlib.h> > #include <string.h> > #include <signal.h> >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > > #include "xmalloc.h" > #include "ssh.h" >Index: sshconnect2.c >=================================================================== >RCS file: /cvs/openssh/sshconnect2.c,v >retrieving revision 1.187 >diff -u -r1.187 sshconnect2.c >--- sshconnect2.c 23 Apr 2013 05:18:52 -0000 1.187 >+++ sshconnect2.c 15 May 2013 12:02:25 -0000 >@@ -27,14 +27,22 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/socket.h> >-#include <sys/wait.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_SYS_WAIT_H >+# include <sys/wait.h> >+#endif > #include <sys/stat.h> > > #include <errno.h> > #include <fcntl.h> >-#include <netdb.h> >-#include <pwd.h> >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <signal.h> > #include <stdarg.h> > #include <stdio.h> >Index: sshpty.h >=================================================================== >RCS file: /cvs/openssh/sshpty.h,v >retrieving revision 1.14 >diff -u -r1.14 sshpty.h >--- sshpty.h 9 Jan 2010 11:26:23 -0000 1.14 >+++ sshpty.h 15 May 2013 12:02:25 -0000 >@@ -14,7 +14,9 @@ > * called by a name other than "ssh" or "Secure Shell". > */ > >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > > struct termios *get_saved_tio(void); > void leave_raw_mode(int); >Index: sshtty.c >=================================================================== >RCS file: /cvs/openssh/sshtty.c,v >retrieving revision 1.14 >diff -u -r1.14 sshtty.c >--- sshtty.c 9 Jan 2010 11:26:23 -0000 1.14 >+++ sshtty.c 15 May 2013 12:02:25 -0000 >@@ -39,8 +39,12 @@ > > #include <sys/types.h> > #include <stdio.h> >-#include <termios.h> >-#include <pwd.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > > #include "sshpty.h" > >Index: ttymodes.c >=================================================================== >RCS file: /cvs/openssh/ttymodes.c,v >retrieving revision 1.28 >diff -u -r1.28 ttymodes.c >--- ttymodes.c 3 Nov 2008 08:27:52 -0000 1.28 >+++ ttymodes.c 15 May 2013 12:02:25 -0000 >@@ -49,7 +49,9 @@ > > #include <errno.h> > #include <string.h> >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > #include <stdarg.h> > > #include "packet.h" >Index: ttymodes.h >=================================================================== >RCS file: /cvs/openssh/ttymodes.h,v >retrieving revision 1.12 >diff -u -r1.12 ttymodes.h >--- ttymodes.h 26 Mar 2006 03:30:02 -0000 1.12 >+++ ttymodes.h 15 May 2013 12:02:25 -0000 >@@ -67,21 +67,33 @@ > > /* termios macro */ > /* name, op */ >+#if defined(VINTR) > TTYCHAR(VINTR, 1) >+#endif /* VINTR */ >+#if defined(VQUIT) > TTYCHAR(VQUIT, 2) >+#endif /* VQUIT */ >+#if defined(VERASE) > TTYCHAR(VERASE, 3) >+#endif /* VERASE */ > #if defined(VKILL) > TTYCHAR(VKILL, 4) > #endif /* VKILL */ >+#if defined(VEOF) > TTYCHAR(VEOF, 5) >+#endif /* VEOF */ > #if defined(VEOL) > TTYCHAR(VEOL, 6) > #endif /* VEOL */ > #ifdef VEOL2 > TTYCHAR(VEOL2, 7) > #endif /* VEOL2 */ >+#if defined(VSTART) > TTYCHAR(VSTART, 8) >+#endif /* VSTART */ >+#if defined(VSTOP) > TTYCHAR(VSTOP, 9) >+#endif /* VSTOP */ > #if defined(VSUSP) > TTYCHAR(VSUSP, 10) > #endif /* VSUSP */ >Index: uidswap.c >=================================================================== >RCS file: /cvs/openssh/uidswap.c,v >retrieving revision 1.61 >diff -u -r1.61 uidswap.c >--- uidswap.c 5 Nov 2012 06:04:37 -0000 1.61 >+++ uidswap.c 15 May 2013 12:02:25 -0000 >@@ -16,12 +16,16 @@ > > #include <sys/param.h> > #include <errno.h> >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <string.h> > #include <unistd.h> > #include <stdarg.h> > >-#include <grp.h> >+#ifdef HAVE_GRP_H >+# include <grp.h> >+#endif > > #include "log.h" > #include "uidswap.h" >Index: uuencode.c >=================================================================== >RCS file: /cvs/openssh/uuencode.c,v >retrieving revision 1.26 >diff -u -r1.26 uuencode.c >--- uuencode.c 31 Aug 2010 12:41:14 -0000 1.26 >+++ uuencode.c 15 May 2013 12:02:25 -0000 >@@ -26,8 +26,12 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <netinet/in.h> >-#include <resolv.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_RESOLV_H >+# include <resolv.h> >+#endif > #include <stdio.h> > > #include "xmalloc.h" >Index: openbsd-compat/Makefile.in >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/Makefile.in,v >retrieving revision 1.51 >diff -u -r1.51 Makefile.in >--- openbsd-compat/Makefile.in 10 May 2013 06:28:56 -0000 1.51 >+++ openbsd-compat/Makefile.in 15 May 2013 12:02:25 -0000 >@@ -22,6 +22,8 @@ > > PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o > >+WIN32=win32-afunix.o win32-misc.o win32-pwd.o win32-socket.o win32-sspi.o win32-stubs.o win32-tty.o >+ > .c.o: > $(CC) $(CFLAGS) $(CPPFLAGS) -c $< > >@@ -30,9 +32,10 @@ > $(COMPAT): ../config.h > $(OPENBSD): ../config.h > $(PORTS): ../config.h >+$(WIN32): ../config.h > >-libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS) >- $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS) >+libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS) $(WIN32) >+ $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS) $(WIN32) > $(RANLIB) $@ > > clean: >Index: openbsd-compat/base64.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/base64.c,v >retrieving revision 1.8 >diff -u -r1.8 base64.c >--- openbsd-compat/base64.c 26 Oct 2007 06:17:26 -0000 1.8 >+++ openbsd-compat/base64.c 15 May 2013 12:02:25 -0000 >@@ -50,9 +50,15 @@ > > #include <sys/types.h> > #include <sys/param.h> >-#include <sys/socket.h> >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <ctype.h> > #include <stdio.h> >Index: openbsd-compat/bindresvport.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/bindresvport.c,v >retrieving revision 1.12 >diff -u -r1.12 bindresvport.c >--- openbsd-compat/bindresvport.c 2 Dec 2010 23:50:26 -0000 1.12 >+++ openbsd-compat/bindresvport.c 15 May 2013 12:02:26 -0000 >@@ -34,10 +34,16 @@ > > #ifndef HAVE_BINDRESVPORT_SA > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <errno.h> > #include <string.h> >Index: openbsd-compat/bsd-getpeereid.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/bsd-getpeereid.c,v >retrieving revision 1.6 >diff -u -r1.6 bsd-getpeereid.c >--- openbsd-compat/bsd-getpeereid.c 21 Mar 2007 10:39:58 -0000 1.6 >+++ openbsd-compat/bsd-getpeereid.c 15 May 2013 12:02:26 -0000 >@@ -19,7 +19,9 @@ > #if !defined(HAVE_GETPEEREID) > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > > #include <unistd.h> > >Index: openbsd-compat/bsd-misc.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/bsd-misc.c,v >retrieving revision 1.40 >diff -u -r1.40 bsd-misc.c >--- openbsd-compat/bsd-misc.c 14 Mar 2013 23:34:27 -0000 1.40 >+++ openbsd-compat/bsd-misc.c 15 May 2013 12:02:26 -0000 >@@ -29,6 +29,9 @@ > #include <signal.h> > #include <stdlib.h> > #include <unistd.h> >+#ifdef HAVE_FCNTL_H >+# include <fcntl.h> >+#endif > > #include "xmalloc.h" > >Index: openbsd-compat/bsd-poll.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/bsd-poll.c,v >retrieving revision 1.4 >diff -u -r1.4 bsd-poll.c >--- openbsd-compat/bsd-poll.c 29 Aug 2008 21:32:38 -0000 1.4 >+++ openbsd-compat/bsd-poll.c 15 May 2013 12:02:26 -0000 >@@ -42,7 +42,6 @@ > nfds_t i; > int saved_errno, ret, fd, maxfd = 0; > fd_set *readfds = NULL, *writefds = NULL, *exceptfds = NULL; >- size_t nmemb; > struct timeval tv, *tvp = NULL; > > for (i = 0; i < nfds; i++) { >@@ -54,10 +53,9 @@ > maxfd = MAX(maxfd, fd); > } > >- nmemb = howmany(maxfd + 1 , NFDBITS); >- if ((readfds = calloc(nmemb, sizeof(fd_mask))) == NULL || >- (writefds = calloc(nmemb, sizeof(fd_mask))) == NULL || >- (exceptfds = calloc(nmemb, sizeof(fd_mask))) == NULL) { >+ if ((readfds = calloc(1, FD_SET_SIZE(maxfd))) == NULL || >+ (writefds = calloc(1, FD_SET_SIZE(maxfd))) == NULL || >+ (exceptfds = calloc(1, FD_SET_SIZE(maxfd))) == NULL) { > saved_errno = ENOMEM; > ret = -1; > goto out; >Index: openbsd-compat/bsd-waitpid.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/bsd-waitpid.c,v >retrieving revision 1.6 >diff -u -r1.6 bsd-waitpid.c >--- openbsd-compat/bsd-waitpid.c 25 Mar 2006 13:03:24 -0000 1.6 >+++ openbsd-compat/bsd-waitpid.c 15 May 2013 12:02:26 -0000 >@@ -26,7 +26,9 @@ > > #ifndef HAVE_WAITPID > #include <errno.h> >-#include <sys/wait.h> >+#ifdef HAVE_SYS_WAIT_H >+# include <sys/wait.h> >+#endif > #include "bsd-waitpid.h" > > pid_t >Index: openbsd-compat/fake-rfc2553.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/fake-rfc2553.c,v >retrieving revision 1.10 >diff -u -r1.10 fake-rfc2553.c >--- openbsd-compat/fake-rfc2553.c 14 Jul 2008 11:37:37 -0000 1.10 >+++ openbsd-compat/fake-rfc2553.c 15 May 2013 12:02:26 -0000 >@@ -40,8 +40,12 @@ > #include <stdlib.h> > #include <string.h> > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #ifndef HAVE_GETNAMEINFO > int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, >Index: openbsd-compat/getgrouplist.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/getgrouplist.c,v >retrieving revision 1.7 >diff -u -r1.7 getgrouplist.c >--- openbsd-compat/getgrouplist.c 23 Sep 2011 00:44:04 -0000 1.7 >+++ openbsd-compat/getgrouplist.c 15 May 2013 12:02:26 -0000 >@@ -40,7 +40,9 @@ > #include <sys/types.h> > #include <string.h> > #include <unistd.h> >-#include <grp.h> >+#ifdef HAVE_GRP_H >+# include <grp.h> >+#endif > > int > getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) >Index: openbsd-compat/getopt.h >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/getopt.h,v >retrieving revision 1.6 >diff -u -r1.6 getopt.h >--- openbsd-compat/getopt.h 10 May 2013 08:08:49 -0000 1.6 >+++ openbsd-compat/getopt.h 15 May 2013 12:02:26 -0000 >@@ -33,7 +33,14 @@ > #ifndef _GETOPT_H_ > #define _GETOPT_H_ > >-#include <sys/cdefs.h> >+#ifdef HAVE_SYS_CDEFS_H >+# include <sys/cdefs.h> >+#endif >+ >+#ifndef __BEGIN_DECLS >+#define __BEGIN_DECLS >+#define __END_DECLS >+#endif > > /* > * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions >Index: openbsd-compat/getrrsetbyname.h >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/getrrsetbyname.h,v >retrieving revision 1.8 >diff -u -r1.8 getrrsetbyname.h >--- openbsd-compat/getrrsetbyname.h 26 Oct 2007 06:26:50 -0000 1.8 >+++ openbsd-compat/getrrsetbyname.h 15 May 2013 12:02:26 -0000 >@@ -53,10 +53,18 @@ > #ifndef HAVE_GETRRSETBYNAME > > #include <sys/types.h> >-#include <netinet/in.h> >-#include <arpa/nameser.h> >-#include <netdb.h> >-#include <resolv.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_NAMESER_H >+# include <arpa/nameser.h> >+#endif >+#ifdef HAVE_NETDB_H >+# include <netdb.h> >+#endif >+#ifdef HAVE_RESOLV_H >+# include <resolv.h> >+#endif > > #ifndef HFIXEDSZ > #define HFIXEDSZ 12 >Index: openbsd-compat/glob.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/glob.c,v >retrieving revision 1.32 >diff -u -r1.32 glob.c >--- openbsd-compat/glob.c 22 Sep 2011 11:22:23 -0000 1.32 >+++ openbsd-compat/glob.c 15 May 2013 12:02:26 -0000 >@@ -67,7 +67,9 @@ > #include <ctype.h> > #include <errno.h> > #include <limits.h> >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >@@ -650,10 +652,13 @@ > } > > if (((pglob->gl_flags & GLOB_MARK) && >- pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || >- (S_ISLNK(sb.st_mode) && >+ pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) >+#ifdef S_ISLNK >+ || (S_ISLNK(sb.st_mode) && > (g_stat(pathbuf, &sb, pglob) == 0) && >- S_ISDIR(sb.st_mode)))) { >+ S_ISDIR(sb.st_mode)) >+#endif >+ )) { > if (pathend+1 > pathend_last) > return (1); > *pathend++ = SEP; >Index: openbsd-compat/inet_aton.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/inet_aton.c,v >retrieving revision 1.9 >diff -u -r1.9 inet_aton.c >--- openbsd-compat/inet_aton.c 10 Nov 2005 06:21:21 -0000 1.9 >+++ openbsd-compat/inet_aton.c 15 May 2013 12:02:26 -0000 >@@ -57,8 +57,12 @@ > > #include <sys/types.h> > #include <sys/param.h> >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > #include <ctype.h> > > #if 0 >Index: openbsd-compat/inet_ntop.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/inet_ntop.c,v >retrieving revision 1.13 >diff -u -r1.13 inet_ntop.c >--- openbsd-compat/inet_ntop.c 23 Sep 2011 01:16:11 -0000 1.13 >+++ openbsd-compat/inet_ntop.c 15 May 2013 12:02:26 -0000 >@@ -24,10 +24,18 @@ > > #include <sys/param.h> > #include <sys/types.h> >-#include <sys/socket.h> >-#include <netinet/in.h> >-#include <arpa/inet.h> >-#include <arpa/nameser.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif >+#ifdef HAVE_ARPA_NAMESER_H >+# include <arpa/nameser.h> >+#endif > #include <string.h> > #include <errno.h> > #include <stdio.h> >Index: openbsd-compat/openbsd-compat.h >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/openbsd-compat.h,v >retrieving revision 1.56 >diff -u -r1.56 openbsd-compat.h >--- openbsd-compat/openbsd-compat.h 10 May 2013 08:08:49 -0000 1.56 >+++ openbsd-compat/openbsd-compat.h 15 May 2013 12:02:26 -0000 >@@ -32,9 +32,22 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif >+ >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <sys/socket.h> >+/* Windows specific compatibility routines */ >+#include "win32-afunix.h" >+#include "win32-misc.h" >+#include "win32-pwd.h" >+#include "win32-socket.h" >+#include "win32-sspi.h" >+#include "win32-stubs.h" >+#include "win32-tty.h" > > /* OpenBSD function replacements */ > #include "base64.h" >@@ -144,7 +157,9 @@ > > #if defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0 > # include <sys/types.h> >-# include <sys/uio.h> >+# ifdef HAVE_SYS_UIO_H >+# include <sys/uio.h> >+# endif > int writev(int, struct iovec *, int); > #endif > >@@ -177,7 +192,9 @@ > #endif > > #ifndef HAVE_OPENPTY >-# include <sys/ioctl.h> /* for struct winsize */ >+# ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> /* for struct winsize */ >+# endif > int openpty(int *, int *, char *, struct termios *, struct winsize *); > #endif /* HAVE_OPENPTY */ > >Index: openbsd-compat/port-solaris.h >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/port-solaris.h,v >retrieving revision 1.2 >diff -u -r1.2 port-solaris.h >--- openbsd-compat/port-solaris.h 5 Nov 2010 01:03:05 -0000 1.2 >+++ openbsd-compat/port-solaris.h 15 May 2013 12:02:26 -0000 >@@ -20,7 +20,9 @@ > > #include <sys/types.h> > >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > > void solaris_contract_pre_fork(void); > void solaris_contract_post_fork_child(void); >Index: openbsd-compat/port-tun.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/port-tun.c,v >retrieving revision 1.15 >diff -u -r1.15 port-tun.c >--- openbsd-compat/port-tun.c 10 Aug 2010 02:47:42 -0000 1.15 >+++ openbsd-compat/port-tun.c 15 May 2013 12:02:26 -0000 >@@ -17,11 +17,19 @@ > #include "includes.h" > > #include <sys/types.h> >-#include <sys/ioctl.h> >+#ifdef HAVE_SYS_IOCTL_H >+# include <sys/ioctl.h> >+#endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >-#include <netinet/ip.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif >+#ifdef HAVE_NETINET_IP_H >+# include <netinet/ip.h> >+#endif > > #include <errno.h> > #include <fcntl.h> >Index: openbsd-compat/pwcache.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/pwcache.c,v >retrieving revision 1.4 >diff -u -r1.4 pwcache.c >--- openbsd-compat/pwcache.c 16 Jan 2010 02:53:52 -0000 1.4 >+++ openbsd-compat/pwcache.c 15 May 2013 12:02:26 -0000 >@@ -34,8 +34,12 @@ > > #include <sys/types.h> > >-#include <grp.h> >-#include <pwd.h> >+#ifdef HAVE_GRP_H >+# include <grp.h> >+#endif >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >Index: openbsd-compat/readpassphrase.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/readpassphrase.c,v >retrieving revision 1.23 >diff -u -r1.23 readpassphrase.c >--- openbsd-compat/readpassphrase.c 13 Jan 2010 10:32:44 -0000 1.23 >+++ openbsd-compat/readpassphrase.c 15 May 2013 12:02:26 -0000 >@@ -26,7 +26,9 @@ > > #ifndef HAVE_READPASSPHRASE > >-#include <termios.h> >+#ifdef HAVE_TERMIOS_H >+# include <termios.h> >+#endif > #include <signal.h> > #include <ctype.h> > #include <fcntl.h> >Index: openbsd-compat/realpath.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/realpath.c,v >retrieving revision 1.14 >diff -u -r1.14 realpath.c >--- openbsd-compat/realpath.c 12 Nov 2005 03:14:53 -0000 1.14 >+++ openbsd-compat/realpath.c 15 May 2013 12:02:26 -0000 >@@ -142,6 +142,7 @@ > } > return (NULL); > } >+#ifdef S_ISLNK > if (S_ISLNK(sb.st_mode)) { > if (symlinks++ > MAXSYMLINKS) { > errno = ELOOP; >@@ -184,6 +185,7 @@ > } > left_len = strlcpy(left, symlink, sizeof(left)); > } >+#endif > } > > /* >Index: openbsd-compat/rresvport.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/rresvport.c,v >retrieving revision 1.13 >diff -u -r1.13 rresvport.c >--- openbsd-compat/rresvport.c 14 Jul 2008 02:03:27 -0000 1.13 >+++ openbsd-compat/rresvport.c 15 May 2013 12:02:26 -0000 >@@ -36,10 +36,16 @@ > #ifndef HAVE_RRESVPORT_AF > > #include <sys/types.h> >-#include <sys/socket.h> >+#ifdef HAVE_SYS_SOCKET_H >+# include <sys/socket.h> >+#endif > >-#include <netinet/in.h> >-#include <arpa/inet.h> >+#ifdef HAVE_NETINET_IN_H >+# include <netinet/in.h> >+#endif >+#ifdef HAVE_ARPA_INET_H >+# include <arpa/inet.h> >+#endif > > #include <errno.h> > #include <stdlib.h> >Index: openbsd-compat/strmode.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/strmode.c,v >retrieving revision 1.7 >diff -u -r1.7 strmode.c >--- openbsd-compat/strmode.c 10 Nov 2005 05:38:54 -0000 1.7 >+++ openbsd-compat/strmode.c 15 May 2013 12:02:26 -0000 >@@ -56,9 +56,11 @@ > case S_IFREG: /* regular */ > *p++ = '-'; > break; >+#ifdef S_IFLNK > case S_IFLNK: /* symbolic link */ > *p++ = 'l'; > break; >+#endif > #ifdef S_IFSOCK > case S_IFSOCK: /* socket */ > *p++ = 's'; >Index: openbsd-compat/win32-afunix.c >=================================================================== >RCS file: openbsd-compat/win32-afunix.c >diff -N openbsd-compat/win32-afunix.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-afunix.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,171 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#include "log.h" >+ >+#ifdef WIN32 >+ >+static FD_SET afunix_sockets; >+static int skip_redirection; >+ >+int >+win32_is_afunix(int fd) >+{ >+ /* Temporary bypass */ >+ if (skip_redirection) { >+ skip_redirection = 0; >+ return 0; >+ } >+ >+ return FD_ISSET(fd, &afunix_sockets); >+} >+ >+int >+win32_afunix_close(int fd) >+{ >+ if (!win32_is_afunix(fd)) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ FD_CLR(fd, &afunix_sockets); >+ >+ return 0; >+} >+ >+int >+win32_afunix_accept(int socket, struct sockaddr *address, >+ socklen_t *address_len) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+win32_afunix_bind(int socket, const struct sockaddr *address, >+ socklen_t address_len) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+win32_afunix_connect(int socket, const struct sockaddr *address, >+ socklen_t address_len) >+{ >+ int ret; >+ const struct sockaddr_un *addr; >+ >+ FILE *f; >+ int port; >+ char cookie[65]; >+ >+ struct sockaddr_in sin; >+ >+ if (!win32_is_afunix(socket)) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ if ((address == NULL) || (address_len != sizeof(struct sockaddr_un))) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ addr = (const struct sockaddr_un*)address; >+ >+ f = fopen(addr->sun_path, "rt"); >+ if (f == NULL) >+ return -1; >+ >+ port = 0; >+ cookie[0] = '\0'; >+ >+ fscanf(f, "%d ", &port); >+ fgets(cookie, sizeof(cookie), f); >+ >+ fclose(f); >+ >+ if ((port == 0) || (strlen(cookie) != sizeof(cookie)-1)) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ memset(&sin, 0, sizeof(struct sockaddr_in)); >+ >+ sin.sin_family = AF_INET; >+ sin.sin_port = htons(port); >+ sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); >+ >+ /* Temporarily allow us to call a real connect() */ >+ skip_redirection = 1; >+ >+ ret = connect(socket, (struct sockaddr*)&sin, >+ sizeof(struct sockaddr_in)); >+ if (ret == -1) { >+ FD_SET fds; >+ >+ if (errno != EINPROGRESS) >+ return -1; >+ >+ debug("waiting for emulated unix socket to connect..."); >+ >+ FD_ZERO(&fds); >+ FD_SET(socket, &fds); >+ >+ ret = select(socket, NULL, &fds, NULL, NULL); >+ if (ret == -1) >+ return -1; >+ >+ debug("done."); >+ } >+ >+ ret = write(socket, cookie, strlen(cookie)); >+ if (ret == -1) >+ return -1; >+ >+ return 0; >+} >+ >+int >+win32_afunix_listen(int sockfd, int backlog) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+win32_afunix_socket(int domain, int type, int protocol) >+{ >+ int fd; >+ >+ if ((domain != AF_UNIX) || (type != SOCK_STREAM)) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ fd = socket(AF_INET, SOCK_STREAM, 0); >+ if (fd == -1) >+ return -1; >+ >+ FD_SET(fd, &afunix_sockets); >+ >+ return fd; >+} >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-afunix.h >=================================================================== >RCS file: openbsd-compat/win32-afunix.h >diff -N openbsd-compat/win32-afunix.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-afunix.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,39 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_AFUNIX_H >+#define _WIN32_AFUNIX_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+int win32_is_afunix(int fd); >+ >+int win32_afunix_close(int fd); >+ >+int win32_afunix_accept(int socket, struct sockaddr *address, >+ socklen_t *address_len); >+int win32_afunix_bind(int socket, const struct sockaddr *address, >+ socklen_t address_len); >+int win32_afunix_connect(int socket, const struct sockaddr *address, >+ socklen_t address_len); >+int win32_afunix_listen(int sockfd, int backlog); >+int win32_afunix_socket(int domain, int type, int protocol); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_AFUNIX_H */ >Index: openbsd-compat/win32-misc.c >=================================================================== >RCS file: openbsd-compat/win32-misc.c >diff -N openbsd-compat/win32-misc.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-misc.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,233 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#undef strerror >+ >+#ifdef WIN32 >+ >+#include <ddk/ntifs.h> >+ >+int >+isafifo(int fd) >+{ >+ int ret; >+ struct stat st; >+ >+ ret = fstat(fd, &st); >+ if (ret != 0) >+ return 0; >+ >+ return S_ISFIFO(st.st_mode); >+} >+ >+int >+fcntl(int fd, int cmd, ... /* arg */ ) >+{ >+ unsigned long val; >+ >+ va_list ap; >+ >+ switch (cmd) { >+ case F_SETFD: >+ return 0; >+ case F_GETFL: >+ if (isatty(fd)) { >+ /* The console cannot be made non-blocking */ >+ return 0; >+ } else if (isafifo(fd)) { >+ HANDLE handle; >+ DWORD state; >+ >+ handle = (HANDLE)_get_osfhandle(fd); >+ if (!GetNamedPipeHandleState(handle, &state, NULL, >+ NULL, NULL, NULL, 0)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ if (state & PIPE_NOWAIT) >+ return O_NONBLOCK; >+ >+ return 0; >+ } else { >+ /* >+ * Sockets are blocking by default, but we have no >+ * way of checking what it is now. >+ */ >+ return 0; >+ } >+ case F_SETFL: >+ va_start(ap, cmd); >+ val = va_arg(ap, int); >+ va_end(ap); >+ >+ if (isatty(fd)) { >+ /* The console cannot be made non-blocking */ >+ if (val & O_NONBLOCK) { >+ errno = EPERM; >+ return -1; >+ } >+ >+ return 0; >+ } else if (isafifo(fd)) { >+ int i; >+ HANDLE handle; >+ DWORD state; >+ >+ handle = (HANDLE)_get_osfhandle(fd); >+ >+ /* >+ * You can't reconfigure a pipe that has data in it >+ * so we need to check the buffers. We can't do >+ * anything about incoming data, but outgoing data >+ * we can wait a while for... >+ */ >+ for (i = 0;i < 100;i++) { >+ IO_STATUS_BLOCK iosb; >+ FILE_PIPE_LOCAL_INFORMATION fpli; >+ NTSTATUS ret; >+ >+ ret = ZwQueryInformationFile(handle, &iosb, >+ &fpli, sizeof(fpli), >+ FilePipeLocalInformation); >+ if (ret != STATUS_SUCCESS) { >+ errno = ret | WIN32_ERRNO; >+ return -1; >+ } >+ >+ if (fpli.WriteQuotaAvailable == fpli.OutboundQuota) >+ break; >+ >+ Sleep(50); >+ } >+ >+ if (!GetNamedPipeHandleState(handle, &state, NULL, >+ NULL, NULL, NULL, 0)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ if (val & O_NONBLOCK) >+ state |= PIPE_NOWAIT; >+ else >+ state &= ~PIPE_NOWAIT; >+ >+ if (!SetNamedPipeHandleState(handle, &state, >+ NULL, NULL)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+ } else { >+ int ret; >+ >+ val = (val & O_NONBLOCK) != 0; >+ >+ ret = ioctlsocket(fd, FIONBIO, &val); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+ } >+ default: >+ errno = EINVAL; >+ return -1; >+ } >+} >+ >+int >+sigaction(int sig, struct sigaction *sigact, struct sigaction *osigact) >+{ >+ void (*old)(int); >+ >+ if (sig >= NSIG) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ if (sigact) >+ old = signal(sig, sigact->sa_handler); >+ else >+ old = signal(sig, SIG_IGN); >+ >+ if (old == SIG_ERR) >+ return -1; >+ >+ if (!sigact) >+ signal(sig, old); >+ >+ if (osigact) >+ osigact->sa_handler = old; >+ >+ return 0; >+} >+ >+int >+sigemptyset(sigset_t *mask) >+{ >+ *mask = 0; >+ >+ return 0; >+} >+ >+int kill(pid_t pid, int sig) >+{ >+ if (pid != getpid()) { >+ errno = EPERM; >+ return -1; >+ } >+ >+ if (sig >= NSIG) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ return raise(sig); >+} >+ >+unsigned int >+sleep(unsigned int seconds) >+{ >+ Sleep(seconds * 1000); >+ return 0; >+} >+ >+char * >+win32_strerror(int errnum) >+{ >+ if (errnum & WIN32_ERRNO) { >+ static char msg[256]; >+ errnum &= ~WIN32_ERRNO; >+ if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, errnum, >+ 0, msg, sizeof(msg), NULL)) { >+ snprintf(msg, sizeof(msg), "Unknown error %d", errnum); >+ } else { >+ // Windows likes line ending on their error messages >+ if (strlen(msg) >= 2) >+ msg[strlen(msg)-2] = '\0'; >+ } >+ return msg; >+ } >+ >+ return strerror(errnum); >+} >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-misc.h >=================================================================== >RCS file: openbsd-compat/win32-misc.h >diff -N openbsd-compat/win32-misc.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-misc.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,94 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_MISC_H >+#define _WIN32_MISC_H >+ >+#include "includes.h" >+ >+#include <signal.h> >+ >+#ifdef WIN32 >+ >+#undef _PATH_DEVNULL >+#define _PATH_DEVNULL "nul" >+ >+#define bzero(s, n) memset(s, 0, n) >+ >+/* These are outside the normal range */ >+#define S_IXGRP 0x00010000 >+#define S_IWGRP 0x00020000 >+#define S_IRGRP 0x00040000 >+#define S_IXOTH 0x00100000 >+#define S_IWOTH 0x00200000 >+#define S_IROTH 0x00400000 >+#define S_ISUID 0x01000000 >+#define S_ISGID 0x02000000 >+#define S_ISVTX 0x04000000 >+ >+#define lstat(path, st) stat(path, st) >+ >+#define mkdir(path, mode) mkdir(path) >+ >+#define F_SETFD 0 >+#define F_GETFL 1 >+#define F_SETFL 2 >+ >+#define FD_CLOEXEC 0x1 >+ >+int isafifo(int fd); >+ >+int fcntl(int fd, int cmd, ... /* arg */ ); >+ >+struct iovec { >+ void *iov_base; /* Starting address */ >+ size_t iov_len; /* Number of bytes to transfer */ >+}; >+ >+#define SIGHUP (NSIG+1) >+#define SIGQUIT (NSIG+2) >+#define SIGPIPE (NSIG+3) >+#define SIGALRM (NSIG+4) >+#define SIGCHLD (NSIG+5) >+#define SIGTSTP (NSIG+6) >+#define SIGTTIN (NSIG+7) >+#define SIGTTOU (NSIG+8) >+#define SIGWINCH (NSIG+9) >+ >+typedef int sigset_t; >+ >+struct sigaction { >+ void (*sa_handler)(int); >+ sigset_t sa_mask; >+ int sa_flags; >+}; >+ >+int sigaction(int sig, struct sigaction *sigact, struct sigaction *osigact); >+int sigemptyset(sigset_t *mask); >+ >+int kill(pid_t pid, int sig); >+ >+unsigned int sleep(unsigned int seconds); >+ >+#define WIN32_ERRNO 0x80000000 >+ >+#define strerror win32_strerror >+ >+char *win32_strerror(int errnum); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_MISC_H */ >Index: openbsd-compat/win32-pwd.c >=================================================================== >RCS file: openbsd-compat/win32-pwd.c >diff -N openbsd-compat/win32-pwd.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-pwd.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,167 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+#include <shlobj.h> >+ >+#define MAGIC_UID 666 >+#define MAGIC_GID 777 >+ >+uid_t >+getuid(void) >+{ >+ return MAGIC_UID; >+} >+ >+uid_t >+geteuid(void) >+{ >+ return getuid(); >+} >+ >+int >+setuid(uid_t uid) >+{ >+ if (uid != MAGIC_UID) { >+ errno = EPERM; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+seteuid(uid_t euid) >+{ >+ return setuid(euid); >+} >+ >+struct passwd* >+getpwnam(const char *name) >+{ >+ struct passwd *pw; >+ >+ pw = getpwuid(MAGIC_UID); >+ if (pw == NULL) >+ return NULL; >+ >+ if (strcmp(pw->pw_name, name) != 0) { >+ errno = ENOENT; >+ return NULL; >+ } >+ >+ return pw; >+} >+ >+struct passwd* >+getpwuid(uid_t uid) >+{ >+ HRESULT result; >+ >+ static struct passwd pw; >+ >+ static char name[256]; >+ static char password[] = ""; >+ static char gecos[] = ""; >+ static char dir[MAX_PATH]; >+ static char shell[] = "/bin/false"; >+ >+ DWORD len; >+ >+ if (uid != MAGIC_UID) { >+ errno = ENOENT; >+ return NULL; >+ } >+ >+ memset(&pw, 0, sizeof(struct passwd)); >+ >+ pw.pw_name = name; >+ pw.pw_passwd = password; >+ pw.pw_uid = MAGIC_UID; >+ pw.pw_gid = MAGIC_GID; >+ pw.pw_gecos = gecos; >+ pw.pw_dir = dir; >+ pw.pw_shell = shell; >+ >+ len = sizeof(name); >+ if (!GetUserName(name, &len)) >+ return NULL; >+ >+ /* >+ * The Windows home directory is meant for user data, not >+ * configuration. So point things at the Application Data >+ * path instead. >+ */ >+ result = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, dir); >+ if (result != S_OK) >+ return NULL; >+ >+ return &pw; >+} >+ >+gid_t >+getgid(void) >+{ >+ return MAGIC_GID; >+} >+ >+gid_t >+getegid(void) >+{ >+ return getgid(); >+} >+ >+int >+setgid(gid_t gid) >+{ >+ if (gid != MAGIC_GID) { >+ errno = EPERM; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+setegid(gid_t egid) >+{ >+ return setgid(egid); >+} >+ >+int >+initgroups(const char *user, gid_t group) >+{ >+ errno = EPERM; >+ return -1; >+} >+ >+int >+getgroups(int size, gid_t list[]) >+{ >+ return 0; >+} >+ >+int >+setgroups(size_t size, const gid_t *list) >+{ >+ errno = EPERM; >+ return -1; >+} >+ >+#endif >Index: openbsd-compat/win32-pwd.h >=================================================================== >RCS file: openbsd-compat/win32-pwd.h >diff -N openbsd-compat/win32-pwd.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-pwd.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,65 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_PWD_H >+#define _WIN32_PWD_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+typedef unsigned long uid_t; >+typedef unsigned long gid_t; >+ >+struct passwd { >+ char *pw_name; /* username */ >+ char *pw_passwd; /* user password */ >+ uid_t pw_uid; /* user ID */ >+ gid_t pw_gid; /* group ID */ >+ char *pw_gecos; /* user information */ >+ char *pw_dir; /* home directory */ >+ char *pw_shell; /* shell program */ >+}; >+ >+struct group { >+ char *gr_name; /* group name */ >+ char *gr_passwd; /* group password */ >+ gid_t gr_gid; /* group ID */ >+ char **gr_mem; /* group members */ >+}; >+ >+uid_t getuid(void); >+uid_t geteuid(void); >+ >+int setuid(uid_t uid); >+int seteuid(uid_t euid); >+ >+struct passwd *getpwnam(const char *name); >+struct passwd *getpwuid(uid_t uid); >+ >+gid_t getgid(void); >+gid_t getegid(void); >+ >+int setgid(gid_t gid); >+int setegid(gid_t egid); >+ >+int initgroups(const char *user, gid_t group); >+int getgroups(int size, gid_t list[]); >+int setgroups(size_t size, const gid_t *list); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_PWD_H */ >Index: openbsd-compat/win32-socket.c >=================================================================== >RCS file: openbsd-compat/win32-socket.c >diff -N openbsd-compat/win32-socket.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-socket.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,696 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#include "log.h" >+ >+#undef read >+#undef write >+ >+#undef close >+ >+#undef accept >+#undef bind >+#undef connect >+#undef gethostbyaddr >+#undef gethostbyname >+#undef gethostname >+#undef getpeername >+#undef getprotobyname >+#undef getservbyname >+#undef getsockopt >+#undef getsockname >+#undef listen >+#undef setsockopt >+#undef socket >+ >+#undef select >+ >+#ifdef WIN32 >+ >+extern ssize_t win32_read_console(int fildes, void *buf, size_t nbyte); >+extern int win32_filter_console_events(HANDLE console); >+ >+ssize_t >+win32_read(int fildes, void *buf, size_t nbyte) >+{ >+ int ret; >+ >+ if (isatty(fildes)) >+ return win32_read_console(fildes, buf, nbyte); >+ >+ ret = recv(fildes, buf, nbyte, 0); >+ if (ret != SOCKET_ERROR) >+ return ret; >+ >+ errno = WSAGetLastError(); >+ >+ if ((errno != WSAENOTSOCK) && (errno != WSAEBADF)) { >+ errno |= WIN32_ERRNO; >+ return -1; >+ } >+ >+ return read(fildes, buf, nbyte); >+} >+ >+ssize_t >+win32_write(int fildes, const void *buf, size_t nbyte) >+{ >+ int ret; >+ >+ ret = send(fildes, buf, nbyte, 0); >+ if (ret != SOCKET_ERROR) >+ return ret; >+ >+ errno = WSAGetLastError(); >+ >+ if ((errno != WSAENOTSOCK) && (errno != WSAEBADF)) { >+ errno |= WIN32_ERRNO; >+ return -1; >+ } >+ >+ return write(fildes, buf, nbyte); >+} >+ >+int >+win32_close(int fd) >+{ >+ int ret; >+ >+ if (win32_is_afunix(fd)) >+ return win32_afunix_close(fd); >+ >+ ret = closesocket(fd); >+ if (ret != SOCKET_ERROR) >+ return ret; >+ >+ errno = WSAGetLastError(); >+ >+ if ((errno != WSAENOTSOCK) && (errno != WSAEBADF)) { >+ errno |= WIN32_ERRNO; >+ return -1; >+ } >+ >+ return close(fd); >+} >+ >+int >+win32_accept(int socket, struct sockaddr *address, socklen_t *address_len) >+{ >+ SOCKET ret; >+ >+ if (win32_is_afunix(socket)) >+ return win32_afunix_accept(socket, address, address_len); >+ >+ ret = accept(socket, address, address_len); >+ if (ret == INVALID_SOCKET) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return ret; >+} >+ >+int >+win32_bind(int socket, const struct sockaddr *address, >+ socklen_t address_len) >+{ >+ int ret; >+ >+ if (win32_is_afunix(socket)) >+ return win32_afunix_bind(socket, address, address_len); >+ >+ ret = bind(socket, address, address_len); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_connect(int socket, const struct sockaddr *address, >+ socklen_t address_len) >+{ >+ int ret; >+ >+ if (win32_is_afunix(socket)) >+ return win32_afunix_connect(socket, address, address_len); >+ >+ ret = connect(socket, address, address_len); >+ if (ret == SOCKET_ERROR) { >+ /* >+ * POSIX says that the proper errno for a connect() >+ * that cannot complete immediately is EINPROGRESS. >+ * Windows decides to send the standard EWOULDBLOCK. >+ */ >+ if (WSAGetLastError() == WSAEWOULDBLOCK) >+ errno = WSAEINPROGRESS | WIN32_ERRNO; >+ else >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ >+ return -1; >+ } >+ >+ return 0; >+} >+ >+struct hostent* >+win32_gethostbyaddr(const void *addr, socklen_t len, int type) >+{ >+ struct hostent *ret; >+ >+ ret = gethostbyaddr(addr, len, type); >+ if (ret == NULL) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return NULL; >+ } >+ >+ return ret; >+} >+ >+struct hostent* >+win32_gethostbyname(const char *name) >+{ >+ struct hostent *ret; >+ >+ ret = gethostbyname(name); >+ if (ret == NULL) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return NULL; >+ } >+ >+ return ret; >+} >+ >+int >+win32_gethostname(char *name, size_t len) >+{ >+ int ret; >+ >+ ret = gethostname(name, len); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) >+{ >+ int ret; >+ >+ ret = getpeername(sockfd, addr, addrlen); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+struct protoent* >+win32_getprotobyname(const char *name) >+{ >+ struct protoent *ret; >+ >+ ret = getprotobyname(name); >+ if (ret == NULL) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return NULL; >+ } >+ >+ return ret; >+} >+ >+struct servent* >+win32_getservbyname(const char *name, const char *proto) >+{ >+ struct servent *ret; >+ >+ ret = getservbyname(name, proto); >+ if (ret == NULL) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return NULL; >+ } >+ >+ return ret; >+} >+ >+int >+win32_getsockopt(int sockfd, int level, int optname, >+ void *optval, socklen_t *optlen) >+{ >+ int ret; >+ >+ ret = getsockopt(sockfd, level, optname, optval, optlen); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) >+{ >+ int ret; >+ >+ ret = getsockname(sockfd, addr, addrlen); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_listen(int sockfd, int backlog) >+{ >+ int ret; >+ >+ if (win32_is_afunix(sockfd)) >+ return win32_afunix_listen(sockfd, backlog); >+ >+ ret = listen(sockfd, backlog); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_setsockopt(int sockfd, int level, int optname, >+ const void *optval, socklen_t optlen) >+{ >+ int ret; >+ >+ ret = setsockopt(sockfd, level, optname, optval, optlen); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+win32_socket(int domain, int type, int protocol) >+{ >+ SOCKET ret; >+ >+ if (domain == AF_UNIX) >+ return win32_afunix_socket(domain, type, protocol); >+ >+ ret = socket(domain, type, protocol); >+ if (ret == INVALID_SOCKET) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ return ret; >+} >+ >+typedef struct fd_events { >+ SOCKET fd; >+ long events; >+} fd_events; >+ >+typedef struct fd_event_set { >+ u_int fd_count; >+ fd_events fd_array[128]; >+} fd_event_set; >+ >+static void >+build_fd_event(fd_event_set *events, fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds) >+{ >+ u_int i, j; >+ fd_events *ev; >+ >+ events->fd_count = 0; >+ >+ if (readfds != NULL) { >+ for (i = 0;i < readfds->fd_count;i++) { >+ ev = &events->fd_array[events->fd_count++]; >+ ev->fd = readfds->fd_array[i]; >+ ev->events = FD_READ | FD_ACCEPT | FD_CLOSE; >+ } >+ } >+ >+ if (writefds != NULL) { >+ for (i = 0;i < writefds->fd_count;i++) { >+ for (j = 0;j < events->fd_count;j++) { >+ ev = &events->fd_array[j]; >+ if (ev->fd == writefds->fd_array[i]) >+ break; >+ } >+ >+ if (j == events->fd_count) { >+ ev = &events->fd_array[events->fd_count++]; >+ ev->fd = writefds->fd_array[i]; >+ ev->events = 0; >+ } >+ >+ ev->events |= FD_WRITE | FD_CONNECT; >+ } >+ } >+} >+ >+static int >+win32_wait(fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds, struct timeval *timeout) >+{ >+ int ret; >+ u_int i; >+ >+ struct timeval no_timeout = {0, 0}; >+ >+ fd_event_set events; >+ WSAEVENT socket_event; >+ >+ int has_console, has_fifo; >+ >+ HANDLE handles[2]; >+ DWORD dwtimeout, pipe_timeout; >+ >+ has_console = 0; >+ has_fifo = 0; >+ >+ /* Start by assembling the three lists into one */ >+ build_fd_event(&events, readfds, writefds, exceptfds); >+ >+ /* >+ * Now we need to check for pre-existing states, which only >+ * the good ol' select() can do. >+ */ >+ if (readfds != NULL) { >+ for (i = 0;i < readfds->fd_count;i++) { >+ if (isatty(readfds->fd_array[i])) >+ has_console = 1; >+ else if (isafifo(readfds->fd_array[i])) >+ has_fifo = 1; >+ else >+ continue; >+ FD_CLR(readfds->fd_array[i], readfds); >+ i--; >+ } >+ } >+ if (writefds != NULL) { >+ for (i = 0;i < writefds->fd_count;i++) { >+ if (isatty(writefds->fd_array[i]) || >+ isafifo(writefds->fd_array[i])) { >+ FD_CLR(writefds->fd_array[i], writefds); >+ i--; >+ } >+ } >+ } >+ if (exceptfds != NULL) { >+ for (i = 0;i < exceptfds->fd_count;i++) { >+ if (isatty(exceptfds->fd_array[i]) || >+ isafifo(exceptfds->fd_array[i])) { >+ FD_CLR(exceptfds->fd_array[i], exceptfds); >+ i--; >+ } >+ } >+ } >+ >+ ret = select(0, readfds, writefds, exceptfds, &no_timeout); >+ if (ret > 0) >+ return ret; >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ /* Don't need these anymore */ >+ if (readfds != NULL) >+ FD_ZERO(readfds); >+ if (writefds != NULL) >+ FD_ZERO(writefds); >+ if (exceptfds != NULL) >+ FD_ZERO(exceptfds); >+ >+ /* Connect an event to all sockets */ >+ socket_event = WSACreateEvent(); >+ >+ for (i = 0;i < events.fd_count;i++) { >+ if (isatty(events.fd_array[i].fd) || >+ isafifo(events.fd_array[i].fd)) >+ continue; >+ >+ ret = WSAEventSelect(events.fd_array[i].fd, socket_event, >+ events.fd_array[i].events); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ ret = -1; >+ goto end; >+ } >+ } >+ >+ handles[0] = socket_event; >+ handles[1] = GetStdHandle(STD_INPUT_HANDLE); >+ >+ if (timeout == NULL) >+ dwtimeout = INFINITE; >+ else >+ dwtimeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; >+ >+ pipe_timeout = 100; >+ >+ /* >+ * It is impossible to get events for pipes, so we have to resort >+ * to polling if we have one in the list. We start by polling >+ * rapidly and gradually back off to at least a 1 second delay. >+ * This is done to quickly respond to interactive periods, yet >+ * still sleep properly during idle times. >+ */ >+ do { >+ DWORD iter_timeout; >+ >+ iter_timeout = dwtimeout; >+ >+ if (has_fifo) { >+ for (i = 0;i < events.fd_count;i++) { >+ HANDLE handle; >+ DWORD avail; >+ >+ if (!isafifo(events.fd_array[i].fd)) >+ continue; >+ >+ if (!(events.fd_array[i].events & FD_READ)) >+ continue; >+ >+ handle = (HANDLE)_get_osfhandle(events.fd_array[i].fd); >+ if (!PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ ret = -1; >+ goto end; >+ } >+ >+ if (avail == 0) >+ continue; >+ >+ FD_SET(events.fd_array[i].fd, readfds); >+ } >+ >+ if (readfds->fd_count > 0) { >+ ret = readfds->fd_count; >+ goto end; >+ } >+ >+ if (iter_timeout > pipe_timeout) >+ iter_timeout = pipe_timeout; >+ if (dwtimeout != INFINITE) >+ dwtimeout -= iter_timeout; >+ if (pipe_timeout < 1000) >+ pipe_timeout *= 2; >+ } >+ >+ /* Now do the actual wait...*/ >+ ret = WaitForMultipleObjects(has_console ? 2 : 1, handles, >+ FALSE, iter_timeout); >+ } while (has_fifo && (ret == WAIT_TIMEOUT) && (dwtimeout > 0)); >+ >+ if (ret == WAIT_FAILED) { >+ errno = GetLastError() | WIN32_ERRNO; >+ ret = -1; >+ goto end; >+ } >+ >+ if (ret == WAIT_TIMEOUT) { >+ ret = 0; >+ goto end; >+ } >+ >+ /* We got something on stdin... */ >+ if (ret == (WAIT_OBJECT_0 + 1)) { >+ /* >+ * stdin will signal on a lot of non-data events, so >+ * we need to filter out that crud. >+ */ >+ ret = win32_filter_console_events(GetStdHandle(STD_INPUT_HANDLE)); >+ if (ret <= 0) >+ goto end; >+ >+ for (i = 0;i < events.fd_count;i++) { >+ if (!isatty(events.fd_array[i].fd)) >+ continue; >+ >+ if (!(events.fd_array[i].events & FD_READ)) >+ continue; >+ >+ FD_SET(events.fd_array[i].fd, readfds); >+ } >+ >+ ret = readfds->fd_count; >+ goto end; >+ } >+ >+ /* We got something on a socket. Figure out what... */ >+ for (i = 0;i < events.fd_count;i++) { >+ WSANETWORKEVENTS net_events; >+ >+ if (isatty(events.fd_array[i].fd) || >+ isafifo(events.fd_array[i].fd)) >+ continue; >+ >+ ret = WSAEnumNetworkEvents(events.fd_array[i].fd, >+ socket_event, &net_events); >+ if (ret == SOCKET_ERROR) { >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ ret = -1; >+ goto end; >+ } >+ >+ if (readfds != NULL) { >+ if (net_events.lNetworkEvents & events.fd_array[i].events & >+ (FD_READ | FD_ACCEPT | FD_CLOSE)) >+ FD_SET(events.fd_array[i].fd, readfds); >+ } >+ >+ if (writefds != NULL) { >+ if (net_events.lNetworkEvents & events.fd_array[i].events & >+ (FD_WRITE | FD_CONNECT)) >+ FD_SET(events.fd_array[i].fd, writefds); >+ } >+ } >+ >+ /* Sum up the number of signalled sockets */ >+ ret = 0; >+ if (readfds != NULL) >+ ret += readfds->fd_count; >+ if (writefds != NULL) >+ ret += writefds->fd_count; >+ if (exceptfds != NULL) >+ ret += exceptfds->fd_count; >+ >+end: >+ /* >+ * Undocumented misfeature of the week: having an event >+ * connected to a socket makes accept() return WSEANOTSOCK. >+ * Make sure we clear the event from all sockets before >+ * returning. >+ */ >+ for (i = 0;i < events.fd_count;i++) { >+ int local_ret; >+ >+ if (isatty(events.fd_array[i].fd) || >+ isafifo(events.fd_array[i].fd)) >+ continue; >+ >+ local_ret = WSAEventSelect(events.fd_array[i].fd, NULL, 0); >+ if (local_ret == SOCKET_ERROR) { >+ error("WSAEventSelect(%d, NULL, 0): %s", >+ events.fd_array[i].fd, >+ win32_strerror(WSAGetLastError() | WIN32_ERRNO)); >+ } >+ } >+ >+ CloseHandle(socket_event); >+ >+ return ret; >+} >+ >+ >+int >+win32_select(int nfds, fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds, struct timeval *timeout) >+{ >+ int ret; >+ u_int i; >+ >+ /* >+ * There is no select() equivalent for writing non-sockets so we need >+ * to check for that first and assume they are always writable. >+ */ >+ if (writefds != NULL) { >+ for (i = 0;i < writefds->fd_count;i++) { >+ if (isatty(writefds->fd_array[i]) || >+ isafifo(writefds->fd_array[i])) >+ break; >+ } >+ >+ if (i != writefds->fd_count) { >+ fd_set newwr; >+ >+ FD_ZERO(&newwr); >+ >+ for (;i < writefds->fd_count;i++) { >+ if (isatty(writefds->fd_array[i]) || >+ isafifo(writefds->fd_array[i])) >+ FD_SET(writefds->fd_array[i], &newwr); >+ } >+ >+ if (readfds != NULL) >+ FD_ZERO(readfds); >+ if (writefds != NULL) >+ FD_ZERO(writefds); >+ if (exceptfds != NULL) >+ FD_ZERO(exceptfds); >+ >+ memcpy(writefds, &newwr, sizeof(fd_set)); >+ >+ return writefds->fd_count; >+ } >+ } >+ >+ /* Need to use more Windows specific APIs when dealing with non-sockets */ >+ if (readfds != NULL) { >+ for (i = 0;i < readfds->fd_count;i++) { >+ if (isatty(readfds->fd_array[i]) || >+ isafifo(readfds->fd_array[i])) >+ return win32_wait(readfds, writefds, exceptfds, timeout); >+ } >+ } >+ >+ ret = select(nfds, readfds, writefds, exceptfds, timeout); >+ >+ if (ret == SOCKET_ERROR) >+ errno = WSAGetLastError() | WIN32_ERRNO; >+ >+ return ret; >+} >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-socket.h >=================================================================== >RCS file: openbsd-compat/win32-socket.h >diff -N openbsd-compat/win32-socket.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-socket.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,86 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_SOCKET_H >+#define _WIN32_SOCKET_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+#define EPFNOSUPPORT (WSAEPFNOSUPPORT | WIN32_ERRNO) >+#define EAFNOSUPPORT (WSAEAFNOSUPPORT | WIN32_ERRNO) >+#define EADDRINUSE (WSAEADDRINUSE | WIN32_ERRNO) >+#define ECONNABORTED (WSAECONNABORTED | WIN32_ERRNO) >+#define ECONNRESET (WSAECONNRESET | WIN32_ERRNO) >+#define ENOTCONN (WSAENOTCONN | WIN32_ERRNO) >+#define ETIMEDOUT (WSAETIMEDOUT | WIN32_ERRNO) >+#define ECONNREFUSED (WSAECONNREFUSED | WIN32_ERRNO) >+#define EHOSTUNREACH (WSAEHOSTUNREACH | WIN32_ERRNO) >+#define EINPROGRESS (WSAEINPROGRESS | WIN32_ERRNO) >+ >+#define read win32_read >+#define write win32_write >+ >+ssize_t win32_read(int fildes, void *buf, size_t nbyte); >+ssize_t win32_write(int fildes, const void *buf, size_t nbyte); >+ >+#define close win32_close >+ >+int win32_close(int fd); >+ >+#define accept win32_accept >+#define bind win32_bind >+#define connect win32_connect >+#define gethostbyaddr win32_gethostbyaddr >+#define gethostbyname win32_gethostbyname >+#define gethostname win32_gethostname >+#define getpeername win32_getpeername >+#define getprotobyname win32_getprotobyname >+#define getservbyname win32_getservbyname >+#define getsockopt win32_getsockopt >+#define getsockname win32_getsockname >+#define listen win32_listen >+#define setsockopt win32_setsockopt >+#define socket win32_socket >+ >+int win32_accept(int socket, struct sockaddr *address, socklen_t *address_len); >+int win32_bind(int socket, const struct sockaddr *address, >+ socklen_t address_len); >+int win32_connect(int socket, const struct sockaddr *address, >+ socklen_t address_len); >+struct hostent *win32_gethostbyaddr(const void *addr, socklen_t len, int type); >+struct hostent *win32_gethostbyname(const char *name); >+int win32_gethostname(char *name, size_t len); >+int win32_getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); >+struct protoent *win32_getprotobyname(const char *name); >+struct servent *win32_getservbyname(const char *name, const char *proto); >+int win32_getsockopt(int sockfd, int level, int optname, >+ void *optval, socklen_t *optlen); >+int win32_getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); >+int win32_listen(int sockfd, int backlog); >+int win32_setsockopt(int sockfd, int level, int optname, >+ const void *optval, socklen_t optlen); >+int win32_socket(int domain, int type, int protocol); >+ >+#define select win32_select >+ >+int win32_select(int nfds, fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds, struct timeval *timeout); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_SOCKET_H */ >Index: openbsd-compat/win32-sspi.c >=================================================================== >RCS file: openbsd-compat/win32-sspi.c >diff -N openbsd-compat/win32-sspi.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-sspi.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,558 @@ >+/* >+ * Copyright 2013 Aaron Sowry for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#if defined(WIN32) >+#include <string.h> >+#include <security.h> >+#include <xmalloc.h> >+ >+#include "win32-sspi.h" >+ >+static gss_OID_desc _GSS_C_NT_HOSTBASED_SERVICE = {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"}; >+gss_OID GSS_C_NT_HOSTBASED_SERVICE = &_GSS_C_NT_HOSTBASED_SERVICE; >+ >+static gss_OID_desc _GSS_MECH_KRB5 = {9, (void *)"\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"}; >+static gss_OID GSS_MECH_KRB5 = &_GSS_MECH_KRB5; >+ >+struct gss_ctx_id_struct { >+ CtxtHandle *ctxt_handle; >+ CredHandle *cred_handle; >+}; >+ >+OM_uint32 gss_display_status ( >+ OM_uint32 *minor_status, >+ OM_uint32 status_value, >+ int status_type, >+ const gss_OID mech_type, >+ OM_uint32 *message_context, >+ gss_buffer_t status_string) >+{ >+ OM_uint32 tmp; >+ char *msg; >+ >+ if (status_string == NULL || message_context == NULL) >+ return GSS_S_FAILURE; >+ >+ status_string->length = 0; >+ status_string->value = NULL; >+ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ // XXX: Since this is Windows-specific, we are assuming >+ // a mech_type of GSS_MECH_KRB5. >+ >+ if (status_type == GSS_C_GSS_CODE) { >+ // Major status >+ if (status_value == 0) { >+ *message_context = 0; >+ return GSS_S_BAD_STATUS; >+ } >+ >+ // Routine error >+ if (*message_context == 0) { >+ if ((tmp = GSS_ROUTINE_ERROR(status_value))) { >+ status_value -= tmp; >+ switch (tmp) { >+ case GSS_S_FAILURE: >+ msg = "Unspecified GSS failure. Minor code may provide more information"; >+ break; >+ case GSS_S_BAD_MECH: >+ msg = "An unsupported mechanism was requested"; >+ break; >+ case GSS_S_BAD_NAME: >+ msg = "An invalid name was supplied"; >+ break; >+ case GSS_S_BAD_NAMETYPE: >+ msg = "A supplied name was of an unsupported type"; >+ break; >+ case GSS_S_BAD_BINDINGS: >+ msg = "Incorrect channel bindings were supplied"; >+ break; >+ case GSS_S_BAD_SIG: >+ msg = "A token had an invalid Message Integrity Check (MIC)"; >+ break; >+ case GSS_S_NO_CRED: >+ msg = "No credentials were supplied, or the credentials were unavailable or inaccessible"; >+ break; >+ case GSS_S_NO_CONTEXT: >+ msg = "No context has been established"; >+ break; >+ case GSS_S_DEFECTIVE_TOKEN: >+ msg = "Invalid token was supplied"; >+ break; >+ case GSS_S_DEFECTIVE_CREDENTIAL: >+ msg = "Invalid credential was supplied"; >+ break; >+ case GSS_S_CREDENTIALS_EXPIRED: >+ msg = "The referenced credential has expired"; >+ break; >+ case GSS_S_CONTEXT_EXPIRED: >+ msg = "The referenced context has expired"; >+ break; >+ case GSS_S_BAD_QOP: >+ msg = "The quality-of-protection (QOP) requested could not be provided"; >+ break; >+ case GSS_S_UNAUTHORIZED: >+ msg = "The operation is forbidden by local security policy"; >+ break; >+ case GSS_S_UNAVAILABLE: >+ msg = "The operation or option is not available or unsupported"; >+ break; >+ case GSS_S_DUPLICATE_ELEMENT: >+ msg = "The requested credential element already exists"; >+ break; >+ case GSS_S_NAME_NOT_MN: >+ msg = "The provided name was not mechanism specific (MN)"; >+ break; >+ case GSS_S_BAD_STATUS: >+ default: >+ msg = "An invalid status code was supplied"; >+ } >+ status_string->length = strlen(msg); >+ status_string->value = xstrdup(msg); >+ if (status_value) { >+ (*message_context)++; >+ return GSS_S_COMPLETE; >+ } >+ else { >+ *message_context = 0; >+ return GSS_S_COMPLETE; >+ } >+ } >+ else >+ (*message_context)++; >+ } >+ else >+ status_value -= GSS_ROUTINE_ERROR(status_value); >+ >+ // Calling error >+ if (*message_context == 1) { >+ if ((tmp = GSS_CALLING_ERROR(status_value))) { >+ status_value -= tmp; >+ switch (tmp) { >+ case GSS_S_CALL_INACCESSIBLE_READ: >+ msg = "A required input parameter could not be read"; >+ break; >+ case GSS_S_CALL_INACCESSIBLE_WRITE: >+ msg = "A required input parameter could not be written"; >+ break; >+ case GSS_S_CALL_BAD_STRUCTURE: >+ msg = "A parameter was malformed"; >+ break; >+ default: >+ msg = "An invalid status code was supplied"; >+ } >+ status_string->length = strlen(msg); >+ status_string->value = xstrdup(msg); >+ if (status_value) { >+ (*message_context)++; >+ return GSS_S_COMPLETE; >+ } >+ else { >+ *message_context = 0; >+ return GSS_S_COMPLETE; >+ } >+ } >+ else >+ (*message_context)++; >+ } >+ else >+ status_value -= GSS_CALLING_ERROR(status_value); >+ >+ // FIXME: Check supplimentary info bits as well >+ >+ } >+ else if (status_type == GSS_C_MECH_CODE) { >+ // Minor status >+ if (*message_context) >+ return GSS_S_FAILURE; >+ >+ switch (status_value) { >+ // FIXME: We don't set a minor code on Windows >+ default: >+ msg = "No minor code available"; >+ } >+ status_string->length = strlen(msg); >+ status_string->value = msg; >+ >+ return GSS_S_COMPLETE; >+ } >+ else >+ return GSS_S_BAD_STATUS; >+ >+ return GSS_S_COMPLETE; >+ >+}; >+ >+OM_uint32 gss_release_buffer ( >+ OM_uint32 *minor_status, >+ gss_buffer_t buffer) >+{ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ if (buffer == GSS_C_NO_BUFFER) >+ return GSS_S_COMPLETE; >+ >+ if (buffer->value) { >+ xfree(buffer->value); >+ buffer->value = NULL; >+ buffer->length = 0; >+ } >+ >+ return GSS_S_COMPLETE; >+ >+}; >+ >+OM_uint32 gss_delete_sec_context ( >+ OM_uint32 *minor_status, >+ gss_ctx_id_t *context_handle, >+ gss_buffer_t output_token) >+{ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT) >+ return GSS_S_NO_CONTEXT; >+ >+ int ret; >+ ret = DeleteSecurityContext((*context_handle)->ctxt_handle); >+ >+ if (ret == SEC_E_OK) { >+ if ((*context_handle)->cred_handle) >+ xfree((*context_handle)->cred_handle); >+ xfree(*context_handle); >+ *context_handle = GSS_C_NO_CONTEXT; >+ return GSS_S_COMPLETE; >+ } >+ >+ return GSS_S_FAILURE; >+ >+}; >+ >+OM_uint32 gss_release_name ( >+ OM_uint32 *minor_status, >+ gss_name_t *name) >+{ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ if (name == NULL) >+ return GSS_S_BAD_NAME; >+ >+ if (*name == GSS_C_NO_NAME) >+ return GSS_S_COMPLETE; >+ >+ xfree(*name); >+ *name = GSS_C_NO_NAME; >+ >+ return GSS_S_COMPLETE; >+ >+}; >+ >+OM_uint32 gss_release_cred ( >+ OM_uint32 *minor_status, >+ gss_cred_id_t *cred_handle) >+{ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ if (cred_handle == NULL) >+ return GSS_S_NO_CRED; >+ >+ if (*cred_handle == GSS_C_NO_CREDENTIAL) >+ return GSS_S_COMPLETE; >+ >+ if (*cred_handle) >+ xfree(*cred_handle); >+ *cred_handle = GSS_C_NO_CREDENTIAL; >+ >+ return GSS_S_COMPLETE; >+ >+}; >+ >+OM_uint32 gss_init_sec_context ( >+ OM_uint32 *minor_status, >+ gss_cred_id_t initiator_cred_handle, >+ gss_ctx_id_t *context_handle, >+ gss_name_t target_name, >+ gss_OID mech_type, >+ OM_uint32 req_flags, >+ OM_uint32 time_req, >+ gss_channel_bindings_t input_chan_bindings, >+ gss_buffer_t input_token, >+ gss_OID *actual_mech_type, >+ gss_buffer_t output_token, >+ OM_uint32 *ret_flags, >+ OM_uint32 *time_rec) >+{ >+ int ret; >+ >+ if (minor_status == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ *minor_status = 0; >+ >+ // Set up context handles >+ PCtxtHandle phContext = NULL; >+ >+ if (*context_handle == GSS_C_NO_CONTEXT) { >+ // This is the first call to gss_init_sec_context >+ *context_handle = (gss_ctx_id_t) xcalloc(1, sizeof(gss_ctx_id_t)); >+ (*context_handle)->cred_handle = (CredHandle*) xmalloc(sizeof(CredHandle)); >+ >+ TimeStamp ptsExpiry; >+ ret = AcquireCredentialsHandle(NULL, >+ "Kerberos", >+ SECPKG_CRED_OUTBOUND, >+ NULL, >+ NULL, >+ NULL, >+ NULL, >+ (*context_handle)->cred_handle, >+ &ptsExpiry); >+ >+ if (ret != SEC_E_OK) { >+ xfree((*context_handle)->cred_handle); >+ xfree(*context_handle); >+ *context_handle = GSS_C_NO_CONTEXT; >+ >+ if (ret == SEC_E_NO_CREDENTIALS || >+ ret == SEC_E_UNKNOWN_CREDENTIALS) >+ return GSS_S_NO_CRED; >+ >+ return GSS_S_FAILURE; >+ } >+ } >+ else >+ phContext = (*context_handle)->ctxt_handle; >+ >+ // Set up input buffer >+ SecBufferDesc pInput; >+ SecBuffer input_buffer; >+ >+ if (input_token == GSS_C_NO_BUFFER) { >+ input_buffer.cbBuffer = 0; >+ input_buffer.pvBuffer = NULL; >+ input_buffer.BufferType = SECBUFFER_TOKEN; >+ } >+ else { >+ input_buffer.cbBuffer = input_token->length; >+ input_buffer.pvBuffer = input_token->value; >+ input_buffer.BufferType = SECBUFFER_TOKEN; >+ } >+ >+ pInput.cBuffers = 1; >+ pInput.pBuffers = &input_buffer; >+ pInput.ulVersion = SECBUFFER_VERSION; >+ >+ // Set up output buffer >+ SecBufferDesc pOutput; >+ SecBuffer output_buffer; >+ >+ // Allocate our own token buffer >+ PSecPkgInfo PackageInfo; >+ QuerySecurityPackageInfo("Kerberos", &PackageInfo); >+ >+ output_buffer.cbBuffer = PackageInfo->cbMaxToken; >+ output_buffer.pvBuffer = xmalloc(PackageInfo->cbMaxToken); >+ output_buffer.BufferType = SECBUFFER_TOKEN; >+ >+ pOutput.cBuffers = 1; >+ pOutput.pBuffers = &output_buffer; >+ pOutput.ulVersion = SECBUFFER_VERSION; >+ >+ // Set up context attributes handle >+ unsigned long pfContextAttr; >+ >+ // Set up flags >+ unsigned long flags = ISC_REQ_MUTUAL_AUTH|ISC_REQ_REPLAY_DETECT| >+ ISC_REQ_CONFIDENTIALITY; >+ >+ if (req_flags & GSS_C_DELEG_FLAG) >+ flags |= ISC_REQ_DELEGATE; >+ >+ if ((*context_handle)->ctxt_handle == NULL) >+ (*context_handle)->ctxt_handle = (CtxtHandle*) xmalloc(sizeof(CtxtHandle)); >+ >+ ret = InitializeSecurityContext((*context_handle)->cred_handle, >+ phContext, >+ (char *) target_name, >+ flags, >+ 0, // Reserved >+ SECURITY_NATIVE_DREP, >+ &pInput, >+ 0, // Reserved >+ (*context_handle)->ctxt_handle, >+ &pOutput, >+ &pfContextAttr, >+ NULL); >+ >+ if (ret_flags != NULL) >+ if (pfContextAttr & ISC_RET_INTEGRITY) >+ *ret_flags |= GSS_C_INTEG_FLAG; >+ >+ // FIXME: Check that the correct token type was received >+ output_token->length = output_buffer.cbBuffer; >+ output_token->value = output_buffer.pvBuffer; >+ >+ if (ret == SEC_I_CONTINUE_NEEDED) >+ return GSS_S_CONTINUE_NEEDED; >+ else if (ret == SEC_E_OK) >+ return GSS_S_COMPLETE; >+ >+ return GSS_S_FAILURE; >+ >+}; >+ >+OM_uint32 gss_import_name ( >+ OM_uint32 *minor_status, >+ const gss_buffer_t input_name_buffer, >+ const gss_OID input_name_type, >+ gss_name_t *output_name) >+{ >+ if (minor_status == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ *minor_status = 0; >+ >+ if (output_name == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ char *sspi_name; >+ >+ if (input_name_type == GSS_C_NT_HOSTBASED_SERVICE) { >+ char buf[1024]; >+ char host[1024]; >+ char *ch; >+ >+ if (input_name_buffer->length + 1 > sizeof(buf)) >+ return GSS_S_BAD_NAME; >+ >+ memcpy(buf, input_name_buffer->value, input_name_buffer->length); >+ buf[input_name_buffer->length] = '\0'; >+ ch = strchr(buf, '@'); >+ >+ if (ch == NULL) >+ return GSS_S_BAD_NAME; >+ >+ strcpy(host, ch+1); >+ >+ xasprintf(&sspi_name, "host/%s", host); >+ } >+ else >+ // Unsupported name type >+ return GSS_S_BAD_NAMETYPE; >+ >+ *output_name = (gss_name_t) sspi_name; >+ >+ return GSS_S_COMPLETE; >+ >+}; >+ >+OM_uint32 gss_get_mic ( >+ OM_uint32 *minor_status, >+ const gss_ctx_id_t context_handle, >+ gss_qop_t qop_req, >+ const gss_buffer_t message_buffer, >+ gss_buffer_t msg_token) >+{ >+ if (minor_status == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ *minor_status = 0; >+ >+ if (msg_token == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ if (message_buffer == NULL) >+ return GSS_S_FAILURE | GSS_S_CALL_INACCESSIBLE_READ; >+ >+ if (context_handle == GSS_C_NO_CONTEXT) >+ return GSS_S_NO_CONTEXT; >+ >+ SecPkgContext_Sizes ContextSizes; >+ memset(&ContextSizes, 0, sizeof(ContextSizes)); >+ >+ SecBufferDesc InputBufferDescriptor; >+ SecBuffer InputSecurityToken[2]; >+ >+ int ret; >+ ret = QueryContextAttributes(context_handle->ctxt_handle, >+ SECPKG_ATTR_SIZES, >+ &ContextSizes); >+ >+ if (ret != SEC_E_OK || ContextSizes.cbMaxSignature == 0) >+ return GSS_S_FAILURE; >+ >+ InputBufferDescriptor.cBuffers = 2; >+ InputBufferDescriptor.pBuffers = InputSecurityToken; >+ InputBufferDescriptor.ulVersion = SECBUFFER_VERSION; >+ InputSecurityToken[0].BufferType = SECBUFFER_DATA; >+ InputSecurityToken[0].cbBuffer = message_buffer->length; >+ InputSecurityToken[0].pvBuffer = message_buffer->value; >+ InputSecurityToken[1].BufferType = SECBUFFER_TOKEN; >+ InputSecurityToken[1].cbBuffer = ContextSizes.cbMaxSignature; >+ InputSecurityToken[1].pvBuffer = xmalloc(ContextSizes.cbMaxSignature * sizeof(char)); >+ >+ ret = MakeSignature(context_handle->ctxt_handle, >+ 0, >+ &InputBufferDescriptor, >+ 0); >+ >+ if (ret == SEC_E_OK) { >+ msg_token->length = InputSecurityToken[1].cbBuffer; >+ msg_token->value = InputSecurityToken[1].pvBuffer; >+ return GSS_S_COMPLETE; >+ } >+ >+ return GSS_S_FAILURE; >+ >+}; >+ >+OM_uint32 gss_indicate_mechs ( >+ OM_uint32 *minor_status, >+ gss_OID_set *mech_set) >+{ >+ gss_OID_set set; >+ >+ if (minor_status != NULL) >+ *minor_status = 0; >+ >+ if (mech_set == NULL) >+ return GSS_S_CALL_INACCESSIBLE_WRITE; >+ >+ set = (gss_OID_set_desc *) xcalloc(1, sizeof(*set)); >+ >+ /* We're only providing a single mech */ >+ set->count = 1; >+ >+ set->elements = (gss_OID_desc *) xcalloc(set->count, sizeof(*set->elements)); >+ >+ set->elements[0].length = GSS_MECH_KRB5->length; >+ set->elements[0].elements = xmalloc(GSS_MECH_KRB5->length); >+ >+ memcpy(set->elements[0].elements, GSS_MECH_KRB5->elements, GSS_MECH_KRB5->length); >+ >+ *mech_set = set; >+ >+ return GSS_S_COMPLETE; >+}; >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-sspi.h >=================================================================== >RCS file: openbsd-compat/win32-sspi.h >diff -N openbsd-compat/win32-sspi.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-sspi.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,352 @@ >+/* >+ * Copyright 2013 Aaron Sowry for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_SSPI_H >+#define _WIN32_SSPI_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+#include <stdint.h> >+#include <inttypes.h> >+ >+/* >+ * First, include stddef.h to get size_t defined. >+ */ >+#include <stddef.h> >+ >+/* >+ * POSIX says that sys/types.h is where size_t is defined. >+ */ >+#include <sys/types.h> >+ >+/* >+ * First, define the three platform-dependent pointer types. >+ */ >+struct gss_name_struct; >+typedef struct gss_name_struct * gss_name_t; >+ >+struct gss_cred_id_struct; >+typedef struct gss_cred_id_struct * gss_cred_id_t; >+ >+struct gss_ctx_id_struct; >+typedef struct gss_ctx_id_struct * gss_ctx_id_t; >+ >+/* >+ * The following type must be defined as the smallest natural unsigned integer >+ * supported by the platform that has at least 32 bits of precision. >+ */ >+typedef uint32_t gss_uint32; >+typedef int32_t gss_int32; >+ >+#ifdef OM_STRING >+/* >+ * We have included the xom.h header file. Use the definition for >+ * OM_object identifier. >+ */ >+typedef OM_object_identifier gss_OID_desc, *gss_OID; >+#else /* OM_STRING */ >+ >+/* >+ * We can't use X/Open definitions, so roll our own. >+ */ >+typedef gss_uint32 OM_uint32; >+ >+typedef struct gss_OID_desc_struct { >+ OM_uint32 length; >+ void *elements; >+} gss_OID_desc, *gss_OID; >+#endif /* OM_STRING */ >+ >+typedef struct gss_buffer_desc_struct { >+ size_t length; >+ void *value; >+} gss_buffer_desc, *gss_buffer_t; >+ >+typedef struct gss_OID_set_desc_struct { >+ size_t count; >+ gss_OID elements; >+} gss_OID_set_desc, *gss_OID_set; >+ >+typedef struct gss_channel_bindings_struct { >+ OM_uint32 initiator_addrtype; >+ gss_buffer_desc initiator_address; >+ OM_uint32 acceptor_addrtype; >+ gss_buffer_desc acceptor_address; >+ gss_buffer_desc application_data; >+} *gss_channel_bindings_t; >+ >+/* >+ * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing >+ * discussions). >+ */ >+typedef OM_uint32 gss_qop_t; >+typedef int gss_cred_usage_t; >+ >+/* >+ * Flag bits for context-level services. >+ */ >+#define GSS_C_DELEG_FLAG 1 >+#define GSS_C_MUTUAL_FLAG 2 >+#define GSS_C_REPLAY_FLAG 4 >+#define GSS_C_SEQUENCE_FLAG 8 >+#define GSS_C_CONF_FLAG 16 >+#define GSS_C_INTEG_FLAG 32 >+#define GSS_C_ANON_FLAG 64 >+#define GSS_C_PROT_READY_FLAG 128 >+#define GSS_C_TRANS_FLAG 256 >+#define GSS_C_DELEG_POLICY_FLAG 32768 >+ >+/* >+ * Define WIN32 flags missing from MinGW's headers >+ */ >+#ifndef ISC_RET_INTEGRITY >+#define ISC_RET_INTEGRITY ISC_REQ_INTEGRITY >+#endif >+ >+/* >+ * Credential usage options >+ */ >+#define GSS_C_BOTH 0 >+#define GSS_C_INITIATE 1 >+#define GSS_C_ACCEPT 2 >+ >+/* >+ * Status code types for gss_display_status >+ */ >+#define GSS_C_GSS_CODE 1 >+#define GSS_C_MECH_CODE 2 >+ >+/* >+ * The constant definitions for channel-bindings address families >+ */ >+#define GSS_C_AF_UNSPEC 0 >+#define GSS_C_AF_LOCAL 1 >+#define GSS_C_AF_INET 2 >+#define GSS_C_AF_IMPLINK 3 >+#define GSS_C_AF_PUP 4 >+#define GSS_C_AF_CHAOS 5 >+#define GSS_C_AF_NS 6 >+#define GSS_C_AF_NBS 7 >+#define GSS_C_AF_ECMA 8 >+#define GSS_C_AF_DATAKIT 9 >+#define GSS_C_AF_CCITT 10 >+#define GSS_C_AF_SNA 11 >+#define GSS_C_AF_DECnet 12 >+#define GSS_C_AF_DLI 13 >+#define GSS_C_AF_LAT 14 >+#define GSS_C_AF_HYLINK 15 >+#define GSS_C_AF_APPLETALK 16 >+#define GSS_C_AF_BSC 17 >+#define GSS_C_AF_DSS 18 >+#define GSS_C_AF_OSI 19 >+#define GSS_C_AF_NETBIOS 20 >+#define GSS_C_AF_X25 21 >+ >+#define GSS_C_AF_NULLADDR 255 >+ >+/* >+ * Various Null values. >+ */ >+#define GSS_C_NO_NAME ((gss_name_t) 0) >+#define GSS_C_NO_BUFFER ((gss_buffer_t) 0) >+#define GSS_C_NO_OID ((gss_OID) 0) >+#define GSS_C_NO_OID_SET ((gss_OID_set) 0) >+#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) >+#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) >+#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) >+#define GSS_C_EMPTY_BUFFER {0, NULL} >+ >+/* >+ * Some alternate names for a couple of the above values. These are defined >+ * for V1 compatibility. >+ */ >+#define GSS_C_NULL_OID GSS_C_NO_OID >+#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET >+ >+/* >+ * Define the default Quality of Protection for per-message services. Note >+ * that an implementation that offers multiple levels of QOP may either reserve >+ * a value (for example zero, as assumed here) to mean "default protection", or >+ * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit >+ * QOP value. However a value of 0 should always be interpreted by a GSSAPI >+ * implementation as a request for the default protection level. >+ */ >+#define GSS_C_QOP_DEFAULT 0 >+ >+/* >+ * Expiration time of 2^32-1 seconds means infinite lifetime for a >+ * credential or security context >+ */ >+#define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful) >+ >+ >+/* Major status codes */ >+ >+#define GSS_S_COMPLETE 0 >+ >+/* >+ * Some "helper" definitions to make the status code macros obvious. >+ */ >+#define GSS_C_CALLING_ERROR_OFFSET 24 >+#define GSS_C_ROUTINE_ERROR_OFFSET 16 >+#define GSS_C_SUPPLEMENTARY_OFFSET 0 >+#define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul) >+#define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul) >+#define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul) >+ >+/* >+ * The macros that test status codes for error conditions. Note that the >+ * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now >+ * evaluates its argument only once. >+ */ >+#define GSS_CALLING_ERROR(x) \ >+ ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) >+#define GSS_ROUTINE_ERROR(x) \ >+ ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) >+#define GSS_SUPPLEMENTARY_INFO(x) \ >+ ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) >+#define GSS_ERROR(x) \ >+ ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ >+ (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) >+ >+/* >+ * Now the actual status code definitions >+ */ >+ >+/* >+ * Calling errors: >+ */ >+#define GSS_S_CALL_INACCESSIBLE_READ \ >+ (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET) >+#define GSS_S_CALL_INACCESSIBLE_WRITE \ >+ (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET) >+#define GSS_S_CALL_BAD_STRUCTURE \ >+ (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET) >+ >+/* >+ * Routine errors: >+ */ >+#define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_DEFECTIVE_CREDENTIAL \ >+ (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_CREDENTIALS_EXPIRED \ >+ (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_CONTEXT_EXPIRED \ >+ (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_DUPLICATE_ELEMENT \ >+ (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_NAME_NOT_MN \ >+ (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+#define GSS_S_BAD_MECH_ATTR \ >+ (((OM_uint32) 19ul) << GSS_C_ROUTINE_ERROR_OFFSET) >+ >+/* >+ * Supplementary info bits: >+ */ >+#define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0)) >+#define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1)) >+#define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2)) >+#define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3)) >+#define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) >+ >+ >+/* >+ * Finally, function prototypes for the GSSAPI routines. >+ */ >+extern gss_OID GSS_C_NT_HOSTBASED_SERVICE; >+ >+OM_uint32 >+gss_display_status( >+ OM_uint32 *, /* minor_status */ >+ OM_uint32, /* status_value */ >+ int, /* status_type */ >+ gss_OID, /* mech_type (used to be const) */ >+ OM_uint32 *, /* message_context */ >+ gss_buffer_t); /* status_string */ >+ >+OM_uint32 >+gss_release_buffer( >+ OM_uint32 *, /* minor_status */ >+ gss_buffer_t); /* buffer */ >+ >+OM_uint32 >+gss_delete_sec_context( >+ OM_uint32 *, /* minor_status */ >+ gss_ctx_id_t *, /* context_handle */ >+ gss_buffer_t); /* output_token */ >+ >+OM_uint32 >+gss_release_name( >+ OM_uint32 *, /* minor_status */ >+ gss_name_t *); /* input_name */ >+ >+OM_uint32 >+gss_release_cred( >+ OM_uint32 *, /* minor_status */ >+ gss_cred_id_t *); /* cred_handle */ >+ >+OM_uint32 >+gss_init_sec_context( >+ OM_uint32 *, /* minor_status */ >+ gss_cred_id_t, /* claimant_cred_handle */ >+ gss_ctx_id_t *, /* context_handle */ >+ gss_name_t, /* target_name */ >+ gss_OID, /* mech_type (used to be const) */ >+ OM_uint32, /* req_flags */ >+ OM_uint32, /* time_req */ >+ gss_channel_bindings_t, /* input_chan_bindings */ >+ gss_buffer_t, /* input_token */ >+ gss_OID *, /* actual_mech_type */ >+ gss_buffer_t, /* output_token */ >+ OM_uint32 *, /* ret_flags */ >+ OM_uint32 *); /* time_rec */ >+ >+OM_uint32 >+gss_import_name( >+ OM_uint32 *, /* minor_status */ >+ gss_buffer_t, /* input_name_buffer */ >+ gss_OID, /* input_name_type(used to be const) */ >+ gss_name_t *); /* output_name */ >+ >+OM_uint32 >+gss_get_mic( >+ OM_uint32 *, /* minor_status */ >+ gss_ctx_id_t, /* context_handle */ >+ gss_qop_t, /* qop_req */ >+ gss_buffer_t, /* message_buffer */ >+ gss_buffer_t); /* message_token */ >+ >+OM_uint32 >+gss_indicate_mechs( >+ OM_uint32 *, /* minor_status */ >+ gss_OID_set *); /* mech_set */ >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_SSPI_H */ >Index: openbsd-compat/win32-stubs.c >=================================================================== >RCS file: openbsd-compat/win32-stubs.c >diff -N openbsd-compat/win32-stubs.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-stubs.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,87 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+ssize_t >+readv(int fd, const struct iovec *iov, int iovcnt) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+void >+openlog(const char *ident, int option, int facility) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+void >+syslog(int priority, const char *format, ...) >+{ >+} >+ >+void >+closelog(void) >+{ >+} >+ >+pid_t >+fork(void) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+setpgrp(pid_t pid, pid_t pgid) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+link(const char *path1, const char *path2) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+pipe(int pipefd[2]) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+getdtablesize(void) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+pid_t >+wait4(pid_t pid, int *status, int options, struct rusage *rusage) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-stubs.h >=================================================================== >RCS file: openbsd-compat/win32-stubs.h >diff -N openbsd-compat/win32-stubs.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-stubs.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,72 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_STUBS_H >+#define _WIN32_STUBS_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+ssize_t readv(int fd, const struct iovec *iov, int iovcnt); >+ >+#define LOG_CRIT 0 >+#define LOG_ERR 1 >+#define LOG_INFO 2 >+#define LOG_DEBUG 3 >+ >+#define LOG_USER 0 >+#define LOG_DAEMON 1 >+#define LOG_AUTH 2 >+ >+#define LOG_LOCAL0 10 >+#define LOG_LOCAL1 11 >+#define LOG_LOCAL2 12 >+#define LOG_LOCAL3 13 >+#define LOG_LOCAL4 14 >+#define LOG_LOCAL5 15 >+#define LOG_LOCAL6 16 >+#define LOG_LOCAL7 17 >+ >+#define LOG_PID 0x01 >+ >+void openlog(const char *ident, int option, int facility); >+void syslog(int priority, const char *format, ...); >+void closelog(void); >+ >+pid_t fork(void); >+ >+int setpgrp(pid_t pid, pid_t pgid); >+ >+int link(const char *path1, const char *path2); >+ >+int pipe(int pipefd[2]); >+ >+int getdtablesize(void); >+ >+#define WNOHANG 1 >+ >+union wait { >+ int w_status; >+}; >+ >+struct rusage; >+ >+pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_STUBS_H */ >Index: openbsd-compat/win32-tty.c >=================================================================== >RCS file: openbsd-compat/win32-tty.c >diff -N openbsd-compat/win32-tty.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-tty.c 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,160 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+int >+ioctl(int d, int request, ...) >+{ >+ if (request != TIOCGWINSZ) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ errno = EINVAL; >+ return -1; >+} >+ >+speed_t >+cfgetispeed(const struct termios *termios_p) >+{ >+ return B9600; >+} >+ >+speed_t >+cfgetospeed(const struct termios *termios_p) >+{ >+ return B9600; >+} >+ >+int >+cfsetispeed(struct termios *termios_p, speed_t speed) >+{ >+ if (speed != B9600) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+cfsetospeed(struct termios *termios_p, speed_t speed) >+{ >+ if (speed != B9600) { >+ errno = EINVAL; >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+tcgetattr(int fd, struct termios *termios_p) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+int >+tcsetattr(int fd, int optional_actions, const struct termios *termios_p) >+{ >+ errno = EINVAL; >+ return -1; >+} >+ >+pid_t >+tcgetpgrp(int fd) >+{ >+ return getpid(); >+} >+ >+ssize_t >+win32_read_console(int fildes, void *buf, size_t nbyte) >+{ >+ int ret; >+ HANDLE handle; >+ INPUT_RECORD input[1024]; >+ DWORD i, out; >+ >+ /* >+ * The only way to properly read raw input from stdin is via >+ * ReadConsoleInput(). Both read() and ReadFile() have magic >+ * filtering that you cannot fully turn off. >+ * >+ * FIXME: Handle raw mode on/off >+ */ >+ >+ handle = (HANDLE)_get_osfhandle(fildes); >+ if (handle == INVALID_HANDLE_VALUE) >+ return -1; >+ >+ ret = 0; >+ >+ while (ret == 0) { >+ if (!ReadConsoleInput(handle, input, min(nbyte, 1024), &out)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ for (i = 0;i < out;i++) { >+ if (input[i].EventType != KEY_EVENT) >+ continue; >+ if (!input[i].Event.KeyEvent.bKeyDown) >+ continue; >+ if (input[i].Event.KeyEvent.uChar.AsciiChar == 0) >+ continue; >+ >+ ((char*)buf)[ret++] = input[i].Event.KeyEvent.uChar.AsciiChar; >+ } >+ } >+ >+ return ret; >+} >+ >+int >+win32_filter_console_events(HANDLE console) >+{ >+ /* Filter out anything that doesn't generate an input character */ >+ while (TRUE) { >+ INPUT_RECORD input; >+ DWORD read; >+ >+ if (!PeekConsoleInput(console, &input, 1, &read)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ >+ if (read == 0) >+ return 0; >+ >+ if ((input.EventType == KEY_EVENT) && >+ input.Event.KeyEvent.bKeyDown && >+ (input.Event.KeyEvent.uChar.UnicodeChar != 0)) >+ break; >+ >+ if (!ReadConsoleInput(console, &input, 1, &read)) { >+ errno = GetLastError() | WIN32_ERRNO; >+ return -1; >+ } >+ } >+ >+ return 1; >+} >+ >+#endif /* WIN32 */ >Index: openbsd-compat/win32-tty.h >=================================================================== >RCS file: openbsd-compat/win32-tty.h >diff -N openbsd-compat/win32-tty.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ openbsd-compat/win32-tty.h 15 May 2013 12:02:26 -0000 >@@ -0,0 +1,117 @@ >+/* >+ * Copyright 2013 Pierre Ossman for Cendio AB >+ * >+ * Permission to use, copy, modify, and distribute this software for any >+ * purpose with or without fee is hereby granted, provided that the above >+ * copyright notice and this permission notice appear in all copies. >+ * >+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >+ */ >+ >+#ifndef _WIN32_TTY_H >+#define _WIN32_TTY_H >+ >+#include "includes.h" >+ >+#ifdef WIN32 >+ >+struct winsize { >+ unsigned short ws_row; /* rows, in characters */ >+ unsigned short ws_col; /* columns, in character */ >+ unsigned short ws_xpixel; /* horizontal size, pixels */ >+ unsigned short ws_ypixel; /* vertical size, pixels */ >+}; >+ >+#define TIOCGWINSZ 0x5413 >+ >+int ioctl(int d, int request, ...); >+ >+typedef unsigned char cc_t; >+typedef unsigned int speed_t; >+typedef unsigned int tcflag_t; >+ >+#define NCCS 2 >+struct termios { >+ tcflag_t c_iflag; /* input modes */ >+ tcflag_t c_oflag; /* output modes */ >+ tcflag_t c_cflag; /* control modes */ >+ tcflag_t c_lflag; /* local modes */ >+ cc_t c_cc[NCCS]; /* special characters */ >+}; >+ >+/* c_cc characters */ >+#define VTIME 0 >+#define VMIN 1 >+ >+/* c_iflag bits */ >+#define IGNPAR 0000004 >+#define PARMRK 0000010 >+#define INPCK 0000020 >+#define ISTRIP 0000040 >+#define INLCR 0000100 >+#define IGNCR 0000200 >+#define ICRNL 0000400 >+#define IXON 0002000 >+#define IXANY 0004000 >+#define IXOFF 0010000 >+ >+/* c_oflag bits */ >+#define OPOST 0000001 >+#define ONLCR 0000004 >+ >+/* c_cflag bit meaning */ >+#define B0 0000000 >+#define B50 0000001 >+#define B75 0000002 >+#define B110 0000003 >+#define B134 0000004 >+#define B150 0000005 >+#define B200 0000006 >+#define B300 0000007 >+#define B600 0000010 >+#define B1200 0000011 >+#define B1800 0000012 >+#define B2400 0000013 >+#define B4800 0000014 >+#define B9600 0000015 >+#define CS7 0000040 >+#define CS8 0000060 >+#define PARENB 0000400 >+#define PARODD 0001000 >+ >+/* c_lflag bits */ >+#define ISIG 0000001 >+#define ICANON 0000002 >+#define ECHO 0000010 >+#define ECHOE 0000020 >+#define ECHOK 0000040 >+#define ECHONL 0000100 >+#define NOFLSH 0000200 >+#define TOSTOP 0000400 >+ >+speed_t cfgetispeed(const struct termios *termios_p); >+speed_t cfgetospeed(const struct termios *termios_p); >+ >+int cfsetispeed(struct termios *termios_p, speed_t speed); >+int cfsetospeed(struct termios *termios_p, speed_t speed); >+ >+/* tcsetattr uses these */ >+#define TCSANOW 0 >+#define TCSADRAIN 1 >+#define TCSAFLUSH 2 >+ >+int tcgetattr(int fd, struct termios *termios_p); >+int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); >+ >+#define HAVE_TCGETPGRP >+pid_t tcgetpgrp(int fd); >+ >+#endif /* WIN32 */ >+ >+#endif /* _WIN32_TTY_H */ >Index: openbsd-compat/xcrypt.c >=================================================================== >RCS file: /cvs/openssh/openbsd-compat/xcrypt.c,v >retrieving revision 1.12 >diff -u -r1.12 xcrypt.c >--- openbsd-compat/xcrypt.c 7 Jan 2009 18:04:12 -0000 1.12 >+++ openbsd-compat/xcrypt.c 15 May 2013 12:02:26 -0000 >@@ -26,7 +26,9 @@ > > #include <sys/types.h> > #include <unistd.h> >-#include <pwd.h> >+#ifdef HAVE_PWD_H >+# include <pwd.h> >+#endif > > # if defined(HAVE_CRYPT_H) && !defined(HAVE_SECUREWARE) > # include <crypt.h>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2104
: 2268