Add support for tuples in def_data.in; these are implemented as an

enum type.  Currently there is only a single tuple enum but in the
future we may have one tuple enum per T_TUPLE entry in def_data.in.
Currently listpw, verifypw and lecture are tuples.  This avoids the
need to have two entries (one ival, one str) for pwflags and syslog
values.

lecture is now a tuple with the following values: never, once, always

We no longer use both an int and string entry for syslog facilities
and priorities.  Instead, there are logfac2str() and logpri2str()
functions that get used when we need to print the string values.
This commit is contained in:
Todd C. Miller
2003-12-30 22:31:30 +00:00
parent 6ad252765b
commit 02f37dc2da
11 changed files with 444 additions and 390 deletions

29
sudo.h
View File

@@ -71,13 +71,14 @@ struct sudo_user {
* Note: cannot use '0' as a value here.
*/
/* XXX - VALIDATE_SUCCESS and VALIDATE_FAILURE instead? */
#define VALIDATE_ERROR 0x01
#define VALIDATE_OK 0x02
#define VALIDATE_NOT_OK 0x04
#define FLAG_NOPASS 0x10
#define FLAG_NO_USER 0x20
#define FLAG_NO_HOST 0x40
#define FLAG_NO_CHECK 0x80
#define VALIDATE_ERROR 0x001
#define VALIDATE_OK 0x002
#define VALIDATE_NOT_OK 0x004
#define FLAG_CHECK_USER 0x010
#define FLAG_NOPASS 0x020
#define FLAG_NO_USER 0x040
#define FLAG_NO_HOST 0x080
#define FLAG_NO_CHECK 0x100
/*
* Boolean values
@@ -159,18 +160,6 @@ struct sudo_user {
#define SUDO_TLOCK 2 /* test & lock a file (non-blocking) */
#define SUDO_UNLOCK 4 /* unlock a file */
/*
* Flags for sudoers_lookup:
* PASSWD_NEVER: user never has to give a passwd
* PASSWD_ALL: no passwd needed if all entries for host have NOPASSWD flag
* PASSWD_ANY: no passwd needed if any entry for host has a NOPASSWD flag
* PASSWD_ALWAYS: passwd always needed
*/
#define PWCHECK_NEVER 0x01
#define PWCHECK_ALL 0x02
#define PWCHECK_ANY 0x04
#define PWCHECK_ALWAYS 0x08
/*
* Flags for tgetpass()
*/
@@ -209,7 +198,7 @@ size_t strlcpy __P((char *, const char *, size_t));
char *sudo_goodpath __P((const char *));
char *tgetpass __P((const char *, int, int));
int find_path __P((char *, char **, char *));
void check_user __P((void));
void check_user __P((int));
void verify_user __P((struct passwd *, char *));
int sudoers_lookup __P((int));
void set_perms_nosuid __P((int));