Todd C. Miller
7f99af859a
Use a tty lock even for kernel time stamps so we can avoid simultaneous
...
password prompts.
2017-12-22 11:10:22 -07:00
Todd C. Miller
feb48b8ebf
Add "kernel" as a possible value of timestamp_type.
...
Currently only supported on OpenBSD.
2017-12-20 16:19:54 -07:00
Todd C. Miller
1709dc7f77
In the timestamp record, include the start time of the terminal
...
session leader for tty-based timestamps or the start time of the
parent process for ppid-based timestamps. Idea from Duncan Overbruck.
2017-12-16 05:53:05 -07:00
Todd C. Miller
5cec5734cc
If the lock record doesn't match the expected record size we need
...
to seek to the end of the record as we otherwise may have gone too
far (or not far enough). Fixes interop problems when the time stamp
record changes size.
2017-12-15 21:08:38 -07:00
Todd C. Miller
48fba3c2cc
update my email to Todd.Miller@sudo.ws
2017-12-03 17:53:40 -07:00
Todd C. Miller
63d954d1fc
Replace tty_tickets option with timestamp_type which can be
...
global, ppid or tty. Defaults to tty (no change in behavior).
Some users want the ppid behavior.
2017-08-01 16:14:54 -06:00
Todd C. Miller
a842913aa7
Use debug logging instead of ignore_result() where possible.
2017-05-12 10:02:18 -06:00
Todd C. Miller
b5c88e52b1
Remove use of the non-standard SA_INTERRUPT
2017-05-12 10:02:17 -06:00
Todd C. Miller
8d1e994d84
cast mode_t to unsigned int when printing with %o
2017-03-22 08:37:12 -06:00
Todd C. Miller
7668b4b42b
Set umask temporarily when creating files instead of changing the
...
mode after the fact. This is slightly less error prone.
2017-03-21 16:21:17 -06:00
Todd C. Miller
8d57491dc1
Add PERM_IOLOG so we can create I/O log files on an NFS-mounted
...
filesystem where root is remapped to an unprivileged user.
2017-03-21 13:41:14 -06:00
Todd C. Miller
2dbd091443
When creating the timestamp directory, use the group of the timestamp
...
owner instead of inheriting the group of the parent directory.
2017-03-20 12:59:28 -06:00
Todd C. Miller
00b4732c9d
Add some casts to quiet gcc warnings on Solaris and remove a
...
now-useless debug printf.
2017-03-03 11:20:56 -07:00
Todd C. Miller
852ffa5938
Ignore a boot time that is in the future, which can happen when the
...
clock is corrected down after boot. Otherwise, the timestamp file
will be unlinked each time sudo is run and a password is always
required.
2016-12-01 10:52:05 -07:00
Todd C. Miller
8133cdfdf6
Use sys/stat.h defines instead of bare octal values.
2016-11-07 13:36:05 -07:00
Todd C. Miller
bf62530acf
Move io_mkdir_parents() to its own file and use it in ts_mkdirs().
2016-10-29 12:45:57 -06:00
Todd C. Miller
cf5a12c09a
def_timestamp_timeout is a double so compare against 0.0 not 0 to
...
avoid making it appear to be an integer type.
2016-10-26 10:56:32 -06:00
Todd C. Miller
3f022419ae
Be consistent with the naming of the variable used to store the
...
function return value. Previously, some code used "rval", some
used "ret". This standardizes on "ret" and uses "rc" for temporary
return codes.
2016-09-08 16:38:08 -06:00
Todd C. Miller
602ed0c747
In ts_mkdirs(), change the order from stat then mkdir, to mkdir then stat.
...
This more closely matches what "mkdir -p" does.
Coverity CID 104119.
2016-05-06 16:37:20 -06:00
Todd C. Miller
7a86430d41
Cast off_t printed via printf(3) instead of assuming it is long long.
2016-05-06 14:17:32 -06:00
Todd C. Miller
562b5cb59b
Check lseek() return value.
...
Coverity CID 104061.
2016-05-05 16:46:25 -06:00
Todd C. Miller
60e740dd60
Ignore ts_write() return value when disabling an entry with a bogus
...
timestamp. We ignore the timestamp entry even it doesn't succeed.
Coverity CID 104062.
2016-05-05 16:30:11 -06:00
Todd C. Miller
8b12390abf
Add debug_return_ssize_t
2015-11-01 15:13:28 -07:00
Todd C. Miller
c6dad0001d
Avoid compilation error on Solaris 10 with Stun Studio 12.
...
Bug #727
2015-11-01 15:08:50 -07:00
Todd C. Miller
118680eabf
Cast sizeof(entry) to off_t before making it a negative offset for
...
lseek(). Fixes "sudo -k" on Solaris and probably others.
2015-09-24 10:52:44 -06:00
Todd C. Miller
67183d74f4
Remove include/compat/timespec.h. Systems old enough to lack struct
...
timespec are too old to build a modern sudo.
2015-09-09 11:13:22 -06:00
Todd C. Miller
69050f9345
Bring back the check for time stamp files that predate the boot
...
time. Instead of truncating we now unlink the file since another
process may be sleeping on the lock.
2015-09-07 06:06:08 -06:00
Todd C. Miller
7d0a623fdd
Use pread(2) and pwrite(2) where possible.
2015-09-07 06:06:08 -06:00
Todd C. Miller
0487b6da9d
Adjust new locking to work when tty_tickets is disabled. We need
...
to use per-tty/ppid locking to gain exclusive access to the tty
for the password prompt but use a separate (short term) lock
that is shared among all sudo processes for the user.
2015-09-07 06:06:08 -06:00
Todd C. Miller
f9b8a43816
Allow the time stamp lock to be interrupted by signals.
2015-09-07 06:06:08 -06:00
Todd C. Miller
00142c91fa
Lock individual records in the timestamp file instead of the entire
...
file. This will make it possible for multiple sudo processes using
the same tty to serialize their timestamp lookups.
2015-09-07 06:06:08 -06:00
Todd C. Miller
8f84857977
Fix creation of the timestamp file; bug #704
2015-07-20 20:16:14 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
81f94499bf
Check restore_perms() return value in all cases, pushing the
...
return value back up the call stack.
2015-06-25 11:12:36 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
ee72cba937
Use futimens() and utimensat() instead of futimes() and utimes().
2015-03-02 13:58:50 -07:00
Todd C. Miller
5d2e9426b2
We cannot (easily) use clock_gettime(CLOCK_MONOTONIC) directly as
...
it may be present but not implemented. Add sudo_gettime_real() and
sudo_gettime_mono() functions to get the real and monotonic times
respectively. Now sudo_gettime_mono() checks the value of
sysconf(_SC_MONOTONIC_CLOCK) before calling clock_gettime(CLOCK_MONOTONIC)
and falls back on sudo_gettime_real() as needed. The Mach version
of sudo_gettime_mono() uses mach_absolute_time().
This should fix problems with timestamp files on systems where
the CLOCK_MONOTONIC is defined but not actually implemented.
2015-02-24 11:19:21 -07:00
Todd C. Miller
01a4d6ccbf
Check clock_gettime() return value and warn if it fails.
...
Currently, the timestamp will be ignored if clock_gettime() fails.
2015-02-24 09:53:50 -07:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
ecaecdc1f4
Merge secure_path.h -> sudo_util.h
2014-07-22 11:37:39 -06:00
Todd C. Miller
aecef4aa1d
Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
...
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
f029e3e744
Remove touch() from fileops.c and just call utimes/futimes directly.
...
Rename lock_file -> sudo_lock_file to avoid namespace pollution
2014-06-26 15:51:15 -06:00
Todd C. Miller
b0f1fa7d05
Rename log_warning flags and only send mail if SLOG_SEND_MAIL is
...
set instead of mailing by default like we used to.
2014-05-02 20:54:01 -06:00
Todd C. Miller
954a3e77b1
Add log_warningx
2014-05-02 16:40:30 -06:00
Todd C. Miller
a78da37487
Make set_perms() and restore_perms() return an error instead of
...
calling exit() on failure.
2014-04-10 16:11:47 -06:00
Todd C. Miller
db54815996
Use log_warning() instead of log_fatal() if the ticket or lecture
...
path is too long and just return an error. This can only happen
from a misconfiguration so just ignoring the ticket/lecture file
is safe.
2014-03-26 14:22:46 -06:00
Todd C. Miller
2dfc10830c
Fix warning on systems where mode_t is not unsigned int (Solaris).
2014-03-26 11:09:57 -06:00