Commit Graph

47 Commits

Author SHA1 Message Date
Todd C. Miller
d956d77528 Move defaults info into its own files from which we generate
.h and .c files.  This makes adding or rearranging variables
much simpler.
2000-12-31 01:38:37 +00:00
Todd C. Miller
1eeb9cb963 When checking to see if the host/user matches in a defaults spec, check
against TRUE, not just non-zero since it might be -1.
2000-03-24 23:58:59 +00:00
Todd C. Miller
ffca544b6c Fully qualified hosts w/ wildcards were not matching the FQHOST token type.
There's really no need for a separate token for fully-qualified vs.
unqualified anymore so FQHOST is now history and hostname_matches
now decides which hostname (short or long) to check based on whether
or not the pattern contains a '.'.
2000-03-23 04:38:22 +00:00
Todd C. Miller
5ce1fa96f2 Add support for wildcards in the hostname. 2000-03-23 04:09:53 +00:00
Todd C. Miller
30c5e442ff fix a yacc (skeleton.c) warning 2000-01-28 01:41:33 +00:00
Todd C. Miller
9abb89750c Regen with yacc that has a memory leak plugged. 2000-01-26 23:14:18 +00:00
Todd C. Miller
0b59a0974d netgr_matches needs to check shost as well as host since they may be different. 2000-01-11 18:20:41 +00:00
Todd C. Miller
625e3e46d0 Make treatment of -l and -v sane wrt NOPASSWD flags. Now allow -l w/o a passwd
if there is *any* entry for the user on the host with a NOPASSWD flag.
For -v, only allow w/o a passwd if *all* entries for the user on the host
w/ the specified runas user have the NOPASSWD flag set.
2000-01-03 04:43:33 +00:00
Todd C. Miller
34d793254d fix parsing of runas lists:
o oprunasuser and runaslist now return a value
o in a runasspec, if a runaslist does not return TRUE, set runas_matches to
  FALSE.  Normally, a runaslist only returns FALSE for explicitly denied
  users.
o since runaslist does not modify the stack there is no need for a push/pop
  in runasalias.
1999-12-05 19:06:09 +00:00
Todd C. Miller
7769bf6a32 o Change defaults stuff to put the value right in the struct.
o Implement mailer_flags
o Store syslog stuff both in int and string form.  Setting the string
  form magically updates the int version.
o Add boolean attribute to strings where it makes sense to say !foo
1999-10-07 21:21:08 +00:00
Todd C. Miller
13bf42675d Add support for "Defaults" line in sudoers to make configuration variables
changable at runtime (and on a global, per-host and per-user basis).
Both the names and the internal representation are still subject to change.
It was necessary to make sudo_user.runas but a char ** instead of a
char * since this value can be changed by a Defaults line.  There is a
similar (but more complicated) issue with sudo_user.prompt but it
is handled differently at the moment.

Add a "-L" flag to list the name of options with their descriptions.  This
may only be temporary.

Move some prototypes to parse.h

Be much less restrictive on what is allowed for a username.
1999-09-08 08:06:28 +00:00
Todd C. Miller
3a8c0ca966 include strings.h everywhere we include string.h 1999-08-28 09:24:15 +00:00
Todd C. Miller
2b28160a5d minor change to first line printed in -l mode 1999-08-26 09:10:50 +00:00
Todd C. Miller
0d38bef9a7 include strcasecmp() for those without it 1999-08-24 17:37:38 +00:00
Todd C. Miller
25d75cea68 these should be generated with byacc, not bison 1999-08-24 16:40:58 +00:00
Todd C. Miller
51350b2c79 In "sudo -l" mode, the type of the stored (expanded) alias was not
stored with the contents.  This could lead to incorrect output
if the sudoers file had different alias types with the same name.
Normal parsing (ie: not in '-l' mode) is unaffected.
1999-08-24 15:58:39 +00:00
Todd C. Miller
bc65b24ed3 regen 1999-08-20 20:32:07 +00:00
Todd C. Miller
804e168d90 o NewArgv and NewArgc don't need to be externally visible.
o If pedantic > 1, it is a parse error.
o Add -s (strict) option to visudo which sets pedantic to 2.
1999-08-17 15:29:47 +00:00
Todd C. Miller
b28ac86ab8 In pedantic mode we need to save *all* the aliases, not just those
that match, or we get spurious warnings.
1999-08-17 12:47:53 +00:00
Todd C. Miller
3a8b0be635 o --with-otp deprecated, use --without-passwd instead
o real dependencies in the Makefile
o --with-devel option to enable yacc, lex, and -Wall
o style -- "foo -> bar" becomes "foo->bar"
o ALL goes back to being a token, not a string but don't leak memory
o rename hsotspec -> host in parse.yacc
1999-08-14 15:34:55 +00:00
Todd C. Miller
2386dc1b45 o Add a "pedentic" flag to the parser. This makes sudo warn in cases
where an alias may be used before it is defined.  Only turned on for visudo
and testsudoers.
o Add --disable-authentication option that makes sudo not require
authentication by default.  The PASSWD tag can be used to require
authentication for an entry.  We no longer overload --without-passwd.
1999-08-12 14:37:27 +00:00
Todd C. Miller
2ce523cd1f o add a 'val' element to aliasinfo struct and move -> parse.h
o find_alias() now returns an aliasinfo * instead of boolean
o add_alias() now takes a value parameter to store in the aliasinfo.val
o The cmnd, hostspec, runasuser, and user rules now return:
1) positive match
0) negative match (due to '!')
-1) no match
This means setting $$ explicitly in all cases, which I should have done in
the first place.  It also means that we always store a value that is != -1
and when we see a '!' we can set *_matches to !rv if rv != -1.
The upshot of all of this is that '!' now works the way it should in
lists and some of the rules are more uniform and sensible.
1999-08-09 22:25:17 +00:00
Todd C. Miller
b4a7c5507a parse.yacc 1999-08-09 14:34:23 +00:00
Todd C. Miller
16ab377018 o Add '!' correctly when expanding Aliases.
o Add shortcut macros for append() to make things more readable.
o The separator in append() is now a string instead of a char.
o In append(), only prepend the separator if the last char is not a '!'.
  This is a hack but it greatly simplifies '!' handling.
o In -l mode, Runas lists and NOPASSWD/PASSWD tags are now inherited
  across entries in a list (matches current behavior).
o Fix formatting in -l mode such that items in a list are separated by
  a space.  Greatlt improves readability.
o Space for name field in struct aliasinfo is now allocated dyanically
  instead of using a (big) buffer.
o In add_alias(), only search the list once (lsearch instead of lfind + lsearch)
1999-08-04 17:28:47 +00:00
Todd C. Miller
0d5a675f5b regen 1999-08-04 15:31:47 +00:00
Todd C. Miller
0d732401f4 add 4th term to license similar to term 5 in the apache license 1999-07-31 16:19:50 +00:00
Todd C. Miller
7126759483 regen 1999-07-22 13:12:27 +00:00
Todd C. Miller
d22fe7a98d regen 1999-07-08 10:46:46 +00:00
Todd C. Miller
5ab9fa82e1 regen 1999-07-08 10:35:58 +00:00
Todd C. Miller
80287c981c Move interface-related defines to interfaces.h so we don't have to include
<netinet/in.h> everywhere.
1999-05-17 01:36:30 +00:00
Todd C. Miller
850a52aa6f o Replace _PASSWD_LEN braindeath with our own SUDO_MAX_PASS.
It turns out the old DES crypt does the right thing with passwords
   longert than 8 characters.
 o Fix common typo (necesary -> necessary)
 o Update TODO list
1999-05-14 16:30:14 +00:00
Todd C. Miller
06e586ee7b Function names should be flush with the start of the line so they can be found trivially in an editor and with grep 1999-04-10 04:49:03 +00:00
Todd C. Miller
eecc5ce1c9 free(3) is already void, no need to cast it 1999-04-10 04:40:57 +00:00
Todd C. Miller
59b0cff8cf Stash the "safe" path (ie: the one listed in sudoers) to the command instead
of stashing the struct stat.  Should be safer.
1999-04-10 04:10:01 +00:00
Todd C. Miller
622b7a1d97 You can now specifiy a host list instead of just a host or alias.
Ie: user = host1,host2,ALIAS,!host3 my_command
now works.
1999-04-07 23:18:52 +00:00
Todd C. Miller
91e31132dd Move the push from the beginning of cmndspec to the end. This means we
no longer have to do a push at the end of privilege, just reset some values.
1999-04-07 06:50:47 +00:00
Todd C. Miller
f50a342b4e It is now possible to use the '!' operator in a runas list as
well as in a Cmnd_Alias, Host_Alias and User_Alias.
1999-04-06 05:40:51 +00:00
Todd C. Miller
499e869237 Add VALIDATE_NOT_OK_NOPASS for when user is not allowed to run a command
but the NOPASSWD flag was set.
Make runasspec, runaslist, runasuser, and nopasswd typeless in parse.yacc
Add support for '!' in the runas list
Fix double printing of '%' and '+' for groups and netgroups respectively
Add *_matched macros (no need for local stack variable).  Should only be
used directly after a pop (since top must be >= 2).
1999-04-06 05:00:29 +00:00
Todd C. Miller
e6deacb6c4 Crank version to 1.6 and combine copyright statements 1999-04-05 20:57:25 +00:00
Todd C. Miller
094a29a66b regen 1999-04-05 20:29:54 +00:00
Todd C. Miller
49c5a12d8c Fix another parser bug. For a sudoers entry like this:
millert	ALL=/bin/ls,(daemon) !/bin/ls
sudo would not allow millert to run ls as root.
1999-03-30 17:17:54 +00:00
Todd C. Miller
baae4d4dd9 Save entries that match a ! command on the matching stack too 1999-03-30 06:03:38 +00:00
Todd C. Miller
75fb22990f Fix off by one error introduced in *alloc changes 1999-03-29 04:31:16 +00:00
Todd C. Miller
79c46d1c81 ++version 1999-03-29 04:05:15 +00:00
Todd C. Miller
382ef75493 Use emalloc/erealloc/estrdup 1999-03-29 02:59:34 +00:00
Todd C. Miller
e4b42c5eac Still not right, this fixes it for real 1999-03-29 00:23:49 +00:00
Todd C. Miller
b789f9e932 Fix for previous commit 1999-03-29 00:08:02 +00:00