Print this page
3808 sulogin should reset console to text mode
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>

@@ -16,11 +16,16 @@
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
+
 /*
+ * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ */
+
+/*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*

@@ -73,10 +78,11 @@
 #include <auth_attr.h>
 #include <auth_list.h>
 #include <nss_dbdefs.h>
 #include <user_attr.h>
 #include <sys/vt.h>
+#include <sys/kd.h>
 
 /*
  * Intervals to sleep after failed login
  */
 #ifndef SLEEPTIME

@@ -440,11 +446,11 @@
 }
 
 static void
 main_loop(char *devname, boolean_t cttyflag)
 {
-        int             fd, i;
+        int             fd, fb, i;
         char            *user = NULL;           /* authorized user */
         char            *pass;                  /* password from user */
         char            *cpass;                 /* crypted password */
         struct spwd     spwd;
         struct spwd     *lshpw;                 /* local shadow */

@@ -476,10 +482,16 @@
         if (fd != 2)
                 (void) dup2(fd, STDERR_FILENO);
         if (fd > 2)
                 (void) close(fd);
 
+        /* Stop progress bar and reset console mode to text */
+        if ((fb = open("/dev/fb", O_RDONLY)) >= 0) {
+                (void) ioctl(fb, KDSETMODE, KD_RESETTEXT);
+                (void) close(fb);
+        }
+
         sysmsgfd = fopen("/dev/sysmsg", "w");
 
         sanitize_tty(fileno(stdin));
 
         for (;;) {