Kernel Functions for Drivers privpolicy(9F)
NAME
privpolicy, privpolicyonly, privpolicychoice - check,
report, and audit privileges
SYNOPSIS
#include
int privpolicy(const credt *cr, int priv, int err,
const char *msg);
int privpolicyonly(const credt *cr, int priv);
int privpolicychoice(const credt *cr, int priv);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
PARAMETERS
cr The credential to be checked.
priv The integer value of the privilege to test.
err The error code to return.
msg String that is added to the privilege debugging mes-
sage if one is generated. NUL if no additional
information is needed. Because the function name is
included in the output, NUL is usually the best
value to pass as a parameter.
DESCRIPTION
These functions aid in privilege checking and privilege
debugging.
The privpolicy(), privpolicyonly(), and
privpolicychoice() functions all check whether priv is
asserted in the effective set of the credential. The special
value PRIVAL tests for all privileges.
The privpolicy() function updates the ASU accounting flag
and records the privilege used on success in the audit trail
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers privpolicy(9F)
if the required privilege was not a basic privilege.
The privpolicyonly() function checks whether a privilege
is asserted and has no side effects.
The privpolicychoice() function behaves like
privpolicyonly() but records the successfully used non-
basic privileges in the audit trail.
RETURN VALUES
On success, privpolicy() return 0. On failure it returns
its parameter err.
On success, privpolicychoice() and privpolicyonly()
return 1, on failure both return 0.
ERORS
EINVAL This might be caused by any of the follow-
ing:
o The flags parameter is invalid.
o The specified privilege does not
exist.
o The priv parameter contains invalid
characters.
ENOMEM There is no room to allocate another
privilege.
ENAMETOLONG An attempt was made to allocate a privilege
that was longer than {PRIVNAMEMAX} charac-
ters.
CONTEXT
This functions can be called from user, interrupt, or kernel
context.
ATRIBUTES
See attributes(5) for a description of the following attri-
butes:
SunOS 5.11 Last change: 16 Jan 2006 2
Kernel Functions for Drivers privpolicy(9F)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
SEE ALSO
acct(3HEAD), attributes(5), privileges(5)
Writing Device Drivers
SunOS 5.11 Last change: 16 Jan 2006 3
|