]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: don't run if not found passww entry [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 13:50:52 +0000 (14:50 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 13:50:52 +0000 (14:50 +0100)
sulogin(8) should not run if there is no /etc/{passwd,shadow} entry
and --force command line option is no specified otherwise NULL pointer
dereference is possible.

Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/sulogin.c

index 621df1e4fcf88b53f02af2d577c49cbcad690c12..71308583c33f0401e5479797caf84f347cba561b 100644 (file)
@@ -877,6 +877,7 @@ int main(int argc, char **argv)
        if ((pwd = getrootpwent(opt_e)) == NULL) {
                warnx(_("cannot open password database."));
                sleep(2);
+               return EXIT_FAILURE;
        }
 
        /*