2016-12-31 07:00:46 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Find suitable PAM config file
|
|
|
|
|
|
|
|
rules="$1"
|
|
|
|
srcdir="$2"
|
|
|
|
outfile="$3"
|
|
|
|
|
|
|
|
service="xrdp-sesman"
|
|
|
|
pamdir="/etc/pam.d"
|
|
|
|
|
|
|
|
guess_rules ()
|
|
|
|
{
|
|
|
|
if test -s "$pamdir/password-auth"; then
|
|
|
|
rules="redhat"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -s "$pamdir/common-account"; then
|
|
|
|
if grep "^@include" "$pamdir/passwd" >/dev/null 2>&1; then
|
|
|
|
rules="debian"
|
|
|
|
else
|
|
|
|
rules="suse"
|
|
|
|
fi
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2017-07-19 09:17:10 +03:00
|
|
|
if test ! -f "$pamdir/system-auth" -a -s "$pamdir/system"; then
|
|
|
|
rules="freebsd"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-01-30 12:42:42 +03:00
|
|
|
if test -s "$pamdir/authorization"; then
|
|
|
|
rules="macos"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-03-23 21:34:23 +03:00
|
|
|
if test -s "$pamdir/system-remote-login"; then
|
|
|
|
rules="arch"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2016-12-31 07:00:46 +03:00
|
|
|
rules="unix"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if test "$rules" = "auto"; then
|
|
|
|
guess_rules
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -s "$srcdir/$service.$rules"; then
|
|
|
|
ln -nsf "$srcdir/$service.$rules" "$outfile"
|
|
|
|
else
|
|
|
|
echo "Cannot find $srcdir/$service.$rules"
|
|
|
|
exit 1
|
|
|
|
fi
|