[BACK]Return to sudo.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Annotation of src/usr.bin/sudo/sudo.h, Revision 1.1

1.1     ! millert     1: /*
        !             2:  * Copyright (c) 1994-1996,1998-1999 Todd C. Miller <Todd.Miller@courtesan.com>
        !             3:  * 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:  *
        !             9:  * 1. Redistributions of source code must retain the above copyright
        !            10:  *    notice, this list of conditions and the following disclaimer.
        !            11:  *
        !            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:  *
        !            16:  * 3. The name of the author may not be used to endorse or promote products
        !            17:  *    derived from this software without specific prior written permission.
        !            18:  *
        !            19:  * 4. Products derived from this software may not be called "Sudo" nor
        !            20:  *    may "Sudo" appear in their names without specific prior written
        !            21:  *    permission from the author.
        !            22:  *
        !            23:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
        !            24:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
        !            25:  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
        !            26:  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
        !            27:  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        !            28:  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
        !            29:  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
        !            30:  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
        !            31:  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
        !            32:  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            33:  *
        !            34:  * $Sudo: sudo.h,v 1.163 1999/09/08 08:06:17 millert Exp $
        !            35:  */
        !            36:
        !            37: #ifndef _SUDO_SUDO_H
        !            38: #define _SUDO_SUDO_H
        !            39:
        !            40: #include <pathnames.h>
        !            41: #include "compat.h"
        !            42: #include "defaults.h"
        !            43: #include "logging.h"
        !            44:
        !            45: /*
        !            46:  * Info pertaining to the invoking user.
        !            47:  */
        !            48: struct sudo_user {
        !            49:     struct passwd *pw;
        !            50:     char *tty;
        !            51:     char  cwd[MAXPATHLEN];
        !            52:     char *host;
        !            53:     char *shost;
        !            54:     char **runas;
        !            55:     char *prompt;
        !            56:     char *cmnd_safe;
        !            57:     char *cmnd;
        !            58:     char *cmnd_args;
        !            59: };
        !            60:
        !            61: /*
        !            62:  * Return values for sudoers_lookup(), also used as arguments for log_auth()
        !            63:  * Note: cannot use '0' as a value here.
        !            64:  */
        !            65: /* XXX - VALIDATE_SUCCESS and VALIDATE_FAILURE instead? */
        !            66: #define VALIDATE_ERROR          0x01
        !            67: #define VALIDATE_OK            0x02
        !            68: #define VALIDATE_NOT_OK                0x04
        !            69: #define FLAG_NOPASS            0x10
        !            70: #define FLAG_NO_USER           0x20
        !            71: #define FLAG_NO_HOST           0x40
        !            72: #define FLAG_NO_CHECK          0x80
        !            73:
        !            74: /*
        !            75:  * Boolean values
        !            76:  */
        !            77: #undef TRUE
        !            78: #define TRUE                     1
        !            79: #undef FALSE
        !            80: #define FALSE                    0
        !            81:
        !            82: /*
        !            83:  * find_path()/load_cmnd() return values
        !            84:  */
        !            85: #define FOUND                    1
        !            86: #define NOT_FOUND                0
        !            87: #define NOT_FOUND_DOT          -1
        !            88:
        !            89: /*
        !            90:  * Various modes sudo can be in (based on arguments) in octal
        !            91:  */
        !            92: #define MODE_RUN                 00001
        !            93: #define MODE_VALIDATE            00002
        !            94: #define MODE_INVALIDATE          00004
        !            95: #define MODE_KILL                00010
        !            96: #define MODE_VERSION             00020
        !            97: #define MODE_HELP                00040
        !            98: #define MODE_LIST                00100
        !            99: #define MODE_LISTDEFS            00200
        !           100: #define MODE_BACKGROUND          00400
        !           101: #define MODE_SHELL               01000
        !           102: #define MODE_RESET_HOME          02000
        !           103:
        !           104: /*
        !           105:  * Used with set_perms()
        !           106:  */
        !           107: #define PERM_ROOT                0x00
        !           108: #define PERM_USER                0x01
        !           109: #define PERM_FULL_USER           0x02
        !           110: #define PERM_SUDOERS             0x03
        !           111: #define PERM_RUNAS              0x04
        !           112:
        !           113: /*
        !           114:  * Shortcuts for sudo_user contents.
        !           115:  */
        !           116: #define user_name              (sudo_user.pw->pw_name)
        !           117: #define user_passwd            (sudo_user.pw->pw_passwd)
        !           118: #define user_uid               (sudo_user.pw->pw_uid)
        !           119: #define user_gid               (sudo_user.pw->pw_gid)
        !           120: #define user_shell             (sudo_user.pw->pw_shell)
        !           121: #define user_dir               (sudo_user.pw->pw_dir)
        !           122: #define user_tty               (sudo_user.tty)
        !           123: #define user_cwd               (sudo_user.cwd)
        !           124: #define user_runas             (sudo_user.runas)
        !           125: #define user_cmnd              (sudo_user.cmnd)
        !           126: #define user_args              (sudo_user.cmnd_args)
        !           127: #define user_prompt            (sudo_user.prompt)
        !           128: #define user_host              (sudo_user.host)
        !           129: #define user_shost             (sudo_user.shost)
        !           130: #define safe_cmnd              (sudo_user.cmnd_safe)
        !           131:
        !           132: /*
        !           133:  * We used to use the system definition of PASS_MAX or _PASSWD_LEN,
        !           134:  * but that caused problems with various alternate authentication
        !           135:  * methods.  So, we just define our own and assume that it is >= the
        !           136:  * system max.
        !           137:  */
        !           138: #define SUDO_PASS_MAX  256
        !           139:
        !           140: /*
        !           141:  * Flags for lock_file()
        !           142:  */
        !           143: #define SUDO_LOCK      1               /* lock a file */
        !           144: #define SUDO_TLOCK     2               /* test & lock a file (non-blocking) */
        !           145: #define SUDO_UNLOCK    4               /* unlock a file */
        !           146:
        !           147: /*
        !           148:  * Function prototypes
        !           149:  */
        !           150: #define YY_DECL int yylex __P((void))
        !           151:
        !           152: #ifndef HAVE_GETCWD
        !           153: char *getcwd           __P((char *, size_t size));
        !           154: #endif
        !           155: #if !defined(HAVE_PUTENV) && !defined(HAVE_SETENV)
        !           156: int putenv             __P((const char *));
        !           157: #endif
        !           158: #ifndef HAVE_SNPRINTF
        !           159: int snprintf           __P((char *, size_t, const char *, ...));
        !           160: #endif
        !           161: #ifndef HAVE_VSNPRINTF
        !           162: int vsnprintf          __P((char *, size_t, const char *, va_list));
        !           163: #endif
        !           164: #ifndef HAVE_ASPRINTF
        !           165: int asprintf           __P((char **, const char *, ...));
        !           166: #endif
        !           167: #ifndef HAVE_VASPRINTF
        !           168: int vasprintf          __P((char **, const char *, va_list));
        !           169: #endif
        !           170: #ifndef HAVE_STRCASECMP
        !           171: int strcasecmp         __P((const char *, const char *));
        !           172: #endif
        !           173: char *sudo_goodpath    __P((const char *));
        !           174: int sudo_setenv                __P((char *, char *));
        !           175: char *tgetpass         __P((const char *, int, int));
        !           176: int find_path          __P((char *, char **));
        !           177: void check_user                __P((void));
        !           178: void verify_user       __P((char *));
        !           179: int sudoers_lookup     __P((int));
        !           180: void set_perms         __P((int, int));
        !           181: void remove_timestamp  __P((int));
        !           182: int check_secureware   __P((char *));
        !           183: void sia_attempt_auth  __P((void));
        !           184: void pam_attempt_auth  __P((void));
        !           185: int yyparse            __P((void));
        !           186: void pass_warn         __P((FILE *));
        !           187: VOID *emalloc          __P((size_t));
        !           188: VOID *erealloc         __P((VOID *, size_t));
        !           189: char *estrdup          __P((const char *));
        !           190: void easprintf         __P((char **, const char *, ...));
        !           191: void evasprintf                __P((char **, const char *, va_list));
        !           192: void dump_defaults     __P((void));
        !           193: void dump_auth_methods __P((void));
        !           194: int lock_file          __P((int, int));
        !           195: int touch              __P((char *, time_t));
        !           196: YY_DECL;
        !           197:
        !           198: /* Only provide extern declarations outside of sudo.c. */
        !           199: #ifndef _SUDO_SUDO_C
        !           200: extern struct sudo_user sudo_user;
        !           201:
        !           202: extern int Argc;
        !           203: extern char **Argv;
        !           204: extern FILE *sudoers_fp;
        !           205: #endif
        !           206: extern int errno;
        !           207:
        !           208: #endif /* _SUDO_SUDO_H */