xref: /freebsd/contrib/openpam/doc/man/openpam_subst.3 (revision 7f106882fe02eed8861e8e9df7ab1e1100283cc0)
1*7f106882SDag-Erling Smørgrav.\"-
2*7f106882SDag-Erling Smørgrav.\" Copyright (c) 2001-2003 Networks Associates Technology, Inc.
3*7f106882SDag-Erling Smørgrav.\" Copyright (c) 2004-2011 Dag-Erling Smørgrav
4*7f106882SDag-Erling Smørgrav.\" All rights reserved.
5*7f106882SDag-Erling Smørgrav.\"
6*7f106882SDag-Erling Smørgrav.\" This software was developed for the FreeBSD Project by ThinkSec AS and
7*7f106882SDag-Erling Smørgrav.\" Network Associates Laboratories, the Security Research Division of
8*7f106882SDag-Erling Smørgrav.\" Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
9*7f106882SDag-Erling Smørgrav.\" ("CBOSS"), as part of the DARPA CHATS research program.
10*7f106882SDag-Erling Smørgrav.\"
11*7f106882SDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without
12*7f106882SDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions
13*7f106882SDag-Erling Smørgrav.\" are met:
14*7f106882SDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright
15*7f106882SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer.
16*7f106882SDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright
17*7f106882SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer in the
18*7f106882SDag-Erling Smørgrav.\"    documentation and/or other materials provided with the distribution.
19*7f106882SDag-Erling Smørgrav.\" 3. The name of the author may not be used to endorse or promote
20*7f106882SDag-Erling Smørgrav.\"    products derived from this software without specific prior written
21*7f106882SDag-Erling Smørgrav.\"    permission.
22*7f106882SDag-Erling Smørgrav.\"
23*7f106882SDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24*7f106882SDag-Erling Smørgrav.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*7f106882SDag-Erling Smørgrav.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*7f106882SDag-Erling Smørgrav.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27*7f106882SDag-Erling Smørgrav.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*7f106882SDag-Erling Smørgrav.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*7f106882SDag-Erling Smørgrav.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*7f106882SDag-Erling Smørgrav.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*7f106882SDag-Erling Smørgrav.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*7f106882SDag-Erling Smørgrav.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*7f106882SDag-Erling Smørgrav.\" SUCH DAMAGE.
34*7f106882SDag-Erling Smørgrav.\"
35*7f106882SDag-Erling Smørgrav.\" $Id$
36*7f106882SDag-Erling Smørgrav.\"
37*7f106882SDag-Erling Smørgrav.Dd December 18, 2011
38*7f106882SDag-Erling Smørgrav.Dt OPENPAM_SUBST 3
39*7f106882SDag-Erling Smørgrav.Os
40*7f106882SDag-Erling Smørgrav.Sh NAME
41*7f106882SDag-Erling Smørgrav.Nm openpam_subst
42*7f106882SDag-Erling Smørgrav.Nd substitute PAM item values in a string
43*7f106882SDag-Erling Smørgrav.Sh LIBRARY
44*7f106882SDag-Erling Smørgrav.Lb libpam
45*7f106882SDag-Erling Smørgrav.Sh SYNOPSIS
46*7f106882SDag-Erling Smørgrav.In sys/types.h
47*7f106882SDag-Erling Smørgrav.In security/pam_appl.h
48*7f106882SDag-Erling Smørgrav.In security/openpam.h
49*7f106882SDag-Erling Smørgrav.Ft "int"
50*7f106882SDag-Erling Smørgrav.Fn openpam_subst "const pam_handle_t *pamh" "char *buf" "size_t *bufsize" "const char *template"
51*7f106882SDag-Erling Smørgrav.Sh DESCRIPTION
52*7f106882SDag-Erling SmørgravThe
53*7f106882SDag-Erling Smørgrav.Nm
54*7f106882SDag-Erling Smørgravfunction expands a string, substituting PAM item
55*7f106882SDag-Erling Smørgravvalues for all occurrences of specific substitution codes.
56*7f106882SDag-Erling SmørgravThe
57*7f106882SDag-Erling Smørgrav.Fa template
58*7f106882SDag-Erling Smørgravargument points to the initial string.
59*7f106882SDag-Erling SmørgravThe result is stored in the buffer pointed to by the
60*7f106882SDag-Erling Smørgrav.Fa buf
61*7f106882SDag-Erling Smørgravargument; the
62*7f106882SDag-Erling Smørgrav.Fa bufsize
63*7f106882SDag-Erling Smørgravargument specifies the size of that buffer.
64*7f106882SDag-Erling SmørgravThe actual size of the resulting string, including the terminating NUL
65*7f106882SDag-Erling Smørgravcharacter, is stored in the location pointed to by the
66*7f106882SDag-Erling Smørgrav.Fa bufsize
67*7f106882SDag-Erling Smørgravargument.
68*7f106882SDag-Erling Smørgrav.Pp
69*7f106882SDag-Erling SmørgravIf
70*7f106882SDag-Erling Smørgrav.Fa buf
71*7f106882SDag-Erling Smørgravis NULL, or if the buffer is too small to hold the expanded
72*7f106882SDag-Erling Smørgravstring,
73*7f106882SDag-Erling Smørgrav.Fa bufsize
74*7f106882SDag-Erling Smørgravis updated to reflect the amount of space required to
75*7f106882SDag-Erling Smørgravhold the entire string, and
76*7f106882SDag-Erling Smørgrav.Nm
77*7f106882SDag-Erling Smørgravreturns
78*7f106882SDag-Erling Smørgrav.Dv PAM_TRY_AGAIN .
79*7f106882SDag-Erling Smørgrav.Pp
80*7f106882SDag-Erling SmørgravIf
81*7f106882SDag-Erling Smørgrav.Nm
82*7f106882SDag-Erling Smørgravfails for any other reason, the
83*7f106882SDag-Erling Smørgrav.Fa bufsize
84*7f106882SDag-Erling Smørgravargument is
85*7f106882SDag-Erling Smørgravuntouched, but part of the buffer may still have been overwritten.
86*7f106882SDag-Erling Smørgrav.Pp
87*7f106882SDag-Erling SmørgravSubstitution codes are introduced by a percent character and correspond
88*7f106882SDag-Erling Smørgravto PAM items:
89*7f106882SDag-Erling Smørgrav.Bl -tag -width 18n
90*7f106882SDag-Erling Smørgrav.It \&%H
91*7f106882SDag-Erling SmørgravReplaced by the current value of the
92*7f106882SDag-Erling Smørgrav.Dv PAM_RHOST
93*7f106882SDag-Erling Smørgravitem.
94*7f106882SDag-Erling Smørgrav.It \&%h
95*7f106882SDag-Erling SmørgravReplaced by the current value of the
96*7f106882SDag-Erling Smørgrav.Dv PAM_HOST
97*7f106882SDag-Erling Smørgravitem.
98*7f106882SDag-Erling Smørgrav.It \&%s
99*7f106882SDag-Erling SmørgravReplaced by the current value of the
100*7f106882SDag-Erling Smørgrav.Dv PAM_SERVICE
101*7f106882SDag-Erling Smørgravitem.
102*7f106882SDag-Erling Smørgrav.It \&%t
103*7f106882SDag-Erling SmørgravReplaced by the current value of the
104*7f106882SDag-Erling Smørgrav.Dv PAM_TTY
105*7f106882SDag-Erling Smørgravitem.
106*7f106882SDag-Erling Smørgrav.It \&%U
107*7f106882SDag-Erling SmørgravReplaced by the current value of the
108*7f106882SDag-Erling Smørgrav.Dv PAM_RUSER
109*7f106882SDag-Erling Smørgravitem.
110*7f106882SDag-Erling Smørgrav.It \&%u
111*7f106882SDag-Erling SmørgravReplaced by the current value of the
112*7f106882SDag-Erling Smørgrav.Dv PAM_USER
113*7f106882SDag-Erling Smørgravitem.
114*7f106882SDag-Erling Smørgrav.El
115*7f106882SDag-Erling Smørgrav.Pp
116*7f106882SDag-Erling Smørgrav.Sh RETURN VALUES
117*7f106882SDag-Erling SmørgravThe
118*7f106882SDag-Erling Smørgrav.Nm
119*7f106882SDag-Erling Smørgravfunction returns one of the following values:
120*7f106882SDag-Erling Smørgrav.Bl -tag -width 18n
121*7f106882SDag-Erling Smørgrav.It Bq Er PAM_SYSTEM_ERR
122*7f106882SDag-Erling SmørgravSystem error.
123*7f106882SDag-Erling Smørgrav.It Bq Er PAM_TRY_AGAIN
124*7f106882SDag-Erling SmørgravTry again.
125*7f106882SDag-Erling Smørgrav.El
126*7f106882SDag-Erling Smørgrav.Sh SEE ALSO
127*7f106882SDag-Erling Smørgrav.Xr pam 3 ,
128*7f106882SDag-Erling Smørgrav.Xr pam_get_authtok 3 ,
129*7f106882SDag-Erling Smørgrav.Xr pam_get_item 3 ,
130*7f106882SDag-Erling Smørgrav.Xr pam_get_user 3 ,
131*7f106882SDag-Erling Smørgrav.Xr pam_strerror 3
132*7f106882SDag-Erling Smørgrav.Sh STANDARDS
133*7f106882SDag-Erling SmørgravThe
134*7f106882SDag-Erling Smørgrav.Nm
135*7f106882SDag-Erling Smørgravfunction is an OpenPAM extension.
136*7f106882SDag-Erling Smørgrav.Sh AUTHORS
137*7f106882SDag-Erling SmørgravThe
138*7f106882SDag-Erling Smørgrav.Nm
139*7f106882SDag-Erling Smørgravfunction and this manual page were developed for the
140*7f106882SDag-Erling Smørgrav.Fx
141*7f106882SDag-Erling SmørgravProject by
142*7f106882SDag-Erling Smørgrav.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
143