Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MacOS. #2812

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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