Home | History | Annotate | Download | only in dropbear
      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:
     13  *
     14  * The above copyright notice and this permission notice shall be included in
     15  * all copies or substantial portions of the Software.
     16  *
     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. */
     24 
     25 #ifndef _RUNOPTS_H_
     26 #define _RUNOPTS_H_
     27 
     28 #include "includes.h"
     29 #include "signkey.h"
     30 #include "buffer.h"
     31 #include "auth.h"
     32 #include "tcpfwd.h"
     33 
     34 typedef struct runopts {
     35 
     36 #if defined(ENABLE_SVR_REMOTETCPFWD) || defined(ENABLE_CLI_LOCALTCPFWD)
     37 	int listen_fwd_all;
     38 #endif
     39 
     40 } runopts;
     41 
     42 extern runopts opts;
     43 
     44 int readhostkey(const char * filename, sign_key * hostkey, int *type);
     45 
     46 typedef struct svr_runopts {
     47 
     48 	char * rsakeyfile;
     49 	char * dsskeyfile;
     50 	char * bannerfile;
     51 
     52 	int forkbg;
     53 	int usingsyslog;
     54 
     55 	/* ports is an array of the portcount listening ports */
     56 	char *ports[DROPBEAR_MAX_PORTS];
     57 	unsigned int portcount;
     58 	char *addresses[DROPBEAR_MAX_PORTS];
     59 
     60 	int inetdmode;
     61 
     62 	/* Flags indicating whether to use ipv4 and ipv6 */
     63 	/* not used yet
     64 	int ipv4;
     65 	int ipv6;
     66 	*/
     67 
     68 #ifdef DO_MOTD
     69 	/* whether to print the MOTD */
     70 	int domotd;
     71 #endif
     72 
     73 	int norootlogin;
     74 
     75 	int noauthpass;
     76 	int norootpass;
     77 
     78 #ifdef ENABLE_SVR_REMOTETCPFWD
     79 	int noremotetcp;
     80 #endif
     81 #ifdef ENABLE_SVR_LOCALTCPFWD
     82 	int nolocaltcp;
     83 #endif
     84 
     85 	sign_key *hostkey;
     86 	buffer * banner;
     87 	char * pidfile;
     88 
     89 } svr_runopts;
     90 
     91 extern svr_runopts svr_opts;
     92 
     93 void svr_getopts(int argc, char ** argv);
     94 void loadhostkeys();
     95 
     96 typedef struct cli_runopts {
     97 
     98 	char *progname;
     99 	char *remotehost;
    100 	char *remoteport;
    101 
    102 	char *username;
    103 
    104 	char *cmd;
    105 	int wantpty;
    106 	int always_accept_key;
    107 	int no_cmd;
    108 	int backgrounded;
    109 #ifdef ENABLE_CLI_PUBKEY_AUTH
    110 	struct SignKeyList *privkeys; /* Keys to use for public-key auth */
    111 #endif
    112 #ifdef ENABLE_CLI_REMOTETCPFWD
    113 	struct TCPFwdList * remotefwds;
    114 #endif
    115 #ifdef ENABLE_CLI_LOCALTCPFWD
    116 	struct TCPFwdList * localfwds;
    117 #endif
    118 
    119 } cli_runopts;
    120 
    121 extern cli_runopts cli_opts;
    122 void cli_getopts(int argc, char ** argv);
    123 
    124 #endif /* _RUNOPTS_H_ */
    125