]>
Commit | Line | Data |
---|---|---|
3b2d4f6f JR |
1 | diff -ur mingetty-1.07/mingetty.8 mingetty-1.07-remote/mingetty.8 |
2 | --- mingetty-1.07/mingetty.8 2007-02-11 20:48:29.000000000 +0100 | |
3 | +++ mingetty-1.07-remote/mingetty.8 2007-02-11 20:48:14.000000000 +0100 | |
4 | @@ -65,6 +65,9 @@ | |
5 | a login name and password. Check the \-f option from | |
6 | .B /bin/login | |
7 | for this. | |
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 JR |
14 | diff -ur mingetty-1.07/mingetty.c mingetty-1.07-remote/mingetty.c |
15 | --- mingetty-1.07/mingetty.c 2007-02-11 20:48:29.000000000 +0100 | |
16 | +++ mingetty-1.07-remote/mingetty.c 2007-02-11 20:47:45.000000000 +0100 | |
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 | |
28 | @@ -94,6 +98,10 @@ | |
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 JR |
35 | +static char remote_host[MAXHOSTNAMELEN + 1]; |
36 | ||
37 | /* error() - output error messages */ | |
38 | static void error (const char *fmt, ...) | |
39 | @@ -429,7 +439,7 @@ | |
40 | "[--nohangup] [--nohostname] [--long-hostname] " | |
41 | "[--loginprog=/bin/login] [--nice=10] [--delay=10] " | |
42 | "[--chdir=/home] [--chroot=/chroot] [--autologin=user] " | |
43 | - "[--mono] [--defaultlogin=user] " | |
44 | + "[--mono] [--defaultlogin=user] [--remote-host=host] " | |
45 | "tty' with e.g. tty=tty1", progname); | |
46 | } | |
e51ee0a0 | 47 | |
3b2d4f6f JR |
48 | @@ -447,20 +458,20 @@ |
49 | { "loginprog", required_argument, NULL, 'l' }, | |
50 | { "long-hostname", no_argument, &longhostname, 1 }, | |
51 | { "nice", required_argument, NULL, 'n' }, | |
e51ee0a0 | 52 | + { "remote-host", required_argument, NULL, 2}, |
e51ee0a0 SZ |
53 | { 0, 0, 0, 0 } |
54 | }; | |
55 | ||
e51ee0a0 SZ |
56 | int main (int argc, char **argv) |
57 | { | |
58 | char *logname, *s; | |
59 | + int option_index = 0; | |
60 | int c; | |
61 | ||
62 | progname = argv[0]; | |
3b2d4f6f JR |
63 | if (!progname) |
64 | progname = "mingetty"; | |
e51ee0a0 SZ |
65 | uname (&uts); |
66 | - gethostname (hn, MAXHOSTNAMELEN); | |
3b2d4f6f | 67 | - hn[MAXHOSTNAMELEN] = '\0'; |
e51ee0a0 | 68 | pid = getpid (); |
3b2d4f6f JR |
69 | sid = getsid (0); |
70 | #if defined(s390) || defined(__s390__) | |
71 | @@ -470,10 +481,15 @@ | |
72 | #endif | |
e51ee0a0 | 73 | |
3b2d4f6f JR |
74 | while ((c = getopt_long (argc, argv, "a:d:l:n:w:r:", long_options, |
75 | - (int *) 0)) != EOF) { | |
76 | + &option_index)) != EOF) { | |
e51ee0a0 | 77 | switch (c) { |
3b2d4f6f JR |
78 | case 0: |
79 | break; | |
80 | + case 2: | |
81 | + remote_login = 1; | |
82 | + strncpy(remote_host, optarg, MAXHOSTNAMELEN); | |
83 | + remote_host[MAXHOSTNAMELEN] = '\0'; | |
84 | + break; | |
85 | case 'a': | |
86 | autologin = optarg; | |
87 | break; | |
88 | @@ -499,6 +515,13 @@ | |
89 | usage (); | |
e51ee0a0 SZ |
90 | } |
91 | } | |
e51ee0a0 SZ |
92 | + if (!remote_login) |
93 | + gethostname (hn, MAXHOSTNAMELEN); | |
94 | + else { | |
95 | + strncpy(hn, remote_host, MAXHOSTNAMELEN); | |
e51ee0a0 | 96 | + } |
3b2d4f6f | 97 | + hn[MAXHOSTNAMELEN] = '\0'; |
e51ee0a0 | 98 | + |
3b2d4f6f JR |
99 | if (longhostname == 0 && (s = strchr (hn, '.'))) |
100 | *s = '\0'; | |
101 | tty = argv[optind]; | |
102 | @@ -533,7 +556,11 @@ | |
103 | if (priority) | |
104 | nice (priority); | |
e51ee0a0 | 105 | |
3b2d4f6f JR |
106 | - execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL); |
107 | + if (remote_login) { | |
108 | + execl (loginprog, loginprog, "-l", logname, remote_host, NULL); | |
e51ee0a0 | 109 | + } else { |
3b2d4f6f | 110 | + execl (loginprog, loginprog, autologin? "-f" : "--", logname, NULL); |
e51ee0a0 | 111 | + } |
3b2d4f6f JR |
112 | error ("%s: can't exec %s: %s", tty, loginprog, strerror (errno)); |
113 | sleep (5); | |
114 | exit (EXIT_FAILURE); |