From 4b87548b71566e066a3186c5e0258cfd4a1fedf1 Mon Sep 17 00:00:00 2001 From: Ian Geiser Date: Thu, 13 Jul 2017 12:01:07 -0400 Subject: [PATCH 1/3] Use g_create_path instead of g_create_dir Rename g_mk_temp_dir to g_mk_socket_path --- common/os_calls.c | 14 +++++++------- common/os_calls.h | 2 +- sesman/env.c | 4 ++-- sesman/sesman.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 481fd570..8d2b06c7 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -109,17 +109,17 @@ g_rm_temp_dir(void) /*****************************************************************************/ int -g_mk_temp_dir(const char *app_name) +g_mk_socket_path(const char *app_name) { if (!g_directory_exist(XRDP_SOCKET_PATH)) { - if (!g_create_dir(XRDP_SOCKET_PATH)) + if (!g_create_path(XRDP_SOCKET_PATH)) { /* if failed, still check if it got created by someone else */ if (!g_directory_exist(XRDP_SOCKET_PATH)) { log_message(LOG_LEVEL_ERROR, - "g_mk_temp_dir: g_create_dir(%s) failed", + "g_mk_socket_path: g_create_path(%s) failed", XRDP_SOCKET_PATH); return 1; } @@ -153,7 +153,7 @@ g_init(const char *app_name) setlocale(LC_CTYPE, "en_US.UTF-8"); } - g_mk_temp_dir(app_name); + g_mk_socket_path(app_name); } /*****************************************************************************/ @@ -2954,7 +2954,7 @@ g_execvp(const char *p1, char *args[]) g_rm_temp_dir(); rv = execvp(p1, args); - g_mk_temp_dir(0); + g_mk_socket_path(0); return rv; #endif } @@ -2971,7 +2971,7 @@ g_execlp3(const char *a1, const char *a2, const char *a3) g_rm_temp_dir(); rv = execlp(a1, a2, a3, (void *)0); - g_mk_temp_dir(0); + g_mk_socket_path(0); return rv; #endif } @@ -3067,7 +3067,7 @@ g_fork(void) if (rv == 0) /* child */ { - g_mk_temp_dir(0); + g_mk_socket_path(0); } return rv; diff --git a/common/os_calls.h b/common/os_calls.h index 90db706d..98f87b3e 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -38,7 +38,7 @@ #define g_close_wait_obj g_delete_wait_obj int g_rm_temp_dir(void); -int g_mk_temp_dir(const char* app_name); +int g_mk_socket_path(const char* app_name); void g_init(const char* app_name); void g_deinit(void); void* g_malloc(int size, int zero); diff --git a/sesman/env.c b/sesman/env.c index ccec950b..29bd281d 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -69,7 +69,7 @@ env_check_password_file(const char *filename, const char *passwd) g_strncpy(encryptedPasswd, passwd, 8); g_memset(key, 0, sizeof(key)); g_mirror_memcpy(key, g_fixedkey, 8); - des = ssl_des3_encrypt_info_create(key, 0); + des = ssl_des3_encrypt_info_create(key, 0); ssl_des3_encrypt(des, 8, encryptedPasswd, encryptedPasswd); ssl_des3_info_delete(des); fd = g_file_open_ex(filename, 0, 1, 1, 1); @@ -124,7 +124,7 @@ env_set_user(const char *username, char **passwd_file, int display, error = g_setuid(uid); } - g_mk_temp_dir(0); + g_mk_socket_path(0); if (error == 0) { diff --git a/sesman/sesman.c b/sesman/sesman.c index 98346ea8..fd98370c 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -418,7 +418,7 @@ main(int argc, char **argv) "starting xrdp-sesman with pid %d", g_pid); /* make sure the socket directory exists */ - g_mk_temp_dir("xrdp-sesman"); + g_mk_socket_path("xrdp-sesman"); /* make sure the /tmp/.X11-unix directory exists */ if (!g_directory_exist("/tmp/.X11-unix")) From aa0721a90e9ea94512f763a732946c2530a3d28d Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Fri, 14 Jul 2017 21:08:03 +0900 Subject: [PATCH 2/3] common: fix more glitches in IPv4 initialization --- common/os_calls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 8d2b06c7..04c5007d 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -753,7 +753,7 @@ connect_loopback(int sck, const char *port) } // else IPv4 - g_memset(&sa, 0, sizeof(s)); + g_memset(&s, 0, sizeof(s)); s.sin_family = AF_INET; s.sin_addr.s_addr = htonl(INADDR_LOOPBACK); // IPv4 127.0.0.1 s.sin_port = htons((tui16)atoi(port)); @@ -944,7 +944,7 @@ g_tcp_bind(int sck, const char *port) errno6 = errno; // else IPv4 - g_memset(&sa, 0, sizeof(s)); + g_memset(&s, 0, sizeof(s)); s.sin_family = AF_INET; s.sin_addr.s_addr = htonl(INADDR_ANY); // IPv4 0.0.0.0 s.sin_port = htons((tui16)atoi(port)); From aaa40edefb762f87e2bd2e5e3073845134f3ec8a Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Fri, 14 Jul 2017 21:17:54 +0900 Subject: [PATCH 3/3] NEWS: pulralize glitches --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a9e04133..f8156f81 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,7 +8,7 @@ * Now sesman ensures socket directory present #801 * Exit with failure status if port already in use #644 * Eliminate some hard coded paths - * Fix a glitch with IPv4 struct initialization #803 + * Fix glitches with IPv4 struct initialization #803 * Fix some keyboard layout integration (UK, Spanish) * Fix handle OS when IPv6 disabled #714 * Fix issues around systemd session #778