| 1 | # Copyright 2004 Gentoo Foundation |
1 | # Copyright 2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License, v2 or later |
| 3 | # Author Diego Pettenò <flameeyes@gentoo.org> |
3 | # Author Diego Pettenò <flameeyes@gentoo.org> |
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.3 2005/05/20 15:54:34 flameeyes Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.6 2005/07/04 12:50:47 flameeyes Exp $ |
| 5 | # |
5 | # |
| 6 | # This eclass contains functions to install pamd configuration files and |
6 | # This eclass contains functions to install pamd configuration files and |
| 7 | # pam modules. |
7 | # pam modules. |
| 8 | |
8 | |
| 9 | inherit multilib |
9 | inherit multilib |
| … | |
… | |
| 47 | if hasq pam ${IUSE} && ! use pam; then |
47 | if hasq pam ${IUSE} && ! use pam; then |
| 48 | return 0; |
48 | return 0; |
| 49 | fi |
49 | fi |
| 50 | |
50 | |
| 51 | INSDESTTREE=/etc/security/$1 \ |
51 | INSDESTTREE=/etc/security/$1 \ |
| 52 | shift |
|
|
| 53 | doins "$@" || die "failed to install $@" |
52 | doins "${@:2}" || die "failed to install ${@:2}" |
| 54 | } |
53 | } |
| 55 | |
54 | |
| 56 | # newpamsecurity <section> <old name> <new name> |
55 | # newpamsecurity <section> <old name> <new name> |
| 57 | # |
56 | # |
| 58 | # Installs the config file <old name> as <new name> in /etc/security/<section>/ |
57 | # Installs the config file <old name> as <new name> in /etc/security/<section>/ |
| … | |
… | |
| 69 | |
68 | |
| 70 | # getpam_mod_dir |
69 | # getpam_mod_dir |
| 71 | # |
70 | # |
| 72 | # Returns the pam modules' directory for current implementation |
71 | # Returns the pam modules' directory for current implementation |
| 73 | getpam_mod_dir() { |
72 | getpam_mod_dir() { |
| 74 | if has_version sys-libs/pam; then |
73 | if has_version sys-libs/pam || has_version sys-libs/openpam; then |
| 75 | PAM_MOD_DIR=/$(get_libdir)/security |
74 | PAM_MOD_DIR=/$(get_libdir)/security |
| 76 | elif has_version sys-libs/openpam; then |
75 | elif use ppc-macos; then |
|
|
76 | # OSX looks there for pam modules |
| 77 | PAM_MOD_DIR=/usr/$(get_libdir) |
77 | PAM_MOD_DIR=/usr/lib/pam |
| 78 | else |
78 | else |
| 79 | # Unable to find PAM implementation... defaulting |
79 | # Unable to find PAM implementation... defaulting |
| 80 | PAM_MOD_DIR=/$(get_libdir)/security |
80 | PAM_MOD_DIR=/$(get_libdir)/security |
| 81 | fi |
81 | fi |
| 82 | |
82 | |
| … | |
… | |
| 125 | |
125 | |
| 126 | dodir /etc/pam.d |
126 | dodir /etc/pam.d |
| 127 | pamdfile=${D}/etc/pam.d/$1 |
127 | pamdfile=${D}/etc/pam.d/$1 |
| 128 | echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \ |
128 | echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \ |
| 129 | $pamdfile |
129 | $pamdfile |
| 130 | |
130 | |
| 131 | authlevels="auth account password session" |
131 | authlevels="auth account password session" |
|
|
132 | |
|
|
133 | if has_version '<sys-libs/pam-0.78'; then |
|
|
134 | mimic="\trequired\t\tpam_stack.so service=system-auth" |
|
|
135 | else |
|
|
136 | mimic="\tinclude\t\tsystem-auth" |
|
|
137 | fi |
| 132 | |
138 | |
| 133 | shift |
139 | shift |
| 134 | |
140 | |
| 135 | while [[ -n $1 ]]; do |
141 | while [[ -n $1 ]]; do |
| 136 | hasq $1 ${authlevels} || die "unknown level type" |
142 | hasq $1 ${authlevels} || die "unknown level type" |
| 137 | |
143 | |
| 138 | echo -e "$1\tinclude\t\tsystem-auth" >> ${pamdfile} |
144 | echo -e "$1${mimic}" >> ${pamdfile} |
| 139 | |
145 | |
| 140 | shift |
146 | shift |
| 141 | done |
147 | done |
| 142 | } |
148 | } |