Commit Graph

75 Commits

Author SHA1 Message Date
Todd C. Miller
b75bb6991f Do not leak old istack if realloc fails; found by cppcheck.
Also modify yyless() to avoid a harmless cppcheck warning every
time it is used.
2014-01-13 09:52:41 -07:00
Todd C. Miller
b2c456341a Move symbol extern defs into sudoers.h 2013-12-16 14:18:42 -07:00
Todd C. Miller
96eb2c4f8f Add warning_gettext() wrapper function that changes to the user locale,
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
a3aa40b0fe Cope with a comment on the last line of the file with no newline.
Bug #623
2013-11-12 09:36:39 -07:00
Todd C. Miller
8e503a229f Fix warnings from -Wold-style-definition 2013-11-04 06:26:37 -07:00
Todd C. Miller
07a804caf3 Quiet sign comparision warnings. 2013-10-23 15:03:31 -06:00
Todd C. Miller
f85106ea67 Use SLIST and STAILQ macros instead of doing headless singly linked
lists manually.  As a bonus we now use a tail queue for ldap.c and
sudoreplay.c.
2013-10-22 09:08:09 -06:00
Todd C. Miller
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
26a256260d Include stdint.h or inttypes.h before sha2.h 2013-04-16 12:16:41 -04:00
Todd C. Miller
e715841fc2 Sanity check digest in parser so visudo can catch errors.
Add base64 support
2013-04-15 15:12:00 -04:00
Todd C. Miller
35375a2b7e Initial implementation of checksum support in sudoers.
Currently supports SHA-224, SHA-256, SHA-384, SHA-512.
TODO: checksum format validation in parser and base64 support.
      checksum support for ldap sudoers
2013-04-14 07:00:21 -04:00
Todd C. Miller
c47f5f7abd Fix potential double free in an error path. 2013-03-05 10:16:50 -05:00
Todd C. Miller
1d7072fe09 Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
MAXHOSTNAMELEN and the MIN/MAX macros.  We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
7b3d268687 Call gettext() on parameters for warning()/warningx() instead of
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
15c69e0e3f Call gettext() in sudoerserror() in the user's locale and pass the untranslated string to it. 2012-11-25 09:33:58 -05:00
Todd C. Miller
595d3b2651 Display warning/error messages in the user's locale. 2012-11-08 15:37:44 -05:00
Todd C. Miller
1d90c0ad71 No need to translate "unable to allocate memory" when we can just
use the system translation via strerror().
2012-09-17 16:59:26 -04:00
Todd C. Miller
5276ab3a5f Set yacc prefix to "sudoers" to avoid conflicts other yacc parsers. 2012-09-14 16:19:25 -04:00
Todd C. Miller
e498bab4c1 Don't print an error message in yyerror() if open_sudoers() fails,
we've already printed an error message.  Also restore the check
for sudoers_warnings in yyerror().
2012-08-23 14:02:02 -04:00
Todd C. Miller
0c8c3c0cd8 Avoid printing the >>> parse error <<< message for testsudoers
when the -t flag is specified.
2012-08-23 11:28:44 -04:00
Todd C. Miller
b1d1d89899 Fix compilation on Solaris 2012-08-01 14:57:14 -04:00
Todd C. Miller
a9623c29c2 Fix SELinux build 2012-07-30 11:01:32 -04:00
Todd C. Miller
4abd2a6cf4 Merge in Solaris privilege support by Darren Moffat and John Zolnowsky 2012-07-26 13:49:21 -04:00
Todd C. Miller
8a7ac44590 Fix #includedir; from Mike Frysinger 2012-05-17 15:42:57 -04:00
Todd C. Miller
2c84bd4d08 Log warning() at SUDO_DEBUG_WARN not SUDO_DEBUG_ERROR.
Log the function, file and line number in the debug log for warning()
and error().
2012-04-05 12:37:15 -04:00
Todd C. Miller
aecb5206e2 Fix compiler warnings on some platforms and provide a better method
of defeating gcc's warn_unused_result attribute.
2012-03-29 10:33:40 -04:00
Todd C. Miller
b330cbbed8 We should always call warning() with a format string or a string literal.
In this case, the argument (path) is not user-controlled.
2012-03-15 08:47:23 -04:00
Todd C. Miller
8d05f0d1b0 Add type param to sudo_secure_path() and add sudo_secure_file()
and sudo_secure_dir() wrappers which get by #includedir in sudoers.
2012-02-29 15:50:48 -05:00
Todd C. Miller
21a2f95821 Use stdbool.h instead of rolling our own TRUE/FALSE macros. 2011-12-02 11:27:33 -05:00
Todd C. Miller
481877e3b8 Add support for relative paths in #include and #includedir 2011-11-17 20:48:42 -05:00
Todd C. Miller
ab437ae6c3 Add lexer tracing as debug@parser 2011-11-12 12:41:44 -05:00
Todd C. Miller
09beba8259 Revert 003bdb078a15. We need to #include <gram.h> not "gram.h" and
<def_data.h> and not "def_data.h" when generating the parser in a
build dir.
2011-11-12 12:18:44 -05:00
Todd C. Miller
0bf68d2103 #include "gram.h" not <gram.h> and "def_data.h" and not <def_data.h>. 2011-11-08 14:09:48 -05:00
Todd C. Miller
bd881c26e8 Keep track of the last token returned. On error, if the last token was
COMMENT, decrement sudolineno since the error most likely occurred on
the preceding line.  Previously we always uses sudolineno-1 which will
give the wrong line number for errors within a line.
2011-11-05 07:37:14 -04:00
Todd C. Miller
839919566e Add debug_decl/debug_return (almost) everywhere.
Remove old sudo_debug() and convert users to sudo_debug_printf().
2011-10-22 14:40:21 -04:00
Todd C. Miller
4f9a93f658 Fix some potential problems found by the clang static analyzer,
none serious.
2011-07-28 10:59:37 -04:00
Todd C. Miller
f6aea10724 Quiet compiler warning when SELinux is enabled. 2011-05-16 16:52:34 -04:00
Todd C. Miller
b643b190a7 Prepare sudoers module messages for translation. 2011-05-16 16:32:05 -04:00
Todd C. Miller
4dd3440cb6 Split ALL, ROLE and TYPE into their own actions. Since you can
only have #ifdefs inside of braces, ROLE and TYPE use a naughty
goto in the non-SELinux case.  This is safe because the actions are
in one big switch() statement.
2011-04-29 16:05:50 -04:00
Todd C. Miller
189817a313 Fix regexp for matching a CIDR-style IPv4 netmask. From Marc Espie. 2011-04-29 11:22:49 -04:00
Todd C. Miller
c6ad6d29e5 Treat a missing includedir like an empty one and do not return an error. 2011-04-14 14:27:11 -04:00
Todd C. Miller
c82e29f274 Add '!' token to lex tracing 2011-03-31 13:42:05 -04:00
Todd C. Miller
ca32055fd8 Avoid using pre or post increment in a parameter to a ctype(3)
function as it might be a macro that causes the increment to happen
more than once.
2011-03-31 12:48:01 -04:00
Todd C. Miller
041b1a896a Add back missing #include of config.h 2011-03-28 14:50:55 -04:00
Todd C. Miller
e3ff59e506 Use bitwise AND instead of modulus to check for length being odd.
A newline in the middle of a string is an error unless a line
continuation character is used.
2011-03-27 17:12:45 -04:00
Todd C. Miller
45b82039be Move lexer globals initialization into init_lexer. 2011-03-27 09:45:42 -04:00
Todd C. Miller
aed50b4d7b Fix a potential crash when a non-regular file is present in an
includedir.  Fixes bz #452
2011-03-27 09:27:43 -04:00
Todd C. Miller
31c164dae1 Make an empty group or netgroup a syntax error. 2011-03-24 11:00:30 -04:00
Todd C. Miller
784d0dda37 Allow a group ID in the User_Spec. 2011-03-24 10:37:34 -04:00
Todd C. Miller
fe1bc681ba Return an error for the empty string when a word is expected.
Allow an ID for per-user or per-runas Defaults.
2011-03-23 18:51:57 -04:00