Todd C. Miller [Thu, 27 May 2010 18:46:39 +0000 (14:46 -0400)]
Add init_session function to struct policy_plugin that gets called
before the uid/gid/etc changes. A struct passwd pointer is passed in,which may be NULL if the user does not exist in the passwd database.The sudoers module uses init_session to open the pam session as needed.
Todd C. Miller [Wed, 26 May 2010 21:01:00 +0000 (17:01 -0400)]
Back out most of change 45e406ebdea2. Create dummy .l.c and .y.c
rules as an alternate way to prevent HP-UX make (and others) from
trying to rebuild the parser in non-dev mode.
Todd C. Miller [Fri, 21 May 2010 16:19:55 +0000 (12:19 -0400)]
Set user_tty to "unknown" if there is no tty, like sudo 1.7 does
(it is used when logging). Note that user_ttypath will still be
NULL if there is no tty.
Todd C. Miller [Thu, 20 May 2010 11:33:14 +0000 (07:33 -0400)]
When execve() of the command fails, it is possible to receive SIGCHLD
before we've read the error status from the pipe. Re-order things
such that we send the final status at the very end and prefer error
status over wait status.
Todd C. Miller [Tue, 18 May 2010 22:50:20 +0000 (18:50 -0400)]
Additional checks to make sure we don't close /dev/tty by mistake.
When flushing, sleep in select as long as we have buffers that need
to be written out.
Todd C. Miller [Tue, 18 May 2010 21:43:10 +0000 (17:43 -0400)]
Now that we can use pipes for stdin/stdout/stderr there is no
longer a need to error out when there is no tty. We just need
to make sure we don't try to use the tty fd if it is -1.
Todd C. Miller [Mon, 17 May 2010 14:25:27 +0000 (10:25 -0400)]
Remove check_sudoedit function pointer in struct sudo_policy.
Instead, sudo will set sudoedit=true in the settings array.
The plugin should check for this and modify argv_out as appropriate
in check_policy.
Todd C. Miller [Sun, 16 May 2010 23:27:04 +0000 (19:27 -0400)]
If plugin sets "sudoedit=true" in the command info, enable
sudoedit mode even if not invoked as sudoedit. This allows
a plugin to enable sudoedit when the user runs an editor.
Todd C. Miller [Thu, 13 May 2010 21:11:31 +0000 (17:11 -0400)]
Change how we handle the sudoedit argv. We now require that there
be a "--" in argv to separate the editor and any command line arguments
from the files to be edited.
Todd C. Miller [Tue, 11 May 2010 18:25:14 +0000 (14:25 -0400)]
If the tty lives on a devpts filesystem, stash the ctime in the tty
ticket file, as it is not updated when the tty is written to.
This helps us determine when a tty has been reused without the
user authenticating again with sudo.
Todd C. Miller [Tue, 11 May 2010 16:11:03 +0000 (12:11 -0400)]
Link with -lpthread on HP-UX since a plugin may be linked with -lpthread
and dlopen() will fail if the shared object has a dependency on -lpthread
but the main program is not linked with it.
Todd C. Miller [Mon, 10 May 2010 21:23:35 +0000 (17:23 -0400)]
No need to use pseudo-cbreak mode now that we use pipes when stdout is
not a tty. Instead, check whether stdin is a tty and if not, delay
setting the tty to raw mode until the command tries to access it itself
(and receives SIGTTIN or SIGTTOU).
Todd C. Miller [Mon, 10 May 2010 19:02:50 +0000 (15:02 -0400)]
Do signal setup after turning off echo, not before. If we are using
a tty but are not the foreground pgrp this will generate SIGTTOU
so we want the default action to be taken (suspend process).
Todd C. Miller [Wed, 5 May 2010 20:11:13 +0000 (16:11 -0400)]
Go back to reseting io_buffer offset and length (and now also the
EOF handling) in the loop we do the FD_SET, not after we drain the
buffer after write() since we don't know what order reads and writes
will occur in.
Todd C. Miller [Wed, 5 May 2010 13:47:12 +0000 (09:47 -0400)]
Add support for logging stdin when it is not a tty.
There is still a bug where "cat | sudo cat" has problems because
both cat and sudo are trying to read from the tty.
Todd C. Miller [Tue, 4 May 2010 23:17:31 +0000 (19:17 -0400)]
Add pointer to a printf like function to plugin open functon.
This can be used instead of the conversation function to display
info and error messages.