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

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

1.1     ! millert     1: /*
        !             2:  * Copyright (c) 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: parse.h,v 1.5 1999/09/08 08:06:15 millert Exp $
        !            35:  */
        !            36:
        !            37: #ifndef _SUDO_PARSE_H
        !            38: #define _SUDO_PARSE_H
        !            39:
        !            40: /*
        !            41:  * Data structure used in parsing sudoers;
        !            42:  * top of stack values are the ones that
        !            43:  * apply when parsing is done & can be
        !            44:  * accessed by *_matches macros
        !            45:  */
        !            46: #define STACKINCREMENT (32)
        !            47: struct matchstack {
        !            48:        int user;
        !            49:        int cmnd;
        !            50:        int host;
        !            51:        int runas;
        !            52:        int nopass;
        !            53: };
        !            54:
        !            55: /*
        !            56:  * Data structure describing a command in the
        !            57:  * sudoers file.
        !            58:  */
        !            59: struct sudo_command {
        !            60:     char *cmnd;
        !            61:     char *args;
        !            62: };
        !            63:
        !            64: #define user_matches   (match[top-1].user)
        !            65: #define cmnd_matches   (match[top-1].cmnd)
        !            66: #define host_matches   (match[top-1].host)
        !            67: #define runas_matches  (match[top-1].runas)
        !            68: #define no_passwd      (match[top-1].nopass)
        !            69:
        !            70: /*
        !            71:  * Structure containing command matches if "sudo -l" is used.
        !            72:  */
        !            73: struct command_match {
        !            74:     char *runas;
        !            75:     size_t runas_len;
        !            76:     size_t runas_size;
        !            77:     char *cmnd;
        !            78:     size_t cmnd_len;
        !            79:     size_t cmnd_size;
        !            80:     int nopasswd;
        !            81: };
        !            82:
        !            83: /*
        !            84:  * Structure describing an alias match in parser.
        !            85:  */
        !            86: typedef struct {
        !            87:     int type;
        !            88:     char *name;
        !            89:     int val;
        !            90: } aliasinfo;
        !            91:
        !            92: /*
        !            93:  * Structure containing Cmnd_Alias's if "sudo -l" is used.
        !            94:  */
        !            95: struct generic_alias {
        !            96:     int type;
        !            97:     char *alias;
        !            98:     char *entries;
        !            99:     size_t entries_size;
        !           100:     size_t entries_len;
        !           101: };
        !           102:
        !           103: /* The matching stack and number of entries on it. */
        !           104: extern struct matchstack *match;
        !           105: extern int top;
        !           106:
        !           107: /*
        !           108:  * Prototypes
        !           109:  */
        !           110: int addr_matches       __P((char *));
        !           111: int command_matches    __P((char *, char *, char *, char *));
        !           112: int netgr_matches      __P((char *, char *, char *));
        !           113: int usergr_matches     __P((char *, char *));
        !           114:
        !           115: #endif /* _SUDO_PARSE_H */