Skip to content

xrdp compiling on Solaris, two changes required #2908

@abrossard

Description

@abrossard

xrdp version

0.9.80

Detailed xrdp version, build options

xrdp 0.9.80
  A Remote Desktop Protocol Server.
  Copyright (C) 2004-2020 Jay Sorg, Neutrino Labs, and all contributors.
  See https://github.com/neutrinolabs/xrdp for more information.

  Configure options:
      

  Compiled with OpenSSL 1.0.2zh  30 May 2023

Operating system & version

Solaris 11.4.62

Installation method

git clone & make install

Which backend do you use?

tbd

What desktop environment do you use?

gnove

Environment xrdp running on

Solaris zones

What's your client?

tbd

Area(s) with issue?

Crashes such as segfault, Compile error

Steps to reproduce

The first issue is the requirements for <limits.h> in os_calls.c in order to compile.
In the same file, the second issue is the method used to clear the environment is "harsh" (environ=0) and cause a core on Solaris, it is better to use clearenv which would work everywhere.

diff --git a/common/os_calls.c b/common/os_calls.c
index 765ad472..624e0621 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -35,6 +35,7 @@
 /* fix for solaris 10 with gcc 3.3.2 problem */
 #if defined(sun) || defined(__sun)
 #define ctid_t id_t
+#include <limits.h>
 #endif
 #include <unistd.h>
 #include <errno.h>
@@ -3450,10 +3451,14 @@ g_clearenv(void)
 #else
 #if defined(BSD)
     environ[0] = 0;
+#else
+#if defined(sun) || defined(__sun)
+    clearenv();
 #else
     environ = 0;
 #endif
 #endif
+#endif
 }
 
 /*****************************************************************************/

✔️ Expected Behavior

attempt to start the Xorg server

❌ Actual Behavior

core because of "environ=0" in g_clearenv()
[2024-01-09T09:27:46.976+0100] [ERROR] waitforx failed with unexpected signal SIGSEGV

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions