readconf.h revision 63249
1228690Sdes/* 2348980Sdes * 3228690Sdes * readconf.h 4228690Sdes * 5228690Sdes * Author: Tatu Ylonen <ylo@cs.hut.fi> 6228690Sdes * 7228690Sdes * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8228690Sdes * All rights reserved 9255376Sdes * 10228690Sdes * Created: Sat Apr 22 00:25:29 1995 ylo 11228690Sdes * 12228690Sdes * Functions for reading the configuration file. 13236099Sdes * 14236099Sdes * $FreeBSD: head/crypto/openssh/readconf.h 60576 2000-05-15 05:24:25Z kris $ 15236099Sdes */ 16228690Sdes 17228690Sdes/* RCSID("$Id: readconf.h,v 1.18 2000/05/08 17:12:15 markus Exp $"); */ 18228690Sdes 19228690Sdes#ifndef READCONF_H 20228690Sdes#define READCONF_H 21228690Sdes 22228690Sdes/* Data structure for representing a forwarding request. */ 23228690Sdes 24228690Sdestypedef struct { 25228690Sdes u_short port; /* Port to forward. */ 26228690Sdes char *host; /* Host to connect. */ 27228690Sdes u_short host_port; /* Port to connect on host. */ 28228690Sdes} Forward; 29348980Sdes/* Data structure for representing option data. */ 30228690Sdes 31228690Sdestypedef struct { 32236099Sdes int forward_agent; /* Forward authentication agent. */ 33236099Sdes int forward_x11; /* Forward X11 display. */ 34228690Sdes int gateway_ports; /* Allow remote connects to forwarded ports. */ 35228690Sdes int use_privileged_port; /* Don't use privileged port if false. */ 36348980Sdes int rhosts_authentication; /* Try rhosts authentication. */ 37228690Sdes int rhosts_rsa_authentication; /* Try rhosts with RSA 38228690Sdes * authentication. */ 39228690Sdes int rsa_authentication; /* Try RSA authentication. */ 40228690Sdes int dsa_authentication; /* Try DSA authentication. */ 41228690Sdes int skey_authentication; /* Try S/Key or TIS authentication. */ 42228690Sdes#ifdef KRB4 43255376Sdes int krb4_authentication; /* Try Kerberos v4 44255376Sdes * authentication. */ 45255376Sdes#endif 46228690Sdes 47#ifdef KRB5 48 int krb5_authentication; 49 int krb5_tgt_passing; 50#endif /* KRB5 */ 51 52#ifdef AFS 53 int krb4_tgt_passing; /* Try Kerberos v4 tgt passing. */ 54 int afs_token_passing; /* Try AFS token passing. */ 55#endif 56 int password_authentication; /* Try password 57 * authentication. */ 58 int fallback_to_rsh;/* Use rsh if cannot connect with ssh. */ 59 int use_rsh; /* Always use rsh (don\'t try ssh). */ 60 int batch_mode; /* Batch mode: do not ask for passwords. */ 61 int check_host_ip; /* Also keep track of keys for IP address */ 62 int strict_host_key_checking; /* Strict host key checking. */ 63 int compression; /* Compress packets in both directions. */ 64 int compression_level; /* Compression level 1 (fast) to 9 65 * (best). */ 66 int keepalives; /* Set SO_KEEPALIVE. */ 67 LogLevel log_level; /* Level for logging. */ 68 69 int port; /* Port to connect. */ 70 int connection_attempts; /* Max attempts (seconds) before 71 * giving up */ 72 int number_of_password_prompts; /* Max number of password 73 * prompts. */ 74 int cipher; /* Cipher to use. */ 75 char *ciphers; /* SSH2 ciphers in order of preference. */ 76 int protocol; /* Protocol in order of preference. */ 77 char *hostname; /* Real host to connect. */ 78 char *proxy_command; /* Proxy command for connecting the host. */ 79 char *user; /* User to log in as. */ 80 int escape_char; /* Escape character; -2 = none */ 81 82 char *system_hostfile;/* Path for /etc/ssh_known_hosts. */ 83 char *user_hostfile; /* Path for $HOME/.ssh/known_hosts. */ 84 char *system_hostfile2; 85 char *user_hostfile2; 86 87 int num_identity_files; /* Number of files for RSA identities. */ 88 int num_identity_files2; /* DSA identities. */ 89 char *identity_files[SSH_MAX_IDENTITY_FILES]; 90 char *identity_files2[SSH_MAX_IDENTITY_FILES]; 91 92 /* Local TCP/IP forward requests. */ 93 int num_local_forwards; 94 Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; 95 96 /* Remote TCP/IP forward requests. */ 97 int num_remote_forwards; 98 Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; 99} Options; 100 101 102/* 103 * Initializes options to special values that indicate that they have not yet 104 * been set. Read_config_file will only set options with this value. Options 105 * are processed in the following order: command line, user config file, 106 * system config file. Last, fill_default_options is called. 107 */ 108void initialize_options(Options * options); 109 110/* 111 * Called after processing other sources of option data, this fills those 112 * options for which no value has been specified with their default values. 113 */ 114void fill_default_options(Options * options); 115 116/* 117 * Processes a single option line as used in the configuration files. This 118 * only sets those values that have not already been set. Returns 0 for legal 119 * options 120 */ 121int 122process_config_line(Options * options, const char *host, 123 char *line, const char *filename, int linenum, 124 int *activep); 125 126/* 127 * Reads the config file and modifies the options accordingly. Options 128 * should already be initialized before this call. This never returns if 129 * there is an error. If the file does not exist, this returns immediately. 130 */ 131void 132read_config_file(const char *filename, const char *host, 133 Options * options); 134 135/* 136 * Adds a local TCP/IP port forward to options. Never returns if there is an 137 * error. 138 */ 139void 140add_local_forward(Options * options, u_short port, const char *host, 141 u_short host_port); 142 143/* 144 * Adds a remote TCP/IP port forward to options. Never returns if there is 145 * an error. 146 */ 147void 148add_remote_forward(Options * options, u_short port, const char *host, 149 u_short host_port); 150 151#endif /* READCONF_H */ 152