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

Diff of /eclass/pam.eclass

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

Revision 1.14 Revision 1.15
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.14 2007/11/04 15:00:27 flameeyes Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.15 2008/02/20 00:00:01 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
9inherit multilib 9inherit multilib
128# 128#
129# This function creates a pamd file which mimics system-auth file 129# This function creates a pamd file which mimics system-auth file
130# for the given levels in the /etc/pam.d directory. 130# for the given levels in the /etc/pam.d directory.
131pamd_mimic_system() { 131pamd_mimic_system() {
132 [[ $# -lt 2 ]] && die "pamd_mimic_system requires at least two argments" 132 [[ $# -lt 2 ]] && die "pamd_mimic_system requires at least two argments"
133 pamd_mimic system-auth "$@"
134}
135
136# pamd_mimic <stack> <pamd file> [auth levels]
137#
138# This function creates a pamd file which mimics the given stack
139# for the given levels in the /etc/pam.d directory.
140pamd_mimic() {
141 [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments"
133 142
134 if hasq pam ${IUSE} && ! use pam; then 143 if hasq pam ${IUSE} && ! use pam; then
135 return 0; 144 return 0;
136 fi 145 fi
137 146
138 dodir /etc/pam.d 147 dodir /etc/pam.d
139 pamdfile=${D}/etc/pam.d/$1 148 pamdfile=${D}/etc/pam.d/$2
140 echo -e "# File autogenerated by pamd_mimic_system in pam eclass\n\n" >> \ 149 echo -e "# File autogenerated by pamd_mimic in pam eclass\n\n" >> \
141 $pamdfile 150 $pamdfile
142 151
152 originalstack=$1
143 authlevels="auth account password session" 153 authlevels="auth account password session"
144 154
145 if has_version '<sys-libs/pam-0.78'; then 155 if has_version '<sys-libs/pam-0.78'; then
146 mimic="\trequired\t\tpam_stack.so service=system-auth" 156 mimic="\trequired\t\tpam_stack.so service=${originalstack}"
147 else 157 else
148 mimic="\tinclude\t\tsystem-auth" 158 mimic="\tinclude\t\t${originalstack}"
149 fi 159 fi
150 160
151 shift 161 shift; shift
152 162
153 while [[ -n $1 ]]; do 163 while [[ -n $1 ]]; do
154 hasq $1 ${authlevels} || die "unknown level type" 164 hasq $1 ${authlevels} || die "unknown level type"
155 165
156 echo -e "$1${mimic}" >> ${pamdfile} 166 echo -e "$1${mimic}" >> ${pamdfile}

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20