]>
Commit | Line | Data |
---|---|---|
3b2d4f6f | 1 | diff -ur mingetty-1.07/mingetty.8 mingetty-1.07-remote/mingetty.8 |
7e46d3b6 JR |
2 | --- mingetty-1.07/mingetty.8 2007-02-11 21:00:04.000000000 +0100 |
3 | +++ mingetty-1.07-remote/mingetty.8 2007-02-11 20:58:28.000000000 +0100 | |
4 | @@ -69,6 +69,9 @@ | |
4bd21eb8 AM |
5 | Wait for any key before dropping to the login prompt. |
6 | Can be combined with \fB\-\-autologin\fR to save memory by lazily spawning | |
7 | shells. | |
e51ee0a0 SZ |
8 | +.TP |
9 | +.B \-\-remote-host=<hostname> | |
10 | +Login to remote host. Uses /usr/bin/ssh as default login program. | |
e51ee0a0 SZ |
11 | .PP |
12 | .SH "ISSUE ESCAPES" | |
13 | .B mingetty | |
3b2d4f6f | 14 | diff -ur mingetty-1.07/mingetty.c mingetty-1.07-remote/mingetty.c |
7e46d3b6 JR |
15 | --- mingetty-1.07/mingetty.c 2007-02-11 21:00:04.000000000 +0100 |
16 | +++ mingetty-1.07-remote/mingetty.c 2007-02-11 20:59:44.000000000 +0100 | |
3b2d4f6f JR |
17 | @@ -50,6 +50,10 @@ |
18 | #include <sys/kd.h> | |
19 | #include <sys/ttydefaults.h> | |
e51ee0a0 SZ |
20 | |
21 | +#ifndef _PATH_SSH | |
22 | +#define _PATH_SSH "/usr/bin/ssh" | |
23 | +#endif | |
24 | + | |
3b2d4f6f JR |
25 | #ifndef IUTF8 |
26 | # ifndef ASM_IUTF8 | |
27 | # error ASM_IUTF8 input flag not defined - Cannot define IUTF8 | |
7e46d3b6 | 28 | @@ -98,6 +102,12 @@ |
e51ee0a0 | 29 | static int mono_term = 0; |
3b2d4f6f JR |
30 | /* If no login supplied, attempt a default login with this username. */ |
31 | static char *defaultlogin_name = NULL; | |
e51ee0a0 SZ |
32 | +/* Log onto remote host */ |
33 | +static int remote_login = 0; | |
34 | +/* Remote hostname */ | |
3b2d4f6f | 35 | +static char remote_host[MAXHOSTNAMELEN + 1]; |
7e46d3b6 JR |
36 | +/* Do we use user's login app? */ |
37 | +static int another_login = 0; | |
3b2d4f6f JR |
38 | |
39 | /* error() - output error messages */ | |
40 | static void error (const char *fmt, ...) | |
7e46d3b6 | 41 | @@ -433,7 +443,7 @@ |
3b2d4f6f JR |
42 | "[--nohangup] [--nohostname] [--long-hostname] " |
43 | "[--loginprog=/bin/login] [--nice=10] [--delay=10] " | |
44 | "[--chdir=/home] [--chroot=/chroot] [--autologin=user] " | |
4bd21eb8 AM |
45 | - "[--loginpause] [--mono] [--defaultlogin=user] " |
46 | + "[--loginpause] [--mono] [--defaultlogin=user] [--remote-host=host] " | |
3b2d4f6f JR |
47 | "tty' with e.g. tty=tty1", progname); |
48 | } | |
e51ee0a0 | 49 | |
7e46d3b6 | 50 | @@ -453,20 +463,20 @@ |
3b2d4f6f | 51 | { "long-hostname", no_argument, &longhostname, 1 }, |
7e46d3b6 | 52 | { "mono", no_argument, &mono_term, 1}, |
3b2d4f6f | 53 | { "nice", required_argument, NULL, 'n' }, |
e51ee0a0 | 54 | + { "remote-host", required_argument, NULL, 2}, |
e51ee0a0 SZ |
55 | { 0, 0, 0, 0 } |
56 | }; | |
57 | ||
e51ee0a0 SZ |
58 | int main (int argc, char **argv) |
59 | { | |
60 | char *logname, *s; | |
61 | + int option_index = 0; | |
62 | int c; | |
63 | ||
64 | progname = argv[0]; | |
3b2d4f6f JR |
65 | if (!progname) |
66 | progname = "mingetty"; | |
e51ee0a0 SZ |
67 | uname (&uts); |
68 | - gethostname (hn, MAXHOSTNAMELEN); | |
3b2d4f6f | 69 | - hn[MAXHOSTNAMELEN] = '\0'; |
e51ee0a0 | 70 | pid = getpid (); |
3b2d4f6f JR |
71 | sid = getsid (0); |
72 | #if defined(s390) || defined(__s390__) | |
7e46d3b6 | 73 | @@ -479,10 +489,17 @@ |
3b2d4f6f | 74 | #endif |
e51ee0a0 | 75 | |
4bd21eb8 | 76 | while ((c = getopt_long (argc, argv, "a:p:d:l:n:w:r:", long_options, |
3b2d4f6f JR |
77 | - (int *) 0)) != EOF) { |
78 | + &option_index)) != EOF) { | |
e51ee0a0 | 79 | switch (c) { |
3b2d4f6f JR |
80 | case 0: |
81 | break; | |
82 | + case 2: | |
83 | + remote_login = 1; | |
84 | + strncpy(remote_host, optarg, MAXHOSTNAMELEN); | |
85 | + remote_host[MAXHOSTNAMELEN] = '\0'; | |
7e46d3b6 JR |
86 | + if (another_login == 0) |
87 | + loginprog = strdup(_PATH_SSH); | |
3b2d4f6f JR |
88 | + break; |
89 | case 'a': | |
90 | autologin = optarg; | |
91 | break; | |
7e46d3b6 JR |
92 | @@ -490,6 +507,7 @@ |
93 | delay = atoi (optarg); | |
94 | break; | |
95 | case 'l': | |
96 | + another_login = 1; | |
97 | loginprog = optarg; | |
98 | break; | |
99 | case 'n': | |
100 | @@ -508,6 +526,13 @@ | |
3b2d4f6f | 101 | usage (); |
e51ee0a0 SZ |
102 | } |
103 | } | |
e51ee0a0 SZ |
104 | + if (!remote_login) |
105 | + gethostname (hn, MAXHOSTNAMELEN); | |
106 | + else { | |
107 | + strncpy(hn, remote_host, MAXHOSTNAMELEN); | |
e51ee0a0 | 108 | + } |
3b2d4f6f | 109 | + hn[MAXHOSTNAMELEN] = '\0'; |
e51ee0a0 | 110 | + |
3b2d4f6f JR |
111 | if (longhostname == 0 && (s = strchr (hn, '.'))) |
112 | *s = '\0'; | |
113 | tty = argv[optind]; | |
7e46d3b6 | 114 | @@ -542,7 +567,11 @@ |
3b2d4f6f JR |
115 | if (priority) |
116 | nice (priority); | |
e51ee0a0 | 117 | |
3b2d4f6f JR |
118 | - execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL); |
119 | + if (remote_login) { | |
120 | + execl (loginprog, loginprog, "-l", logname, remote_host, NULL); | |
e51ee0a0 | 121 | + } else { |
3b2d4f6f | 122 | + execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL); |
e51ee0a0 | 123 | + } |
3b2d4f6f JR |
124 | error ("%s: can't exec %s: %s", tty, loginprog, strerror (errno)); |
125 | sleep (5); | |
126 | exit (EXIT_FAILURE); |