Skip to content

Commit

Permalink
Make pam.d directory configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanjiang committed Feb 21, 2023
1 parent 11a8823 commit 8ef999e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ if test "x$enable_strict_locations" != "xyes"; then
localstatedir="/var";
fi

AC_ARG_WITH([pamconfdir],
[AS_HELP_STRING([--with-pamconfdir=DIR],
[Use directory for pam.d config (default: /etc/pam.d)])],
[], [with_pamconfdir="$sysconfdir/pam.d"])
AC_SUBST([pamconfdir], [$with_pamconfdir])

PKG_INSTALLDIR

AC_CHECK_HEADERS([sys/prctl.h])
Expand Down Expand Up @@ -638,6 +644,7 @@ echo " exec_prefix $exec_prefix"
echo " libdir $libdir"
echo " bindir $bindir"
echo " sysconfdir $sysconfdir"
echo " pamconfdir $pamconfdir"
echo " localstatedir $localstatedir"
echo " runstatedir $runstatedir"
echo " socketdir $socketdir"
Expand Down
2 changes: 1 addition & 1 deletion instfiles/pam.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif
endif
endif

pamddir = $(sysconfdir)/pam.d
pamddir = $(pamconfdir)

pamd_DATA = \
$(PAMFILE)
Expand Down
1 change: 1 addition & 0 deletions sesman/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AM_CPPFLAGS = \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-DXRDP_SOCKET_PATH=\"${socketdir}\" \
-DXRDP_PAMCONF_PATH=\"${pamconfdir}\" \
-DSESMAN_RUNTIME_PATH=\"${sesmanruntimedir}\" \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libipm
Expand Down
1 change: 1 addition & 0 deletions sesman/tools/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ AM_CPPFLAGS = \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-DXRDP_SOCKET_PATH=\"${socketdir}\" \
-DXRDP_PAMCONF_PATH=\"${pamconfdir}\" \
-DXRDP_AUTHMOD_SRC=\"../${AUTHMOD_SRC}\" \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libipm \
Expand Down
10 changes: 9 additions & 1 deletion sesman/verify_user_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@ get_service_name(char *service_name)
service_name[0] = 0;

if (g_file_exist("/etc/pam.d/xrdp-sesman") ||
g_file_exist(XRDP_SYSCONF_PATH "/pam.d/xrdp-sesman"))
#ifdef __LINUX_PAM__
/* /usr/lib/pam.d is hardcoded into Linux-PAM */
g_file_exist("/usr/lib/pam.d/xrdp-sesman") ||
#endif
#ifdef OPENPAM_VERSION
/* /usr/local/etc/pam.d is hardcoded into OpenPAM */
g_file_exist("/usr/local/etc/pam.d/xrdp-sesman") ||
#endif
g_file_exist(XRDP_PAMCONF_PATH "/xrdp-sesman"))
{
g_strncpy(service_name, "xrdp-sesman", 255);
}
Expand Down

0 comments on commit 8ef999e

Please sign in to comment.