Age | Commit message (Collapse) | Author |
|
In function ‘safe_strncpy’,
inlined from ‘set_utmpx’ at sessreg.c:540:3,
inlined from ‘main’ at sessreg.c:357:2:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
In function ‘safe_strncpy’,
inlined from ‘set_utmpx’ at sessreg.c:530:4,
inlined from ‘main’ at sessreg.c:357:2:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
In function ‘safe_strncpy’,
inlined from ‘set_utmpx’ at sessreg.c:532:3,
inlined from ‘main’ at sessreg.c:357:2:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 257 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
In function ‘safe_strncpy’,
inlined from ‘set_utmpx’ at sessreg.c:540:3,
inlined from ‘main’ at sessreg.c:357:2:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
In function ‘safe_strncpy’,
inlined from ‘main’ at sessreg.c:423:5:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 8 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
In function ‘safe_strncpy’,
inlined from ‘main’ at sessreg.c:425:5:
sessreg.c:204:11: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
204 | (void)strncpy(dest, src, n);
| ^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Found by using:
codespell --builtin clear,rare,usage,informal,code,names
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Fixes coverity complaints about potentially unterminated strings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
We already use the macro AC_SYS_LARGEFILE in configure.ac. This will only
work properly if the correct types are used as well: replace long by off_t
when calculating file offsets - which makes a difference on 32-bit systems.
http://bugzilla.opensuse.org/show_bug.cgi?id=981522
Signed-off-by: Egbert Eich <eich@suse.de>
Found-by: Herbert Kütz <herbert.kuetz@ofd-z.niedersachsen.de>
Reviewed-by: Stefan Dirsch <sndirsch@suse.de>
|
|
The handling of the -u & -w flags would only set utmp_file & wtmp_file,
leaving utmpx_file & wtmpx_file set to NULL, disabling the calls to the
code to update those files.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
In the process, try to make the code a little less painful to read.
Still, no love to whomever came up with (*++*a) style coding.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
sessreg.c:360:43: warning: implicit conversion changes signedness:
'unsigned long' to 'off_t' (aka 'long') [-Wsign-conversion]
sysnerr (lseek(llog, (long) pwd->pw_uid*sizeof(ll), 0)
~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
sessreg.c:360:25: warning: implicit conversion changes signedness: 'long' to
'unsigned long' [-Wsign-conversion]
sysnerr (lseek(llog, (long) pwd->pw_uid*sizeof(ll), 0)
^~~~~~~~~~~~~~~~~~~
sessreg.c:405:7: warning: implicit conversion loses integer precision: 'size_t'
(aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
i = strlen (line);
~ ^~~~~~~~~~~~~
sessreg.c:406:9: warning: comparison of integers of different signs: 'int' and
'unsigned long' [-Wsign-compare]
if (i >= sizeof (u->ut_id))
~ ^ ~~~~~~~~~~~~~~~~~
sessreg.c:494:7: warning: implicit conversion loses integer precision: 'size_t'
(aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
i = strlen (line);
~ ^~~~~~~~~~~~~
sessreg.c:495:9: warning: comparison of integers of different signs: 'int' and
'unsigned long' [-Wsign-compare]
if (i >= sizeof (u->ut_id))
~ ^ ~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
The NO_UTMP definition is set on non-FreeBSD, non-OpenBSD, BSD-based
systems. When looking at the commonly used BSD-based operating systems,
they either use utmpx, or I can't think of a reason why the utmp code
wouldn't work.
If it turns out some obscure operating system breaks because of this
change, we should replace this by something more accurate, such as an
Autoconf check or an #ifdef specific to that operating system.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
It is only used within main(). This prevents a compilation failure when
building with -Wshadow.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
For all the other databases (utmp, wtmp, lastlog) we already do it in
sessreg.h. There's no reason why we should place the utmpx specific ones
in sessreg.c.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Make sure file name defines exist on NetBSD.
https://bugs.freedesktop.org/show_bug.cgi?id=50940
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
FreeBSD 8.x and lower have struct lastlog in <utmp.h>. Add a specific
Autoconf check for struct lastlog, where we include both <utmp.h> and
<lastlog.h>.
Also, change NO_LASTLOG to a definition for the opposite; USE_LASTLOG.
This is more consistent with USE_UTMP and USE_UTMPX.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
There is no use for this #define (anymore). We can already assume that
any decent system has time_t defined. It has to, otherwise struct utmp
and struct utmpx can't even be defined.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
The sflag variable is only used when using BSD-style utmp.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
If the system provides pututline(), we just want to use that, instead of
specifically checking for certain operating systems.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
bzero() is not part of POSIX; memset() is.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Don't use the quirky SYSV and __QNX__ definitions to determine whether
the utmp fields exist.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
This prevents pseudo-terminals with names like /dev/pts/0 from getting
trimmed to just 0 instead of pts/0.
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Let Autoconf do the work of setting up the #define in config.h.
Apply and comment standard sections layout.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
As of 9.0, FreeBSD will only support <utmpx.h>. It only implements the
POSIX interface with minor extensions. There is no need to write to
wtmp and lastlog separately, because this is already done by
pututxline(). Add additional checks to configure.ac to search for the
presence of utmpxname() and updwtmpx().
Signed-off-by: Ed Schouten <ed@80386.nl>
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
|
|
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects
make distcheck and all gcc 4.3 and sparse warnings.
|
|
|
|
|
|
ifdefs to find the paths on each platform have been broken out into a new
sessreg.h header that is also preprocessed into sed rules applied to the
man page. Old ifdefs left for Imake compatibility in the 6.9/7.0 hybrid
release have been dropped now that autoconf is required to build.
|
|
|
|
<https://bugs.freedesktop.org/attachment.cgi?id=3472> Use SysV-style
utmp on GNU/kFreeBSD (Robert Millan)
|
|
(reported by Dan McNichol of IBM)
|
|
|
|
|
|
fields. (Egmont Koblinger)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|