| 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.10 2005/11/03 21:27:02 flameeyes Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.11 2007/04/07 08:52:46 vapier 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 |
| … | |
… | |
| 16 | |
16 | |
| 17 | if hasq pam ${IUSE} && ! use pam; then |
17 | if hasq pam ${IUSE} && ! use pam; then |
| 18 | return 0; |
18 | return 0; |
| 19 | fi |
19 | fi |
| 20 | |
20 | |
| 21 | INSDESTTREE=/etc/pam.d \ |
21 | ( # dont want to pollute calling env |
| 22 | INSOPTIONS="-m 0644" \ |
22 | insinto /etc/pam.d |
|
|
23 | insopts -m 0644 |
|
|
24 | doins "$@" |
| 23 | doins "$@" || die "failed to install $@" |
25 | ) || die "failed to install $@" |
| 24 | cleanpamd "$@" |
26 | cleanpamd "$@" |
| 25 | } |
27 | } |
| 26 | |
28 | |
| 27 | # newpamd <old name> <new name> |
29 | # newpamd <old name> <new name> |
| 28 | # |
30 | # |
| … | |
… | |
| 32 | |
34 | |
| 33 | if hasq pam ${IUSE} && ! use pam; then |
35 | if hasq pam ${IUSE} && ! use pam; then |
| 34 | return 0; |
36 | return 0; |
| 35 | fi |
37 | fi |
| 36 | |
38 | |
| 37 | INSDESTTREE=/etc/pam.d \ |
39 | ( # dont want to pollute calling env |
| 38 | INSOPTIONS="-m 0644" \ |
40 | insinto /etc/pam.d |
|
|
41 | insopts -m 0644 |
|
|
42 | newins "$1" "$2" |
| 39 | newins "$1" "$2" || die "failed to install $1 as $2" |
43 | ) || die "failed to install $1 as $2" |
| 40 | cleanpamd $2 |
44 | cleanpamd $2 |
| 41 | } |
45 | } |
| 42 | |
46 | |
| 43 | # dopamsecurity <section> <file> [more files] |
47 | # dopamsecurity <section> <file> [more files] |
| 44 | # |
48 | # |
| 45 | # Installs the config files in /etc/security/<section>/ |
49 | # Installs the config files in /etc/security/<section>/ |
| 46 | dopamsecurity() { |
50 | dopamsecurity() { |
| 47 | [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments" |
51 | [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments" |
| 48 | |
52 | |
| 49 | if hasq pam ${IUSE} && ! use pam; then |
53 | if hasq pam ${IUSE} && ! use pam; then |
| 50 | return 0; |
54 | return 0 |
| 51 | fi |
55 | fi |
| 52 | |
56 | |
| 53 | INSDESTTREE=/etc/security/$1 \ |
57 | ( # dont want to pollute calling env |
| 54 | INSOPTIONS="-m 0644" \ |
58 | insinto /etc/security/$1 |
| 55 | doins "${@:2}" || die "failed to install ${@:2}" |
59 | insopts -m 0644 |
|
|
60 | doins "${@:2}" |
|
|
61 | ) || die "failed to install ${@:2}" |
| 56 | } |
62 | } |
| 57 | |
63 | |
| 58 | # newpamsecurity <section> <old name> <new name> |
64 | # newpamsecurity <section> <old name> <new name> |
| 59 | # |
65 | # |
| 60 | # Installs the config file <old name> as <new name> in /etc/security/<section>/ |
66 | # Installs the config file <old name> as <new name> in /etc/security/<section>/ |
| … | |
… | |
| 63 | |
69 | |
| 64 | if hasq pam ${IUSE} && ! use pam; then |
70 | if hasq pam ${IUSE} && ! use pam; then |
| 65 | return 0; |
71 | return 0; |
| 66 | fi |
72 | fi |
| 67 | |
73 | |
| 68 | INSDESTTREE=/etc/security/$1 \ |
74 | ( # dont want to pollute calling env |
| 69 | INSOPTIONS="-m 0644" \ |
75 | insinto /etc/security/$1 |
|
|
76 | insopts -m 0644 |
|
|
77 | newins "$2" "$3" |
| 70 | newins "$2" "$3" || die "failed to install $2 as $3" |
78 | ) || die "failed to install $2 as $3" |
| 71 | } |
79 | } |
| 72 | |
80 | |
| 73 | # getpam_mod_dir |
81 | # getpam_mod_dir |
| 74 | # |
82 | # |
| 75 | # Returns the pam modules' directory for current implementation |
83 | # Returns the pam modules' directory for current implementation |