2 .\" Copyright (c) 1996 Julian R Elischer
3 .\" All rights reserved.
5 .\" This code is derived from software contributed by Kenneth Stailey.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. The name of the author may not be used to endorse or promote products
16 .\" derived from this software without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd check if credentials have superuser privileges
42 .Fn suser "struct thread *td"
44 .Fn suser_cred "struct ucred *cred" "int flag"
50 functions check if the credentials given include superuser powers.
52 These interfaces have now been obsoleted by
54 and are provided only for compatibility with third party kernel modules that
55 have not yet been updated to the new interface.
56 They should not be used in any new kernel code.
60 function is the most common, and should be used unless special
61 circumstances dictate otherwise.
65 function should be used when the credentials to be checked are
66 not the thread's own, when there is no thread, when superuser
67 powers should be extended to imprisoned roots, or when the credential
68 to be checked is the real user rather than the effective user.
70 Whether or not a privilege is permitted in a
73 .Fn prison_priv_check .
75 In general, privileges are assigned based on the effective user ID; in some
76 cases, the real user ID may be used.
80 field is currently unused.
86 functions note the fact that superuser powers have been used in the
87 process structure of the process specified.
88 Because part of their function is to notice
89 whether superuser powers have been used,
90 the functions should only be called after other permission
91 possibilities have been exhausted.
97 functions return 0 if the user has superuser powers and
102 of some other implementations of
104 in which a TRUE response indicates superuser powers.
114 functions do not, in fact, record that superuser privileges have been
115 used, and have not done so since August 2000.