Todd C. Miller [Fri, 2 Dec 2011 19:29:54 +0000 (14:29 -0500)]
Fetch the login class for the user we authenticate specifically when
using BSD authentication. That user may have a different login class
than what we will use to run the command. When setting the login
class for the command, use the target user's struct passwd, not
the invoking user's. Fixes bug 526
Todd C. Miller [Thu, 1 Dec 2011 16:27:57 +0000 (11:27 -0500)]
No longer need SUDO_CHECK_TYPE and SUDO_TYPE_* now that the default
includes have unistd.h in them. Add check for socklen_t for upcoming
getaddrinfo compat.
Todd C. Miller [Tue, 8 Nov 2011 13:24:45 +0000 (08:24 -0500)]
Change Debug sudo.conf setting to take a program name as the first
argument. In the future, this will allow visudo and sudoreplay to
use their own Debug entries.
Todd C. Miller [Sun, 6 Nov 2011 22:04:55 +0000 (17:04 -0500)]
Tests for empty sudoers (should parse OK) and syntax errors within
a line (should report correct line number) both with and without
the trailing newline.
Todd C. Miller [Sat, 5 Nov 2011 11:37:14 +0000 (07:37 -0400)]
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.
Todd C. Miller [Tue, 25 Oct 2011 14:08:26 +0000 (10:08 -0400)]
We need to init the auth system regardless of whether we need a
password since we will be closing the PAM session in the monitor
process. Fixes a crash in the monitor on Solaris; bugzilla #518
Todd C. Miller [Sat, 22 Oct 2011 18:28:33 +0000 (14:28 -0400)]
Wrap error/errorx and warning/warningx functions with debug statements.
Disable wrapping for standalone sudoers programs as well as memory
allocation functions (to avoid infinite recursion).
Todd C. Miller [Wed, 12 Oct 2011 12:24:13 +0000 (08:24 -0400)]
Override and ignore the --disable-static option. Sudo already runs
libtool with -tag=disable-static where applicable and we need non-PIC
objects to build the executables.
Todd C. Miller [Mon, 10 Oct 2011 17:10:24 +0000 (13:10 -0400)]
Ignore set_logname (which is now the default) for sudoedit since
we want the LOGNAME, USER and USERNAME environment variables to
refer to the calling user since that is who the editor runs as.
This allows the editor to find the user's startup files.
Fixes bugzilla #515
Todd C. Miller [Mon, 10 Oct 2011 15:10:59 +0000 (11:10 -0400)]
Instead of trying to grow the buffer in make_grlist_item(), simply
increase the total length, free the old buffer and allocate a new
one. This is less error prone and saves us from having to adjust
all the pointers in the buffer. This code path is only taken when
there are groups longer than the length of the user field in struct
utmp or utmpx, which should be quite rare.
Todd C. Miller [Tue, 27 Sep 2011 17:18:46 +0000 (13:18 -0400)]
Modify the authentication API such that the init and cleanup functions
are always called, regardless of whether or not we are going to
verify a password. This is needed for proper PAM session support.
Todd C. Miller [Tue, 27 Sep 2011 15:13:44 +0000 (11:13 -0400)]
Fix a PAM_USER mismatch in session open/close. We update PAM_USER
to the target user immediately before setting resource limits, which
is after the monitor process has forked (so it has the old value).
Also, if the user did not authenticate, there is no pamh in the
monitor so we need to init pam here too. This means we end up
calling pam_start() twice, which should be fixed, but at least the
session is always properly closed now.
Todd C. Miller [Fri, 23 Sep 2011 23:37:21 +0000 (19:37 -0400)]
Quiet a false positive found by several static analysis tools.
These tools don't know that log_error() does not return (it longjmps
to error_jmp which returns to the sudo front-end).