xref: /minix3/lib/libutil/pw_getconf.3 (revision 0c3983b25a88161cf074524e5c94585a2582ae82)
1*0c3983b2SBen Gras.\"	$NetBSD: pw_getconf.3,v 1.12 2010/05/04 06:41:27 jruoho Exp $
2*0c3983b2SBen Gras.\"
3*0c3983b2SBen Gras.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
4*0c3983b2SBen Gras.\" All rights reserved.
5*0c3983b2SBen Gras.\"
6*0c3983b2SBen Gras.\" Redistribution and use in source and binary forms, with or without
7*0c3983b2SBen Gras.\" modification, are permitted provided that the following conditions
8*0c3983b2SBen Gras.\" are met:
9*0c3983b2SBen Gras.\" 1. Redistributions of source code must retain the above copyright
10*0c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer.
11*0c3983b2SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
12*0c3983b2SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
13*0c3983b2SBen Gras.\"    documentation and/or other materials provided with the distribution.
14*0c3983b2SBen Gras.\" 3. All advertising materials mentioning features or use of this software
15*0c3983b2SBen Gras.\"    must display the following acknowledgement:
16*0c3983b2SBen Gras.\"      This product includes software developed by Niels Provos.
17*0c3983b2SBen Gras.\" 4. The name of the author may not be used to endorse or promote products
18*0c3983b2SBen Gras.\"    derived from this software without specific prior written permission.
19*0c3983b2SBen Gras.\"
20*0c3983b2SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21*0c3983b2SBen Gras.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22*0c3983b2SBen Gras.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23*0c3983b2SBen Gras.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24*0c3983b2SBen Gras.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25*0c3983b2SBen Gras.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26*0c3983b2SBen Gras.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27*0c3983b2SBen Gras.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28*0c3983b2SBen Gras.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29*0c3983b2SBen Gras.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*0c3983b2SBen Gras.\"
31*0c3983b2SBen Gras.\" from OpenBSD: pw_getconf.3,v 1.5 1999/09/21 04:52:46 csapuntz Exp
32*0c3983b2SBen Gras.\"
33*0c3983b2SBen Gras.Dd May 4, 2010
34*0c3983b2SBen Gras.Dt PW_GETCONF 3
35*0c3983b2SBen Gras.Os
36*0c3983b2SBen Gras.Sh NAME
37*0c3983b2SBen Gras.Nm pw_getconf ,
38*0c3983b2SBen Gras.Nm pw_getpwconf
39*0c3983b2SBen Gras.Nd password encryption configuration access function
40*0c3983b2SBen Gras.Sh LIBRARY
41*0c3983b2SBen Gras.Lb libutil
42*0c3983b2SBen Gras.Sh SYNOPSIS
43*0c3983b2SBen Gras.In util.h
44*0c3983b2SBen Gras.Ft void
45*0c3983b2SBen Gras.Fn pw_getconf "char *data" "size_t len" "const char *key" "const char *option"
46*0c3983b2SBen Gras.Ft void
47*0c3983b2SBen Gras.Fn pw_getpwconf "char *data" "size_t len" "const struct passwd *pwd" "const char *option"
48*0c3983b2SBen Gras.Sh DESCRIPTION
49*0c3983b2SBen GrasThe
50*0c3983b2SBen Gras.Fn pw_getconf
51*0c3983b2SBen Grasfunction reads
52*0c3983b2SBen Gras.Pa /etc/passwd.conf
53*0c3983b2SBen Grasand retrieves the value of the option specified
54*0c3983b2SBen Grasby
55*0c3983b2SBen Gras.Pa option
56*0c3983b2SBen Grasfrom the section given by
57*0c3983b2SBen Gras.Pa key .
58*0c3983b2SBen GrasIf no suitable entry is found
59*0c3983b2SBen Grasfor the
60*0c3983b2SBen Gras.Pa key
61*0c3983b2SBen Grasan empty string will be returned in data.
62*0c3983b2SBen Gras.Pp
63*0c3983b2SBen GrasTo retrieve default values the key
64*0c3983b2SBen Gras.Pa default
65*0c3983b2SBen Grascan be used.
66*0c3983b2SBen GrasIn this case, if
67*0c3983b2SBen Gras.Pa /etc/passwd.conf
68*0c3983b2SBen Grasdoes not exist or does not contain a
69*0c3983b2SBen Gras.Pa default
70*0c3983b2SBen Grassection, the built-in defaults will be returned.
71*0c3983b2SBen GrasThey are as follows:
72*0c3983b2SBen Gras.Bl -column localcipher data -offset indent
73*0c3983b2SBen Gras.It Sy option	data
74*0c3983b2SBen Gras.It ypcipher	old
75*0c3983b2SBen Gras.It localcipher	old
76*0c3983b2SBen Gras.El
77*0c3983b2SBen Gras.Pp
78*0c3983b2SBen GrasAn empty string is returned for all errors.
79*0c3983b2SBen Gras.Pp
80*0c3983b2SBen Gras.Fn pw_getpwconf
81*0c3983b2SBen Grasreturns the value for the option specified for the particular user
82*0c3983b2SBen Grasspecified in
83*0c3983b2SBen Gras.Ar pwd .
84*0c3983b2SBen GrasIf that option is not found, then it tries to find the option in
85*0c3983b2SBen Grasthe primary group of that user, and if that fails, then it returns
86*0c3983b2SBen Grasthe default entry.
87*0c3983b2SBen Gras.Sh FILES
88*0c3983b2SBen Gras.Bl -tag -width /etc/passwd.conf -compact
89*0c3983b2SBen Gras.It Pa /etc/passwd.conf
90*0c3983b2SBen Gras.El
91*0c3983b2SBen Gras.Sh ERRORS
92*0c3983b2SBen Gras.Fn pw_getconf
93*0c3983b2SBen Grasand
94*0c3983b2SBen Gras.Fn pw_getpwconf
95*0c3983b2SBen Graswill fail if:
96*0c3983b2SBen Gras.Bl -tag -width Er
97*0c3983b2SBen Gras.It Bq Er ENOENT
98*0c3983b2SBen GrasThere is no option named
99*0c3983b2SBen Gras.Pa option
100*0c3983b2SBen Grasin the specified key.
101*0c3983b2SBen Gras.It Bq Er ENOTDIR
102*0c3983b2SBen GrasThere is no key in
103*0c3983b2SBen Gras.Pa /etc/passwd.conf
104*0c3983b2SBen Grasnamed
105*0c3983b2SBen Gras.Pa key .
106*0c3983b2SBen Gras.El
107*0c3983b2SBen Gras.Sh SEE ALSO
108*0c3983b2SBen Gras.Xr passwd 5 ,
109*0c3983b2SBen Gras.Xr passwd.conf 5
110*0c3983b2SBen Gras.Sh HISTORY
111*0c3983b2SBen GrasThe
112*0c3983b2SBen Gras.Fn pw_getconf
113*0c3983b2SBen Grasfunction first appeared in
114*0c3983b2SBen Gras.Nx 1.6 .
115