/[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.21
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.21 2011/12/17 04:20:52 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
9inherit multilib 9if [[ ${___ECLASS_ONCE_PAM} != "recur -_+^+_- spank" ]] ; then
10___ECLASS_ONCE_PAM="recur -_+^+_- spank"
11
12inherit multilib flag-o-matic
10 13
11# dopamd <file> [more files] 14# dopamd <file> [more files]
12# 15#
13# Install pam auth config file in /etc/pam.d 16# Install pam auth config file in /etc/pam.d
14dopamd() { 17dopamd() {
15 [[ -z $1 ]] && die "dopamd requires at least one argument" 18 [[ -z $1 ]] && die "dopamd requires at least one argument"
16 19
17 if hasq pam ${IUSE} && ! use pam; then 20 if has pam ${IUSE} && ! use pam; then
18 return 0; 21 return 0;
19 fi 22 fi
20 23
21 ( # dont want to pollute calling env 24 ( # dont want to pollute calling env
22 insinto /etc/pam.d 25 insinto /etc/pam.d
30# 33#
31# Install pam file <old name> as <new name> in /etc/pam.d 34# Install pam file <old name> as <new name> in /etc/pam.d
32newpamd() { 35newpamd() {
33 [[ $# -ne 2 ]] && die "newpamd requires two arguments" 36 [[ $# -ne 2 ]] && die "newpamd requires two arguments"
34 37
35 if hasq pam ${IUSE} && ! use pam; then 38 if has pam ${IUSE} && ! use pam; then
36 return 0; 39 return 0;
37 fi 40 fi
38 41
39 ( # dont want to pollute calling env 42 ( # dont want to pollute calling env
40 insinto /etc/pam.d 43 insinto /etc/pam.d
48# 51#
49# Installs the config files in /etc/security/<section>/ 52# Installs the config files in /etc/security/<section>/
50dopamsecurity() { 53dopamsecurity() {
51 [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments" 54 [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments"
52 55
53 if hasq pam ${IUSE} && ! use pam; then 56 if has pam ${IUSE} && ! use pam; then
54 return 0 57 return 0
55 fi 58 fi
56 59
57 ( # dont want to pollute calling env 60 ( # dont want to pollute calling env
58 insinto /etc/security/$1 61 insinto /etc/security/$1
65# 68#
66# Installs the config file <old name> as <new name> in /etc/security/<section>/ 69# Installs the config file <old name> as <new name> in /etc/security/<section>/
67newpamsecurity() { 70newpamsecurity() {
68 [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments" 71 [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments"
69 72
70 if hasq pam ${IUSE} && ! use pam; then 73 if has pam ${IUSE} && ! use pam; then
71 return 0; 74 return 0;
72 fi 75 fi
73 76
74 ( # dont want to pollute calling env 77 ( # dont want to pollute calling env
75 insinto /etc/security/$1 78 insinto /etc/security/$1
90 fi 93 fi
91 94
92 echo ${PAM_MOD_DIR} 95 echo ${PAM_MOD_DIR}
93} 96}
94 97
98# pammod_hide_symbols
99#
100# Hide all non-PAM-used symbols from the module; this function creates a
101# simple ld version script that hides all the symbols that are not
102# necessary for PAM to load the module, then uses append-flags to make
103# sure that it gets used.
104pammod_hide_symbols() {
105 cat - > "${T}"/pam-eclass-pam_symbols.ver <<EOF
106{
107 global: pam_sm_*;
108 local: *;
109};
110EOF
111
112 append-ldflags -Wl,--version-script="${T}"/pam-eclass-pam_symbols.ver
113}
114
95# dopammod <file> [more files] 115# dopammod <file> [more files]
96# 116#
97# Install pam module file in the pam modules' dir for current implementation 117# Install pam module file in the pam modules' dir for current implementation
98dopammod() { 118dopammod() {
99 [[ -z $1 ]] && die "dopammod requires at least one argument" 119 [[ -z $1 ]] && die "dopammod requires at least one argument"
100 120
101 if hasq pam ${IUSE} && ! use pam; then 121 if has pam ${IUSE} && ! use pam; then
102 return 0; 122 return 0;
103 fi 123 fi
104 124
105 exeinto $(getpam_mod_dir) 125 exeinto $(getpam_mod_dir)
106 doexe "$@" || die "failed to install $@" 126 doexe "$@" || die "failed to install $@"
111# Install pam module file <old name> as <new name> in the pam 131# Install pam module file <old name> as <new name> in the pam
112# modules' dir for current implementation 132# modules' dir for current implementation
113newpammod() { 133newpammod() {
114 [[ $# -ne 2 ]] && die "newpammod requires two arguements" 134 [[ $# -ne 2 ]] && die "newpammod requires two arguements"
115 135
116 if hasq pam ${IUSE} && ! use pam; then 136 if has pam ${IUSE} && ! use pam; then
117 return 0; 137 return 0;
118 fi 138 fi
119 139
120 exeinto $(getpam_mod_dir) 140 exeinto $(getpam_mod_dir)
121 newexe "$1" "$2" || die "failed to install $1 as $2" 141 newexe "$1" "$2" || die "failed to install $1 as $2"
135# This function creates a pamd file which mimics the given stack 155# This function creates a pamd file which mimics the given stack
136# for the given levels in the /etc/pam.d directory. 156# for the given levels in the /etc/pam.d directory.
137pamd_mimic() { 157pamd_mimic() {
138 [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments" 158 [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments"
139 159
140 if hasq pam ${IUSE} && ! use pam; then 160 if has pam ${IUSE} && ! use pam; then
141 return 0; 161 return 0;
142 fi 162 fi
143 163
144 dodir /etc/pam.d 164 dodir /etc/pam.d
145 pamdfile=${D}/etc/pam.d/$2 165 pamdfile=${D}/etc/pam.d/$2
156 fi 176 fi
157 177
158 shift; shift 178 shift; shift
159 179
160 while [[ -n $1 ]]; do 180 while [[ -n $1 ]]; do
161 hasq $1 ${authlevels} || die "unknown level type" 181 has $1 ${authlevels} || die "unknown level type"
162 182
163 echo -e "$1${mimic}" >> ${pamdfile} 183 echo -e "$1${mimic}" >> ${pamdfile}
164 184
165 shift 185 shift
166 done 186 done
216# 236#
217# pam_epam_expand "${D}"/etc/pam.d/* 237# pam_epam_expand "${D}"/etc/pam.d/*
218# 238#
219# eshopts_pop # reset old shell opts 239# eshopts_pop # reset old shell opts
220# } 240# }
241
242fi

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

  ViewVC Help
Powered by ViewVC 1.1.20