mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
second part of win32 changes
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@143 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user