readconf.h revision 65674
1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 *                    All rights reserved
5 * Functions for reading the configuration file.
6 *
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose.  Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
12 */
13
14/* RCSID("$OpenBSD: readconf.h,v 1.21 2000/09/07 20:27:53 deraadt Exp $"); */
15/* $FreeBSD: head/crypto/openssh/readconf.h 65674 2000-09-10 09:35:38Z kris $ */
16
17#ifndef READCONF_H
18#define READCONF_H
19
20/* Data structure for representing a forwarding request. */
21
22typedef struct {
23	u_short	  port;		/* Port to forward. */
24	char	 *host;		/* Host to connect. */
25	u_short	  host_port;	/* Port to connect on host. */
26}       Forward;
27/* Data structure for representing option data. */
28
29typedef struct {
30	int     forward_agent;	/* Forward authentication agent. */
31	int     forward_x11;	/* Forward X11 display. */
32	char   *xauth_location;	/* Location for xauth program */
33	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
34	int     use_privileged_port;	/* Don't use privileged port if false. */
35	int     rhosts_authentication;	/* Try rhosts authentication. */
36	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
37						 * authentication. */
38	int     rsa_authentication;	/* Try RSA authentication. */
39	int     dsa_authentication;	/* Try DSA authentication. */
40	int     skey_authentication;	/* Try S/Key or TIS authentication. */
41#ifdef KRB4
42	int     krb4_authentication;		/* Try Kerberos v4
43						 * authentication. */
44#endif
45
46#ifdef KRB5
47	int	krb5_authentication;
48	int	krb5_tgt_passing;
49#endif /* KRB5 */
50
51#ifdef AFS
52	int     krb4_tgt_passing;	/* Try Kerberos v4 tgt passing. */
53	int     afs_token_passing;	/* Try AFS token passing. */
54#endif
55	int     password_authentication;	/* Try password
56						 * authentication. */
57	int     fallback_to_rsh;/* Use rsh if cannot connect with ssh. */
58	int     use_rsh;	/* Always use rsh (don\'t try ssh). */
59	int     batch_mode;	/* Batch mode: do not ask for passwords. */
60	int     check_host_ip;	/* Also keep track of keys for IP address */
61	int     strict_host_key_checking;	/* Strict host key checking. */
62	int     compression;	/* Compress packets in both directions. */
63	int     compression_level;	/* Compression level 1 (fast) to 9
64					 * (best). */
65	int     keepalives;	/* Set SO_KEEPALIVE. */
66	LogLevel log_level;	/* Level for logging. */
67
68	int     port;		/* Port to connect. */
69	int     connection_attempts;	/* Max attempts (seconds) before
70					 * giving up */
71	int     number_of_password_prompts;	/* Max number of password
72						 * prompts. */
73	int     cipher;		/* Cipher to use. */
74	char   *ciphers;	/* SSH2 ciphers in order of preference. */
75	int	protocol;	/* Protocol in order of preference. */
76	char   *hostname;	/* Real host to connect. */
77	char   *proxy_command;	/* Proxy command for connecting the host. */
78	char   *user;		/* User to log in as. */
79	int     escape_char;	/* Escape character; -2 = none */
80
81	char   *system_hostfile;/* Path for /etc/ssh_known_hosts. */
82	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
83	char   *system_hostfile2;
84	char   *user_hostfile2;
85
86	int     num_identity_files;	/* Number of files for RSA identities. */
87	int     num_identity_files2;	/* DSA identities. */
88	char   *identity_files[SSH_MAX_IDENTITY_FILES];
89	char   *identity_files2[SSH_MAX_IDENTITY_FILES];
90
91	/* Local TCP/IP forward requests. */
92	int     num_local_forwards;
93	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
94
95	/* Remote TCP/IP forward requests. */
96	int     num_remote_forwards;
97	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
98}       Options;
99
100
101/*
102 * Initializes options to special values that indicate that they have not yet
103 * been set.  Read_config_file will only set options with this value. Options
104 * are processed in the following order: command line, user config file,
105 * system config file.  Last, fill_default_options is called.
106 */
107void    initialize_options(Options * options);
108
109/*
110 * Called after processing other sources of option data, this fills those
111 * options for which no value has been specified with their default values.
112 */
113void    fill_default_options(Options * options);
114
115/*
116 * Processes a single option line as used in the configuration files. This
117 * only sets those values that have not already been set. Returns 0 for legal
118 * options
119 */
120int
121process_config_line(Options * options, const char *host,
122    char *line, const char *filename, int linenum,
123    int *activep);
124
125/*
126 * Reads the config file and modifies the options accordingly.  Options
127 * should already be initialized before this call.  This never returns if
128 * there is an error.  If the file does not exist, this returns immediately.
129 */
130void
131read_config_file(const char *filename, const char *host,
132    Options * options);
133
134/*
135 * Adds a local TCP/IP port forward to options.  Never returns if there is an
136 * error.
137 */
138void
139add_local_forward(Options * options, u_short port, const char *host,
140    u_short host_port);
141
142/*
143 * Adds a remote TCP/IP port forward to options.  Never returns if there is
144 * an error.
145 */
146void
147add_remote_forward(Options * options, u_short port, const char *host,
148    u_short host_port);
149
150#endif				/* READCONF_H */
151