Skip to content

Commit

Permalink
Support MacOS.
Browse files Browse the repository at this point in the history
Fix bad space in LaunchDaemons directory.
Remove use of daemondo.
Fix formatting with astyle.
  • Loading branch information
mstone2001 committed Oct 15, 2023
1 parent 89ceaf0 commit 6785a7f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 7 deletions.
4 changes: 3 additions & 1 deletion common/os_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3365,14 +3365,16 @@ g_setpgid(int pid, int pgid)
void
g_clearenv(void)
{
LOG_DEVEL(LOG_LEVEL_TRACE, "g_clearenv()");
#if defined(_WIN32)
#else
#if defined(BSD)
#if defined(BSD) || defined(__sun) || defined(__APPLE__)
environ[0] = 0;
#else
environ = 0;
#endif
#endif
LOG_DEVEL(LOG_LEVEL_TRACE, "--g_clearenv()");
}

/*****************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ AC_CONFIG_FILES([
instfiles/pam.d/Makefile
instfiles/pulse/Makefile
instfiles/rc.d/Makefile
instfiles/launchdaemons/Makefile
keygen/Makefile
waitforx/Makefile
libipm/Makefile
Expand Down
4 changes: 3 additions & 1 deletion instfiles/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ SUBDIRS += \
endif

if MACOS
SUBDIRS += pam.d
SUBDIRS += \
pam.d \
launchdaemons
endif

#
Expand Down
3 changes: 3 additions & 0 deletions instfiles/launchdaemons/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
startscriptdir = /Library/LaunchDaemons

dist_startscript_SCRIPTS = org.xrdp.xrdp.plist org.xrdp.xrdp-sesman.plist
15 changes: 15 additions & 0 deletions instfiles/launchdaemons/org.xrdp.xrdp-sesman.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.xrdp.xrdp-sesman</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/xrdp-sesman</string>
<string>-n</string>
</array>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>
15 changes: 15 additions & 0 deletions instfiles/launchdaemons/org.xrdp.xrdp.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.xrdp.xrdp</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/xrdp</string>
<string>-n</string>
</array>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion instfiles/pam.d/xrdp-sesman.macos
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ auth optional pam_ntlm.so try_first_pass
auth optional pam_mount.so try_first_pass
auth required pam_opendirectory.so try_first_pass
account required pam_nologin.so
account required pam_sacl.so sacl_service=ssh
account required pam_sacl.so sacl_service=xrdp-sesman
account required pam_opendirectory.so
password required pam_opendirectory.so
session required pam_launchd.so
Expand Down
6 changes: 6 additions & 0 deletions xrdp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ dist_xrdppkgdata_DATA = \
sans-18.fv1 \
cursor0.cur \
cursor1.cur

if MACOS
# must be tab below. Common out Xorg and Xvnc since they don't work on MacOs.
install-data-hook:
sed -i '' '235,249s/^/;/g' $(DESTDIR)$(sysconfdir)/xrdp/xrdp.ini
endif
27 changes: 23 additions & 4 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2605,13 +2605,32 @@ xrdp_mm_connect_sm(struct xrdp_mm *self)

gw_username = xrdp_mm_get_value(self, "pamusername");
gw_password = xrdp_mm_get_value(self, "pampassword");
if (!g_strcmp(gw_username, "same"))
if ( gw_username != NULL )
{
gw_username = xrdp_mm_get_value(self, "username");
if (!g_strcmp(gw_username, "same"))
{
gw_username = xrdp_mm_get_value(self, "username");
}

if ( !g_strncmp("ask", gw_username, 3))
{
gw_username = self->wm->session->client_info->username;
}
}

if (gw_password == NULL ||
!g_strcmp(gw_password, "same"))
if (gw_password != NULL )
{
if ( !g_strcmp(gw_password, "same"))
{
gw_password = xrdp_mm_get_value(self, "password");
}

if ( !g_strncmp("ask", gw_password, 3))
{
gw_password = self->wm->session->client_info->password;
}
}
else
{
gw_password = xrdp_mm_get_value(self, "password");
}
Expand Down

0 comments on commit 6785a7f

Please sign in to comment.