1 .\" $NetBSD: login_cap.3,v 1.21 2013/06/23 08:38:41 wiz Exp $
3 .\" Copyright (c) 1996,1997 Berkeley Software Design, Inc. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by Berkeley Software Design,
17 .\" 4. The name of Berkeley Software Design, Inc. may not be used to endorse
18 .\" or promote products derived from this software without specific prior
19 .\" written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" BSDI login_cap.3,v 1.4 1997/11/07 16:22:27 jch Exp
40 .Nm login_getcapbool ,
42 .Nm login_getcapsize ,
44 .Nm login_getcaptime ,
45 .Nm login_getpwclass ,
49 .Nd query login.conf database about a user class
56 .Fn login_getclass "char *class"
58 .Fn login_getcapbool "login_cap_t *lc" "const char *cap" "u_int def"
60 .Fn login_getcapnum "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
62 .Fn login_getcapsize "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
64 .Fn login_getcapstr "login_cap_t *lc" "const char *cap" "char *def" "char *err"
66 .Fn login_getcaptime "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
68 .Fn login_getpwclass "struct passwd *pwd"
70 .Fn login_close "login_cap_t *lc"
72 .Fn setclasscontext "const char *class" "u_int flags"
74 .Fn setusercontext "login_cap_t *lc" "const struct passwd *pwd" "uid_t uid" "u_int flags"
78 function extracts the entry specified by
91 If the entry is found, a
95 is returned if the user class is not found.
98 structure is no longer needed, it should be freed by the
104 function is equivalent to:
105 .Dl login_getclass(pwd\ ? pwd->pw_class\ : NULL)
113 functions may be called.
116 .Fn login_getcapnum ,
117 .Fn login_getcapsize ,
118 .Fn login_getcapstr ,
121 functions all query the database entry for a field named
123 If the field is found, its value is returned.
124 If the field is not found, the value specified by
127 If an error is encountered while trying to find the field,
132 for a discussion of the various textual forms the value may take.
135 function is slightly different.
138 if no capabilities were found for this class (typically meaning that
139 the default class was used and the
142 It returns a non-zero value if
144 with no value, was found,
151 the name of a user class,
152 and sets the resources defined by that class according to
156 .Dv LOGIN_SETPRIORITY ,
157 .Dv LOGIN_SETRESOURCES ,
164 It returns 0 on success and -1 on failure.
169 sets the resources according to
175 contains the class information that should
181 provides information about the user.
190 argument is used in place of the user id contained in the
192 structure when calling
194 The various bits available to be or-ed together to make up
197 .Bl -tag -width LOGIN_SETRESOURCESXX
204 Set the group membership list by calling
210 Set the group id and call
216 Sets the login name by
224 environment variable.
225 .It LOGIN_SETPRIORITY
228 .It LOGIN_SETRESOURCES
229 Sets the various system resources by
240 Sets the environment variables as defined by the setenv keyword, by
243 Sets all of the above.
257 family of functions are largely based on the
259 implementation of same, and appeared in
263 The string returned by
267 when the specified capability is present and thus it is the responsibility
271 However, if the capability was not found or an error occurred and
275 (whichever is relevant) are
277 the returned value is simply what was passed in to
278 .Fn login_getcapstr .
279 Therefore it is not possible to blindly
281 the return value without first checking it against
286 The same warnings set forth in
293 Specifically, changing the login name affects all processes in the current
294 session, not just the current process.
297 for more information.