summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c22
-rw-r--r--common/os_calls.h2
-rw-r--r--sesman/sesman.c9
-rw-r--r--sesman/session.c13
4 files changed, 36 insertions, 10 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 57bb6a2f..21577a71 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -2833,6 +2833,28 @@ g_setuid(int pid)
}
/*****************************************************************************/
+int APP_CC
+g_setsid(void)
+{
+#if defined(_WIN32)
+ return -1;
+#else
+ return setsid();
+#endif
+}
+
+/*****************************************************************************/
+int APP_CC
+g_setlogin(const char *name)
+{
+#ifdef BSD
+ return setlogin(name);
+#else
+ return -1;
+#endif
+}
+
+/*****************************************************************************/
/* does not work in win32
returns pid of process that exits or zero if signal occurred */
int APP_CC
diff --git a/common/os_calls.h b/common/os_calls.h
index a4c05375..c7b6cb09 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -156,6 +156,8 @@ int APP_CC g_initgroups(const char* user, int gid);
int APP_CC g_getuid(void);
int APP_CC g_getgid(void);
int APP_CC g_setuid(int pid);
+int APP_CC g_setsid(void);
+int APP_CC g_setlogin(const char *name);
int APP_CC g_waitchild(void);
int APP_CC g_waitpid(int pid);
void APP_CC g_clearenv(void);
diff --git a/sesman/sesman.c b/sesman/sesman.c
index fe1f0952..88eeb346 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -136,7 +136,8 @@ int DEFAULT_CC
main(int argc, char **argv)
{
int fd;
- enum logReturns error;
+ enum logReturns log_error;
+ int error;
int daemon = 1;
int pid;
char pid_s[32];
@@ -267,11 +268,11 @@ main(int argc, char **argv)
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
/* starting logging subsystem */
- error = log_start(cfg_file, "xrdp-sesman");
+ log_error = log_start(cfg_file, "xrdp-sesman");
- if (error != LOG_STARTUP_OK)
+ if (log_error != LOG_STARTUP_OK)
{
- switch (error)
+ switch (log_error)
{
case LOG_ERROR_MALLOC:
g_writeln("error on malloc. cannot start logging. quitting.");
diff --git a/sesman/session.c b/sesman/session.c
index 3860c199..9e29b199 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -504,16 +504,17 @@ session_start_fork(int width, int height, int bpp, char *username,
* Create a new session and process group since the 4.4BSD
* setlogin() affects the entire process group
*/
- if (setsid() < 0)
+ if (g_setsid() < 0)
{
- log_message(LOG_LEVEL_ERROR,
- "setsid failed - pid %d", g_getpid());
+ log_message(LOG_LEVEL_ERROR,
+ "setsid failed - pid %d", g_getpid());
}
- if (setlogin(username) < 0)
+ if (g_setlogin(username) < 0)
{
- log_message(LOG_LEVEL_ERROR,
- "setlogin failed for user %s - pid %d", username, g_getpid());
+ log_message(LOG_LEVEL_ERROR,
+ "setlogin failed for user %s - pid %d", username,
+ g_getpid());
}
}