diff options
author | Chris White <chriswhite@gentoo.org> | 2005-11-30 09:59:41 +0000 |
---|---|---|
committer | Chris White <chriswhite@gentoo.org> | 2005-11-30 09:59:41 +0000 |
commit | 452d5f75c3ad3754e34865c736497ee0ddb71331 (patch) | |
tree | 9d9056d6e6c1e92175e1401a23b215303b9b4f65 /eclass/pam.eclass | |
parent | *** empty log message *** (diff) | |
download | gentoo-2-452d5f75c3ad3754e34865c736497ee0ddb71331.tar.gz gentoo-2-452d5f75c3ad3754e34865c736497ee0ddb71331.tar.bz2 gentoo-2-452d5f75c3ad3754e34865c736497ee0ddb71331.zip |
*** empty log message ***
Diffstat (limited to 'eclass/pam.eclass')
-rw-r--r-- | eclass/pam.eclass | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/eclass/pam.eclass b/eclass/pam.eclass index 06ba26194d62..f92c1970896d 100644 --- a/eclass/pam.eclass +++ b/eclass/pam.eclass @@ -1,14 +1,12 @@ # 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.1 2005/05/20 11:58:32 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.1.1.1 2005/11/30 09:59:31 chriswhite Exp $ # # This eclass contains functions to install pamd configuration files and # pam modules. inherit multilib -ECLASS="pam" -INHERITED="$INHERITED $ECLASS" # dopamd <file> [more files] # @@ -20,8 +18,10 @@ dopamd() { return 0; fi - insinto /etc/pam.d + INSDESTTREE=/etc/pam.d \ + INSOPTIONS="-m 0644" \ doins "$@" || die "failed to install $@" + cleanpamd "$@" } # newpamd <old name> <new name> @@ -34,8 +34,10 @@ newpamd() { return 0; fi - insinto /etc/pam.d + INSDESTTREE=/etc/pam.d \ + INSOPTIONS="-m 0644" \ newins "$1" "$2" || die "failed to install $1 as $2" + cleanpamd $2 } # dopamsecurity <section> <file> [more files] @@ -48,9 +50,9 @@ dopamsecurity() { return 0; fi - insinto /etc/security/$1 - shift - doins "$@" || die "failed to install $@" + INSDESTTREE=/etc/security/$1 \ + INSOPTIONS="-m 0644" \ + doins "${@:2}" || die "failed to install ${@:2}" } # newpamsecurity <section> <old name> <new name> @@ -63,7 +65,8 @@ newpamsecurity() { return 0; fi - insinto /etc/security/$1 + INSDESTTREE=/etc/security/$1 \ + INSOPTIONS="-m 0644" \ newins "$2" "$3" || die "failed to install $2 as $3" } @@ -71,10 +74,11 @@ newpamsecurity() { # # Returns the pam modules' directory for current implementation getpam_mod_dir() { - if has_version sys-libs/pam; then + if has_version sys-libs/pam || has_version sys-libs/openpam; then PAM_MOD_DIR=/$(get_libdir)/security - elif has_version sys-libs/openpam; then - PAM_MOD_DIR=/usr/$(get_libdir) + elif use ppc-macos; then + # OSX looks there for pam modules + PAM_MOD_DIR=/usr/lib/pam else # Unable to find PAM implementation... defaulting PAM_MOD_DIR=/$(get_libdir)/security @@ -127,18 +131,36 @@ pamd_mimic_system() { pamdfile=${D}/etc/pam.d/$1 echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \ $pamdfile - + authlevels="auth account password session" + if has_version '<sys-libs/pam-0.78'; then + mimic="\trequired\t\tpam_stack.so service=system-auth" + else + mimic="\tinclude\t\tsystem-auth" + fi + shift while [[ -n $1 ]]; do hasq $1 ${authlevels} || die "unknown level type" - echo -e "$1\tinclude\t\tsystem-auth" >> ${pamdfile} + echo -e "$1${mimic}" >> ${pamdfile} shift done +} + +# cleanpamd <pamd file> +# +# Cleans a pam.d file from modules that might not be present on the system +# where it's going to be installed +cleanpamd() { + while [[ -n $1 ]]; do + if ! has_version sys-libs/pam; then + sed -i -e '/pam_shells\|pam_console/s:^:#:' ${D}/etc/pam.d/$1 + fi - return 1 + shift + done } |