| 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.8 2005/07/06 20:23:20 agriffis Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.9 2005/09/09 10:31:35 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 |
| … | |
… | |
| 18 | return 0; |
18 | return 0; |
| 19 | fi |
19 | fi |
| 20 | |
20 | |
| 21 | INSDESTTREE=/etc/pam.d \ |
21 | INSDESTTREE=/etc/pam.d \ |
| 22 | doins "$@" || die "failed to install $@" |
22 | doins "$@" || die "failed to install $@" |
|
|
23 | cleanpamd "$@" |
| 23 | } |
24 | } |
| 24 | |
25 | |
| 25 | # newpamd <old name> <new name> |
26 | # newpamd <old name> <new name> |
| 26 | # |
27 | # |
| 27 | # Install pam file <old name> as <new name> in /etc/pam.d |
28 | # Install pam file <old name> as <new name> in /etc/pam.d |
| … | |
… | |
| 32 | return 0; |
33 | return 0; |
| 33 | fi |
34 | fi |
| 34 | |
35 | |
| 35 | INSDESTTREE=/etc/pam.d \ |
36 | INSDESTTREE=/etc/pam.d \ |
| 36 | newins "$1" "$2" || die "failed to install $1 as $2" |
37 | newins "$1" "$2" || die "failed to install $1 as $2" |
|
|
38 | cleanpamd $2 |
| 37 | } |
39 | } |
| 38 | |
40 | |
| 39 | # dopamsecurity <section> <file> [more files] |
41 | # dopamsecurity <section> <file> [more files] |
| 40 | # |
42 | # |
| 41 | # Installs the config files in /etc/security/<section>/ |
43 | # Installs the config files in /etc/security/<section>/ |
| … | |
… | |
| 142 | echo -e "$1${mimic}" >> ${pamdfile} |
144 | echo -e "$1${mimic}" >> ${pamdfile} |
| 143 | |
145 | |
| 144 | shift |
146 | shift |
| 145 | done |
147 | done |
| 146 | } |
148 | } |
|
|
149 | |
|
|
150 | # cleanpamd <pamd file> |
|
|
151 | # |
|
|
152 | # Cleans a pam.d file from modules that might not be present on the system |
|
|
153 | # where it's going to be installed |
|
|
154 | cleanpamd() { |
|
|
155 | while [[ -n $1 ]]; do |
|
|
156 | if ! has_version sys-libs/pam; then |
|
|
157 | sed -i -e '/pam_shells\|pam_console/s:^:#:' ${D}/etc/pam.d/$1 |
|
|
158 | fi |
|
|
159 | |
|
|
160 | shift |
|
|
161 | done |
|
|
162 | } |