annotate cli-runopts.c @ 39:0883c0906870

tty raw mode support works mostly adding cli-{chansession,runopts}.c which were missing
author Matt Johnston <matt@ucc.asn.au>
date Fri, 30 Jul 2004 12:29:53 +0000
parents
children b4874d772210
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /*
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 * Dropbear - a SSH2 server
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 *
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 * Copyright (c) 2002,2003 Matt Johnston
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 * All rights reserved.
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 *
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 * of this software and associated documentation files (the "Software"), to deal
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 * in the Software without restriction, including without limitation the rights
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 * copies of the Software, and to permit persons to whom the Software is
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 * furnished to do so, subject to the following conditions:
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 *
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be included in
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 * all copies or substantial portions of the Software.
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 *
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 * SOFTWARE. */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 #include "includes.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 #include "runopts.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 #include "signkey.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 #include "buffer.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 #include "dbutil.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 #include "algo.h"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 cli_runopts cli_opts; /* GLOBAL */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 static void printhelp(const char * progname);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 static void printhelp(const char * progname) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 fprintf(stderr, "Dropbear client v%s\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 "Usage: %s [options] [email protected][:port]\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 "Options are:\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 "user Remote username\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 "host Remote host\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 "port Remote port\n"
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 ,DROPBEAR_VERSION, progname);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 void cli_getopts(int argc, char ** argv) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 unsigned int i;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 char ** next = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 uid_t uid;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 struct passwd *pw;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 char* userhostarg = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 /* see printhelp() for options */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 cli_opts.remotehost = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 cli_opts.remoteport = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 cli_opts.username = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 cli_opts.cmd = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 cli_opts.wantpty = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 opts.nolocaltcp = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 opts.noremotetcp = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 /* not yet
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 opts.ipv4 = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67 opts.ipv6 = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
69
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70 if (argc != 2) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 exit(EXIT_FAILURE);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
74
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
75 /* We'll be editing it, should probably make a copy */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76 userhostarg = m_strdup(argv[1]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
77
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78 cli_opts.remotehost = strchr(userhostarg, '@');
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79 if (cli_opts.remotehost == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 /* no username portion, the cli-auth.c code can figure the local
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81 * user's name */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
82 cli_opts.remotehost = userhostarg;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
83 } else {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 cli_opts.remotehost[0] = '\0'; /* Split the user/host */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 cli_opts.remotehost++;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86 cli_opts.username = userhostarg;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89 if (cli_opts.username == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90 uid = getuid();
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92 pw = getpwuid(uid);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 if (pw == NULL || pw->pw_name == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94 dropbear_exit("Couldn't find username for current user");
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 cli_opts.username = m_strdup(pw->pw_name);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 if (cli_opts.remotehost[0] == '\0') {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 dropbear_exit("Bad hostname argument");
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104 cli_opts.remoteport = strchr(cli_opts.remotehost, ':');
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 if (cli_opts.remoteport == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 cli_opts.remoteport = "22";
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 } else {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108 cli_opts.remoteport[0] = '\0';
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
109 cli_opts.remoteport++;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
111
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112 #if 0
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 for (i = 1; i < (unsigned int)argc; i++) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
114 if (next) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
115 *next = argv[i];
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116 if (*next == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
117 dropbear_exit("Invalid null argument");
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
118 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
119 next = 0x00;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
120 continue;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
121 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
122
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
123 if (argv[i][0] == '-') {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
124 switch (argv[i][1]) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
125 case 'b':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
126 next = &svr_opts.bannerfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
127 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
128 #ifdef DROPBEAR_DSS
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
129 case 'd':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
130 next = &svr_opts.dsskeyfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
131 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
132 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
133 #ifdef DROPBEAR_RSA
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
134 case 'r':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
135 next = &svr_opts.rsakeyfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
136 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
137 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
138 case 'F':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
139 svr_opts.forkbg = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
140 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
141 #ifndef DISABLE_SYSLOG
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
142 case 'E':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
143 svr_opts.usingsyslog = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
144 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
145 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
146 #ifndef DISABLE_LOCALTCPFWD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
147 case 'j':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
148 opts.nolocaltcp = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
149 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
150 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
151 #ifndef DISABLE_REMOTETCPFWD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
152 case 'k':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
153 opts.noremotetcp = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
154 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
155 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
156 case 'p':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
157 if (portnum < DROPBEAR_MAX_PORTS) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
158 portstring[portnum] = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
159 next = &portstring[portnum];
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
160 portnum++;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
161 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
162 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
163 #ifdef DO_MOTD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
164 /* motd is displayed by default, -m turns it off */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
165 case 'm':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
166 svr_opts.domotd = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
167 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 case 'w':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 svr_opts.norootlogin = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 #ifdef DROPBEAR_PASSWORD_AUTH
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173 case 's':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 svr_opts.noauthpass = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
176 case 'g':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
177 svr_opts.norootpass = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
178 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
179 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
180 case 'h':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
181 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
182 exit(EXIT_FAILURE);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
183 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
184 /*
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
185 case '4':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
186 svr_opts.ipv4 = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
187 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
188 case '6':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
189 svr_opts.ipv6 = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
190 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
191 */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
192 default:
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
193 fprintf(stderr, "Unknown argument %s\n", argv[i]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
194 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
195 exit(EXIT_FAILURE);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
196 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
197 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
198 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
199 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
200 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
201
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
202 }