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

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

  ViewVC Help
Powered by ViewVC 1.1.20