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

Diff of /eclass/pam.eclass

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

Revision 1.18 Revision 1.20
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.18 2009/12/11 20:33:11 vapier Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/pam.eclass,v 1.20 2011/07/08 11:35:01 ssuominen 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 flag-o-matic
10 10
11# dopamd <file> [more files] 11# dopamd <file> [more files]
12# 12#
13# Install pam auth config file in /etc/pam.d 13# Install pam auth config file in /etc/pam.d
14dopamd() { 14dopamd() {
15 [[ -z $1 ]] && die "dopamd requires at least one argument" 15 [[ -z $1 ]] && die "dopamd requires at least one argument"
16 16
17 if hasq pam ${IUSE} && ! use pam; then 17 if has pam ${IUSE} && ! use pam; then
18 return 0; 18 return 0;
19 fi 19 fi
20 20
21 ( # dont want to pollute calling env 21 ( # dont want to pollute calling env
22 insinto /etc/pam.d 22 insinto /etc/pam.d
30# 30#
31# Install pam file <old name> as <new name> in /etc/pam.d 31# Install pam file <old name> as <new name> in /etc/pam.d
32newpamd() { 32newpamd() {
33 [[ $# -ne 2 ]] && die "newpamd requires two arguments" 33 [[ $# -ne 2 ]] && die "newpamd requires two arguments"
34 34
35 if hasq pam ${IUSE} && ! use pam; then 35 if has pam ${IUSE} && ! use pam; then
36 return 0; 36 return 0;
37 fi 37 fi
38 38
39 ( # dont want to pollute calling env 39 ( # dont want to pollute calling env
40 insinto /etc/pam.d 40 insinto /etc/pam.d
48# 48#
49# Installs the config files in /etc/security/<section>/ 49# Installs the config files in /etc/security/<section>/
50dopamsecurity() { 50dopamsecurity() {
51 [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments" 51 [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments"
52 52
53 if hasq pam ${IUSE} && ! use pam; then 53 if has pam ${IUSE} && ! use pam; then
54 return 0 54 return 0
55 fi 55 fi
56 56
57 ( # dont want to pollute calling env 57 ( # dont want to pollute calling env
58 insinto /etc/security/$1 58 insinto /etc/security/$1
65# 65#
66# 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>/
67newpamsecurity() { 67newpamsecurity() {
68 [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments" 68 [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments"
69 69
70 if hasq pam ${IUSE} && ! use pam; then 70 if has pam ${IUSE} && ! use pam; then
71 return 0; 71 return 0;
72 fi 72 fi
73 73
74 ( # dont want to pollute calling env 74 ( # dont want to pollute calling env
75 insinto /etc/security/$1 75 insinto /etc/security/$1
90 fi 90 fi
91 91
92 echo ${PAM_MOD_DIR} 92 echo ${PAM_MOD_DIR}
93} 93}
94 94
95# pammod_hide_symbols
96#
97# Hide all non-PAM-used symbols from the module; this function creates a
98# simple ld version script that hides all the symbols that are not
99# necessary for PAM to load the module, then uses append-flags to make
100# sure that it gets used.
101pammod_hide_symbols() {
102 cat - > "${T}"/pam-eclass-pam_symbols.ver <<EOF
103{
104 global: pam_sm_*;
105 local: *;
106};
107EOF
108
109 append-ldflags -Wl,--version-script="${T}"/pam-eclass-pam_symbols.ver
110}
111
95# dopammod <file> [more files] 112# dopammod <file> [more files]
96# 113#
97# Install pam module file in the pam modules' dir for current implementation 114# Install pam module file in the pam modules' dir for current implementation
98dopammod() { 115dopammod() {
99 [[ -z $1 ]] && die "dopammod requires at least one argument" 116 [[ -z $1 ]] && die "dopammod requires at least one argument"
100 117
101 if hasq pam ${IUSE} && ! use pam; then 118 if has pam ${IUSE} && ! use pam; then
102 return 0; 119 return 0;
103 fi 120 fi
104 121
105 exeinto $(getpam_mod_dir) 122 exeinto $(getpam_mod_dir)
106 doexe "$@" || die "failed to install $@" 123 doexe "$@" || die "failed to install $@"
111# Install pam module file <old name> as <new name> in the pam 128# Install pam module file <old name> as <new name> in the pam
112# modules' dir for current implementation 129# modules' dir for current implementation
113newpammod() { 130newpammod() {
114 [[ $# -ne 2 ]] && die "newpammod requires two arguements" 131 [[ $# -ne 2 ]] && die "newpammod requires two arguements"
115 132
116 if hasq pam ${IUSE} && ! use pam; then 133 if has pam ${IUSE} && ! use pam; then
117 return 0; 134 return 0;
118 fi 135 fi
119 136
120 exeinto $(getpam_mod_dir) 137 exeinto $(getpam_mod_dir)
121 newexe "$1" "$2" || die "failed to install $1 as $2" 138 newexe "$1" "$2" || die "failed to install $1 as $2"
135# This function creates a pamd file which mimics the given stack 152# This function creates a pamd file which mimics the given stack
136# for the given levels in the /etc/pam.d directory. 153# for the given levels in the /etc/pam.d directory.
137pamd_mimic() { 154pamd_mimic() {
138 [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments" 155 [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments"
139 156
140 if hasq pam ${IUSE} && ! use pam; then 157 if has pam ${IUSE} && ! use pam; then
141 return 0; 158 return 0;
142 fi 159 fi
143 160
144 dodir /etc/pam.d 161 dodir /etc/pam.d
145 pamdfile=${D}/etc/pam.d/$2 162 pamdfile=${D}/etc/pam.d/$2
156 fi 173 fi
157 174
158 shift; shift 175 shift; shift
159 176
160 while [[ -n $1 ]]; do 177 while [[ -n $1 ]]; do
161 hasq $1 ${authlevels} || die "unknown level type" 178 has $1 ${authlevels} || die "unknown level type"
162 179
163 echo -e "$1${mimic}" >> ${pamdfile} 180 echo -e "$1${mimic}" >> ${pamdfile}
164 181
165 shift 182 shift
166 done 183 done

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20