blob: e33d65a5eefdb77014aa631b6f23e141a677d821 [file] [log] [blame]
Damien Millerd4a8b7e1999-10-27 13:42:43 +10001/*
Damien Miller95def091999-11-25 00:26:21 +11002 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
3 * All rights reserved
Damien Miller4af51302000-04-16 11:18:38 +10004 *
Damien Millere4340be2000-09-16 13:29:08 +11005 * As far as I am concerned, the code I have written for this software
6 * can be used freely for any purpose. Any derived versions of this
7 * software must be clearly marked as such, and if the derived work is
8 * incompatible with the protocol description in the RFC file, it must be
9 * called by a name other than "ssh" or "Secure Shell".
Damien Miller95def091999-11-25 00:26:21 +110010 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100011
12#include "includes.h"
Damien Miller95c249f2002-02-05 12:11:34 +110013RCSID("$OpenBSD: servconf.c,v 1.99 2002/01/27 14:57:46 stevesk Exp $");
Ben Lindstrom226cfa02001-01-22 05:34:40 +000014
Damien Millerc4b7fea2001-07-14 12:20:32 +100015#if defined(KRB4) || defined(KRB5)
Ben Lindstrom226cfa02001-01-22 05:34:40 +000016#include <krb.h>
17#endif
Ben Lindstromeb7a84c2001-07-04 04:48:36 +000018#ifdef AFS
19#include <kafs.h>
20#endif
Damien Millerd4a8b7e1999-10-27 13:42:43 +100021
22#include "ssh.h"
Ben Lindstrom226cfa02001-01-22 05:34:40 +000023#include "log.h"
Damien Millerd4a8b7e1999-10-27 13:42:43 +100024#include "servconf.h"
25#include "xmalloc.h"
Damien Miller78928792000-04-12 20:17:38 +100026#include "compat.h"
Ben Lindstrom226cfa02001-01-22 05:34:40 +000027#include "pathnames.h"
28#include "tildexpand.h"
29#include "misc.h"
30#include "cipher.h"
Ben Lindstrom06b33aa2001-02-15 03:01:59 +000031#include "kex.h"
32#include "mac.h"
Ben Lindstrom226cfa02001-01-22 05:34:40 +000033
Ben Lindstrombba81212001-06-25 05:01:22 +000034static void add_listen_addr(ServerOptions *, char *, u_short);
35static void add_one_listen_addr(ServerOptions *, char *, u_short);
Damien Miller34132e52000-01-14 15:45:46 +110036
Ben Lindstrom226cfa02001-01-22 05:34:40 +000037/* AF_UNSPEC or AF_INET or AF_INET6 */
38extern int IPv4or6;
39
Damien Millerd4a8b7e1999-10-27 13:42:43 +100040/* Initializes the server options to their default values. */
41
Damien Miller4af51302000-04-16 11:18:38 +100042void
Damien Miller95def091999-11-25 00:26:21 +110043initialize_server_options(ServerOptions *options)
Damien Millerd4a8b7e1999-10-27 13:42:43 +100044{
Damien Miller95def091999-11-25 00:26:21 +110045 memset(options, 0, sizeof(*options));
Damien Miller726273e2001-11-12 11:40:11 +110046
47 /* Portable-specific options */
48 options->pam_authentication_via_kbd_int = -1;
49
50 /* Standard Options */
Damien Miller34132e52000-01-14 15:45:46 +110051 options->num_ports = 0;
52 options->ports_from_cmdline = 0;
53 options->listen_addrs = NULL;
Damien Miller0bc1bd82000-11-13 22:57:25 +110054 options->num_host_key_files = 0;
Damien Miller6f83b8e2000-05-02 09:23:45 +100055 options->pid_file = NULL;
Damien Miller95def091999-11-25 00:26:21 +110056 options->server_key_bits = -1;
57 options->login_grace_time = -1;
58 options->key_regeneration_time = -1;
Ben Lindstromd8a90212001-02-15 03:08:27 +000059 options->permit_root_login = PERMIT_NOT_SET;
Damien Miller95def091999-11-25 00:26:21 +110060 options->ignore_rhosts = -1;
61 options->ignore_user_known_hosts = -1;
62 options->print_motd = -1;
Ben Lindstrom7bfff362001-03-26 05:45:53 +000063 options->print_lastlog = -1;
Damien Miller95def091999-11-25 00:26:21 +110064 options->x11_forwarding = -1;
65 options->x11_display_offset = -1;
Damien Miller95c249f2002-02-05 12:11:34 +110066 options->x11_use_localhost = -1;
Damien Millerd3a18572000-06-07 19:55:44 +100067 options->xauth_location = NULL;
Damien Miller95def091999-11-25 00:26:21 +110068 options->strict_modes = -1;
69 options->keepalives = -1;
70 options->log_facility = (SyslogFacility) - 1;
71 options->log_level = (LogLevel) - 1;
72 options->rhosts_authentication = -1;
73 options->rhosts_rsa_authentication = -1;
Ben Lindstrom5eabda32001-04-12 23:34:34 +000074 options->hostbased_authentication = -1;
75 options->hostbased_uses_name_from_packet_only = -1;
Damien Miller95def091999-11-25 00:26:21 +110076 options->rsa_authentication = -1;
Damien Miller0bc1bd82000-11-13 22:57:25 +110077 options->pubkey_authentication = -1;
Ben Lindstromec95ed92001-07-04 04:21:14 +000078#if defined(KRB4) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +110079 options->kerberos_authentication = -1;
80 options->kerberos_or_local_passwd = -1;
81 options->kerberos_ticket_cleanup = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100082#endif
Ben Lindstromec95ed92001-07-04 04:21:14 +000083#if defined(AFS) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +110084 options->kerberos_tgt_passing = -1;
Ben Lindstromec95ed92001-07-04 04:21:14 +000085#endif
86#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +110087 options->afs_token_passing = -1;
Damien Millerd4a8b7e1999-10-27 13:42:43 +100088#endif
Damien Miller95def091999-11-25 00:26:21 +110089 options->password_authentication = -1;
Damien Miller874d77b2000-10-14 16:23:11 +110090 options->kbd_interactive_authentication = -1;
Ben Lindstrom551ea372001-06-05 18:56:16 +000091 options->challenge_response_authentication = -1;
Damien Miller95def091999-11-25 00:26:21 +110092 options->permit_empty_passwd = -1;
93 options->use_login = -1;
Damien Miller50a41ed2000-10-16 12:14:42 +110094 options->allow_tcp_forwarding = -1;
Damien Miller95def091999-11-25 00:26:21 +110095 options->num_allow_users = 0;
96 options->num_deny_users = 0;
97 options->num_allow_groups = 0;
98 options->num_deny_groups = 0;
Damien Miller78928792000-04-12 20:17:38 +100099 options->ciphers = NULL;
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000100 options->macs = NULL;
Damien Miller78928792000-04-12 20:17:38 +1000101 options->protocol = SSH_PROTO_UNKNOWN;
Damien Millere247cc42000-05-07 12:03:14 +1000102 options->gateway_ports = -1;
Damien Millerf6d9e222000-06-18 14:50:44 +1000103 options->num_subsystems = 0;
Damien Miller942da032000-08-18 13:59:06 +1000104 options->max_startups_begin = -1;
105 options->max_startups_rate = -1;
Damien Miller37023962000-07-11 17:31:38 +1000106 options->max_startups = -1;
Ben Lindstrom48bd7c12001-01-09 00:35:42 +0000107 options->banner = NULL;
Damien Miller33804262001-02-04 23:20:18 +1100108 options->reverse_mapping_check = -1;
Ben Lindstrom5744dc42001-04-13 23:28:01 +0000109 options->client_alive_interval = -1;
110 options->client_alive_count_max = -1;
Ben Lindstrombfb3a0e2001-06-05 20:25:05 +0000111 options->authorized_keys_file = NULL;
112 options->authorized_keys_file2 = NULL;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000113}
114
Damien Miller4af51302000-04-16 11:18:38 +1000115void
Damien Miller95def091999-11-25 00:26:21 +1100116fill_default_server_options(ServerOptions *options)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000117{
Damien Miller726273e2001-11-12 11:40:11 +1100118 /* Portable-specific options */
119 if (options->pam_authentication_via_kbd_int == -1)
120 options->pam_authentication_via_kbd_int = 0;
121
122 /* Standard Options */
Damien Miller0bc1bd82000-11-13 22:57:25 +1100123 if (options->protocol == SSH_PROTO_UNKNOWN)
124 options->protocol = SSH_PROTO_1|SSH_PROTO_2;
125 if (options->num_host_key_files == 0) {
126 /* fill default hostkeys for protocols */
127 if (options->protocol & SSH_PROTO_1)
Damien Miller7fc23732002-01-22 23:19:11 +1100128 options->host_key_files[options->num_host_key_files++] =
129 _PATH_HOST_KEY_FILE;
130 if (options->protocol & SSH_PROTO_2) {
131 options->host_key_files[options->num_host_key_files++] =
132 _PATH_HOST_RSA_KEY_FILE;
133 options->host_key_files[options->num_host_key_files++] =
134 _PATH_HOST_DSA_KEY_FILE;
135 }
Damien Miller0bc1bd82000-11-13 22:57:25 +1100136 }
Damien Miller34132e52000-01-14 15:45:46 +1100137 if (options->num_ports == 0)
138 options->ports[options->num_ports++] = SSH_DEFAULT_PORT;
139 if (options->listen_addrs == NULL)
Ben Lindstrom19066a12001-04-12 23:39:26 +0000140 add_listen_addr(options, NULL, 0);
Damien Miller6f83b8e2000-05-02 09:23:45 +1000141 if (options->pid_file == NULL)
Ben Lindstrom226cfa02001-01-22 05:34:40 +0000142 options->pid_file = _PATH_SSH_DAEMON_PID_FILE;
Damien Miller95def091999-11-25 00:26:21 +1100143 if (options->server_key_bits == -1)
144 options->server_key_bits = 768;
145 if (options->login_grace_time == -1)
146 options->login_grace_time = 600;
147 if (options->key_regeneration_time == -1)
148 options->key_regeneration_time = 3600;
Ben Lindstromd8a90212001-02-15 03:08:27 +0000149 if (options->permit_root_login == PERMIT_NOT_SET)
150 options->permit_root_login = PERMIT_YES;
Damien Miller95def091999-11-25 00:26:21 +1100151 if (options->ignore_rhosts == -1)
Damien Miller98c7ad62000-03-09 21:27:49 +1100152 options->ignore_rhosts = 1;
Damien Miller95def091999-11-25 00:26:21 +1100153 if (options->ignore_user_known_hosts == -1)
154 options->ignore_user_known_hosts = 0;
Damien Miller95def091999-11-25 00:26:21 +1100155 if (options->print_motd == -1)
156 options->print_motd = 1;
Ben Lindstrom7bfff362001-03-26 05:45:53 +0000157 if (options->print_lastlog == -1)
158 options->print_lastlog = 1;
Damien Miller95def091999-11-25 00:26:21 +1100159 if (options->x11_forwarding == -1)
Damien Miller98c7ad62000-03-09 21:27:49 +1100160 options->x11_forwarding = 0;
Damien Miller95def091999-11-25 00:26:21 +1100161 if (options->x11_display_offset == -1)
Damien Miller98c7ad62000-03-09 21:27:49 +1100162 options->x11_display_offset = 10;
Damien Miller95c249f2002-02-05 12:11:34 +1100163 if (options->x11_use_localhost == -1)
164 options->x11_use_localhost = 1;
Damien Millerd3a18572000-06-07 19:55:44 +1000165 if (options->xauth_location == NULL)
Ben Lindstrom1bf11f62001-06-09 01:48:01 +0000166 options->xauth_location = _PATH_XAUTH;
Damien Miller95def091999-11-25 00:26:21 +1100167 if (options->strict_modes == -1)
168 options->strict_modes = 1;
169 if (options->keepalives == -1)
170 options->keepalives = 1;
171 if (options->log_facility == (SyslogFacility) (-1))
172 options->log_facility = SYSLOG_FACILITY_AUTH;
173 if (options->log_level == (LogLevel) (-1))
Ben Lindstromdb65e8f2001-01-19 04:26:52 +0000174 options->log_level = SYSLOG_LEVEL_INFO;
Damien Miller95def091999-11-25 00:26:21 +1100175 if (options->rhosts_authentication == -1)
176 options->rhosts_authentication = 0;
177 if (options->rhosts_rsa_authentication == -1)
Damien Miller98c7ad62000-03-09 21:27:49 +1100178 options->rhosts_rsa_authentication = 0;
Ben Lindstrom5eabda32001-04-12 23:34:34 +0000179 if (options->hostbased_authentication == -1)
180 options->hostbased_authentication = 0;
181 if (options->hostbased_uses_name_from_packet_only == -1)
182 options->hostbased_uses_name_from_packet_only = 0;
Damien Miller95def091999-11-25 00:26:21 +1100183 if (options->rsa_authentication == -1)
184 options->rsa_authentication = 1;
Damien Miller0bc1bd82000-11-13 22:57:25 +1100185 if (options->pubkey_authentication == -1)
186 options->pubkey_authentication = 1;
Ben Lindstromec95ed92001-07-04 04:21:14 +0000187#if defined(KRB4) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +1100188 if (options->kerberos_authentication == -1)
189 options->kerberos_authentication = (access(KEYFILE, R_OK) == 0);
190 if (options->kerberos_or_local_passwd == -1)
191 options->kerberos_or_local_passwd = 1;
192 if (options->kerberos_ticket_cleanup == -1)
193 options->kerberos_ticket_cleanup = 1;
Ben Lindstromec95ed92001-07-04 04:21:14 +0000194#endif
195#if defined(AFS) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +1100196 if (options->kerberos_tgt_passing == -1)
197 options->kerberos_tgt_passing = 0;
Ben Lindstromec95ed92001-07-04 04:21:14 +0000198#endif
Damien Miller9f0f5c62001-12-21 14:45:46 +1100199#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100200 if (options->afs_token_passing == -1)
201 options->afs_token_passing = k_hasafs();
Ben Lindstromec95ed92001-07-04 04:21:14 +0000202#endif
Damien Miller95def091999-11-25 00:26:21 +1100203 if (options->password_authentication == -1)
204 options->password_authentication = 1;
Damien Miller874d77b2000-10-14 16:23:11 +1100205 if (options->kbd_interactive_authentication == -1)
206 options->kbd_interactive_authentication = 0;
Ben Lindstrom551ea372001-06-05 18:56:16 +0000207 if (options->challenge_response_authentication == -1)
208 options->challenge_response_authentication = 1;
Damien Miller95def091999-11-25 00:26:21 +1100209 if (options->permit_empty_passwd == -1)
Damien Miller98c7ad62000-03-09 21:27:49 +1100210 options->permit_empty_passwd = 0;
Damien Miller95def091999-11-25 00:26:21 +1100211 if (options->use_login == -1)
212 options->use_login = 0;
Damien Miller50a41ed2000-10-16 12:14:42 +1100213 if (options->allow_tcp_forwarding == -1)
214 options->allow_tcp_forwarding = 1;
Damien Millere247cc42000-05-07 12:03:14 +1000215 if (options->gateway_ports == -1)
216 options->gateway_ports = 0;
Damien Miller37023962000-07-11 17:31:38 +1000217 if (options->max_startups == -1)
218 options->max_startups = 10;
Damien Miller942da032000-08-18 13:59:06 +1000219 if (options->max_startups_rate == -1)
220 options->max_startups_rate = 100; /* 100% */
221 if (options->max_startups_begin == -1)
222 options->max_startups_begin = options->max_startups;
Damien Miller33804262001-02-04 23:20:18 +1100223 if (options->reverse_mapping_check == -1)
224 options->reverse_mapping_check = 0;
Ben Lindstrom5744dc42001-04-13 23:28:01 +0000225 if (options->client_alive_interval == -1)
Damien Miller9f0f5c62001-12-21 14:45:46 +1100226 options->client_alive_interval = 0;
Ben Lindstrom5744dc42001-04-13 23:28:01 +0000227 if (options->client_alive_count_max == -1)
228 options->client_alive_count_max = 3;
Damien Miller75413ac2001-11-12 11:14:35 +1100229 if (options->authorized_keys_file2 == NULL) {
230 /* authorized_keys_file2 falls back to authorized_keys_file */
231 if (options->authorized_keys_file != NULL)
232 options->authorized_keys_file2 = options->authorized_keys_file;
233 else
234 options->authorized_keys_file2 = _PATH_SSH_USER_PERMITTED_KEYS2;
235 }
236 if (options->authorized_keys_file == NULL)
237 options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000238}
239
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000240/* Keyword tokens. */
Damien Miller95def091999-11-25 00:26:21 +1100241typedef enum {
242 sBadOption, /* == unknown option */
Damien Miller726273e2001-11-12 11:40:11 +1100243 /* Portable-specific options */
244 sPAMAuthenticationViaKbdInt,
245 /* Standard Options */
Damien Miller95def091999-11-25 00:26:21 +1100246 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
247 sPermitRootLogin, sLogFacility, sLogLevel,
248 sRhostsAuthentication, sRhostsRSAAuthentication, sRSAAuthentication,
Ben Lindstromec95ed92001-07-04 04:21:14 +0000249#if defined(KRB4) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +1100250 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000251#endif
Ben Lindstromec95ed92001-07-04 04:21:14 +0000252#if defined(AFS) || defined(KRB5)
253 sKerberosTgtPassing,
254#endif
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000255#ifdef AFS
Ben Lindstromec95ed92001-07-04 04:21:14 +0000256 sAFSTokenPassing,
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000257#endif
Ben Lindstrom95fb2dd2001-01-23 03:12:10 +0000258 sChallengeResponseAuthentication,
Damien Miller874d77b2000-10-14 16:23:11 +1100259 sPasswordAuthentication, sKbdInteractiveAuthentication, sListenAddress,
Ben Lindstrom7bfff362001-03-26 05:45:53 +0000260 sPrintMotd, sPrintLastLog, sIgnoreRhosts,
Damien Miller95c249f2002-02-05 12:11:34 +1100261 sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost,
Ben Lindstrom91e98682001-09-12 16:32:14 +0000262 sStrictModes, sEmptyPasswd, sKeepAlives,
Damien Miller50a41ed2000-10-16 12:14:42 +1100263 sUseLogin, sAllowTcpForwarding,
264 sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000265 sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
Damien Miller0bc1bd82000-11-13 22:57:25 +1100266 sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, sMaxStartups,
Ben Lindstrom5eabda32001-04-12 23:34:34 +0000267 sBanner, sReverseMappingCheck, sHostbasedAuthentication,
Damien Miller9f0f5c62001-12-21 14:45:46 +1100268 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
Ben Lindstrombfb3a0e2001-06-05 20:25:05 +0000269 sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
Ben Lindstromade03f62001-12-06 18:22:17 +0000270 sDeprecated
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000271} ServerOpCodes;
272
273/* Textual representation of the tokens. */
Damien Miller95def091999-11-25 00:26:21 +1100274static struct {
275 const char *name;
276 ServerOpCodes opcode;
277} keywords[] = {
Damien Miller726273e2001-11-12 11:40:11 +1100278 /* Portable-specific options */
279 { "PAMAuthenticationViaKbdInt", sPAMAuthenticationViaKbdInt },
280 /* Standard Options */
Damien Miller95def091999-11-25 00:26:21 +1100281 { "port", sPort },
282 { "hostkey", sHostKeyFile },
Damien Miller0bc1bd82000-11-13 22:57:25 +1100283 { "hostdsakey", sHostKeyFile }, /* alias */
Kevin Stevesef4eea92001-02-05 12:42:17 +0000284 { "pidfile", sPidFile },
Damien Miller95def091999-11-25 00:26:21 +1100285 { "serverkeybits", sServerKeyBits },
286 { "logingracetime", sLoginGraceTime },
287 { "keyregenerationinterval", sKeyRegenerationTime },
288 { "permitrootlogin", sPermitRootLogin },
289 { "syslogfacility", sLogFacility },
290 { "loglevel", sLogLevel },
291 { "rhostsauthentication", sRhostsAuthentication },
292 { "rhostsrsaauthentication", sRhostsRSAAuthentication },
Ben Lindstrom5eabda32001-04-12 23:34:34 +0000293 { "hostbasedauthentication", sHostbasedAuthentication },
294 { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly },
Damien Miller95def091999-11-25 00:26:21 +1100295 { "rsaauthentication", sRSAAuthentication },
Damien Miller0bc1bd82000-11-13 22:57:25 +1100296 { "pubkeyauthentication", sPubkeyAuthentication },
297 { "dsaauthentication", sPubkeyAuthentication }, /* alias */
Ben Lindstromec95ed92001-07-04 04:21:14 +0000298#if defined(KRB4) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +1100299 { "kerberosauthentication", sKerberosAuthentication },
300 { "kerberosorlocalpasswd", sKerberosOrLocalPasswd },
301 { "kerberosticketcleanup", sKerberosTicketCleanup },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000302#endif
Ben Lindstromec95ed92001-07-04 04:21:14 +0000303#if defined(AFS) || defined(KRB5)
Damien Miller95def091999-11-25 00:26:21 +1100304 { "kerberostgtpassing", sKerberosTgtPassing },
Ben Lindstromec95ed92001-07-04 04:21:14 +0000305#endif
306#ifdef AFS
Damien Miller95def091999-11-25 00:26:21 +1100307 { "afstokenpassing", sAFSTokenPassing },
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000308#endif
Damien Miller95def091999-11-25 00:26:21 +1100309 { "passwordauthentication", sPasswordAuthentication },
Damien Miller874d77b2000-10-14 16:23:11 +1100310 { "kbdinteractiveauthentication", sKbdInteractiveAuthentication },
Ben Lindstrom95fb2dd2001-01-23 03:12:10 +0000311 { "challengeresponseauthentication", sChallengeResponseAuthentication },
312 { "skeyauthentication", sChallengeResponseAuthentication }, /* alias */
Ben Lindstrom91e98682001-09-12 16:32:14 +0000313 { "checkmail", sDeprecated },
Damien Miller95def091999-11-25 00:26:21 +1100314 { "listenaddress", sListenAddress },
315 { "printmotd", sPrintMotd },
Ben Lindstrom7bfff362001-03-26 05:45:53 +0000316 { "printlastlog", sPrintLastLog },
Damien Miller95def091999-11-25 00:26:21 +1100317 { "ignorerhosts", sIgnoreRhosts },
318 { "ignoreuserknownhosts", sIgnoreUserKnownHosts },
319 { "x11forwarding", sX11Forwarding },
320 { "x11displayoffset", sX11DisplayOffset },
Damien Miller95c249f2002-02-05 12:11:34 +1100321 { "x11uselocalhost", sX11UseLocalhost },
Damien Millerd3a18572000-06-07 19:55:44 +1000322 { "xauthlocation", sXAuthLocation },
Damien Miller95def091999-11-25 00:26:21 +1100323 { "strictmodes", sStrictModes },
324 { "permitemptypasswords", sEmptyPasswd },
325 { "uselogin", sUseLogin },
Damien Miller95def091999-11-25 00:26:21 +1100326 { "keepalive", sKeepAlives },
Damien Miller50a41ed2000-10-16 12:14:42 +1100327 { "allowtcpforwarding", sAllowTcpForwarding },
Damien Miller95def091999-11-25 00:26:21 +1100328 { "allowusers", sAllowUsers },
329 { "denyusers", sDenyUsers },
330 { "allowgroups", sAllowGroups },
331 { "denygroups", sDenyGroups },
Damien Miller78928792000-04-12 20:17:38 +1000332 { "ciphers", sCiphers },
Ben Lindstrom06b33aa2001-02-15 03:01:59 +0000333 { "macs", sMacs },
Damien Miller78928792000-04-12 20:17:38 +1000334 { "protocol", sProtocol },
Damien Millere247cc42000-05-07 12:03:14 +1000335 { "gatewayports", sGatewayPorts },
Damien Millerf6d9e222000-06-18 14:50:44 +1000336 { "subsystem", sSubsystem },
Damien Miller37023962000-07-11 17:31:38 +1000337 { "maxstartups", sMaxStartups },
Ben Lindstrom48bd7c12001-01-09 00:35:42 +0000338 { "banner", sBanner },
Damien Miller33804262001-02-04 23:20:18 +1100339 { "reversemappingcheck", sReverseMappingCheck },
Ben Lindstrom5744dc42001-04-13 23:28:01 +0000340 { "clientaliveinterval", sClientAliveInterval },
341 { "clientalivecountmax", sClientAliveCountMax },
Ben Lindstrombfb3a0e2001-06-05 20:25:05 +0000342 { "authorizedkeysfile", sAuthorizedKeysFile },
343 { "authorizedkeysfile2", sAuthorizedKeysFile2 },
Ben Lindstrom65366a82001-12-06 16:32:47 +0000344 { NULL, sBadOption }
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000345};
346
Damien Miller5428f641999-11-25 11:54:57 +1100347/*
Ben Lindstrom3704c262001-04-02 18:20:03 +0000348 * Returns the number of the token pointed to by cp or sBadOption.
Damien Miller5428f641999-11-25 11:54:57 +1100349 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000350
Damien Miller4af51302000-04-16 11:18:38 +1000351static ServerOpCodes
Damien Miller95def091999-11-25 00:26:21 +1100352parse_token(const char *cp, const char *filename,
353 int linenum)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000354{
Ben Lindstrom46c16222000-12-22 01:43:59 +0000355 u_int i;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000356
Damien Miller95def091999-11-25 00:26:21 +1100357 for (i = 0; keywords[i].name; i++)
Damien Miller5428f641999-11-25 11:54:57 +1100358 if (strcasecmp(cp, keywords[i].name) == 0)
Damien Miller95def091999-11-25 00:26:21 +1100359 return keywords[i].opcode;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000360
Ben Lindstromb5cdc662001-04-16 02:13:26 +0000361 error("%s: line %d: Bad configuration option: %s",
362 filename, linenum, cp);
Damien Miller95def091999-11-25 00:26:21 +1100363 return sBadOption;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000364}
365
Ben Lindstrombba81212001-06-25 05:01:22 +0000366static void
Ben Lindstrom19066a12001-04-12 23:39:26 +0000367add_listen_addr(ServerOptions *options, char *addr, u_short port)
Damien Miller34132e52000-01-14 15:45:46 +1100368{
Damien Miller34132e52000-01-14 15:45:46 +1100369 int i;
370
371 if (options->num_ports == 0)
372 options->ports[options->num_ports++] = SSH_DEFAULT_PORT;
Ben Lindstrom19066a12001-04-12 23:39:26 +0000373 if (port == 0)
Ben Lindstromc510af42001-04-07 17:25:48 +0000374 for (i = 0; i < options->num_ports; i++)
375 add_one_listen_addr(options, addr, options->ports[i]);
376 else
Ben Lindstrom19066a12001-04-12 23:39:26 +0000377 add_one_listen_addr(options, addr, port);
Ben Lindstromc510af42001-04-07 17:25:48 +0000378}
379
Ben Lindstrombba81212001-06-25 05:01:22 +0000380static void
Ben Lindstromc510af42001-04-07 17:25:48 +0000381add_one_listen_addr(ServerOptions *options, char *addr, u_short port)
382{
383 struct addrinfo hints, *ai, *aitop;
384 char strport[NI_MAXSERV];
385 int gaierr;
386
387 memset(&hints, 0, sizeof(hints));
388 hints.ai_family = IPv4or6;
389 hints.ai_socktype = SOCK_STREAM;
390 hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
391 snprintf(strport, sizeof strport, "%d", port);
392 if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
393 fatal("bad addr or host: %s (%s)",
394 addr ? addr : "<NULL>",
395 gai_strerror(gaierr));
396 for (ai = aitop; ai->ai_next; ai = ai->ai_next)
397 ;
398 ai->ai_next = options->listen_addrs;
399 options->listen_addrs = aitop;
Damien Miller34132e52000-01-14 15:45:46 +1100400}
401
Ben Lindstromade03f62001-12-06 18:22:17 +0000402int
403process_server_config_line(ServerOptions *options, char *line,
404 const char *filename, int linenum)
405{
406 char *cp, **charptr, *arg, *p;
407 int *intptr, value;
408 ServerOpCodes opcode;
409 int i, n;
410
411 cp = line;
412 arg = strdelim(&cp);
413 /* Ignore leading whitespace */
414 if (*arg == '\0')
415 arg = strdelim(&cp);
416 if (!arg || !*arg || *arg == '#')
417 return 0;
418 intptr = NULL;
419 charptr = NULL;
420 opcode = parse_token(arg, filename, linenum);
421 switch (opcode) {
422 /* Portable-specific options */
423 case sPAMAuthenticationViaKbdInt:
424 intptr = &options->pam_authentication_via_kbd_int;
425 goto parse_flag;
426
427 /* Standard Options */
428 case sBadOption:
429 return -1;
430 case sPort:
431 /* ignore ports from configfile if cmdline specifies ports */
432 if (options->ports_from_cmdline)
433 return 0;
434 if (options->listen_addrs != NULL)
435 fatal("%s line %d: ports must be specified before "
Damien Miller4fbf08a2002-01-22 23:35:09 +1100436 "ListenAddress.", filename, linenum);
Ben Lindstromade03f62001-12-06 18:22:17 +0000437 if (options->num_ports >= MAX_PORTS)
438 fatal("%s line %d: too many ports.",
439 filename, linenum);
440 arg = strdelim(&cp);
441 if (!arg || *arg == '\0')
442 fatal("%s line %d: missing port number.",
443 filename, linenum);
444 options->ports[options->num_ports++] = a2port(arg);
445 if (options->ports[options->num_ports-1] == 0)
446 fatal("%s line %d: Badly formatted port number.",
447 filename, linenum);
448 break;
449
450 case sServerKeyBits:
451 intptr = &options->server_key_bits;
452parse_int:
453 arg = strdelim(&cp);
454 if (!arg || *arg == '\0')
455 fatal("%s line %d: missing integer value.",
456 filename, linenum);
457 value = atoi(arg);
458 if (*intptr == -1)
459 *intptr = value;
460 break;
461
462 case sLoginGraceTime:
463 intptr = &options->login_grace_time;
464parse_time:
465 arg = strdelim(&cp);
466 if (!arg || *arg == '\0')
467 fatal("%s line %d: missing time value.",
468 filename, linenum);
469 if ((value = convtime(arg)) == -1)
470 fatal("%s line %d: invalid time value.",
471 filename, linenum);
472 if (*intptr == -1)
473 *intptr = value;
474 break;
475
476 case sKeyRegenerationTime:
477 intptr = &options->key_regeneration_time;
478 goto parse_time;
479
480 case sListenAddress:
481 arg = strdelim(&cp);
482 if (!arg || *arg == '\0' || strncmp(arg, "[]", 2) == 0)
483 fatal("%s line %d: missing inet addr.",
484 filename, linenum);
485 if (*arg == '[') {
486 if ((p = strchr(arg, ']')) == NULL)
487 fatal("%s line %d: bad ipv6 inet addr usage.",
488 filename, linenum);
489 arg++;
490 memmove(p, p+1, strlen(p+1)+1);
491 } else if (((p = strchr(arg, ':')) == NULL) ||
492 (strchr(p+1, ':') != NULL)) {
493 add_listen_addr(options, arg, 0);
494 break;
495 }
496 if (*p == ':') {
497 u_short port;
498
499 p++;
500 if (*p == '\0')
501 fatal("%s line %d: bad inet addr:port usage.",
502 filename, linenum);
503 else {
504 *(p-1) = '\0';
505 if ((port = a2port(p)) == 0)
506 fatal("%s line %d: bad port number.",
507 filename, linenum);
508 add_listen_addr(options, arg, port);
509 }
510 } else if (*p == '\0')
511 add_listen_addr(options, arg, 0);
512 else
513 fatal("%s line %d: bad inet addr usage.",
514 filename, linenum);
515 break;
516
517 case sHostKeyFile:
518 intptr = &options->num_host_key_files;
519 if (*intptr >= MAX_HOSTKEYS)
520 fatal("%s line %d: too many host keys specified (max %d).",
521 filename, linenum, MAX_HOSTKEYS);
522 charptr = &options->host_key_files[*intptr];
523parse_filename:
524 arg = strdelim(&cp);
525 if (!arg || *arg == '\0')
526 fatal("%s line %d: missing file name.",
527 filename, linenum);
528 if (*charptr == NULL) {
529 *charptr = tilde_expand_filename(arg, getuid());
530 /* increase optional counter */
531 if (intptr != NULL)
532 *intptr = *intptr + 1;
533 }
534 break;
535
536 case sPidFile:
537 charptr = &options->pid_file;
538 goto parse_filename;
539
540 case sPermitRootLogin:
541 intptr = &options->permit_root_login;
542 arg = strdelim(&cp);
543 if (!arg || *arg == '\0')
544 fatal("%s line %d: missing yes/"
545 "without-password/forced-commands-only/no "
546 "argument.", filename, linenum);
547 value = 0; /* silence compiler */
548 if (strcmp(arg, "without-password") == 0)
549 value = PERMIT_NO_PASSWD;
550 else if (strcmp(arg, "forced-commands-only") == 0)
551 value = PERMIT_FORCED_ONLY;
552 else if (strcmp(arg, "yes") == 0)
553 value = PERMIT_YES;
554 else if (strcmp(arg, "no") == 0)
555 value = PERMIT_NO;
556 else
557 fatal("%s line %d: Bad yes/"
558 "without-password/forced-commands-only/no "
559 "argument: %s", filename, linenum, arg);
560 if (*intptr == -1)
561 *intptr = value;
562 break;
563
564 case sIgnoreRhosts:
565 intptr = &options->ignore_rhosts;
566parse_flag:
567 arg = strdelim(&cp);
568 if (!arg || *arg == '\0')
569 fatal("%s line %d: missing yes/no argument.",
570 filename, linenum);
571 value = 0; /* silence compiler */
572 if (strcmp(arg, "yes") == 0)
573 value = 1;
574 else if (strcmp(arg, "no") == 0)
575 value = 0;
576 else
577 fatal("%s line %d: Bad yes/no argument: %s",
578 filename, linenum, arg);
579 if (*intptr == -1)
580 *intptr = value;
581 break;
582
583 case sIgnoreUserKnownHosts:
584 intptr = &options->ignore_user_known_hosts;
585 goto parse_flag;
586
587 case sRhostsAuthentication:
588 intptr = &options->rhosts_authentication;
589 goto parse_flag;
590
591 case sRhostsRSAAuthentication:
592 intptr = &options->rhosts_rsa_authentication;
593 goto parse_flag;
594
595 case sHostbasedAuthentication:
596 intptr = &options->hostbased_authentication;
597 goto parse_flag;
598
599 case sHostbasedUsesNameFromPacketOnly:
600 intptr = &options->hostbased_uses_name_from_packet_only;
601 goto parse_flag;
602
603 case sRSAAuthentication:
604 intptr = &options->rsa_authentication;
605 goto parse_flag;
606
607 case sPubkeyAuthentication:
608 intptr = &options->pubkey_authentication;
609 goto parse_flag;
610#if defined(KRB4) || defined(KRB5)
611 case sKerberosAuthentication:
612 intptr = &options->kerberos_authentication;
613 goto parse_flag;
614
615 case sKerberosOrLocalPasswd:
616 intptr = &options->kerberos_or_local_passwd;
617 goto parse_flag;
618
619 case sKerberosTicketCleanup:
620 intptr = &options->kerberos_ticket_cleanup;
621 goto parse_flag;
622#endif
623#if defined(AFS) || defined(KRB5)
624 case sKerberosTgtPassing:
625 intptr = &options->kerberos_tgt_passing;
626 goto parse_flag;
627#endif
628#ifdef AFS
629 case sAFSTokenPassing:
630 intptr = &options->afs_token_passing;
631 goto parse_flag;
632#endif
633
634 case sPasswordAuthentication:
635 intptr = &options->password_authentication;
636 goto parse_flag;
637
638 case sKbdInteractiveAuthentication:
639 intptr = &options->kbd_interactive_authentication;
640 goto parse_flag;
641
642 case sChallengeResponseAuthentication:
643 intptr = &options->challenge_response_authentication;
644 goto parse_flag;
645
646 case sPrintMotd:
647 intptr = &options->print_motd;
648 goto parse_flag;
649
650 case sPrintLastLog:
651 intptr = &options->print_lastlog;
652 goto parse_flag;
653
654 case sX11Forwarding:
655 intptr = &options->x11_forwarding;
656 goto parse_flag;
657
658 case sX11DisplayOffset:
659 intptr = &options->x11_display_offset;
660 goto parse_int;
661
Damien Miller95c249f2002-02-05 12:11:34 +1100662 case sX11UseLocalhost:
663 intptr = &options->x11_use_localhost;
664 goto parse_flag;
665
Ben Lindstromade03f62001-12-06 18:22:17 +0000666 case sXAuthLocation:
667 charptr = &options->xauth_location;
668 goto parse_filename;
669
670 case sStrictModes:
671 intptr = &options->strict_modes;
672 goto parse_flag;
673
674 case sKeepAlives:
675 intptr = &options->keepalives;
676 goto parse_flag;
677
678 case sEmptyPasswd:
679 intptr = &options->permit_empty_passwd;
680 goto parse_flag;
681
682 case sUseLogin:
683 intptr = &options->use_login;
684 goto parse_flag;
685
686 case sGatewayPorts:
687 intptr = &options->gateway_ports;
688 goto parse_flag;
689
690 case sReverseMappingCheck:
691 intptr = &options->reverse_mapping_check;
692 goto parse_flag;
693
694 case sLogFacility:
695 intptr = (int *) &options->log_facility;
696 arg = strdelim(&cp);
697 value = log_facility_number(arg);
698 if (value == (SyslogFacility) - 1)
699 fatal("%.200s line %d: unsupported log facility '%s'",
700 filename, linenum, arg ? arg : "<NONE>");
701 if (*intptr == -1)
702 *intptr = (SyslogFacility) value;
703 break;
704
705 case sLogLevel:
706 intptr = (int *) &options->log_level;
707 arg = strdelim(&cp);
708 value = log_level_number(arg);
709 if (value == (LogLevel) - 1)
710 fatal("%.200s line %d: unsupported log level '%s'",
711 filename, linenum, arg ? arg : "<NONE>");
712 if (*intptr == -1)
713 *intptr = (LogLevel) value;
714 break;
715
716 case sAllowTcpForwarding:
717 intptr = &options->allow_tcp_forwarding;
718 goto parse_flag;
719
720 case sAllowUsers:
721 while ((arg = strdelim(&cp)) && *arg != '\0') {
722 if (options->num_allow_users >= MAX_ALLOW_USERS)
723 fatal("%s line %d: too many allow users.",
724 filename, linenum);
725 options->allow_users[options->num_allow_users++] = xstrdup(arg);
726 }
727 break;
728
729 case sDenyUsers:
730 while ((arg = strdelim(&cp)) && *arg != '\0') {
731 if (options->num_deny_users >= MAX_DENY_USERS)
732 fatal( "%s line %d: too many deny users.",
733 filename, linenum);
734 options->deny_users[options->num_deny_users++] = xstrdup(arg);
735 }
736 break;
737
738 case sAllowGroups:
739 while ((arg = strdelim(&cp)) && *arg != '\0') {
740 if (options->num_allow_groups >= MAX_ALLOW_GROUPS)
741 fatal("%s line %d: too many allow groups.",
742 filename, linenum);
743 options->allow_groups[options->num_allow_groups++] = xstrdup(arg);
744 }
745 break;
746
747 case sDenyGroups:
748 while ((arg = strdelim(&cp)) && *arg != '\0') {
749 if (options->num_deny_groups >= MAX_DENY_GROUPS)
750 fatal("%s line %d: too many deny groups.",
751 filename, linenum);
752 options->deny_groups[options->num_deny_groups++] = xstrdup(arg);
753 }
754 break;
755
756 case sCiphers:
757 arg = strdelim(&cp);
758 if (!arg || *arg == '\0')
759 fatal("%s line %d: Missing argument.", filename, linenum);
760 if (!ciphers_valid(arg))
761 fatal("%s line %d: Bad SSH2 cipher spec '%s'.",
762 filename, linenum, arg ? arg : "<NONE>");
763 if (options->ciphers == NULL)
764 options->ciphers = xstrdup(arg);
765 break;
766
767 case sMacs:
768 arg = strdelim(&cp);
769 if (!arg || *arg == '\0')
770 fatal("%s line %d: Missing argument.", filename, linenum);
771 if (!mac_valid(arg))
772 fatal("%s line %d: Bad SSH2 mac spec '%s'.",
773 filename, linenum, arg ? arg : "<NONE>");
774 if (options->macs == NULL)
775 options->macs = xstrdup(arg);
776 break;
777
778 case sProtocol:
779 intptr = &options->protocol;
780 arg = strdelim(&cp);
781 if (!arg || *arg == '\0')
782 fatal("%s line %d: Missing argument.", filename, linenum);
783 value = proto_spec(arg);
784 if (value == SSH_PROTO_UNKNOWN)
785 fatal("%s line %d: Bad protocol spec '%s'.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100786 filename, linenum, arg ? arg : "<NONE>");
Ben Lindstromade03f62001-12-06 18:22:17 +0000787 if (*intptr == SSH_PROTO_UNKNOWN)
788 *intptr = value;
789 break;
790
791 case sSubsystem:
792 if (options->num_subsystems >= MAX_SUBSYSTEMS) {
793 fatal("%s line %d: too many subsystems defined.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100794 filename, linenum);
Ben Lindstromade03f62001-12-06 18:22:17 +0000795 }
796 arg = strdelim(&cp);
797 if (!arg || *arg == '\0')
798 fatal("%s line %d: Missing subsystem name.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100799 filename, linenum);
Ben Lindstromade03f62001-12-06 18:22:17 +0000800 for (i = 0; i < options->num_subsystems; i++)
801 if (strcmp(arg, options->subsystem_name[i]) == 0)
802 fatal("%s line %d: Subsystem '%s' already defined.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100803 filename, linenum, arg);
Ben Lindstromade03f62001-12-06 18:22:17 +0000804 options->subsystem_name[options->num_subsystems] = xstrdup(arg);
805 arg = strdelim(&cp);
806 if (!arg || *arg == '\0')
807 fatal("%s line %d: Missing subsystem command.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100808 filename, linenum);
Ben Lindstromade03f62001-12-06 18:22:17 +0000809 options->subsystem_command[options->num_subsystems] = xstrdup(arg);
810 options->num_subsystems++;
811 break;
812
813 case sMaxStartups:
814 arg = strdelim(&cp);
815 if (!arg || *arg == '\0')
816 fatal("%s line %d: Missing MaxStartups spec.",
Damien Miller9f0f5c62001-12-21 14:45:46 +1100817 filename, linenum);
Ben Lindstromade03f62001-12-06 18:22:17 +0000818 if ((n = sscanf(arg, "%d:%d:%d",
819 &options->max_startups_begin,
820 &options->max_startups_rate,
821 &options->max_startups)) == 3) {
822 if (options->max_startups_begin >
823 options->max_startups ||
824 options->max_startups_rate > 100 ||
825 options->max_startups_rate < 1)
826 fatal("%s line %d: Illegal MaxStartups spec.",
827 filename, linenum);
828 } else if (n != 1)
829 fatal("%s line %d: Illegal MaxStartups spec.",
830 filename, linenum);
831 else
832 options->max_startups = options->max_startups_begin;
833 break;
834
835 case sBanner:
836 charptr = &options->banner;
837 goto parse_filename;
838 /*
839 * These options can contain %X options expanded at
840 * connect time, so that you can specify paths like:
841 *
842 * AuthorizedKeysFile /etc/ssh_keys/%u
843 */
844 case sAuthorizedKeysFile:
845 case sAuthorizedKeysFile2:
846 charptr = (opcode == sAuthorizedKeysFile ) ?
847 &options->authorized_keys_file :
848 &options->authorized_keys_file2;
849 goto parse_filename;
850
851 case sClientAliveInterval:
852 intptr = &options->client_alive_interval;
853 goto parse_time;
854
855 case sClientAliveCountMax:
856 intptr = &options->client_alive_count_max;
857 goto parse_int;
858
859 case sDeprecated:
860 log("%s line %d: Deprecated option %s",
861 filename, linenum, arg);
862 while (arg)
863 arg = strdelim(&cp);
864 break;
865
866 default:
867 fatal("%s line %d: Missing handler for opcode %s (%d)",
868 filename, linenum, arg, opcode);
869 }
870 if ((arg = strdelim(&cp)) != NULL && *arg != '\0')
871 fatal("%s line %d: garbage at end of line; \"%.200s\".",
872 filename, linenum, arg);
873 return 0;
874}
875
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000876/* Reads the server configuration file. */
877
Damien Miller4af51302000-04-16 11:18:38 +1000878void
Damien Miller95def091999-11-25 00:26:21 +1100879read_server_config(ServerOptions *options, const char *filename)
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000880{
Damien Miller95def091999-11-25 00:26:21 +1100881 FILE *f;
882 char line[1024];
Ben Lindstromade03f62001-12-06 18:22:17 +0000883 int linenum;
Damien Miller95def091999-11-25 00:26:21 +1100884 int bad_options = 0;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000885
Damien Miller95def091999-11-25 00:26:21 +1100886 f = fopen(filename, "r");
887 if (!f) {
888 perror(filename);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000889 exit(1);
Damien Miller95def091999-11-25 00:26:21 +1100890 }
891 linenum = 0;
892 while (fgets(line, sizeof(line), f)) {
Ben Lindstromade03f62001-12-06 18:22:17 +0000893 /* Update line number counter. */
Damien Miller95def091999-11-25 00:26:21 +1100894 linenum++;
Ben Lindstromade03f62001-12-06 18:22:17 +0000895 if (process_server_config_line(options, line, filename, linenum) != 0)
Damien Miller95def091999-11-25 00:26:21 +1100896 bad_options++;
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000897 }
Damien Miller95def091999-11-25 00:26:21 +1100898 fclose(f);
Ben Lindstromb5cdc662001-04-16 02:13:26 +0000899 if (bad_options > 0)
900 fatal("%s: terminating, %d bad configuration options",
901 filename, bad_options);
Damien Millerd4a8b7e1999-10-27 13:42:43 +1000902}