SOURCES: mingetty-remote.patch - updated to 1.07

baggins baggins at pld-linux.org
Sun Feb 11 20:55:13 CET 2007


Author: baggins                      Date: Sun Feb 11 19:55:13 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- updated to 1.07

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

---- Diffs:

================================================================
Index: SOURCES/mingetty-remote.patch
diff -u SOURCES/mingetty-remote.patch:1.1 SOURCES/mingetty-remote.patch:1.2
--- SOURCES/mingetty-remote.patch:1.1	Tue Jul  4 17:09:32 2000
+++ SOURCES/mingetty-remote.patch	Sun Feb 11 20:55:08 2007
@@ -1,69 +1,58 @@
-diff -Naur mingetty-0.9.4/Makefile mingetty-0.9.4-p/Makefile
---- mingetty-0.9.4/Makefile	Tue Jul  4 16:55:38 2000
-+++ mingetty-0.9.4-p/Makefile	Tue Jul  4 17:06:07 2000
-@@ -1,5 +1,5 @@
- CC=gcc
--OPT=-O2
-+OPT=-O2 -g
- CFLAGS=$(OPT) -Wall -pipe -D_GNU_SOURCE
- # my compiler doesn't need -fno-strength-reduce
- LDFLAGS=-Wl,-warn-common -s
-diff -Naur mingetty-0.9.4/mingetty.8 mingetty-0.9.4-p/mingetty.8
---- mingetty-0.9.4/mingetty.8	Tue Jul  4 16:55:38 2000
-+++ mingetty-0.9.4-p/mingetty.8	Tue Jul  4 16:39:38 2000
-@@ -29,6 +29,13 @@
- .TP
- .B \-\-mono
- Set terminal type to "linux-m" instead of default "linux" (for mono consoles)
+diff -ur mingetty-1.07/mingetty.8 mingetty-1.07-remote/mingetty.8
+--- mingetty-1.07/mingetty.8	2007-02-11 20:48:29.000000000 +0100
++++ mingetty-1.07-remote/mingetty.8	2007-02-11 20:48:14.000000000 +0100
+@@ -65,6 +65,9 @@
+ a login name and password. Check the \-f option from
+ .B /bin/login
+ for this.
 +.TP
 +.B \-\-remote-host=<hostname>
 +Login to remote host. Uses /usr/bin/ssh as default login program.
-+.TP
-+.B \-\-login-program=<program>
-+Use <program> instead of default login application. Mingetty passes
-+arguments: "-- username" (for local login), or "-l username hostname" (for remote login)
  .PP
  .SH "ISSUE ESCAPES"
  .B mingetty 
-diff -Naur mingetty-0.9.4/mingetty.c mingetty-0.9.4-p/mingetty.c
---- mingetty-0.9.4/mingetty.c	Tue Jul  4 16:55:38 2000
-+++ mingetty-0.9.4-p/mingetty.c	Tue Jul  4 17:03:23 2000
-@@ -48,6 +48,10 @@
- #define _PATH_LOGIN "/bin/login"
- #endif
+diff -ur mingetty-1.07/mingetty.c mingetty-1.07-remote/mingetty.c
+--- mingetty-1.07/mingetty.c	2007-02-11 20:48:29.000000000 +0100
++++ mingetty-1.07-remote/mingetty.c	2007-02-11 20:47:45.000000000 +0100
+@@ -50,6 +50,10 @@
+ #include <sys/kd.h>
+ #include <sys/ttydefaults.h>
  
 +#ifndef _PATH_SSH
 +#define _PATH_SSH "/usr/bin/ssh"
 +#endif
 +
- #ifdef linux
- #include <sys/param.h>
- #define USE_SYSLOG
-@@ -82,6 +86,14 @@
- static int longhostname = 0;
- /* Set mono terminal type */
+ #ifndef IUTF8
+ # ifndef ASM_IUTF8
+ #  error ASM_IUTF8 input flag not defined - Cannot define IUTF8
+@@ -94,6 +98,10 @@
  static int mono_term = 0;
+ /* If no login supplied, attempt a default login with this username. */
+ static char *defaultlogin_name = NULL;
 +/* Log onto remote host */
 +static int remote_login = 0;
 +/* Remote hostname */
-+static char remote_host[1024];
-+/* Do we use user's login app? */
-+static int another_login = 0;
-+/* Login program */
-+static char login_program[1024];
- 
- /*
-  * output error messages
-@@ -395,6 +407,8 @@
- 	{ "noclear", no_argument, &noclear, 1},
- 	{ "long-hostname", no_argument, &longhostname, 1},
- 	{ "mono", no_argument, &mono_term, 1},
++static char remote_host[MAXHOSTNAMELEN + 1];
+ 
+ /* error() - output error messages */
+ static void error (const char *fmt, ...)
+@@ -429,7 +439,7 @@
+ 		"[--nohangup] [--nohostname] [--long-hostname] "
+ 		"[--loginprog=/bin/login] [--nice=10] [--delay=10] "
+ 		"[--chdir=/home] [--chroot=/chroot] [--autologin=user] "
+-		"[--mono] [--defaultlogin=user] "
++		"[--mono] [--defaultlogin=user] [--remote-host=host] "
+ 		"tty' with e.g. tty=tty1", progname);
+ }
+ 
+@@ -447,20 +458,20 @@
+ 	{ "loginprog", required_argument, NULL, 'l' },
+ 	{ "long-hostname", no_argument, &longhostname, 1 },
+ 	{ "nice", required_argument, NULL, 'n' },
 +	{ "remote-host", required_argument, NULL, 2},
-+	{ "login-program", required_argument, NULL, 3},
  	{ 0, 0, 0, 0 }
  };
  
-@@ -404,24 +418,43 @@
  int main (int argc, char **argv)
  {
  	char *logname, *s;
@@ -71,60 +60,55 @@
  	int c;
  
  	progname = argv[0];
+ 	if (!progname)
+ 		progname = "mingetty";
  	uname (&uts);
 -	gethostname (hn, MAXHOSTNAMELEN);
+-	hn[MAXHOSTNAMELEN] = '\0';
  	pid = getpid ();
- 	time (&cur_time);
+ 	sid = getsid (0);
+ #if	defined(s390) || defined(__s390__)
+@@ -470,10 +481,15 @@
+ #endif
  
--	while ((c = getopt_long (argc, argv, "", long_options, (int *) 0))
-+	while ((c = getopt_long (argc, argv, "", long_options, &option_index))
- 			!= EOF) {
+ 	while ((c = getopt_long (argc, argv, "a:d:l:n:w:r:", long_options,
+-		(int *) 0)) != EOF) {
++		&option_index)) != EOF) {
  		switch (c) {
- 			case 0:
- 				break;
-+			case 2:
-+				remote_login = 1;
-+				strncpy(remote_host, optarg, 1024);
-+				remote_host[1023] = '\0';
-+				break;
-+			case 3:
-+				another_login = 1;
-+				strncpy(login_program, optarg, 1024);
-+				login_program[1023] = '\0';
-+				break;
- 			default:
- 				usage ();
+ 		case 0:
+ 			break;
++		case 2:
++			remote_login = 1;
++			strncpy(remote_host, optarg, MAXHOSTNAMELEN);
++			remote_host[MAXHOSTNAMELEN] = '\0';
++			break;
+ 		case 'a':
+ 			autologin = optarg;
+ 			break;
+@@ -499,6 +515,13 @@
+ 			usage ();
  		}
  	}
- 	
 +	if (!remote_login)
 +		  gethostname (hn, MAXHOSTNAMELEN);
 +	else {
 +		  strncpy(hn, remote_host, MAXHOSTNAMELEN);
-+		  hn[MAXHOSTNAMELEN] = '\0';
-+		  if ((!longhostname)&&(strchr(hn,'.')))
-+			  *(strchr(hn,'.')) = '\0';
 +	}
++	hn[MAXHOSTNAMELEN] = '\0';
 +
- 	if (mono_term)
- 		putenv ("TERM=linux-m");
- 	else
-@@ -445,8 +478,16 @@
- 
- 	while ((logname = get_logname ()) == 0);
- 
--	execl (_PATH_LOGIN, _PATH_LOGIN, "--", logname, NULL);
--	error ("%s: can't exec " _PATH_LOGIN ": %s", tty, sys_errlist[errno]);
-+	if (!remote_login) {
-+		  if (!another_login)
-+			    strncpy(login_program, _PATH_LOGIN, 1024);
-+		  execl (login_program, login_program, "--", logname, NULL);
+ 	if (longhostname == 0 && (s = strchr (hn, '.')))
+ 		*s = '\0';
+ 	tty = argv[optind];
+@@ -533,7 +556,11 @@
+ 	if (priority)
+ 		nice (priority);
+ 
+-	execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL);
++	if (remote_login) {
++		execl (loginprog, loginprog, "-l", logname, remote_host, NULL);
 +	} else {
-+		  if (!another_login)
-+			    strncpy(login_program, _PATH_SSH, 1024);
-+		  execl (login_program, login_program, "-l", logname, remote_host, NULL);
++		execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL);
 +	}
-+	error ("%s: can't exec %s: %s", login_program, tty, sys_errlist[errno]);
- 	exit (0);
- }
- 
+ 	error ("%s: can't exec %s: %s", tty, loginprog, strerror (errno));
+ 	sleep (5);
+ 	exit (EXIT_FAILURE);
================================================================

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



More information about the pld-cvs-commit mailing list