annotate cli-runopts.c @ 41:18eccbfb9641

added window-size change handling
author Matt Johnston <matt@ucc.asn.au>
date Sun, 01 Aug 2004 09:41:37 +0000
parents b4874d772210
children 3bea78e1b175
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] user@host[: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 */
40
b4874d772210 - Added terminal mode handling etc for the client, and window change
Matt Johnston <matt@ucc.asn.au>
parents: 39
diff changeset
58 cli_opts.progname = argv[0];
39
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 cli_opts.remotehost = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 cli_opts.remoteport = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 cli_opts.username = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 cli_opts.cmd = NULL;
40
b4874d772210 - Added terminal mode handling etc for the client, and window change
Matt Johnston <matt@ucc.asn.au>
parents: 39
diff changeset
63 cli_opts.wantpty = 1;
39
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 opts.nolocaltcp = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 opts.noremotetcp = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 /* not yet
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67 opts.ipv4 = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 opts.ipv6 = 1;
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 if (argc != 2) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 exit(EXIT_FAILURE);
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76 /* 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
77 userhostarg = m_strdup(argv[1]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79 cli_opts.remotehost = strchr(userhostarg, '@');
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 if (cli_opts.remotehost == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81 /* 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
82 * user's name */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
83 cli_opts.remotehost = userhostarg;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 } else {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 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
86 cli_opts.remotehost++;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 cli_opts.username = userhostarg;
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90 if (cli_opts.username == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 uid = getuid();
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 pw = getpwuid(uid);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94 if (pw == NULL || pw->pw_name == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 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
96 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 cli_opts.username = m_strdup(pw->pw_name);
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 if (cli_opts.remotehost[0] == '\0') {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 dropbear_exit("Bad hostname argument");
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 cli_opts.remoteport = strchr(cli_opts.remotehost, ':');
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 if (cli_opts.remoteport == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 cli_opts.remoteport = "22";
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108 } else {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
109 cli_opts.remoteport[0] = '\0';
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 cli_opts.remoteport++;
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 #if 0
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
114 for (i = 1; i < (unsigned int)argc; i++) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
115 if (next) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116 *next = argv[i];
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
117 if (*next == NULL) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
118 dropbear_exit("Invalid null argument");
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
119 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
120 next = 0x00;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
121 continue;
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
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
124 if (argv[i][0] == '-') {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
125 switch (argv[i][1]) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
126 case 'b':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
127 next = &svr_opts.bannerfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
128 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
129 #ifdef DROPBEAR_DSS
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
130 case 'd':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
131 next = &svr_opts.dsskeyfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
132 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
133 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
134 #ifdef DROPBEAR_RSA
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
135 case 'r':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
136 next = &svr_opts.rsakeyfile;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
137 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
138 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
139 case 'F':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
140 svr_opts.forkbg = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
141 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
142 #ifndef DISABLE_SYSLOG
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
143 case 'E':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
144 svr_opts.usingsyslog = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
145 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
146 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
147 #ifndef DISABLE_LOCALTCPFWD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
148 case 'j':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
149 opts.nolocaltcp = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
150 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
151 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
152 #ifndef DISABLE_REMOTETCPFWD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
153 case 'k':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
154 opts.noremotetcp = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
155 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
156 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
157 case 'p':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
158 if (portnum < DROPBEAR_MAX_PORTS) {
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
159 portstring[portnum] = NULL;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
160 next = &portstring[portnum];
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
161 portnum++;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
162 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
163 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
164 #ifdef DO_MOTD
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
165 /* 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
166 case 'm':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
167 svr_opts.domotd = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 case 'w':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171 svr_opts.norootlogin = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173 #ifdef DROPBEAR_PASSWORD_AUTH
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 case 's':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 svr_opts.noauthpass = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
176 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
177 case 'g':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
178 svr_opts.norootpass = 1;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
179 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
180 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
181 case 'h':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
182 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
183 exit(EXIT_FAILURE);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
184 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
185 /*
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
186 case '4':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
187 svr_opts.ipv4 = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
188 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
189 case '6':
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
190 svr_opts.ipv6 = 0;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
191 break;
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
192 */
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
193 default:
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
194 fprintf(stderr, "Unknown argument %s\n", argv[i]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
195 printhelp(argv[0]);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
196 exit(EXIT_FAILURE);
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
197 break;
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 }
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
201 #endif
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
202
0883c0906870 tty raw mode support works mostly
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
203 }