summaryrefslogtreecommitdiffstats
path: root/login-utils
Commit message (Collapse)AuthorAgeFilesLines
* lib: rename time-util.c to timeutils.c, fix headersKarel Zak2013-09-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: fix memory leakSami Kerola2013-09-101-0/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* su: fix lastlog and btmp loggingKarel Zak2013-09-091-4/+1Star
| | | | | | | | | | | | | | | | The su(1) logging code mix ups "old" and "new" passwd structs. The result is things like Sep 9 11:50:45 x2 su: (to kzak) kzak on none in /var/log/messages. The right log entry is Sep 9 11:50:45 x2 su: (to root) kzak on pts/3 The bug has been introduced by commit c74a7af17c7a176c358dfaa8e1814786c89ebc14. References: https://bugzilla.redhat.com/show_bug.cgi?id=1005194 Signed-off-by: Karel Zak <kzak@redhat.com>
* last: --fulltime and --time-format are mutually exclusiveKarel Zak2013-09-021-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: consolidate time formatting to one structKarel Zak2013-09-021-23/+22Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: use bit arrayKarel Zak2013-09-021-16/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* utmpdump: make IPv6 addresses workSami Kerola2013-08-291-9/+13
| | | | | | | | | | | | (unless bug[s]) This change is backwards compatibile. Earlier binary to text dumps can be converted back to binary, or otherway around. The only thing that will not work are IPv6 addresses that possible earlier conversion had broke. Such conversions resulted with random IPv4 in place of IPv6 address in text format, and original information is gone forever. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last, utmpdump, agetty, wall, write: avoid compatibility hacksSami Kerola2013-08-292-24/+37
| | | | | | | | In include/bits/utmp.h the ut_user and ut_time macros are marked with comment they are backwards compatibility hacks. It is probably best to avoid use of these macros where ever possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: tell verbally system is still runningSami Kerola2013-08-291-2/+11
| | | | | | | | | Use of uptime time stamp as previous boot login time makes the output not constant, which is rather difficult to test. Verbal message 'system is still running' makes testing easy, and noticing which boot is still running clear to a person. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: trim trailing white spacesSami Kerola2013-08-291-0/+18
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: never restrict session timeSami Kerola2013-08-291-2/+2
| | | | | | | When a session time will reach whopping 10000 days the last round bracket is unnecessarily removed from output. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add --time-format to last(1) manual pageSami Kerola2013-08-291-0/+22
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: add --time-format with iso-8601 formatSami Kerola2013-08-291-23/+111
| | | | | | | | | The ISO-8601 format makes consuming time stamps easy with various parsers. The format includes time zone information which is crucial when an investigator is trying to make sense outputs collected from systems all a across planet. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: use configuration structSami Kerola2013-08-291-98/+113
| | | | | | | | This allows reducing global variables and will minimize number of arguments for functions making code a little bit easier to read, and maintain. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: fix --present option logic errorSami Kerola2013-08-291-1/+1
| | | | | | | Printing of sessions 'still logged in' was skipped because an error in logic. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add --since and time option formats to last(1) manualSami Kerola2013-08-291-8/+31
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: add --since time spec optionSami Kerola2013-08-291-6/+20
| | | | | | The --since and --until options are companions often needed together. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/time-util: move YYYYMMDDHHMMSS to common parserSami Kerola2013-08-291-45/+0Star
| | | | | | | | | Even while the YYYYMMDDHHMMSS time format it not magnificent it is best to make it to be part of the one, and only, time format parser. Proposed-by: Karel Zak <kzak@redhat.com> References: http://markmail.org/message/6baqt4ttkopu7ra6 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: parse easy to use time formatsSami Kerola2013-08-292-2/+11
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add --present to last(1) manual pageSami Kerola2013-08-291-0/+6
| | | | | | I forgot to update manual after writing this functionality. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: fix typoSami Kerola2013-08-291-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* su: suppress PAM info messages for -c or non-login sessionsKarel Zak2013-08-271-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | The 'Last login:' messages from PAM lastlogin module is unexpected for non-login sessions or when -c <command> executed. For example: $ su - -c id Last login: Wed Jul 24 08:36:28 CEST 2013 from dhcp-25-161.brq.redhat.com on pts/18 uid=0(root) gid=0(root) skupiny=0(root) this makes 'su' useless in scripts. This patch suppress all PAM_TEXT_INFO messages for -c and for non-login session ('-' is not specified) after pam_authenticate() and pam_acct_mgmt(). Note that the new PAM conversation function checks the first message in the msg[] array only. It seems good enough as PAM internally uses pam_info() function that does not use multiple messages for one conv call. References: https://bugzilla.redhat.com/show_bug.cgi?id=987787 Signed-off-by: Karel Zak <kzak@redhat.com>
* last: mention optional arguments in usageKarel Zak2013-08-232-3/+3
| | | | | Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* last: add --present optionSami Kerola2013-08-231-11/+24
| | | | | | | The --present option will allow user to easily determine who where logged in at a given time. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: allow --file to be defined multiple timesSami Kerola2013-08-232-91/+115
| | | | | | | This is useful when an admin is trying to find something, and has to process all available data. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: global variables are initialize automatically to zeroSami Kerola2013-08-231-6/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: use as narrow variable scoping as possibleSami Kerola2013-08-231-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: remove broken codeSami Kerola2013-08-231-36/+0Star
| | | | | | | | | | | Comment in the deletion tells everything necessary. "This doesn't work on modern systems, where only a DNS lookup of the result from hostname() will get you the domainname. Remember that domainname() is the NIS domainname, not DNS. So basically this whole piece of code is bullshit." Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: prefer enum rather than #definition listSami Kerola2013-08-231-7/+9
| | | | | | | Incremental number lists are more hard to get wrong with enum, and they are nicer to debug as for example gdb is aware of these symbolic names. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: make switch cases complete, and inform if impossible occursSami Kerola2013-08-231-0/+11
| | | | | | | | | | Some of the ut_type numbers does not seem to be recognized by last(1) so they are, at least for now, silently ignored. See glibc documentation for information what the ignored EMPTY, INIT_PROCESS, LOGIN_PROCESS, and ACCOUNTING mean. Reference: FIXME Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: check expected numeric user input is numberSami Kerola2013-08-232-4/+5
| | | | | | | This commit also changes the line count to use unsigned integers, as negative numbers in this context does not make sense. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: use carefulput() for printable character outputSami Kerola2013-08-231-6/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add long options to last.1 manual pageSami Kerola2013-08-231-78/+102
| | | | | | And align the manual page with Documentation/howto-man-page.txt Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: add link to util-linux to last.1Karel Zak2013-08-131-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: coding style clean upKarel Zak2013-08-131-247/+255
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: use xalloc.h, err.h, nls.h and EXIT_ macrosKarel Zak2013-08-121-63/+21Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: consolidate btmp/wtmp file pathsKarel Zak2013-08-121-24/+4Star
| | | | | | .. so share the paths with another utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* last: add long options, improve usage()Karel Zak2013-08-121-12/+60
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix last stuffKarel Zak2013-08-121-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: clean up the begin of the fileKarel Zak2013-08-121-31/+21Star
| | | | | | .. and improve last(1) stuff in configure script. Signed-off-by: Karel Zak <kzak@redhat.com>
* last: merge sysvinit last/lastbOndrej Oprala2013-08-126-472/+1462
| | | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: fix compiler warningKarel Zak2013-07-091-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: fix memory leak [clang-analyzer]Sami Kerola2013-07-091-2/+6
| | | | | | And make code a little bit more robust. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chfn: assigned value is never read [clang-analyzer]Sami Kerola2013-07-091-1/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* utmpdump: assigned values are never read [clang-analyzer]Sami Kerola2013-07-091-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-3/+3
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* su: fix exit status if terminated by signalOndrej Oprala2013-06-072-15/+50
| | | | | | | [kzak@redhat.com: - add comment] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: improve grammar and consistency of comments in login.cBenno Schulenberg2013-06-071-85/+77Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: tiny alphabetical and grammatical tweakBenno Schulenberg2013-06-071-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: standardize the spelling of "superuser"Benno Schulenberg2013-06-071-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>