SOURCES: mingetty-defaultlogin.patch - updated

arekm arekm at pld-linux.org
Sun Feb 11 19:19:19 CET 2007


Author: arekm                        Date: Sun Feb 11 18:19:19 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- updated

---- Files affected:
SOURCES:
   mingetty-defaultlogin.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/mingetty-defaultlogin.patch
diff -u SOURCES/mingetty-defaultlogin.patch:1.1 SOURCES/mingetty-defaultlogin.patch:1.2
--- SOURCES/mingetty-defaultlogin.patch:1.1	Mon Mar  8 02:16:53 2004
+++ SOURCES/mingetty-defaultlogin.patch	Sun Feb 11 19:19:14 2007
@@ -1,47 +1,37 @@
-diff -urN mingetty-0.9.4.orig/mingetty.8 mingetty-0.9.4/mingetty.8
---- mingetty-0.9.4.orig/mingetty.8	2004-03-08 00:35:30.000000000 +0100
-+++ mingetty-0.9.4/mingetty.8	2004-03-08 02:14:18.000000000 +0100
-@@ -3,7 +3,7 @@
- mingetty \- minimal getty for consoles
- .SH SYNOPSIS
- .B mingetty
--[\-\-noclear] [\-\-long\-hostname] [\-\-autologin username]
-+[\-\-noclear] [\-\-long\-hostname] [\-\-autologin username] [\-\-defaultlogin username]
+diff -urN mingetty-1.07.org/mingetty.8 mingetty-1.07/mingetty.8
+--- mingetty-1.07.org/mingetty.8	2007-02-11 18:59:03.438623000 +0100
++++ mingetty-1.07/mingetty.8	2007-02-11 19:00:32.962623000 +0100
+@@ -6,6 +6,7 @@
+ [\-\-noclear] [\-\-nonewline] [\-\-noissue] [\-\-nohangup] [\-\-nohostname]
+ [\-\-long\-hostname] [\-\-loginprog=/bin/login] [\-\-nice=10] [\-\-delay=5]
+ [\-\-chdir=/home] [\-\-chroot=/chroot] [\-\-autologin username] [\-\-mono]
++[\-\-defaultlogin username]
  .I tty
  .PP
  .SH DESCRIPTION
-@@ -58,6 +58,9 @@
- will revert to performing normal interactive logins for all subsequent
- login requests.
+@@ -60,6 +61,9 @@
+ .B \-\-chroot /chroot
+ Call chroot() with this directory name.
  .TP
 +.B \-\-defaultlogin username
 +Log the specified user when no username is supplied in the prompt.
 +.TP
- .B \-\-mono
- Set terminal type to "linux-m" instead of default "linux" (for mono consoles)
- .TP
-diff -urN mingetty-0.9.4.orig/mingetty.c mingetty-0.9.4/mingetty.c
---- mingetty-0.9.4.orig/mingetty.c	2004-03-08 00:35:30.000000000 +0100
-+++ mingetty-0.9.4/mingetty.c	2004-03-08 01:51:19.000000000 +0100
-@@ -17,7 +17,7 @@
-  *  should be very reliable. For a modem getty, I'd also use nothing else
-  *  but mgetty.
-  *
-- *  Usage: mingetty [--noclear] [--autologin username] tty
-+ *  Usage: mingetty [--noclear] [--autologin username] [--defaultlogin username] tty
-  *  Example entry in /etc/inittab: 1:123:respawn:/sbin/mingetty tty1
-  *
-  *  This program is free software; you can redistribute it and/or
-@@ -100,6 +100,8 @@
- static int longhostname = 0;
- /* If supplied, attempt an automatic login with this username. */
- static char *autologin_name = NULL;
-+/* If no login supplied, attempt a default login with this username. */
-+static char *defaultlogin_name = NULL;
+ .B \-\-autologin username
+ Log the specified user automatically in without asking for
+ a login name and password. Check the \-f option from
+diff -urN mingetty-1.07.org/mingetty.c mingetty-1.07/mingetty.c
+--- mingetty-1.07.org/mingetty.c	2007-02-11 18:58:43.434623000 +0100
++++ mingetty-1.07/mingetty.c	2007-02-11 19:13:50.262623000 +0100
+@@ -96,6 +96,8 @@
+ static int mode = K_RAW;
  /* Set mono terminal type */
  static int mono_term = 0;
- /* Log onto remote host */
-@@ -350,6 +352,27 @@
++/* If no login supplied, attempt a default login with this username. */
++static char *defaultlogin_name = NULL;
+ 
+ /* error() - output error messages */
+ static void error (const char *fmt, ...)
+@@ -299,6 +301,27 @@
  	}
  }
  
@@ -53,73 +43,90 @@
 + */
 +static int defaultlogin_ok(void)
 +{
-+	char c, *cp;
++       char c, *cp;
 +
-+	/* An all-alphanumeric defaultlogin name must be supplied. */
-+	if (defaultlogin_name == NULL || defaultlogin_name[0] == '\0')
-+		return 0;
-+	for (cp = defaultlogin_name; (c = *cp); cp++)
-+		if (!isalnum(c) && c != '_')
-+			return 0;
++       /* An all-alphanumeric defaultlogin name must be supplied. */
++       if (defaultlogin_name == NULL || defaultlogin_name[0] == '\0')
++               return 0;
++       for (cp = defaultlogin_name; (c = *cp); cp++)
++               if (!isalnum(c) && c != '_')
++                       return 0;
 +
-+	/* All tests are okay, so grant the defaultlogin request. */
-+	return 1;
++       /* All tests are okay, so grant the defaultlogin request. */
++       return 1;
 +}
 +
  /* do_prompt - show login prompt, optionally preceded by /etc/issue contents */
- static void do_prompt (void)
+ static void do_prompt (int showlogin)
  {
-@@ -378,7 +401,13 @@
+@@ -318,8 +341,13 @@
  	}
- #endif
- 	write (1, hn, strlen (hn));
--	write (1, LOGIN, sizeof (LOGIN) - 1);
-+	write (1, LOGIN, sizeof (LOGIN) - 3);
-+	if(defaultlogin_ok()) {
-+		write (1, " (", 2);
-+		write (1, defaultlogin_name, strlen(defaultlogin_name));
-+		write (1, ")", 1);
-+	};
-+	write (1, ": ", 2);
+ 	if (nohostname == 0)
+ 		printf ("%s ", hn);
+-	if (showlogin)
+-		printf ("login: ");
++	if (showlogin) {
++		printf ("login");
++		if (defaultlogin_ok())
++			printf (" (%s)", defaultlogin_name);
++		printf (": ");
++	}
++
+ 	fflush (stdout);
  }
  
- /* get_logname - get user name, establish speed, erase, kill, eol */
-@@ -410,6 +439,7 @@
- 			else
- 				*bp++ = c;
+@@ -372,6 +400,8 @@
+ 
+ 			*bp++ = c;
  		}
-+		if(defaultlogin_ok()) break;
++		if (defaultlogin_ok())
++			break;
  	}
- 	return logname;
+ 
+ 	if (!ascii && (ic = iconv_open("WCHAR_T", "UTF-8"))) {
+@@ -403,7 +433,7 @@
+ 		"[--nohangup] [--nohostname] [--long-hostname] "
+ 		"[--loginprog=/bin/login] [--nice=10] [--delay=10] "
+ 		"[--chdir=/home] [--chroot=/chroot] [--autologin=user] "
+-		"[--mono] "
++		"[--mono] [--defaultlogin=user] "
+ 		"tty' with e.g. tty=tty1", progname);
  }
-@@ -484,6 +514,7 @@
- 	{ "noclear", no_argument, &noclear, 1},
- 	{ "long-hostname", no_argument, &longhostname, 1},
-  	{ "autologin", required_argument, NULL, 'a'},
-+ 	{ "defaultlogin", required_argument, NULL, 'd'},
- 	{ "mono", no_argument, &mono_term, 1},
- 	{ "remote-host", required_argument, NULL, 2},
- 	{ "login-program", required_argument, NULL, 3},
-@@ -522,6 +553,9 @@
- 			case 'a':
- 				autologin_name = optarg;
- 				break;
-+			case 'd':
-+				defaultlogin_name = optarg;
-+				break;
- 			default:
- 				usage ();
- 		}
-@@ -564,6 +598,12 @@
-  	if (autologin_ok()) {
-  		execl (_PATH_LOGIN, _PATH_LOGIN, "-f", autologin_name, NULL);
-  	} else {
-+
-+ 	if (defaultlogin_ok()) {
-+		logname = get_logname ();
-+		if(*logname == 0)
-+			execl (_PATH_LOGIN, _PATH_LOGIN, "--", defaultlogin_name, NULL);
-+	} else
- 	while ((logname = get_logname ()) == 0);
  
- 	if (!remote_login) {
+@@ -411,6 +441,7 @@
+ 	{ "autologin", required_argument, NULL, 'a' },
+ 	{ "chdir", required_argument, NULL, 'w' },
+ 	{ "chroot", required_argument, NULL, 'r' },
++	{ "defaultlogin", required_argument, NULL, 'u'},
+ 	{ "delay", required_argument, NULL, 'd' },
+ 	{ "noclear", no_argument, &noclear, 1 },
+ 	{ "nonewline", no_argument, &nonewline, 1 },
+@@ -467,6 +498,9 @@
+ 		case 'r':
+ 			ch_root = optarg;
+ 			break;
++		case 'u':
++			defaultlogin_name = optarg;
++			break;
+ 		case 'w':
+ 			ch_dir = optarg;
+ 			break;
+@@ -491,9 +525,15 @@
+ 		do_prompt (0);
+ 		printf ("login: %s (automatic login)\n", autologin);
+ 		logname = autologin;
+-	} else
+-		while ((logname = get_logname ()) == 0)
+-			/* do nothing */ ;
++	} else {
++		if (defaultlogin_ok()) {
++			logname = get_logname ();
++			if(*logname == 0)
++				logname = defaultlogin_name;
++		} else
++			while ((logname = get_logname ()) == 0)
++				/* do nothing */ ;
++	}
+ 
+ 	if (ch_root)
+ 		chroot (ch_root);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/mingetty-defaultlogin.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list