summaryrefslogtreecommitdiff
path: root/sessreg.c
AgeCommit message (Collapse)Author
2019-06-09Add comment about why safe_strncpy isn't replaced with strlcpyAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-09-13Replace strncpy calls with a sane version that always terminatesPeter Hutterer
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>
2016-05-30Use off_t instead of long to make largefile support workEgbert Eich
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>
2014-11-04Stop disabling utmpx & wtmpx calls when -u & -w arguments are passedAlan Coopersmith
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>
2014-11-03Zero initialize struct utmpx, as we already do for struct utmpAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-11-03Print which option was in error along with usage messageAlan Coopersmith
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>
2013-01-19Add -V option to print version numberAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-19Combine usage message into a single stringAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-12-16Fix some clang warnings about implicit conversionsAlan Coopersmith
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>
2012-12-16Remove dubious code.Ed Schouten
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>
2012-12-16Make the `line' variable local to main().Ed Schouten
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>
2012-12-16Place NetBSD specific #defines in the proper place.Ed Schouten
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>
2012-07-08Fix compilation on NetBSD - undefined *TMPX pathsThomas Klausner
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>
2011-09-26Add const attributes to fix gcc -Wwrite-strings warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-06-26Make lastlog work on BSD systems without <lastlog.h>.Ed Schouten
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>
2011-06-26Fix whitespace inconsistencies.Ed Schouten
Signed-off-by: Ed Schouten <ed@80386.nl> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-06-26Just use time_t directly.Ed Schouten
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>
2011-06-26Only expose the sflag variable when needed.Ed Schouten
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>
2011-06-26Get rid of SYSV definition. Just check for pututline().Ed Schouten
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>
2011-06-24Get rid of bzero() calls. Replace them by memset().Ed Schouten
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>
2011-06-24Use Autoconf to check for utmp field existence.Ed Schouten
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>
2011-06-24Only split off /dev/ instead trimming to last /.Ed Schouten
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>
2011-06-24Fix typo in function name check.Ed Schouten
Signed-off-by: Ed Schouten <ed@80386.nl> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-06-24Correct whitespace and indentation.Ed Schouten
Signed-off-by: Ed Schouten <ed@80386.nl> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-01-21config: use AC_CHECK_MEMBERS rather than AC_CHECK_MEMBERGaetan Nadon
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>
2010-11-10Sun's copyrights belong to Oracle nowAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-01-16Allow sessreg to be built without <utmp.h>.Ed Schouten
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>
2010-01-11Update Sun license notices to current X.Org standard formAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-10-12Document -L option for lastlog filesAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-01-19Ansification and compile warning fixes.Paulo Cesar Pereira de Andrade
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings.
2008-06-11X_NOT_POSIX bits for pre-POSIX-1990 systems not needed any moreAlan Coopersmith
2006-11-07Clear unused variable warnings from lintAlan Coopersmith
2006-11-07Substitute correct pathnames for utmp/wtmp files in man pagesAlan Coopersmith
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.
2005-10-05Add check for utmpx.ut_syslen structure memberXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901Kevin E Martin
2005-10-03Bug #4678 <https://bugs.freedesktop.org/show_bug.cgi?id=4678> Patch #3472Alan Coopersmith
<https://bugs.freedesktop.org/attachment.cgi?id=3472> Use SysV-style utmp on GNU/kFreeBSD (Robert Millan)
2005-08-18Undo regression in checking for lastlog support in monolithic buildsAlan Coopersmith
(reported by Dan McNichol of IBM)
2005-08-10Merge in utmpx code from Solaris sessreg. Add #ifdefs for autoconf defines.Alan Coopersmith
2005-08-10Add build system for sessreg, broken out from xdm.Daniel Stone
2004-10-13Bug #1627: Zero out struct utmp before writing it to prevent garbagexprint_packagertest_20041217_basexprint_packagertest_20041125_basesco_port_update-baseXORG-6_99_99_900XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1xprint_packagertest_20041217xprint_packagertest_20041125sco_port_updateAdam Jackson
fields. (Egmont Koblinger)
2004-04-23Merging XORG-CURRENT into trunkrel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGElg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAPEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-11-14XFree86 4.3.0.1xf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-4_3_0_1xf86-012804-2330PRE_xf86-4_3_0_1Kaleb Keithley
2003-11-14R6.6 is the Xorg base-lineXORG-MAINXORG-STABLEKaleb Keithley