summaryrefslogtreecommitdiffstats
path: root/login-utils/sulogin-consoles.c
Commit message (Collapse)AuthorAgeFilesLines
* sulogin: reduce vulnerability surfaceSami Kerola2017-05-031-10/+10
| | | | | | | | | | | | | 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>
* lib/list: remove LIST_HEAD macroKarel Zak2017-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* misc: spelling, always use "cannot" instead of "can not"Ruediger Meier2016-11-301-1/+1
| | | | | | Just to be consistent ... Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* sulogin: remove __nonnull__ function attributeSami Kerola2016-07-141-1/+1
| | | | | | | | | | | | | This change fixes compiler option -Werror=nonnull option warning: login-utils/sulogin-consoles.c: In function 'append_console': login-utils/sulogin-consoles.c:324:14: warning: nonnull argument 'consoles' compared to NULL [-Wnonnull-compare] The NULL check done with list_empty() looks valid, so it is best to remove the function attribute that allows compiler to optimize the check away. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* sulogin: make fopen O_CLOEXEC specifier usage portableSami Kerola2016-04-171-2/+2
| | | | | | | | The close at exit specifier "e" is glibc extension, so use it only if when the extension is available. Proposed-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Revert "include sysmacros.h where used"Karel Zak2016-03-081-1/+0Star
| | | | This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.
* include sysmacros.h where usedMike Frysinger2016-03-081-0/+1
| | | | | | | | BSD/Linux systems stick major/minor/makedev in sysmacros.h. Newer Linux libraries have been moving away from including sysmacros.h implicitly via sys/types.h, so include it directly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* sulogin: avoid shared memory area usemask but use waitid() for childsWerner Fink2016-02-121-11/+42
| | | | | | | | | This small patch improves the console detection code and also avoids not existing device nodes due strdup() which is used in canonicalize_path(). Beside this now the code for emergeny mount does work if enabled at configure time. Signed-off-by: Werner Fink <werner@suse.de>
* docs: fix typos found by codespellRuediger Meier2016-02-031-1/+1
| | | | | | Using "codespell" from https://github.com/lucasdemarchi/codespell Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* sulogin: Use fallback method on the Hurd for detecting consolesJames Clarke2015-10-161-0/+8
| | | | Signed-off-by: James Clarke <jrtc27@jrtc27.com>
* sulogin: Use read instead of allocated size from getline()Guillem Jover2015-06-081-2/+4
| | | | | | | | The getline function distinguishes between the allocated and read lenghts, and we should not mix them up, as we might end up processing junk. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* sulogin: make sure that fallback FD is valid [coverity scan]Karel Zak2015-01-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: find a suitable console device Werner Fink2014-05-131-2/+4
| | | | | | | Enable sulogin to find a suitable console device even if the first line in /proc/consoles does not have any major and minor number. Signed-off-by: Werner Fink <werner@suse.de>
* sulogin: use dirent->d_type when scans /devKarel Zak2013-11-121-0/+5
| | | | | | ... it's more effective than call fstatat() for all device. 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>
* sulogin: fix compiler warningsKarel Zak2013-04-171-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* remove duplicate includesKarel Zak2013-03-201-8/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/ttyutils: add default chardataWerner Fink2013-01-081-7/+1Star
| | | | | | | | | | | | this one moves the init_chardata to include/ttyutils.h as well as to lib/include/ttyutils.c. Also the macros CTL/CTRL are fixed in agetty.c and sulogin.c to use the XOR variant CTL. [kzak@redhat.com: use macro rather than global variable for default chardata] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: don't use {de,con}structor attributesKarel Zak2012-12-231-2/+6
| | | | | | | We're not Russian roulette players, so don't use such ugly things at all.. Reported-by: Dave Reisner <d@falconindy.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: remove consoles.c from libcommonKarel Zak2012-12-231-0/+781
- move struct chardata to include/ttyutils.h - move console.{h,c} to login-utils/sulogin-* (it's sulogin specific) - fix sulogin and agetty includes Signed-off-by: Karel Zak <kzak@redhat.com>