summaryrefslogtreecommitdiffstats
path: root/login-utils
Commit message (Collapse)AuthorAgeFilesLines
* su: remove duplicate const declarationSami Kerola2017-05-161-1/+1
| | | | | | | | | login-utils/su-common.c:619:14: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier] const char const **args = xcalloc (n_args, sizeof *args); Regression-from: 71f207a5f598623a539ba825b97a503072c4a1b4 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: remove duplicate includesKarel Zak2017-05-121-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* vipw: use getopt_long() to parse optionsSami Kerola2017-05-101-7/+16
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sulogin: add missing typeKarel Zak2017-05-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chfn, chsh: use readline(3) to receive user inputSami Kerola2017-05-033-14/+36
| | | | | | | The readline offers editing capabilities while the user is entering the line, unlike fgets(3) and getline(3) that were used earlier. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sulogin: reduce vulnerability surfaceSami Kerola2017-05-033-58/+54Star
| | | | | | | | | | | | | Hopefully these changes are unreachable code, but better safe than sorry when dealing with setuid root code that is installed everywhere. Quite obviously the introduced abort() calls protect from impossible inputs. Secondly set all possible data to be read-only in attempt to make it more difficult to alter anything at all. Reference: https://www.securecoding.cert.org/confluence/display/c/DCL00-C.+Const-qualify+immutable+objects Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* utmpdump: remove unnecessary variableSami Kerola2017-03-311-3/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: use domain string more carefullyKarel Zak2017-03-131-4/+6
| | | | | | | Use xstrcpy() to explicitly terminate the domain string. Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* login: prevent OOB read on illegal /etc/hushloginsTobias Stoeckmann2017-03-131-1/+2
| | | | | | | | | If the file /etc/hushlogins exists and a line starts with '\0', the login tools are prone to an off-by-one read. I see no reliability issue with this, as it would clearly need a hostile action from a system administrator. But for the sake of correctness, I've sent this patch nonetheless.
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-202-8/+8
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-206-30/+30
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* lib: add timegm() portability function to lib/timeutils.cSami Kerola2017-02-031-0/+1
| | | | | | | | | Local timegm() is a replacement function in cases it is missing from libc implementation. Hopefully the replacement is never, or very rarely, used. CC: Ruediger Meier <ruediger.meier@ga-group.nl> Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* su: properly clear child PIDKarel Zak2017-02-011-4/+10
| | | | | Reported-by: Tobias Stöckmann <tobias@stoeckmann.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'shadow-man' of https://github.com/andhe/util-linuxKarel Zak2017-01-203-5/+9
|\ | | | | | | | | | | | | * 'shadow-man' of https://github.com/andhe/util-linux: chsh: use -h as shorthand for --help instead of -u man: chsh(1): add login.defs to SEE ALSO man: chfn(1): add chsh and login.defs to SEE ALSO
| * chsh: use -h as shorthand for --help instead of -uAndreas Henriksson2017-01-192-5/+6
| | | | | | | | | | | | The -u is still supported (but no longer documented). (This matches the switches used by shadow chsh.)
| * man: chsh(1): add login.defs to SEE ALSOAndreas Henriksson2017-01-191-0/+1
| | | | | | | | (The shadow equivalent manpage lists it.)
| * man: chfn(1): add chsh and login.defs to SEE ALSOAndreas Henriksson2017-01-191-0/+2
| | | | | | | | | | (The shadow version of the same manpage mentions these utils, but does not mention finger.)
* | su, runuser: fix typo in the /etc/default pathKarel Zak2017-01-201-2/+2
|/ | | | | Reported-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
* runuser: add "--" to SYNOPSISKarel Zak2017-01-192-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: use --time-format instruction when printing wtmp creation timeSami Kerola2017-01-161-4/+13
| | | | | | | | This makes --time-format=iso timestamp to look the same as login/logout times. When --time-format=noformat is used the file creation time not printed. There is no change to default format. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: use libc explicit_bzero() when it is availableSami Kerola2017-01-161-0/+6
| | | | | | | This currently new function will be part of glibc 2.25. Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=ea1bd74defcf9d5291d14972e63105168ca9eb4f Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/list: remove LIST_HEAD macroKarel Zak2017-01-052-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | * the variable definition with hidden type is always horrible, for example: int func() { LIST_HEAD(foo); ... } the more readable is: int func() { struct list_head foo; INIT_LIST_HEAD(&foo); ... } * the name LIST_HEAD conflict with /usr/include/sys/queue.h * we use it only on two places in sulogin Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-198-10/+8Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: replace FTP by HTTPS in kernel.org URLsSébastien Helleu2016-12-1912-12/+12
| | | | | | | The links to ftp://ftp.kernel.org/ are replaced by https://www.kernel.org/. Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: last(1): Eliminate oddball formattingMichael Kerrisk2016-12-091-3/+3
| | | | | | \s-2...\s0 is unused anywhere else. Remove it. Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
* docs: last(1): SEE ALSO: add reference to wtmp(5)Michael Kerrisk2016-12-091-0/+1
| | | | Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
* docs: various pages: Use consistent terminology (set-user-ID and set-group-ID)Michael Kerrisk2016-12-092-2/+3
| | | | | | | | | | Use consistent terminology for set-user-ID and set-group-ID bits. There's much inconsistency in the pages. "suid", "set-user-identifier", "setuid". Stick with one terminology, "set-user-ID" and set-grout-ID, as suggested in man-pages(7). Signed-off-by: <mtk.man-pages@gmail.com>
* docs: various pages: Format pathnames as italic (.I)Michael Kerrisk2016-12-094-8/+8
| | | | | | | | | In the majority of pages, pathnames are formatted as Italic, which is the norm. However, there are several cases where they are formatted as bold. This patch fixes a number of those exceptions. Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
* sulogin: bail out from getpasswd(...) on timeoutAndreas Henriksson2016-12-071-0/+4
| | | | | | | | | If timeout happens while waiting in prompt, bail out instead of retrying. Reported-by: Bjørn Mork <bjorn@mork.no> Addresses: http://bugs.debian.org/846107 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* sulogin: make getpasswd(...) return NULL on ^DAndreas Henriksson2016-12-071-0/+1
| | | | | | | | | This makes the caller bail out early instead of evaluating the input as a password. Reported-by: Bjørn Mork <bjorn@mork.no> Addresses: http://bugs.debian.org/846112 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* login-utils: switch to utmpx.hRuediger Meier2016-12-075-51/+53
| | | | | | | | Now the build will fail on many non-Linux systems because utmpx.h is available everywhere but we still use non-POSIX features. We'll fix this next commit. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login: re-add lastlog.h headerRuediger Meier2016-12-071-0/+3
| | | | | | | | | | | | | | | This include was removed in a365953a but we will need it again when we move from utmp.h to utmpx.h. On Linux (glibc, musl) the struct lastlog is defined in utmp.h and lastlog.h just includes utmp.h. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl> Conflicts: login-utils/login.c Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login-utils: avoid using the defined utmp sizes.Ruediger Meier2016-12-071-9/+9
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* utmpdump: code formatting for readabilityRuediger Meier2016-12-071-3/+5
| | | | | | BTW avoid using the defined sizes. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lslogins: remove useless strlen()Ruediger Meier2016-12-071-6/+2Star
| | | | | | | | | | strlen() is not smarter than strncpy(). Bytes that follow a null byte are not compared anyway. BTW avoid using the defined sizes. CC: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* login-utils: remove _HAVE_UT_TV fallbackRuediger Meier2016-12-074-52/+15Star
| | | | | | | | | | _HAVE_UT_TV is glibc only. Moreover we want to move to utmpx where timeval is standard. Now utmp/subsecond (1173d0a6) should work on all supported systems. CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* last: include libgen.h for basename(3p)Ruediger Meier2016-12-071-1/+6
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: spelling, always use "cannot" instead of "can not"Ruediger Meier2016-11-303-4/+4
| | | | | | Just to be consistent ... Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Correctly format page cross referencesMichael Kerrisk (man-pages)2016-11-292-2/+2
| | | | | | | | Most pages in util-linux follow the standard convention of formatting page cross references in bold. Fix the few exceptions that use italic. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* Place SEE ALSO entries in orderMichael Kerrisk (man-pages)2016-11-295-12/+12
| | | | | | | | | | | | This patch does only the following: * Order SEE ALSO entries first by section name, then alphabetically within section * Adds one or two missing commas in SEE ALSO lists * Removes one or two periods that were (inconsistently) used at the end of SEE ALSO lists. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* misc: fix unsigned int usage for ctype.h functionsKarel Zak2016-10-261-1/+1
| | | | | Reported-by: "Yuriy M. Kaminskiy" <yumkam@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "su,runuser: add libseccomp based workaround for TIOCSTI ioctl"Karel Zak2016-10-032-24/+3Star
| | | | | | This reverts commit 8e4925016875c6a4f2ab4f833ba66f0fc57396a2. Stupid hack...
* su,runuser: add libseccomp based workaround for TIOCSTI ioctlKarel Zak2016-09-292-3/+24
| | | | | | | | | | | This patch add libseccomp based syscalls filter to disable TIOCSTI ioctl in su/runuser children. IMHO it is not elegant solution due to dependence on libseccomp (--without-seccomp if hate it)... but there is nothing better for now. Addresses: CVE-2016-2779 Signed-off-by: Karel Zak <kzak@redhat.com>
* su, runuser, setpriv: create links between man pagesKarel Zak2016-08-182-1/+17
| | | | | | | .. and add notes about differences between the utuils. Reported-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/env: minor fixes and clean upsKarel Zak2016-08-161-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: always check setenv(3) return valueSami Kerola2016-08-123-19/+23
| | | | | | At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix declarations shadowing variables in the global scope [oclint]Sami Kerola2016-07-212-6/+6
| | | | | | Fixes multiple occurences of 'optarg' overwrites. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lslogins: simplify if clause and move definition and comments [oclint]Sami Kerola2016-07-211-11/+9Star
| | | | | | | | The if clause change is pretty trivial. Moving the macro near to where it is used makes sense to people who want to read the code. And finally the comment about user list was at wrong spot. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-213-11/+7Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>