1 .\" $NetBSD: login_cap.3,v 1.16 2007/10/06 21:51:22 christos 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 ,
48 .Nd query login.conf database about a user class
55 .Fn login_getclass "char *class"
57 .Fn login_getcapbool "login_cap_t *lc" "const char *cap" "u_int def"
59 .Fn login_getcapnum "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
61 .Fn login_getcapsize "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
63 .Fn login_getcapstr "login_cap_t *lc" "const char *cap" "char *def" "char *err"
65 .Fn login_getcaptime "login_cap_t *lc" "const char *cap" "quad_t def" "quad_t err"
67 .Fn login_close "login_cap_t *lc"
69 .Fn setclasscontext "const char *class" "u_int flags"
71 .Fn setusercontext "login_cap_t *lc" "const struct passwd *pwd" "uid_t uid" "u_int flags"
75 function extracts the entry specified by
81 is NULL or the empty string)
86 If the entry is found, a
89 NULL is returned if the user class is not found.
92 structure is no longer needed, it should be freed by the
102 functions may be called.
105 .Fn login_getcapnum ,
106 .Fn login_getcapsize ,
107 .Fn login_getcapstr ,
110 functions all query the database entry for a field named
112 If the field is found, its value is returned.
113 If the field is not found, the value specified by
116 If an error is encountered while trying to find the field,
121 for a discussion of the various textual forms the value may take.
124 function is slightly different.
127 if no capabilities were found for this class (typically meaning that
128 the default class was used and the
131 It returns a non-zero value if
133 with no value, was found,
140 the name of a user class,
141 and sets the resources defined by that class according to
145 .Dv LOGIN_SETPRIORITY ,
146 .Dv LOGIN_SETRESOURCES ,
153 It returns 0 on success and -1 on failure.
158 sets the resources according to
162 argument, if not NULL, contains the class information that should
166 argument, if not NULL, provides information about the user.
174 argument is used in place of the user id contained in the
176 structure when calling
178 The various bits available to be or-ed together to make up
181 .Bl -tag -width LOGIN_SETRESOURCESXX
188 Set the group membership list by calling
194 Set the group id and call
200 Sets the login name by
208 environment variable.
209 .It LOGIN_SETPRIORITY
212 .It LOGIN_SETRESOURCES
213 Sets the various system resources by
224 Sets the environment variables as defined by the setenv keyword, by
227 Sets all of the above.
241 family of functions are largely based on the
243 implementation of same, and appeared in
247 The string returned by
251 when the specified capability is present and thus it is the responsibility
255 However, if the capability was not found or an error occurred and
259 (whichever is relevant) are non-NULL the returned value is simply what
261 .Fn login_getcapstr .
262 Therefore it is not possible to blindly
264 the return value without first checking it against
269 The same warnings set forth in
276 Specifically, changing the login name affects all processes in the current
277 session, not just the current process.
280 for more information.