The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/ucred.h

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1989, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    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  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  *      @(#)ucred.h     8.4 (Berkeley) 1/9/95
   30  * $FreeBSD: releng/9.1/sys/sys/ucred.h 219304 2011-03-05 12:40:35Z trasz $
   31  */
   32 
   33 #ifndef _SYS_UCRED_H_
   34 #define _SYS_UCRED_H_
   35 
   36 #include <bsm/audit.h>
   37 
   38 struct loginclass;
   39 
   40 /*
   41  * Credentials.
   42  *
   43  * Please do not inspect cr_uid directly to determine superuserness.  The
   44  * priv(9) interface should be used to check for privilege.
   45  */
   46 #if defined(_KERNEL) || defined(_WANT_UCRED)
   47 struct ucred {
   48         u_int   cr_ref;                 /* reference count */
   49 #define cr_startcopy cr_uid
   50         uid_t   cr_uid;                 /* effective user id */
   51         uid_t   cr_ruid;                /* real user id */
   52         uid_t   cr_svuid;               /* saved user id */
   53         int     cr_ngroups;             /* number of groups */
   54         gid_t   cr_rgid;                /* real group id */
   55         gid_t   cr_svgid;               /* saved group id */
   56         struct uidinfo  *cr_uidinfo;    /* per euid resource consumption */
   57         struct uidinfo  *cr_ruidinfo;   /* per ruid resource consumption */
   58         struct prison   *cr_prison;     /* jail(2) */
   59         struct loginclass       *cr_loginclass; /* login class */
   60         u_int           cr_flags;       /* credential flags */
   61         void            *cr_pspare2[2]; /* general use 2 */
   62 #define cr_endcopy      cr_label
   63         struct label    *cr_label;      /* MAC label */
   64         struct auditinfo_addr   cr_audit;       /* Audit properties. */
   65         gid_t   *cr_groups;             /* groups */
   66         int     cr_agroups;             /* Available groups */
   67 };
   68 #define NOCRED  ((struct ucred *)0)     /* no credential available */
   69 #define FSCRED  ((struct ucred *)-1)    /* filesystem credential */
   70 #endif /* _KERNEL || _WANT_UCRED */
   71 
   72 #define XU_NGROUPS      16
   73 
   74 /*
   75  * Flags for cr_flags.
   76  */
   77 #define CRED_FLAG_CAPMODE       0x00000001      /* In capability mode. */
   78 
   79 /*
   80  * This is the external representation of struct ucred.
   81  */
   82 struct xucred {
   83         u_int   cr_version;             /* structure layout version */
   84         uid_t   cr_uid;                 /* effective user id */
   85         short   cr_ngroups;             /* number of groups */
   86         gid_t   cr_groups[XU_NGROUPS];  /* groups */
   87         void    *_cr_unused1;           /* compatibility with old ucred */
   88 };
   89 #define XUCRED_VERSION  0
   90 
   91 /* This can be used for both ucred and xucred structures. */
   92 #define cr_gid cr_groups[0]
   93 
   94 #ifdef _KERNEL
   95 struct proc;
   96 struct thread;
   97 
   98 void    change_egid(struct ucred *newcred, gid_t egid);
   99 void    change_euid(struct ucred *newcred, struct uidinfo *euip);
  100 void    change_rgid(struct ucred *newcred, gid_t rgid);
  101 void    change_ruid(struct ucred *newcred, struct uidinfo *ruip);
  102 void    change_svgid(struct ucred *newcred, gid_t svgid);
  103 void    change_svuid(struct ucred *newcred, uid_t svuid);
  104 void    crcopy(struct ucred *dest, struct ucred *src);
  105 struct ucred    *crcopysafe(struct proc *p, struct ucred *cr);
  106 struct ucred    *crdup(struct ucred *cr);
  107 void    cred_update_thread(struct thread *td);
  108 void    crfree(struct ucred *cr);
  109 struct ucred    *crget(void);
  110 struct ucred    *crhold(struct ucred *cr);
  111 int     crshared(struct ucred *cr);
  112 void    cru2x(struct ucred *cr, struct xucred *xcr);
  113 void    crsetgroups(struct ucred *cr, int n, gid_t *groups);
  114 int     groupmember(gid_t gid, struct ucred *cred);
  115 #endif /* _KERNEL */
  116 
  117 #endif /* !_SYS_UCRED_H_ */

Cache object: 9e602a61edfbc957b36c8957d797e8a9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.