diff options
author | Koichiro IWAO <meta@vmeta.jp> | 2017-03-08 13:30:14 +0900 |
---|---|---|
committer | metalefty <meta@vmeta.jp> | 2017-06-12 16:57:04 +0900 |
commit | 65c1fe87d7a58f431c6cc1ab62766394837e7408 (patch) | |
tree | 810b8e6b5cb6ae19cab37c331436d1e01f92593d /common | |
parent | 0299d64fa87e1d5b396a0498785879834f6860f5 (diff) | |
download | xrdp-proprietary-65c1fe87d7a58f431c6cc1ab62766394837e7408.tar.gz xrdp-proprietary-65c1fe87d7a58f431c6cc1ab62766394837e7408.zip |
Log user-friendly message when certificate/privkey is inaccessible
We shouldn't assume that xrdp daemon is running under root privilege.
In many cases, root privilege is not really needed for xrdp daemon.
xrdp may fail to load certificate/privkey due to lack of permissions
when running under user privilege. Checking existence of files is not
enough and xrdp should output user-friendly log in such case.
Reported by Debian user in bug 856436 [1].
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=856436
Diffstat (limited to 'common')
-rw-r--r-- | common/os_calls.c | 12 | ||||
-rw-r--r-- | common/os_calls.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 524d8190..592d7d6d 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -2234,6 +2234,18 @@ g_file_exist(const char *filename) } /*****************************************************************************/ +/* returns boolean, non zero if the file is readable */ +int +g_file_readable(const char *filename) +{ +#if defined(_WIN32) + return 0; /* TODO: what should be done here? */ +#else + return access(filename, R_OK) == 0; +#endif +} + +/*****************************************************************************/ /* returns boolean, non zero if the directory exists */ int g_directory_exist(const char *dirname) diff --git a/common/os_calls.h b/common/os_calls.h index 4e93558d..90db706d 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -109,6 +109,7 @@ int g_mkdir(const char* dirname); char* g_get_current_dir(char* dirname, int maxlen); int g_set_current_dir(const char *dirname); int g_file_exist(const char* filename); +int g_file_readable(const char *filename); int g_directory_exist(const char* dirname); int g_create_dir(const char* dirname); int g_create_path(const char* path); |