[10563] | 1 | /* |
---|
| 2 | |
---|
| 3 | readconf.h |
---|
| 4 | |
---|
| 5 | Author: Tatu Ylonen <ylo@cs.hut.fi> |
---|
| 6 | |
---|
| 7 | Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
---|
| 8 | All rights reserved |
---|
| 9 | |
---|
| 10 | Created: Sat Apr 22 00:25:29 1995 ylo |
---|
| 11 | |
---|
| 12 | Functions for reading the configuration file. |
---|
| 13 | |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | /* |
---|
[12645] | 17 | * $Id: readconf.h,v 1.1.1.4 1999-03-08 17:43:37 danw Exp $ |
---|
[10563] | 18 | * $Log: not supported by cvs2svn $ |
---|
[12645] | 19 | * Revision 1.10 1998/07/08 00:46:37 kivinen |
---|
| 20 | * Fixed typo (privileged). |
---|
| 21 | * |
---|
| 22 | * Revision 1.9 1998/04/30 01:55:19 kivinen |
---|
[11533] | 23 | * Added PasswordPromptLogin and PasswordPromptHost options, so |
---|
| 24 | * now the password prompt is configurable. |
---|
| 25 | * |
---|
| 26 | * Revision 1.8 1998/03/27 16:59:43 kivinen |
---|
| 27 | * Added GatewayPorts option. |
---|
| 28 | * |
---|
[11071] | 29 | * Revision 1.7 1998/01/02 06:20:12 kivinen |
---|
| 30 | * Added xauthlocation option. |
---|
| 31 | * |
---|
[10563] | 32 | * Revision 1.6 1997/04/23 00:01:35 kivinen |
---|
| 33 | * Added number_of_password_prompts and clear_all_forwardings |
---|
| 34 | * fields. |
---|
| 35 | * |
---|
| 36 | * Revision 1.5 1997/04/17 04:20:37 kivinen |
---|
| 37 | * Updated strict_host_key_checking comment. |
---|
| 38 | * |
---|
| 39 | * Revision 1.4 1997/03/27 03:10:27 kivinen |
---|
| 40 | * Added kerberos patches from Glenn Machin. |
---|
| 41 | * |
---|
| 42 | * Revision 1.3 1997/03/26 05:34:49 kivinen |
---|
| 43 | * Added UsePriviledgedPort option. |
---|
| 44 | * |
---|
| 45 | * Revision 1.2 1997/03/19 17:54:45 kivinen |
---|
| 46 | * Added TIS authentication code from Andre April |
---|
| 47 | * <Andre.April@cediti.be>. |
---|
| 48 | * |
---|
| 49 | * Revision 1.1.1.1 1996/02/18 21:38:10 ylo |
---|
| 50 | * Imported ssh-1.2.13. |
---|
| 51 | * |
---|
| 52 | * Revision 1.4 1995/09/24 23:59:57 ylo |
---|
| 53 | * Added connection_attempts. |
---|
| 54 | * |
---|
| 55 | * Revision 1.3 1995/07/27 00:39:10 ylo |
---|
| 56 | * Added GlobalKnownHostsFile and UserKnownHostsFile. |
---|
| 57 | * |
---|
| 58 | * Revision 1.2 1995/07/13 01:30:46 ylo |
---|
| 59 | * Removed "Last modified" header. |
---|
| 60 | * Added cvs log. |
---|
| 61 | * |
---|
| 62 | * $Endlog$ |
---|
| 63 | */ |
---|
| 64 | |
---|
| 65 | #ifndef READCONF_H |
---|
| 66 | #define READCONF_H |
---|
| 67 | |
---|
| 68 | /* Data structure for representing a forwarding request. */ |
---|
| 69 | |
---|
| 70 | typedef struct |
---|
| 71 | { |
---|
| 72 | int port; /* Port to forward. */ |
---|
| 73 | char *host; /* Host to connect. */ |
---|
| 74 | int host_port; /* Port to connect on host. */ |
---|
| 75 | } Forward; |
---|
| 76 | |
---|
| 77 | /* Data structure for representing option data. */ |
---|
| 78 | |
---|
| 79 | typedef struct |
---|
| 80 | { |
---|
| 81 | int forward_agent; /* Forward authentication agent. */ |
---|
| 82 | int forward_x11; /* Forward X11 display. */ |
---|
| 83 | int rhosts_authentication; /* Try rhosts authentication. */ |
---|
| 84 | int rhosts_rsa_authentication;/* Try rhosts with RSA authentication. */ |
---|
| 85 | int rsa_authentication; /* Try RSA authentication. */ |
---|
| 86 | int kerberos_authentication; /* Try Kerberos authentication. */ |
---|
| 87 | int kerberos_tgt_passing; /* Try Kerberos tgt passing. */ |
---|
| 88 | int tis_authentication; /* Try TIS authsrv authentication. */ |
---|
| 89 | int password_authentication; /* Try password authentication. */ |
---|
| 90 | int fallback_to_rsh; /* Use rsh if cannot connect with ssh. */ |
---|
| 91 | int use_rsh; /* Always use rsh (don\'t try ssh). */ |
---|
| 92 | int batch_mode; /* Batch mode: do not ask for passwords. */ |
---|
| 93 | int strict_host_key_checking; /* Strict host key checking 0 = no, 1 = yes, |
---|
| 94 | 2 = ask. */ |
---|
| 95 | int compression; /* Compress packets in both directions. */ |
---|
| 96 | int compression_level; /* Compression level 1 (fast) to 9 (best). */ |
---|
| 97 | int keepalives; /* Set SO_KEEPALIVE. */ |
---|
[12645] | 98 | int use_privileged_port; /* Use privileged port */ |
---|
[10563] | 99 | |
---|
| 100 | int port; /* Port to connect. */ |
---|
| 101 | int connection_attempts; /* Max attempts (seconds) before giving up */ |
---|
| 102 | int number_of_password_prompts; /* Max number of password prompts */ |
---|
[11533] | 103 | int password_prompt_login; /* Show remote login at password prompt */ |
---|
| 104 | int password_prompt_host; /* Show remote host at password prompt */ |
---|
[10563] | 105 | int cipher; /* Cipher to use. */ |
---|
| 106 | char *hostname; /* Real host to connect. */ |
---|
| 107 | char *proxy_command; /* Proxy command for connecting the host. */ |
---|
| 108 | char *user; /* User to log in as. */ |
---|
| 109 | int no_user_given; /* True if no user name given */ |
---|
| 110 | int escape_char; /* Escape character; -2 = none */ |
---|
| 111 | |
---|
| 112 | char *system_hostfile; /* Path for /etc/ssh_known_hosts. */ |
---|
| 113 | char *user_hostfile; /* Path for $HOME/.ssh/known_hosts. */ |
---|
| 114 | |
---|
| 115 | int num_identity_files; /* Number of files for RSA identities. */ |
---|
| 116 | char *identity_files[SSH_MAX_IDENTITY_FILES]; |
---|
| 117 | |
---|
| 118 | int clear_all_forwardings; /* Clear all forwardings (scp etc). */ |
---|
| 119 | |
---|
| 120 | /* Local TCP/IP forward requests. */ |
---|
| 121 | int num_local_forwards; |
---|
| 122 | Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; |
---|
| 123 | |
---|
| 124 | /* Remote TCP/IP forward requests. */ |
---|
| 125 | int num_remote_forwards; |
---|
| 126 | Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; |
---|
[11071] | 127 | char *xauth_path; |
---|
[11533] | 128 | int gateway_ports; |
---|
[10563] | 129 | } Options; |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | /* Initializes options to special values that indicate that they have not |
---|
| 133 | yet been set. Read_config_file will only set options with this value. |
---|
| 134 | Options are processed in the following order: command line, user config |
---|
| 135 | file, system config file. Last, fill_default_options is called. */ |
---|
| 136 | void initialize_options(Options *options); |
---|
| 137 | |
---|
| 138 | /* Called after processing other sources of option data, this fills those |
---|
| 139 | options for which no value has been specified with their default values. */ |
---|
| 140 | void fill_default_options(Options *options); |
---|
| 141 | |
---|
| 142 | /* Processes a single option line as used in the configuration files. |
---|
| 143 | This only sets those values that have not already been set. */ |
---|
| 144 | void process_config_line(Options *options, const char *host, |
---|
| 145 | char *line, const char *filename, int linenum, |
---|
| 146 | int *activep); |
---|
| 147 | |
---|
| 148 | /* Reads the config file and modifies the options accordingly. Options should |
---|
| 149 | already be initialized before this call. This never returns if there |
---|
| 150 | is an error. If the file does not exist, this returns immediately. |
---|
| 151 | All I/O will be done with the given uid via userfile. */ |
---|
| 152 | void read_config_file(uid_t uid, const char *filename, const char *host, |
---|
| 153 | Options *options); |
---|
| 154 | |
---|
| 155 | /* Adds a local TCP/IP port forward to options. Never returns if there |
---|
| 156 | is an error. */ |
---|
| 157 | void add_local_forward(Options *options, int port, const char *host, |
---|
| 158 | int host_port); |
---|
| 159 | |
---|
| 160 | /* Adds a remote TCP/IP port forward to options. Never returns if there |
---|
| 161 | is an error. */ |
---|
| 162 | void add_remote_forward(Options *options, int port, const char *host, |
---|
| 163 | int host_port); |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | #endif /* READCONF_H */ |
---|