/[gentoo-x86]/eclass/pam.eclass
Gentoo

Diff of /eclass/pam.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.8
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.2 2005/05/20 12:38:56 flameeyes Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.8 2005/07/06 20:23:20 agriffis 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
9inherit multilib 9inherit multilib
10ECLASS="pam"
11INHERITED="$INHERITED $ECLASS"
12 10
13# dopamd <file> [more files] 11# dopamd <file> [more files]
14# 12#
15# Install pam auth config file in /etc/pam.d 13# Install pam auth config file in /etc/pam.d
16dopamd() { 14dopamd() {
18 16
19 if hasq pam ${IUSE} && ! use pam; then 17 if hasq pam ${IUSE} && ! use pam; then
20 return 0; 18 return 0;
21 fi 19 fi
22 20
23 insinto /etc/pam.d 21 INSDESTTREE=/etc/pam.d \
24 doins "$@" || die "failed to install $@" 22 doins "$@" || die "failed to install $@"
25} 23}
26 24
27# newpamd <old name> <new name> 25# newpamd <old name> <new name>
28# 26#
32 30
33 if hasq pam ${IUSE} && ! use pam; then 31 if hasq pam ${IUSE} && ! use pam; then
34 return 0; 32 return 0;
35 fi 33 fi
36 34
37 insinto /etc/pam.d 35 INSDESTTREE=/etc/pam.d \
38 newins "$1" "$2" || die "failed to install $1 as $2" 36 newins "$1" "$2" || die "failed to install $1 as $2"
39} 37}
40 38
41# dopamsecurity <section> <file> [more files] 39# dopamsecurity <section> <file> [more files]
42# 40#
46 44
47 if hasq pam ${IUSE} && ! use pam; then 45 if hasq pam ${IUSE} && ! use pam; then
48 return 0; 46 return 0;
49 fi 47 fi
50 48
51 insinto /etc/security/$1 49 INSDESTTREE=/etc/security/$1 \
52 shift
53 doins "$@" || die "failed to install $@" 50 doins "${@:2}" || die "failed to install ${@:2}"
54} 51}
55 52
56# newpamsecurity <section> <old name> <new name> 53# newpamsecurity <section> <old name> <new name>
57# 54#
58# Installs the config file <old name> as <new name> in /etc/security/<section>/ 55# Installs the config file <old name> as <new name> in /etc/security/<section>/
61 58
62 if hasq pam ${IUSE} && ! use pam; then 59 if hasq pam ${IUSE} && ! use pam; then
63 return 0; 60 return 0;
64 fi 61 fi
65 62
66 insinto /etc/security/$1 63 INSDESTTREE=/etc/security/$1 \
67 newins "$2" "$3" || die "failed to install $2 as $3" 64 newins "$2" "$3" || die "failed to install $2 as $3"
68} 65}
69 66
70# getpam_mod_dir 67# getpam_mod_dir
71# 68#
72# Returns the pam modules' directory for current implementation 69# Returns the pam modules' directory for current implementation
73getpam_mod_dir() { 70getpam_mod_dir() {
74 if has_version sys-libs/pam; then 71 if has_version sys-libs/pam || has_version sys-libs/openpam; then
75 PAM_MOD_DIR=/$(get_libdir)/security 72 PAM_MOD_DIR=/$(get_libdir)/security
76 elif has_version sys-libs/openpam; then 73 elif use ppc-macos; then
74 # OSX looks there for pam modules
77 PAM_MOD_DIR=/usr/$(get_libdir) 75 PAM_MOD_DIR=/usr/lib/pam
78 else 76 else
79 # Unable to find PAM implementation... defaulting 77 # Unable to find PAM implementation... defaulting
80 PAM_MOD_DIR=/$(get_libdir)/security 78 PAM_MOD_DIR=/$(get_libdir)/security
81 fi 79 fi
82 80
125 123
126 dodir /etc/pam.d 124 dodir /etc/pam.d
127 pamdfile=${D}/etc/pam.d/$1 125 pamdfile=${D}/etc/pam.d/$1
128 echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \ 126 echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \
129 $pamdfile 127 $pamdfile
130 128
131 authlevels="auth account password session" 129 authlevels="auth account password session"
130
131 if has_version '<sys-libs/pam-0.78'; then
132 mimic="\trequired\t\tpam_stack.so service=system-auth"
133 else
134 mimic="\tinclude\t\tsystem-auth"
135 fi
132 136
133 shift 137 shift
134 138
135 while [[ -n $1 ]]; do 139 while [[ -n $1 ]]; do
136 hasq $1 ${authlevels} || die "unknown level type" 140 hasq $1 ${authlevels} || die "unknown level type"
137 141
138 echo -e "$1\tinclude\t\tsystem-auth" >> ${pamdfile} 142 echo -e "$1${mimic}" >> ${pamdfile}
139 143
140 shift 144 shift
141 done 145 done
142} 146}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20