Replace pamd_mimic_system with a pamd_mimic function that takes as an
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Wed, 20 Feb 2008 00:00:01 +0000 (00:00 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Wed, 20 Feb 2008 00:00:01 +0000 (00:00 +0000)
argument the stack that it should mime. pamd_mimic_system is now a
wrapper, which I should deprecated once I'm done with pambase.

eclass/pam.eclass

index 51c58ea1b61c7b219d330fedbf56bfcfe49c2e6f..4a59ed2d2bea1125d473ede617d1845b78e2df39 100644 (file)
@@ -1,7 +1,7 @@
 # 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.
@@ -130,25 +130,35 @@ newpammod() {
 # 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"