tar: cry murder and bail out if file shrinks under us while we tar it up
[oweals/busybox.git] / loginutils / login.c
index 04283007b213e1a7908c2aa059cee19e2b3d86f2..bd3c112b972dc229ce37f4ea390ad1ebe40ed168 100644 (file)
@@ -260,11 +260,11 @@ int login_main(int argc, char **argv)
                USE_FEATURE_UTMP(
                        safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host));
                )
-               snprintf(fromhost, sizeof(fromhost)-1, " on `%.100s' from "
-                                       "`%.200s'", short_tty, opt_host);
+               snprintf(fromhost, sizeof(fromhost)-1, " on '%.100s' from "
+                                       "'%.200s'", short_tty, opt_host);
        }
        else
-               snprintf(fromhost, sizeof(fromhost)-1, " on `%.100s'", short_tty);
+               snprintf(fromhost, sizeof(fromhost)-1, " on '%.100s'", short_tty);
 
        bb_setpgrp;
 
@@ -302,7 +302,7 @@ auth_failed:
                bb_do_delay(FAIL_DELAY);
                puts("Login incorrect");
                if (++count == 3) {
-                       syslog(LOG_WARNING, "invalid password for `%s'%s",
+                       syslog(LOG_WARNING, "invalid password for '%s'%s",
                                                username, fromhost);
                        return EXIT_FAILURE;
                }
@@ -319,20 +319,20 @@ auth_failed:
                security_context_t old_tty_sid, new_tty_sid;
 
                if (get_default_context(username, NULL, &user_sid)) {
-                       bb_error_msg_and_die("unable to get SID for %s",
+                       bb_error_msg_and_die("cannot get SID for %s",
                                        username);
                }
                if (getfilecon(full_tty, &old_tty_sid) < 0) {
-                       bb_perror_msg_and_die("getfilecon(%.100s) failed",
+                       bb_perror_msg_and_die("getfilecon(%s) failed",
                                        full_tty);
                }
                if (security_compute_relabel(user_sid, old_tty_sid,
                                        SECCLASS_CHR_FILE, &new_tty_sid) != 0) {
-                       bb_perror_msg_and_die("security_change_sid(%.100s) failed",
+                       bb_perror_msg_and_die("security_change_sid(%s) failed",
                                        full_tty);
                }
                if (setfilecon(full_tty, new_tty_sid) != 0) {
-                       bb_perror_msg_and_die("chsid(%.100s, %s) failed",
+                       bb_perror_msg_and_die("chsid(%s, %s) failed",
                                        full_tty, new_tty_sid);
                }
        }
@@ -386,7 +386,14 @@ auth_failed:
        // /* TIOCSCTTY: steal tty from other process group */
        // if (ioctl(0, TIOCSCTTY, 1)) error_msg...
 
-       signal(SIGALRM, SIG_DFL); /* set signals to defaults */
+       /* set signals to defaults */
+       signal(SIGALRM, SIG_DFL);
+       /* Is this correct? This way user can ctrl-c out of /etc/profile,
+        * potentially creating security breach (tested with bash 3.0).
+        * But without this, bash 3.0 will not enable ctrl-c either.
+        * Maybe bash is buggy?
+        * Need to find out what standards say about /bin/login -
+        * should it leave SIGINT etc enabled or disabled? */
        signal(SIGINT, SIG_DFL);
 
        run_shell(tmp, 1, 0, 0);        /* exec the shell finally */