Unix/Linux Go Back    

NetBSD 6.1.5 - man page for puffs_cred (netbsd section 3)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

PUFFS_CRED(3)			   BSD Library Functions Manual 		    PUFFS_CRED(3)

     puffs_cred -- puffs credential and access control routines

     library ``libpuffs''

     #include <puffs.h>

     puffs_cred_getuid(const struct puffs_cred *pcr, uid_t *uid);

     puffs_cred_getgid(const struct puffs_cred *pcr, gid_t *gid);

     puffs_cred_getgroups(const struct puffs_cred *pcr, gid_t *gids, short *ngids);

     puffs_cred_isuid(const struct puffs_cred *pcr, uid_t uid);

     puffs_cred_hasgroup(const struct puffs_cred *pcr, gid_t gid);

     puffs_cred_iskernel(const struct puffs_cred *pcr);

     puffs_cred_isfs(const struct puffs_cred *pcr);

     puffs_cred_isjuggernaut(const struct puffs_cred *pcr);

     puffs_access(enum vtype type, mode_t file_mode, uid_t owner, gid_t group,
	 mode_t access_mode, const struct puffs_cred *pcr);

     puffs_access_chown(uid_t owner, gid_t group, uid_t newowner, gid_t newgroup,
	 const struct puffs_cred *pcr);

     puffs_access_chmod(uid_t owner, gid_t group, enum vtype type, mode_t newmode,
	 const struct puffs_cred *pcr);

     puffs_access_times(uid_t owner, gid_t group, mode_t file_mode, int va_utimes_null,
	 const struct puffs_cred *pcr);

     These functions can be used to check operation credentials and perform access control.  The
     structure struct puffs_cred can contain two types of credentials: ones belonging to users
     and ones belonging to the kernel.	The latter is further divided into generic kernel creden-
     tials and file system credentials.  The general rule is that these should be treated as more
     powerful than superuser credentials, but the file system is free to treat them as it sees

     The puffs_cred_get() family of functions fetch the uid or gid(s) from the given credential
     cookie.  They return 0 for success or -1 for an error and set errno.  An error happens when
     the credentials represent kernel or file system credentials and do not contain an uid or

     For puffs_cred_getgroups(), the argument gids should point to an array with room for *ngids

     The puffs_cred_is() family of functions return 1 if the truth value of the function for pcr
     is true and 0 if it is false.  The function puffs_cred_isjuggernaut() is true if pcr
     describes superuser, kernel or file system credentials.

   Access Control
     To help the programmers task of emulating normal kernel file system access control seman-
     tics, several helper functions are provided to check if access is allowed.  They return 0 if
     access should be permitted or an errno value to indicate that access should be denied with
     the returned value.

     puffs_access() is equivalent to the kernel vaccess() function.  The arguments specify cur-
     rent information of the file to be tested with the exception of access_mode, which is a com-
     bination of PUFFS_VREAD, PUFFS_VWRITE and PUFFS_VEXEC indicating the desired file access

     The rest of the functions provide UFS semantics for operations.  puffs_access_chown() checks
     if it is permissible to chown a file with the current uid and gid to the new uid and gid
     with the credentials of pcr.

     puffs_access_chmod() checks against permission to chmod a file of type type to the mode

     Finally, puffs_access_times() checks if it is allowable to update the timestamps of a file.
     The argument va_utimes_null signals if the flags VA_UTIMES_NULL was set in va_vaflags of
     struct vattr.  If coming from a path where this information is unavailable, passing 0 as
     this argument restricts the permission of modification to the owner and superuser.  Other-
     wise the function checks for write permissions to the node and returns success if the caller
     has write permissions.

     puffs(3), vnode(9)

BSD					 October 18, 2007				      BSD
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 07:16 PM.