MertsA
0a506b3801
Rewind utmp file pointer after searching for entry ( #108 )
...
getutline() advances the file pointer until it matches or reaches EOF. pututline() starts from the current position in utmp. This rewinds the file pointer to the beginning to avoid allocating additional spurious utmp entries.
2021-07-26 09:07:10 -06:00
Todd C. Miller
44a1058aa3
Fix typo in last commit.
2020-09-18 06:09:57 -06:00
Todd C. Miller
4f1fff953b
Guard use of ttyslot() with HAVE_TTYSLOT, fix guard for utmp_setid().
...
This should make it easier to compile sudo on Android which doesn't
provide a way to write to the utmp file. Bug #940 .
2020-09-17 20:05:30 -06:00
Todd C. Miller
961a4afe67
Fix some warnings from pvs-studio
2020-08-12 13:45:09 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
92e42ff548
Add compatibility define for fseeko(3).
...
This is better than cluttering up the code with #ifdefs for obsolete
systems.
2020-02-15 10:22:15 -07:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
dfc32e5b3e
Disable stringop-truncation false positive warnings on gcc 8.
...
Strings in struct utmp/utmpx are not guaranteed to be NUL-terminated.
2019-07-30 12:42:07 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
ecd9688818
Add support for utmps as found in HP-UX.
2018-11-18 07:45:43 -07:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
a885b952fb
Remove use of AC_HEADER_TIME, only obsolete platforms actually
...
need this. Also stop removing sys/time.h unless the source file
uses struct timeval.
2018-01-17 09:52:15 -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
78f3f8bb9d
e_termination should be set to the value of WTERMSIG not WEXITSTATUS
2017-03-08 09:17:53 -07: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
25f39ff31d
suppress a cppcheck false positive
2016-08-12 11:11:49 -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
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
4f9cabd005
Remove obsolete memory.h include.
2015-06-18 21:02:57 -06:00
Todd C. Miller
973286c7ac
Check the return value of gettimeofday(), even though it should
...
never fail.
2015-02-25 07:10:25 -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
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
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
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
99b7351de0
Fix some #if vs. #ifdef and remove an extraneous semicolon.
...
Bug #624 ; from Daniel Richard G.
2013-11-17 16:15:36 -07:00
Todd C. Miller
d6282d154a
Update copyright years.
2013-04-24 09:35:02 -04:00
Todd C. Miller
39acd2fcba
Rename error/errorx -> fatal/fatalx and remove the exit value as
...
it was always 1.
2013-04-18 14:07:59 -04: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
71e2d8290b
Use fseeko() for legacy utmp handling if available.
2012-08-29 10:32:49 -04:00
Todd C. Miller
e4e815dd82
Include signal.h before sudo_exec.h since it uses sigset_t * in the
...
fork_pty prototype.
2012-08-10 15:29:07 -04:00
Todd C. Miller
0fbd5e1bc2
Fix the setutxent and endutxent compatibility defines (this time
...
correctly) when only setutent and endutent are available.
2012-04-23 20:04:26 -04:00
Todd C. Miller
5eb61122a6
Fix compat setutxent and endutxent macros for systems with
...
setutent() but not setutxent(). From Gustavo Zacarias
2012-03-30 07:55:49 -04: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
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
7304bc744e
Add check for old being NULL in utmp_setid(); from Steven McDonald
2011-09-27 09:30:59 -04:00
Todd C. Miller
6f8cd91928
can't -> "unable to" in warning/error messages
2011-05-18 12:36:26 -04:00
Todd C. Miller
c865a462cc
Prepare sudo front end messages for translation.
2011-05-06 17:47:51 -04:00
Todd C. Miller
53d183c380
Add explicit check for struct utmpx.ut_exit.e_termination
...
and struct utmpx.ut_exit.__e_termination. HP-UX uses the latter.
Only update ut_exit if we detect one or the other.
2011-03-29 09:10:40 -04:00
Todd C. Miller
2041d39db7
Add support for ut_exit
2011-03-15 16:18:33 -04:00
Todd C. Miller
3506f01077
Add support for controlling whether utmp is updated and which user is
...
listed in the entry.
2011-03-15 15:53:49 -04:00
Todd C. Miller
07968755aa
For legacy utmp, strip the /dev/ prefix before trying to determine
...
slot since the ttys file does not include the /dev/ prefix.
2011-03-15 15:51:44 -04:00
Todd C. Miller
8653ccc809
Redo utmp handling. If no getutent()/getutxent() is available,
...
assume a ttyslot-based utmp. If getttyent() is available, use
that directly instead of ttyslot() so we don't have to do the
stdin dup2 dance.
2011-03-14 10:20:47 -04:00
Todd C. Miller
1e9def1efa
Move utmp handling into utmp.c
2011-03-11 15:54:12 -05:00