aboutsummaryrefslogtreecommitdiff
path: root/libssh/misc.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-03-07 02:11:40 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-03-07 02:11:40 +0000
commitc284eb4e38721f567db15bde24ea53822d0cefb4 (patch)
treed126f1958112b7f8afe9039fa112efbd07f53a86 /libssh/misc.c
parent0d6e3c17903bf370765b24b5f2cfeaf9d5d57e3f (diff)
downloadlibssh-c284eb4e38721f567db15bde24ea53822d0cefb4.tar.gz
libssh-c284eb4e38721f567db15bde24ea53822d0cefb4.tar.xz
libssh-c284eb4e38721f567db15bde24ea53822d0cefb4.zip
second part of win32 changes
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@143 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/misc.c')
-rw-r--r--libssh/misc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index b9400f7..84dd4ea 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -24,11 +24,20 @@ MA 02111-1307, USA. */
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <pwd.h>
#include <sys/types.h>
+
+#ifdef _WIN32
+#define _WIN32_IE 0x0400 //SHGetSpecialFolderPath
+#include <shlobj.h>
+#include <winsock2.h>
+#else
+#include <pwd.h>
#include <netdb.h>
+#endif
+
#include "libssh/libssh.h"
+#ifndef _WIN32
/* if the program was executed suid root, don't trust the user ! */
static int is_trusted(){
if(geteuid()!=getuid())
@@ -77,6 +86,18 @@ char *ssh_get_user_home_dir(){
return get_homedir_from_uid(getuid());
}
+#else /* _WIN32 */
+
+char *ssh_get_user_home_dir(){
+ static char szPath[MAX_PATH];
+ if (SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, TRUE))
+ return szPath;
+ else
+ return NULL;
+}
+
+#endif
+
/* we have read access on file */
int ssh_file_readaccess_ok(char *file){
if(!access(file,R_OK))