dropbear 2016.73
[tomato.git] / release / src / router / dropbear / runopts.h
blobf7c869da8be3cd9ee2adb741cceb9632b10ea8b7
1 /*
2 * Dropbear - a SSH2 server
3 *
4 * Copyright (c) 2002,2003 Matt Johnston
5 * All rights reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE. */
25 #ifndef DROPBEAR_RUNOPTS_H_
26 #define DROPBEAR_RUNOPTS_H_
28 #include "includes.h"
29 #include "signkey.h"
30 #include "buffer.h"
31 #include "auth.h"
32 #include "tcpfwd.h"
34 typedef struct runopts {
36 #if defined(ENABLE_SVR_REMOTETCPFWD) || defined(ENABLE_CLI_LOCALTCPFWD) \
37 || defined(ENABLE_CLI_REMOTETCPFWD)
38 int listen_fwd_all;
39 #endif
40 unsigned int recv_window;
41 time_t keepalive_secs; /* Time between sending keepalives. 0 is off */
42 time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */
43 int usingsyslog;
45 #ifndef DISABLE_ZLIB
46 /* TODO: add a commandline flag. Currently this is on by default if compression
47 * is compiled in, but disabled for a client's non-final multihop stages. (The
48 * intermediate stages are compressed streams, so are uncompressible. */
49 enum {
50 DROPBEAR_COMPRESS_DELAYED, /* Server only */
51 DROPBEAR_COMPRESS_ON,
52 DROPBEAR_COMPRESS_OFF,
53 } compress_mode;
54 #endif
56 #ifdef ENABLE_USER_ALGO_LIST
57 char *cipher_list;
58 char *mac_list;
59 #endif
61 } runopts;
63 extern runopts opts;
65 int readhostkey(const char * filename, sign_key * hostkey,
66 enum signkey_type *type);
67 void load_all_hostkeys(void);
69 typedef struct svr_runopts {
71 char * bannerfile;
73 int forkbg;
75 /* ports and addresses are arrays of the portcount
76 listening ports. strings are malloced. */
77 char *ports[DROPBEAR_MAX_PORTS];
78 unsigned int portcount;
79 char *addresses[DROPBEAR_MAX_PORTS];
81 int inetdmode;
83 /* Flags indicating whether to use ipv4 and ipv6 */
84 /* not used yet
85 int ipv4;
86 int ipv6;
89 #ifdef DO_MOTD
90 /* whether to print the MOTD */
91 int domotd;
92 #endif
94 int norootlogin;
96 int noauthpass;
97 int norootpass;
98 int allowblankpass;
100 #ifdef ENABLE_SVR_REMOTETCPFWD
101 int noremotetcp;
102 #endif
103 #ifdef ENABLE_SVR_LOCALTCPFWD
104 int nolocaltcp;
105 #endif
107 sign_key *hostkey;
109 int delay_hostkey;
111 char *hostkey_files[MAX_HOSTKEYS];
112 int num_hostkey_files;
114 buffer * banner;
115 char * pidfile;
117 } svr_runopts;
119 extern svr_runopts svr_opts;
121 void svr_getopts(int argc, char ** argv);
122 void loadhostkeys(void);
124 typedef struct cli_runopts {
126 char *progname;
127 char *remotehost;
128 char *remoteport;
130 char *own_user;
131 char *username;
133 char *cmd;
134 int wantpty;
135 int always_accept_key;
136 int no_hostkey_check;
137 int no_cmd;
138 int backgrounded;
139 int is_subsystem;
140 #ifdef ENABLE_CLI_PUBKEY_AUTH
141 m_list *privkeys; /* Keys to use for public-key auth */
142 #endif
143 #ifdef ENABLE_CLI_ANYTCPFWD
144 int exit_on_fwd_failure;
145 #endif
146 #ifdef ENABLE_CLI_REMOTETCPFWD
147 m_list * remotefwds;
148 #endif
149 #ifdef ENABLE_CLI_LOCALTCPFWD
150 m_list * localfwds;
151 #endif
152 #ifdef ENABLE_CLI_AGENTFWD
153 int agent_fwd;
154 int agent_keys_loaded; /* whether pubkeys has been populated with a
155 list of keys held by the agent */
156 int agent_fd; /* The agent fd is only set during authentication. Forwarded
157 agent sessions have their own file descriptors */
158 #endif
160 #ifdef ENABLE_CLI_NETCAT
161 char *netcat_host;
162 unsigned int netcat_port;
163 #endif
164 #ifdef ENABLE_CLI_PROXYCMD
165 char *proxycmd;
166 #endif
167 } cli_runopts;
169 extern cli_runopts cli_opts;
170 void cli_getopts(int argc, char ** argv);
172 #ifdef ENABLE_USER_ALGO_LIST
173 void parse_ciphers_macs(void);
174 #endif
176 void print_version(void);
178 #endif /* DROPBEAR_RUNOPTS_H_ */