File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sudo / plugins / sudoers / check.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 16:12:54 2014 UTC (10 years, 1 month ago) by misho
Branches: sudo, MAIN
CVS tags: v1_8_10p3_0, v1_8_10p3, HEAD
sudo v 1.8.10p3

    1: /*
    2:  * Copyright (c) 1993-1996,1998-2005, 2007-2014
    3:  *	Todd C. Miller <Todd.Miller@courtesan.com>
    4:  *
    5:  * Permission to use, copy, modify, and distribute this software for any
    6:  * purpose with or without fee is hereby granted, provided that the above
    7:  * copyright notice and this permission notice appear in all copies.
    8:  *
    9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   16:  *
   17:  * Sponsored in part by the Defense Advanced Research Projects
   18:  * Agency (DARPA) and Air Force Research Laboratory, Air Force
   19:  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
   20:  */
   21: 
   22: #ifndef _SUDOERS_CHECK_H
   23: #define _SUDOERS_CHECK_H
   24: 
   25: /* Status codes for timestamp_status() */
   26: #define TS_CURRENT		0
   27: #define TS_OLD			1
   28: #define TS_MISSING		2
   29: #define TS_NOFILE		3
   30: #define TS_ERROR		4
   31: 
   32: /*
   33:  * Time stamps are now stored in a single file which contains multiple
   34:  * records.  Each record starts with a 16-bit version number and a 16-bit
   35:  * record size.  Multiple record types can coexist in the same file.
   36:  */
   37: #define	TS_VERSION		1
   38: 
   39: /* Time stamp entry types */
   40: #define TS_GLOBAL		0x01
   41: #define TS_TTY			0x02
   42: #define TS_PPID			0x03
   43: 
   44: /* Time stamp flags */
   45: #define TS_DISABLED		0x01	/* entry disabled */
   46: #define TS_ANYUID		0x02	/* ignore uid, only valid in the key */
   47: 
   48: /* XXX - may also want to store uid/gid of tty device */
   49: struct timestamp_entry {
   50:     unsigned short version;	/* version number */
   51:     unsigned short size;	/* entry size */
   52:     unsigned short type;	/* TS_GLOBAL, TS_TTY, TS_PPID */
   53:     unsigned short flags;	/* TS_DISABLED, TS_ANYUID */
   54:     uid_t auth_uid;		/* uid to authenticate as */
   55:     pid_t sid;			/* session ID associated with tty/ppid */
   56:     struct timespec ts;		/* timestamp (CLOCK_MONOTONIC) */
   57:     union {
   58: 	dev_t ttydev;		/* tty device number */
   59: 	pid_t ppid;		/* parent pid */
   60:     } u;
   61: };
   62: 
   63: bool  already_lectured(int status);
   64: bool  update_timestamp(struct passwd *pw);
   65: int   build_timestamp(struct passwd *pw);
   66: int   timestamp_status(struct passwd *pw);
   67: 
   68: #endif /* _SUDOERS_CHECK_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>