# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Diego Pettenò <flameeyes@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.14 2007/11/04 15:00:27 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.15 2008/02/20 00:00:01 flameeyes Exp $
#
# This eclass contains functions to install pamd configuration files and
# pam modules.
# for the given levels in the /etc/pam.d directory.
pamd_mimic_system() {
[[ $# -lt 2 ]] && die "pamd_mimic_system requires at least two argments"
+ pamd_mimic system-auth "$@"
+}
+
+# pamd_mimic <stack> <pamd file> [auth levels]
+#
+# This function creates a pamd file which mimics the given stack
+# for the given levels in the /etc/pam.d directory.
+pamd_mimic() {
+ [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments"
if hasq pam ${IUSE} && ! use pam; then
return 0;
fi
dodir /etc/pam.d
- pamdfile=${D}/etc/pam.d/$1
- echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \
+ pamdfile=${D}/etc/pam.d/$2
+ echo -e "# File autogenerated by pamd_mimic in pam eclass\n\n" >> \
$pamdfile
+ originalstack=$1
authlevels="auth account password session"
if has_version '<sys-libs/pam-0.78'; then
- mimic="\trequired\t\tpam_stack.so service=system-auth"
+ mimic="\trequired\t\tpam_stack.so service=${originalstack}"
else
- mimic="\tinclude\t\tsystem-auth"
+ mimic="\tinclude\t\t${originalstack}"
fi
- shift
+ shift; shift
while [[ -n $1 ]]; do
hasq $1 ${authlevels} || die "unknown level type"