aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libssh/libssh.h1
-rw-r--r--include/libssh/priv.h4
-rw-r--r--include/libssh/sftp.h3
-rw-r--r--libssh/connect.c6
-rw-r--r--libssh/sftp.c13
5 files changed, 19 insertions, 8 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 7e4a99d4..8da66a20 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -54,6 +54,7 @@
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef unsigned long long uint64_t;
+ typedef uint32_t mode_t;
#else /* _MSC_VER */
#include <unistd.h>
#include <inttypes.h>
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 6ad7ca7e..e103ce96 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -34,6 +34,10 @@
#define snprintf _snprintf
/** Imitate define of inttypes.h */
#define PRIdS "Id"
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#define strtoull _strtoui64
+#define isblank(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r')
#else
#include <unistd.h>
#define PRIdS "zd"
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 9d3647b8..fd354600 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -61,9 +61,6 @@ extern "C" {
typedef uint32_t gid_t;
#endif /* gid_t */
#ifdef _MSC_VER
-#ifndef mode_t
- typedef uint32_t mode_t;
-#endif /* mode_t */
#ifndef ssize_t
typedef _W64 signed int ssize_t;
#endif /* ssize_t */
diff --git a/libssh/connect.c b/libssh/connect.c
index ca08b884..c472d2f6 100644
--- a/libssh/connect.c
+++ b/libssh/connect.c
@@ -35,9 +35,15 @@
* http://blogs.msdn.com/oldnewthing/archive/2007/04/11/2079137.aspx
*/
#undef _WIN32_WINNT
+#ifdef HAVE_WSPIAPI_H
#define _WIN32_WINNT 0x0500 /* _WIN32_WINNT_WIN2K */
#undef NTDDI_VERSION
#define NTDDI_VERSION 0x05000400 /* NTDDI_WIN2KSP4 */
+#else
+#define _WIN32_WINNT 0x0501 /* _WIN32_WINNT_WINXP */
+#undef NTDDI_VERSION
+#define NTDDI_VERSION 0x05010000 /* NTDDI_WINXP */
+#endif
#include <winsock2.h>
#include <ws2tcpip.h>
diff --git a/libssh/sftp.c b/libssh/sftp.c
index 5265eb5a..49eb565c 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -33,6 +33,14 @@
#ifndef _WIN32
#include <arpa/inet.h>
+#else
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+
+#ifdef _MSC_VER
+#define S_IFBLK 0060000
+#define S_IFIFO 0010000
+#endif
#endif
#include "libssh/priv.h"
@@ -933,7 +941,6 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_4(SFTP_SESSION *sftp, ssh_buffer buf,
}
attr->permissions = ntohl(attr->permissions);
-#ifndef _WIN32
/* FIXME on windows! */
switch (attr->permissions & S_IFMT) {
case S_IFSOCK:
@@ -955,7 +962,6 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_4(SFTP_SESSION *sftp, ssh_buffer buf,
attr->type = SSH_FILEXFER_TYPE_UNKNOWN;
break;
}
-#endif /* _WIN32 */
}
if (flags & SSH_FILEXFER_ATTR_ACCESSTIME) {
@@ -1126,8 +1132,6 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_SESSION *sftp, ssh_buffer buf,
}
attr->permissions = ntohl(attr->permissions);
-#ifndef _WIN32
- /* FIXME on windows */
switch (attr->permissions & S_IFMT) {
case S_IFSOCK:
case S_IFBLK:
@@ -1148,7 +1152,6 @@ static SFTP_ATTRIBUTES *sftp_parse_attr_3(SFTP_SESSION *sftp, ssh_buffer buf,
attr->type = SSH_FILEXFER_TYPE_UNKNOWN;
break;
}
-#endif /* _WIN32 */
}
if (flags & SSH_FILEXFER_ATTR_ACMODTIME) {