Lines Matching refs:options

85 static void parse_server_config_depth(ServerOptions *options,
94 initialize_server_options(ServerOptions *options) in initialize_server_options() argument
96 memset(options, 0, sizeof(*options)); in initialize_server_options()
99 options->use_pam = -1; in initialize_server_options()
100 options->pam_service_name = NULL; in initialize_server_options()
103 options->num_ports = 0; in initialize_server_options()
104 options->ports_from_cmdline = 0; in initialize_server_options()
105 options->queued_listen_addrs = NULL; in initialize_server_options()
106 options->num_queued_listens = 0; in initialize_server_options()
107 options->listen_addrs = NULL; in initialize_server_options()
108 options->num_listen_addrs = 0; in initialize_server_options()
109 options->address_family = -1; in initialize_server_options()
110 options->routing_domain = NULL; in initialize_server_options()
111 options->num_host_key_files = 0; in initialize_server_options()
112 options->num_host_cert_files = 0; in initialize_server_options()
113 options->host_key_agent = NULL; in initialize_server_options()
114 options->pid_file = NULL; in initialize_server_options()
115 options->login_grace_time = -1; in initialize_server_options()
116 options->permit_root_login = PERMIT_NOT_SET; in initialize_server_options()
117 options->ignore_rhosts = -1; in initialize_server_options()
118 options->ignore_root_rhosts = -1; in initialize_server_options()
119 options->ignore_user_known_hosts = -1; in initialize_server_options()
120 options->print_motd = -1; in initialize_server_options()
121 options->print_lastlog = -1; in initialize_server_options()
122 options->x11_forwarding = -1; in initialize_server_options()
123 options->x11_display_offset = -1; in initialize_server_options()
124 options->x11_use_localhost = -1; in initialize_server_options()
125 options->permit_tty = -1; in initialize_server_options()
126 options->permit_user_rc = -1; in initialize_server_options()
127 options->xauth_location = NULL; in initialize_server_options()
128 options->strict_modes = -1; in initialize_server_options()
129 options->tcp_keep_alive = -1; in initialize_server_options()
130 options->log_facility = SYSLOG_FACILITY_NOT_SET; in initialize_server_options()
131 options->log_level = SYSLOG_LEVEL_NOT_SET; in initialize_server_options()
132 options->num_log_verbose = 0; in initialize_server_options()
133 options->log_verbose = NULL; in initialize_server_options()
134 options->hostbased_authentication = -1; in initialize_server_options()
135 options->hostbased_uses_name_from_packet_only = -1; in initialize_server_options()
136 options->hostbased_accepted_algos = NULL; in initialize_server_options()
137 options->hostkeyalgorithms = NULL; in initialize_server_options()
138 options->pubkey_authentication = -1; in initialize_server_options()
139 options->pubkey_auth_options = -1; in initialize_server_options()
140 options->pubkey_accepted_algos = NULL; in initialize_server_options()
141 options->kerberos_authentication = -1; in initialize_server_options()
142 options->kerberos_or_local_passwd = -1; in initialize_server_options()
143 options->kerberos_ticket_cleanup = -1; in initialize_server_options()
145 options->kerberos_tgt_passing = -1; in initialize_server_options()
148 options->afs_token_passing = -1; in initialize_server_options()
150 options->kerberos_get_afs_token = -1; in initialize_server_options()
151 options->gss_authentication=-1; in initialize_server_options()
152 options->gss_cleanup_creds = -1; in initialize_server_options()
153 options->gss_strict_acceptor = -1; in initialize_server_options()
154 options->password_authentication = -1; in initialize_server_options()
155 options->kbd_interactive_authentication = -1; in initialize_server_options()
156 options->permit_empty_passwd = -1; in initialize_server_options()
157 options->permit_user_env = -1; in initialize_server_options()
158 options->permit_user_env_allowlist = NULL; in initialize_server_options()
159 options->compression = -1; in initialize_server_options()
160 options->rekey_limit = -1; in initialize_server_options()
161 options->rekey_interval = -1; in initialize_server_options()
162 options->allow_tcp_forwarding = -1; in initialize_server_options()
163 options->allow_streamlocal_forwarding = -1; in initialize_server_options()
164 options->allow_agent_forwarding = -1; in initialize_server_options()
165 options->num_allow_users = 0; in initialize_server_options()
166 options->num_deny_users = 0; in initialize_server_options()
167 options->num_allow_groups = 0; in initialize_server_options()
168 options->num_deny_groups = 0; in initialize_server_options()
169 options->ciphers = NULL; in initialize_server_options()
172 options->lpk.ld = NULL; in initialize_server_options()
173 options->lpk.on = -1; in initialize_server_options()
174 options->lpk.servers = NULL; in initialize_server_options()
175 options->lpk.u_basedn = NULL; in initialize_server_options()
176 options->lpk.g_basedn = NULL; in initialize_server_options()
177 options->lpk.binddn = NULL; in initialize_server_options()
178 options->lpk.bindpw = NULL; in initialize_server_options()
179 options->lpk.sgroup = NULL; in initialize_server_options()
180 options->lpk.filter = NULL; in initialize_server_options()
181 options->lpk.fgroup = NULL; in initialize_server_options()
182 options->lpk.l_conf = NULL; in initialize_server_options()
183 options->lpk.tls = -1; in initialize_server_options()
184 options->lpk.b_timeout.tv_sec = -1; in initialize_server_options()
185 options->lpk.s_timeout.tv_sec = -1; in initialize_server_options()
186 options->lpk.flags = FLAG_EMPTY; in initialize_server_options()
187 options->lpk.pub_key_attr = NULL; in initialize_server_options()
189 options->macs = NULL; in initialize_server_options()
190 options->kex_algorithms = NULL; in initialize_server_options()
191 options->ca_sign_algorithms = NULL; in initialize_server_options()
192 options->fwd_opts.gateway_ports = -1; in initialize_server_options()
193 options->fwd_opts.streamlocal_bind_mask = (mode_t)-1; in initialize_server_options()
194 options->fwd_opts.streamlocal_bind_unlink = -1; in initialize_server_options()
195 options->num_subsystems = 0; in initialize_server_options()
196 options->max_startups_begin = -1; in initialize_server_options()
197 options->max_startups_rate = -1; in initialize_server_options()
198 options->max_startups = -1; in initialize_server_options()
199 options->per_source_max_startups = -1; in initialize_server_options()
200 options->per_source_masklen_ipv4 = -1; in initialize_server_options()
201 options->per_source_masklen_ipv6 = -1; in initialize_server_options()
202 options->per_source_penalty_exempt = NULL; in initialize_server_options()
203 options->per_source_penalty.enabled = -1; in initialize_server_options()
204 options->per_source_penalty.max_sources4 = -1; in initialize_server_options()
205 options->per_source_penalty.max_sources6 = -1; in initialize_server_options()
206 options->per_source_penalty.overflow_mode = -1; in initialize_server_options()
207 options->per_source_penalty.overflow_mode6 = -1; in initialize_server_options()
208 options->per_source_penalty.penalty_crash = -1; in initialize_server_options()
209 options->per_source_penalty.penalty_authfail = -1; in initialize_server_options()
210 options->per_source_penalty.penalty_noauth = -1; in initialize_server_options()
211 options->per_source_penalty.penalty_grace = -1; in initialize_server_options()
212 options->per_source_penalty.penalty_refuseconnection = -1; in initialize_server_options()
213 options->per_source_penalty.penalty_max = -1; in initialize_server_options()
214 options->per_source_penalty.penalty_min = -1; in initialize_server_options()
215 options->max_authtries = -1; in initialize_server_options()
216 options->max_sessions = -1; in initialize_server_options()
217 options->banner = NULL; in initialize_server_options()
218 options->use_dns = -1; in initialize_server_options()
219 options->client_alive_interval = -1; in initialize_server_options()
220 options->client_alive_count_max = -1; in initialize_server_options()
221 options->num_authkeys_files = 0; in initialize_server_options()
222 options->num_accept_env = 0; in initialize_server_options()
223 options->num_setenv = 0; in initialize_server_options()
224 options->permit_tun = -1; in initialize_server_options()
225 options->permitted_opens = NULL; in initialize_server_options()
226 options->permitted_listens = NULL; in initialize_server_options()
227 options->adm_forced_command = NULL; in initialize_server_options()
228 options->chroot_directory = NULL; in initialize_server_options()
229 options->authorized_keys_command = NULL; in initialize_server_options()
230 options->authorized_keys_command_user = NULL; in initialize_server_options()
231 options->revoked_keys_file = NULL; in initialize_server_options()
232 options->sk_provider = NULL; in initialize_server_options()
233 options->trusted_user_ca_keys = NULL; in initialize_server_options()
234 options->authorized_principals_file = NULL; in initialize_server_options()
235 options->authorized_principals_command = NULL; in initialize_server_options()
236 options->authorized_principals_command_user = NULL; in initialize_server_options()
237 options->ip_qos_interactive = -1; in initialize_server_options()
238 options->ip_qos_bulk = -1; in initialize_server_options()
239 options->version_addendum = NULL; in initialize_server_options()
240 options->fingerprint_hash = -1; in initialize_server_options()
241 options->disable_forwarding = -1; in initialize_server_options()
242 options->expose_userauth_info = -1; in initialize_server_options()
243 options->required_rsa_size = -1; in initialize_server_options()
244 options->channel_timeouts = NULL; in initialize_server_options()
245 options->num_channel_timeouts = 0; in initialize_server_options()
246 options->unused_connection_timeout = -1; in initialize_server_options()
247 options->sshd_session_path = NULL; in initialize_server_options()
248 options->sshd_auth_path = NULL; in initialize_server_options()
249 options->refuse_connection = -1; in initialize_server_options()
250 options->none_enabled = -1; in initialize_server_options()
251 options->tcp_rcv_buf_poll = -1; in initialize_server_options()
252 options->hpn_disabled = -1; in initialize_server_options()
253 options->hpn_buffer_size = -1; in initialize_server_options()
308 ServerOptions *options, const char *path, int userprovided) in servconf_add_hostkey() argument
313 &options->host_key_files, &options->host_key_file_userprovided, in servconf_add_hostkey()
314 &options->num_host_key_files, apath, userprovided); in servconf_add_hostkey()
320 ServerOptions *options, const char *path) in servconf_add_hostcert() argument
325 &options->host_cert_files, &options->num_host_cert_files, apath); in servconf_add_hostcert()
330 fill_default_server_options(ServerOptions *options) in fill_default_server_options() argument
338 if (options->use_pam == -1) in fill_default_server_options()
339 options->use_pam = 0; in fill_default_server_options()
340 if (options->pam_service_name == NULL) in fill_default_server_options()
341 options->pam_service_name = xstrdup(SSHD_PAM_SERVICE); in fill_default_server_options()
346 if (options->num_host_key_files == 0) { in fill_default_server_options()
348 servconf_add_hostkey("[default]", 0, options, in fill_default_server_options()
350 servconf_add_hostkey("[default]", 0, options, in fill_default_server_options()
352 servconf_add_hostkey("[default]", 0, options, in fill_default_server_options()
355 servconf_add_hostkey("[default]", 0, options, in fill_default_server_options()
360 if (options->num_ports == 0) in fill_default_server_options()
361 options->ports[options->num_ports++] = SSH_DEFAULT_PORT; in fill_default_server_options()
362 if (options->address_family == -1) in fill_default_server_options()
363 options->address_family = AF_UNSPEC; in fill_default_server_options()
364 if (options->listen_addrs == NULL) in fill_default_server_options()
365 add_listen_addr(options, NULL, NULL, 0); in fill_default_server_options()
366 if (options->pid_file == NULL) in fill_default_server_options()
367 options->pid_file = xstrdup(_PATH_SSH_DAEMON_PID_FILE); in fill_default_server_options()
368 if (options->moduli_file == NULL) in fill_default_server_options()
369 options->moduli_file = xstrdup(_PATH_DH_MODULI); in fill_default_server_options()
370 if (options->login_grace_time == -1) in fill_default_server_options()
371 options->login_grace_time = 120; in fill_default_server_options()
372 if (options->permit_root_login == PERMIT_NOT_SET) in fill_default_server_options()
373 options->permit_root_login = PERMIT_NO_PASSWD; in fill_default_server_options()
374 if (options->ignore_rhosts == -1) in fill_default_server_options()
375 options->ignore_rhosts = 1; in fill_default_server_options()
376 if (options->ignore_root_rhosts == -1) in fill_default_server_options()
377 options->ignore_root_rhosts = options->ignore_rhosts; in fill_default_server_options()
378 if (options->ignore_user_known_hosts == -1) in fill_default_server_options()
379 options->ignore_user_known_hosts = 0; in fill_default_server_options()
380 if (options->print_motd == -1) in fill_default_server_options()
381 options->print_motd = 1; in fill_default_server_options()
382 if (options->print_lastlog == -1) in fill_default_server_options()
383 options->print_lastlog = 1; in fill_default_server_options()
384 if (options->x11_forwarding == -1) in fill_default_server_options()
385 options->x11_forwarding = 0; in fill_default_server_options()
386 if (options->x11_display_offset == -1) in fill_default_server_options()
387 options->x11_display_offset = 10; in fill_default_server_options()
388 if (options->x11_use_localhost == -1) in fill_default_server_options()
389 options->x11_use_localhost = 1; in fill_default_server_options()
390 if (options->xauth_location == NULL) in fill_default_server_options()
391 options->xauth_location = xstrdup(_PATH_XAUTH); in fill_default_server_options()
392 if (options->permit_tty == -1) in fill_default_server_options()
393 options->permit_tty = 1; in fill_default_server_options()
394 if (options->permit_user_rc == -1) in fill_default_server_options()
395 options->permit_user_rc = 1; in fill_default_server_options()
396 if (options->strict_modes == -1) in fill_default_server_options()
397 options->strict_modes = 1; in fill_default_server_options()
398 if (options->tcp_keep_alive == -1) in fill_default_server_options()
399 options->tcp_keep_alive = 1; in fill_default_server_options()
400 if (options->log_facility == SYSLOG_FACILITY_NOT_SET) in fill_default_server_options()
401 options->log_facility = SYSLOG_FACILITY_AUTH; in fill_default_server_options()
402 if (options->log_level == SYSLOG_LEVEL_NOT_SET) in fill_default_server_options()
403 options->log_level = SYSLOG_LEVEL_INFO; in fill_default_server_options()
404 if (options->hostbased_authentication == -1) in fill_default_server_options()
405 options->hostbased_authentication = 0; in fill_default_server_options()
406 if (options->hostbased_uses_name_from_packet_only == -1) in fill_default_server_options()
407 options->hostbased_uses_name_from_packet_only = 0; in fill_default_server_options()
408 if (options->pubkey_authentication == -1) in fill_default_server_options()
409 options->pubkey_authentication = 1; in fill_default_server_options()
410 if (options->pubkey_auth_options == -1) in fill_default_server_options()
411 options->pubkey_auth_options = 0; in fill_default_server_options()
412 if (options->kerberos_authentication == -1) in fill_default_server_options()
413 options->kerberos_authentication = 0; in fill_default_server_options()
414 if (options->kerberos_or_local_passwd == -1) in fill_default_server_options()
415 options->kerberos_or_local_passwd = 1; in fill_default_server_options()
416 if (options->kerberos_ticket_cleanup == -1) in fill_default_server_options()
417 options->kerberos_ticket_cleanup = 1; in fill_default_server_options()
419 if (options->kerberos_tgt_passing == -1) in fill_default_server_options()
420 options->kerberos_tgt_passing = 0; in fill_default_server_options()
423 if (options->afs_token_passing == -1) in fill_default_server_options()
424 options->afs_token_passing = 0; in fill_default_server_options()
426 if (options->kerberos_get_afs_token == -1) in fill_default_server_options()
427 options->kerberos_get_afs_token = 0; in fill_default_server_options()
428 if (options->gss_authentication == -1) in fill_default_server_options()
429 options->gss_authentication = 0; in fill_default_server_options()
430 if (options->gss_cleanup_creds == -1) in fill_default_server_options()
431 options->gss_cleanup_creds = 1; in fill_default_server_options()
432 if (options->gss_strict_acceptor == -1) in fill_default_server_options()
433 options->gss_strict_acceptor = 1; in fill_default_server_options()
434 if (options->password_authentication == -1) in fill_default_server_options()
435 options->password_authentication = 1; in fill_default_server_options()
436 if (options->kbd_interactive_authentication == -1) in fill_default_server_options()
437 options->kbd_interactive_authentication = 1; in fill_default_server_options()
438 if (options->permit_empty_passwd == -1) in fill_default_server_options()
439 options->permit_empty_passwd = 0; in fill_default_server_options()
440 if (options->permit_user_env == -1) { in fill_default_server_options()
441 options->permit_user_env = 0; in fill_default_server_options()
442 options->permit_user_env_allowlist = NULL; in fill_default_server_options()
444 if (options->compression == -1) in fill_default_server_options()
446 options->compression = COMP_DELAYED; in fill_default_server_options()
448 options->compression = COMP_NONE; in fill_default_server_options()
451 if (options->rekey_limit == -1) in fill_default_server_options()
452 options->rekey_limit = 0; in fill_default_server_options()
453 if (options->rekey_interval == -1) in fill_default_server_options()
454 options->rekey_interval = 0; in fill_default_server_options()
455 if (options->allow_tcp_forwarding == -1) in fill_default_server_options()
456 options->allow_tcp_forwarding = FORWARD_ALLOW; in fill_default_server_options()
457 if (options->allow_streamlocal_forwarding == -1) in fill_default_server_options()
458 options->allow_streamlocal_forwarding = FORWARD_ALLOW; in fill_default_server_options()
459 if (options->allow_agent_forwarding == -1) in fill_default_server_options()
460 options->allow_agent_forwarding = 1; in fill_default_server_options()
461 if (options->fwd_opts.gateway_ports == -1) in fill_default_server_options()
462 options->fwd_opts.gateway_ports = 0; in fill_default_server_options()
463 if (options->max_startups == -1) in fill_default_server_options()
464 options->max_startups = 100; in fill_default_server_options()
465 if (options->max_startups_rate == -1) in fill_default_server_options()
466 options->max_startups_rate = 30; /* 30% */ in fill_default_server_options()
467 if (options->max_startups_begin == -1) in fill_default_server_options()
468 options->max_startups_begin = 10; in fill_default_server_options()
469 if (options->per_source_max_startups == -1) in fill_default_server_options()
470 options->per_source_max_startups = INT_MAX; in fill_default_server_options()
471 if (options->per_source_masklen_ipv4 == -1) in fill_default_server_options()
472 options->per_source_masklen_ipv4 = 32; in fill_default_server_options()
473 if (options->per_source_masklen_ipv6 == -1) in fill_default_server_options()
474 options->per_source_masklen_ipv6 = 128; in fill_default_server_options()
475 if (options->per_source_penalty.enabled == -1) in fill_default_server_options()
476 options->per_source_penalty.enabled = 1; in fill_default_server_options()
477 if (options->per_source_penalty.max_sources4 == -1) in fill_default_server_options()
478 options->per_source_penalty.max_sources4 = 65536; in fill_default_server_options()
479 if (options->per_source_penalty.max_sources6 == -1) in fill_default_server_options()
480 options->per_source_penalty.max_sources6 = 65536; in fill_default_server_options()
481 if (options->per_source_penalty.overflow_mode == -1) in fill_default_server_options()
482options->per_source_penalty.overflow_mode = PER_SOURCE_PENALTY_OVERFLOW_PERMISSIVE; in fill_default_server_options()
483 if (options->per_source_penalty.overflow_mode6 == -1) in fill_default_server_options()
484options->per_source_penalty.overflow_mode6 = options->per_source_penalty.overflow_mode; in fill_default_server_options()
485 if (options->per_source_penalty.penalty_crash == -1) in fill_default_server_options()
486 options->per_source_penalty.penalty_crash = 90; in fill_default_server_options()
487 if (options->per_source_penalty.penalty_grace == -1) in fill_default_server_options()
488 options->per_source_penalty.penalty_grace = 10; in fill_default_server_options()
489 if (options->per_source_penalty.penalty_authfail == -1) in fill_default_server_options()
490 options->per_source_penalty.penalty_authfail = 5; in fill_default_server_options()
491 if (options->per_source_penalty.penalty_noauth == -1) in fill_default_server_options()
492 options->per_source_penalty.penalty_noauth = 1; in fill_default_server_options()
493 if (options->per_source_penalty.penalty_refuseconnection == -1) in fill_default_server_options()
494 options->per_source_penalty.penalty_refuseconnection = 10; in fill_default_server_options()
495 if (options->per_source_penalty.penalty_min == -1) in fill_default_server_options()
496 options->per_source_penalty.penalty_min = 15; in fill_default_server_options()
497 if (options->per_source_penalty.penalty_max == -1) in fill_default_server_options()
498 options->per_source_penalty.penalty_max = 600; in fill_default_server_options()
499 if (options->max_authtries == -1) in fill_default_server_options()
500 options->max_authtries = DEFAULT_AUTH_FAIL_MAX; in fill_default_server_options()
501 if (options->max_sessions == -1) in fill_default_server_options()
502 options->max_sessions = DEFAULT_SESSIONS_MAX; in fill_default_server_options()
503 if (options->use_dns == -1) in fill_default_server_options()
504 options->use_dns = 0; in fill_default_server_options()
505 if (options->client_alive_interval == -1) in fill_default_server_options()
506 options->client_alive_interval = 0; in fill_default_server_options()
507 if (options->client_alive_count_max == -1) in fill_default_server_options()
508 options->client_alive_count_max = 3; in fill_default_server_options()
509 if (options->num_authkeys_files == 0) { in fill_default_server_options()
511 &options->authorized_keys_files, in fill_default_server_options()
512 &options->num_authkeys_files, in fill_default_server_options()
515 &options->authorized_keys_files, in fill_default_server_options()
516 &options->num_authkeys_files, in fill_default_server_options()
519 if (options->permit_tun == -1) in fill_default_server_options()
520 options->permit_tun = SSH_TUNMODE_NO; in fill_default_server_options()
521 if (options->ip_qos_interactive == -1) in fill_default_server_options()
522 options->ip_qos_interactive = IPTOS_DSCP_AF21; in fill_default_server_options()
523 if (options->ip_qos_bulk == -1) in fill_default_server_options()
524 options->ip_qos_bulk = IPTOS_DSCP_CS1; in fill_default_server_options()
525 if (options->version_addendum == NULL) in fill_default_server_options()
526 options->version_addendum = xstrdup(""); in fill_default_server_options()
528 if (options->hpn_disabled == -1) in fill_default_server_options()
529 options->hpn_disabled = 0; in fill_default_server_options()
531 if (options->hpn_buffer_size == -1) { in fill_default_server_options()
534 if (options->hpn_disabled == 1) { in fill_default_server_options()
535 options->hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT; in fill_default_server_options()
544 options->hpn_buffer_size = socksize; in fill_default_server_options()
545 debug ("HPN Buffer Size: %d", options->hpn_buffer_size); in fill_default_server_options()
551 if (options->hpn_disabled <= 0) { in fill_default_server_options()
552 if (options->hpn_buffer_size == 0) in fill_default_server_options()
553 options->hpn_buffer_size = 1; in fill_default_server_options()
555 if (options->hpn_buffer_size > 64*1024) { in fill_default_server_options()
556 options->hpn_buffer_size = 64*1024*1024; in fill_default_server_options()
558 options->hpn_buffer_size *= 1024; in fill_default_server_options()
561 options->hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT; in fill_default_server_options()
565 if (options->lpk.on == -1) in fill_default_server_options()
566 options->lpk.on = _DEFAULT_LPK_ON; in fill_default_server_options()
567 if (options->lpk.servers == NULL) in fill_default_server_options()
568 options->lpk.servers = _DEFAULT_LPK_SERVERS; in fill_default_server_options()
569 if (options->lpk.u_basedn == NULL) in fill_default_server_options()
570 options->lpk.u_basedn = _DEFAULT_LPK_UDN; in fill_default_server_options()
571 if (options->lpk.g_basedn == NULL) in fill_default_server_options()
572 options->lpk.g_basedn = _DEFAULT_LPK_GDN; in fill_default_server_options()
573 if (options->lpk.binddn == NULL) in fill_default_server_options()
574 options->lpk.binddn = _DEFAULT_LPK_BINDDN; in fill_default_server_options()
575 if (options->lpk.bindpw == NULL) in fill_default_server_options()
576 options->lpk.bindpw = _DEFAULT_LPK_BINDPW; in fill_default_server_options()
577 if (options->lpk.sgroup == NULL) in fill_default_server_options()
578 options->lpk.sgroup = _DEFAULT_LPK_SGROUP; in fill_default_server_options()
579 if (options->lpk.filter == NULL) in fill_default_server_options()
580 options->lpk.filter = _DEFAULT_LPK_FILTER; in fill_default_server_options()
581 if (options->lpk.tls == -1) in fill_default_server_options()
582 options->lpk.tls = _DEFAULT_LPK_TLS; in fill_default_server_options()
583 if (options->lpk.b_timeout.tv_sec == -1) in fill_default_server_options()
584 options->lpk.b_timeout.tv_sec = _DEFAULT_LPK_BTIMEOUT; in fill_default_server_options()
585 if (options->lpk.s_timeout.tv_sec == -1) in fill_default_server_options()
586 options->lpk.s_timeout.tv_sec = _DEFAULT_LPK_STIMEOUT; in fill_default_server_options()
587 if (options->lpk.l_conf == NULL) in fill_default_server_options()
588 options->lpk.l_conf = _DEFAULT_LPK_LDP; in fill_default_server_options()
589 if (options->lpk.pub_key_attr == NULL) in fill_default_server_options()
590 options->lpk.pub_key_attr = __UNCONST(_DEFAULT_LPK_PUB); in fill_default_server_options()
593 if (options->fwd_opts.streamlocal_bind_mask == (mode_t)-1) in fill_default_server_options()
594 options->fwd_opts.streamlocal_bind_mask = 0177; in fill_default_server_options()
595 if (options->fwd_opts.streamlocal_bind_unlink == -1) in fill_default_server_options()
596 options->fwd_opts.streamlocal_bind_unlink = 0; in fill_default_server_options()
597 if (options->fingerprint_hash == -1) in fill_default_server_options()
598 options->fingerprint_hash = SSH_FP_HASH_DEFAULT; in fill_default_server_options()
599 if (options->disable_forwarding == -1) in fill_default_server_options()
600 options->disable_forwarding = 0; in fill_default_server_options()
601 if (options->expose_userauth_info == -1) in fill_default_server_options()
602 options->expose_userauth_info = 0; in fill_default_server_options()
603 if (options->sk_provider == NULL) in fill_default_server_options()
604 options->sk_provider = xstrdup("internal"); in fill_default_server_options()
605 if (options->required_rsa_size == -1) in fill_default_server_options()
606 options->required_rsa_size = SSH_RSA_MINIMUM_MODULUS_SIZE; in fill_default_server_options()
607 if (options->unused_connection_timeout == -1) in fill_default_server_options()
608 options->unused_connection_timeout = 0; in fill_default_server_options()
609 if (options->sshd_session_path == NULL) in fill_default_server_options()
610 options->sshd_session_path = xstrdup(_PATH_SSHD_SESSION); in fill_default_server_options()
611 if (options->sshd_auth_path == NULL) in fill_default_server_options()
612 options->sshd_auth_path = xstrdup(_PATH_SSHD_AUTH); in fill_default_server_options()
613 if (options->refuse_connection == -1) in fill_default_server_options()
614 options->refuse_connection = 0; in fill_default_server_options()
616 assemble_algorithms(options); in fill_default_server_options()
627 if (options->nv == 1 && \ in fill_default_server_options()
628 strcasecmp(options->v[0], none) == 0) { \ in fill_default_server_options()
629 free(options->v[0]); \ in fill_default_server_options()
630 free(options->v); \ in fill_default_server_options()
631 options->v = NULL; \ in fill_default_server_options()
632 options->nv = 0; \ in fill_default_server_options()
635 CLEAR_ON_NONE(options->pid_file); in fill_default_server_options()
636 CLEAR_ON_NONE(options->xauth_location); in fill_default_server_options()
637 CLEAR_ON_NONE(options->banner); in fill_default_server_options()
638 CLEAR_ON_NONE(options->trusted_user_ca_keys); in fill_default_server_options()
639 CLEAR_ON_NONE(options->revoked_keys_file); in fill_default_server_options()
640 CLEAR_ON_NONE(options->sk_provider); in fill_default_server_options()
641 CLEAR_ON_NONE(options->authorized_principals_file); in fill_default_server_options()
642 CLEAR_ON_NONE(options->adm_forced_command); in fill_default_server_options()
643 CLEAR_ON_NONE(options->chroot_directory); in fill_default_server_options()
644 CLEAR_ON_NONE(options->routing_domain); in fill_default_server_options()
645 CLEAR_ON_NONE(options->host_key_agent); in fill_default_server_options()
646 CLEAR_ON_NONE(options->per_source_penalty_exempt); in fill_default_server_options()
648 for (i = 0; i < options->num_host_key_files; i++) in fill_default_server_options()
649 CLEAR_ON_NONE(options->host_key_files[i]); in fill_default_server_options()
650 for (i = 0; i < options->num_host_cert_files; i++) in fill_default_server_options()
651 CLEAR_ON_NONE(options->host_cert_files[i]); in fill_default_server_options()
959 add_listen_addr(ServerOptions *options, const char *addr, in add_listen_addr() argument
965 add_one_listen_addr(options, addr, rdomain, port); in add_listen_addr()
967 for (i = 0; i < options->num_ports; i++) { in add_listen_addr()
968 add_one_listen_addr(options, addr, rdomain, in add_listen_addr()
969 options->ports[i]); in add_listen_addr()
975 add_one_listen_addr(ServerOptions *options, const char *addr, in add_one_listen_addr() argument
984 for (i = 0; i < options->num_listen_addrs; i++) { in add_one_listen_addr()
985 if (rdomain == NULL && options->listen_addrs[i].rdomain == NULL) in add_one_listen_addr()
987 if (rdomain == NULL || options->listen_addrs[i].rdomain == NULL) in add_one_listen_addr()
989 if (strcmp(rdomain, options->listen_addrs[i].rdomain) == 0) in add_one_listen_addr()
992 if (i >= options->num_listen_addrs) { in add_one_listen_addr()
996 options->listen_addrs = xrecallocarray(options->listen_addrs, in add_one_listen_addr()
997 options->num_listen_addrs, options->num_listen_addrs + 1, in add_one_listen_addr()
998 sizeof(*options->listen_addrs)); in add_one_listen_addr()
999 i = options->num_listen_addrs++; in add_one_listen_addr()
1001 options->listen_addrs[i].rdomain = xstrdup(rdomain); in add_one_listen_addr()
1006 hints.ai_family = options->address_family; in add_one_listen_addr()
1016 ai->ai_next = options->listen_addrs[i].addrs; in add_one_listen_addr()
1017 options->listen_addrs[i].addrs = aitop; in add_one_listen_addr()
1058 queue_listen_addr(ServerOptions *options, const char *addr, in queue_listen_addr() argument
1063 options->queued_listen_addrs = xrecallocarray( in queue_listen_addr()
1064 options->queued_listen_addrs, in queue_listen_addr()
1065 options->num_queued_listens, options->num_queued_listens + 1, in queue_listen_addr()
1066 sizeof(*options->queued_listen_addrs)); in queue_listen_addr()
1067 qla = &options->queued_listen_addrs[options->num_queued_listens++]; in queue_listen_addr()
1077 process_queued_listen_addrs(ServerOptions *options) in process_queued_listen_addrs() argument
1082 if (options->num_ports == 0) in process_queued_listen_addrs()
1083 options->ports[options->num_ports++] = SSH_DEFAULT_PORT; in process_queued_listen_addrs()
1084 if (options->address_family == -1) in process_queued_listen_addrs()
1085 options->address_family = AF_UNSPEC; in process_queued_listen_addrs()
1087 for (i = 0; i < options->num_queued_listens; i++) { in process_queued_listen_addrs()
1088 qla = &options->queued_listen_addrs[i]; in process_queued_listen_addrs()
1089 add_listen_addr(options, qla->addr, qla->rdomain, qla->port); in process_queued_listen_addrs()
1093 free(options->queued_listen_addrs); in process_queued_listen_addrs()
1094 options->queued_listen_addrs = NULL; in process_queued_listen_addrs()
1095 options->num_queued_listens = 0; in process_queued_listen_addrs()
1451 process_server_config_line_depth(ServerOptions *options, char *line, in process_server_config_line_depth() argument
1532 intptr = &options->use_pam; in process_server_config_line_depth()
1535 charptr = &options->pam_service_name; in process_server_config_line_depth()
1550 if (options->ports_from_cmdline) { in process_server_config_line_depth()
1554 if (options->num_ports >= MAX_PORTS) in process_server_config_line_depth()
1561 options->ports[options->num_ports++] = a2port(arg); in process_server_config_line_depth()
1562 if (options->ports[options->num_ports-1] <= 0) in process_server_config_line_depth()
1568 intptr = &options->login_grace_time; in process_server_config_line_depth()
1615 queue_listen_addr(options, p, arg2, port); in process_server_config_line_depth()
1620 intptr = &options->address_family; in process_server_config_line_depth()
1648 options, arg, 1); in process_server_config_line_depth()
1653 charptr = &options->host_key_agent; in process_server_config_line_depth()
1669 servconf_add_hostcert(filename, linenum, options, arg); in process_server_config_line_depth()
1673 charptr = &options->pid_file; in process_server_config_line_depth()
1688 charptr = &options->moduli_file; in process_server_config_line_depth()
1692 intptr = &options->permit_root_login; in process_server_config_line_depth()
1697 intptr = &options->ignore_rhosts; in process_server_config_line_depth()
1702 intptr = &options->ignore_root_rhosts; in process_server_config_line_depth()
1706 intptr = &options->none_enabled; in process_server_config_line_depth()
1710 intptr = &options->tcp_rcv_buf_poll; in process_server_config_line_depth()
1714 intptr = &options->hpn_disabled; in process_server_config_line_depth()
1718 intptr = &options->hpn_buffer_size; in process_server_config_line_depth()
1722 intptr = &options->ignore_user_known_hosts; in process_server_config_line_depth()
1728 intptr = &options->hostbased_authentication; in process_server_config_line_depth()
1732 intptr = &options->hostbased_uses_name_from_packet_only; in process_server_config_line_depth()
1736 charptr = &options->hostbased_accepted_algos; in process_server_config_line_depth()
1753 charptr = &options->hostkeyalgorithms; in process_server_config_line_depth()
1758 charptr = &options->ca_sign_algorithms; in process_server_config_line_depth()
1763 intptr = &options->pubkey_authentication; in process_server_config_line_depth()
1768 charptr = &options->pubkey_accepted_algos; in process_server_config_line_depth()
1773 intptr = &options->pubkey_auth_options; in process_server_config_line_depth()
1793 intptr = &options->kerberos_authentication; in process_server_config_line_depth()
1797 intptr = &options->kerberos_or_local_passwd; in process_server_config_line_depth()
1801 intptr = &options->kerberos_ticket_cleanup; in process_server_config_line_depth()
1805 intptr = &options->kerberos_tgt_passing; in process_server_config_line_depth()
1809 intptr = &options->kerberos_get_afs_token; in process_server_config_line_depth()
1813 intptr = &options->gss_authentication; in process_server_config_line_depth()
1817 intptr = &options->gss_cleanup_creds; in process_server_config_line_depth()
1821 intptr = &options->gss_strict_acceptor; in process_server_config_line_depth()
1825 intptr = &options->password_authentication; in process_server_config_line_depth()
1829 intptr = &options->kbd_interactive_authentication; in process_server_config_line_depth()
1833 intptr = &options->print_motd; in process_server_config_line_depth()
1837 intptr = &options->print_lastlog; in process_server_config_line_depth()
1841 intptr = &options->x11_forwarding; in process_server_config_line_depth()
1845 intptr = &options->x11_display_offset; in process_server_config_line_depth()
1856 intptr = &options->x11_use_localhost; in process_server_config_line_depth()
1860 charptr = &options->xauth_location; in process_server_config_line_depth()
1864 intptr = &options->permit_tty; in process_server_config_line_depth()
1868 intptr = &options->permit_user_rc; in process_server_config_line_depth()
1872 intptr = &options->strict_modes; in process_server_config_line_depth()
1876 intptr = &options->tcp_keep_alive; in process_server_config_line_depth()
1880 intptr = &options->permit_empty_passwd; in process_server_config_line_depth()
1884 intptr = &options->permit_user_env; in process_server_config_line_depth()
1885 charptr = &options->permit_user_env_allowlist; in process_server_config_line_depth()
1910 intptr = &options->compression; in process_server_config_line_depth()
1930 if (*activep && options->rekey_limit == -1) in process_server_config_line_depth()
1931 options->rekey_limit = val64; in process_server_config_line_depth()
1937 intptr = &options->rekey_interval; in process_server_config_line_depth()
1943 intptr = &options->fwd_opts.gateway_ports; in process_server_config_line_depth()
1948 intptr = &options->use_dns; in process_server_config_line_depth()
1952 log_facility_ptr = &options->log_facility; in process_server_config_line_depth()
1963 log_level_ptr = &options->log_level; in process_server_config_line_depth()
1974 found = options->num_log_verbose == 0; in process_server_config_line_depth()
1998 options->log_verbose = strs; in process_server_config_line_depth()
1999 options->num_log_verbose = nstrs; in process_server_config_line_depth()
2006 intptr = &options->allow_tcp_forwarding; in process_server_config_line_depth()
2011 intptr = &options->allow_streamlocal_forwarding; in process_server_config_line_depth()
2016 intptr = &options->allow_agent_forwarding; in process_server_config_line_depth()
2020 intptr = &options->disable_forwarding; in process_server_config_line_depth()
2024 chararrayptr = &options->allow_users; in process_server_config_line_depth()
2025 uintptr = &options->num_allow_users; in process_server_config_line_depth()
2046 chararrayptr = &options->deny_users; in process_server_config_line_depth()
2047 uintptr = &options->num_deny_users; in process_server_config_line_depth()
2051 chararrayptr = &options->allow_groups; in process_server_config_line_depth()
2052 uintptr = &options->num_allow_groups; in process_server_config_line_depth()
2072 chararrayptr = &options->deny_groups; in process_server_config_line_depth()
2073 uintptr = &options->num_deny_groups; in process_server_config_line_depth()
2085 if (options->ciphers == NULL) in process_server_config_line_depth()
2086 options->ciphers = xstrdup(arg); in process_server_config_line_depth()
2098 if (options->macs == NULL) in process_server_config_line_depth()
2099 options->macs = xstrdup(arg); in process_server_config_line_depth()
2112 if (options->kex_algorithms == NULL) in process_server_config_line_depth()
2113 options->kex_algorithms = xstrdup(arg); in process_server_config_line_depth()
2126 for (i = 0; i < options->num_subsystems; i++) { in process_server_config_line_depth()
2127 if (strcmp(arg, options->subsystem_name[i]) == 0) { in process_server_config_line_depth()
2138 options->subsystem_name = xrecallocarray( in process_server_config_line_depth()
2139 options->subsystem_name, options->num_subsystems, in process_server_config_line_depth()
2140 options->num_subsystems + 1, in process_server_config_line_depth()
2141 sizeof(*options->subsystem_name)); in process_server_config_line_depth()
2142 options->subsystem_command = xrecallocarray( in process_server_config_line_depth()
2143 options->subsystem_command, options->num_subsystems, in process_server_config_line_depth()
2144 options->num_subsystems + 1, in process_server_config_line_depth()
2145 sizeof(*options->subsystem_command)); in process_server_config_line_depth()
2146 options->subsystem_args = xrecallocarray( in process_server_config_line_depth()
2147 options->subsystem_args, options->num_subsystems, in process_server_config_line_depth()
2148 options->num_subsystems + 1, in process_server_config_line_depth()
2149 sizeof(*options->subsystem_args)); in process_server_config_line_depth()
2150 options->subsystem_name[options->num_subsystems] = xstrdup(arg); in process_server_config_line_depth()
2156 options->subsystem_command[options->num_subsystems] = in process_server_config_line_depth()
2161 xasprintf(&options->subsystem_args[options->num_subsystems], in process_server_config_line_depth()
2166 options->num_subsystems++; in process_server_config_line_depth()
2175 &options->max_startups_begin, in process_server_config_line_depth()
2176 &options->max_startups_rate, in process_server_config_line_depth()
2177 &options->max_startups)) == 3) { in process_server_config_line_depth()
2178 if (options->max_startups_begin > in process_server_config_line_depth()
2179 options->max_startups || in process_server_config_line_depth()
2180 options->max_startups_rate > 100 || in process_server_config_line_depth()
2181 options->max_startups_rate < 1) in process_server_config_line_depth()
2188 options->max_startups = options->max_startups_begin; in process_server_config_line_depth()
2189 if (options->max_startups <= 0 || in process_server_config_line_depth()
2190 options->max_startups_begin <= 0) in process_server_config_line_depth()
2213 options->per_source_masklen_ipv4 = value; in process_server_config_line_depth()
2214 options->per_source_masklen_ipv6 = value2; in process_server_config_line_depth()
2230 if (*activep && options->per_source_max_startups == -1) in process_server_config_line_depth()
2231 options->per_source_max_startups = value; in process_server_config_line_depth()
2235 charptr = &options->per_source_penalty_exempt; in process_server_config_line_depth()
2264 options->per_source_penalty.enabled == -1) in process_server_config_line_depth()
2265 options->per_source_penalty.enabled = value2; in process_server_config_line_depth()
2269 intptr = &options->per_source_penalty.penalty_crash; in process_server_config_line_depth()
2272 intptr = &options->per_source_penalty.penalty_authfail; in process_server_config_line_depth()
2275 intptr = &options->per_source_penalty.penalty_noauth; in process_server_config_line_depth()
2278 intptr = &options->per_source_penalty.penalty_grace; in process_server_config_line_depth()
2281 … intptr = &options->per_source_penalty.penalty_refuseconnection; in process_server_config_line_depth()
2284 intptr = &options->per_source_penalty.penalty_max; in process_server_config_line_depth()
2287 intptr = &options->per_source_penalty.penalty_min; in process_server_config_line_depth()
2289 intptr = &options->per_source_penalty.max_sources4; in process_server_config_line_depth()
2294 intptr = &options->per_source_penalty.max_sources6; in process_server_config_line_depth()
2299 intptr = &options->per_source_penalty.overflow_mode; in process_server_config_line_depth()
2302 intptr = &options->per_source_penalty.overflow_mode; in process_server_config_line_depth()
2305 intptr = &options->per_source_penalty.overflow_mode6; in process_server_config_line_depth()
2308 intptr = &options->per_source_penalty.overflow_mode6; in process_server_config_line_depth()
2322 options->per_source_penalty.enabled = 1; in process_server_config_line_depth()
2332 intptr = &options->max_authtries; in process_server_config_line_depth()
2336 intptr = &options->max_sessions; in process_server_config_line_depth()
2340 charptr = &options->banner; in process_server_config_line_depth()
2350 found = options->num_authkeys_files == 0; in process_server_config_line_depth()
2367 options->authorized_keys_files = strs; in process_server_config_line_depth()
2368 options->num_authkeys_files = nstrs; in process_server_config_line_depth()
2375 charptr = &options->authorized_principals_file; in process_server_config_line_depth()
2389 intptr = &options->client_alive_interval; in process_server_config_line_depth()
2393 intptr = &options->client_alive_count_max; in process_server_config_line_depth()
2406 &options->accept_env, &options->num_accept_env, in process_server_config_line_depth()
2416 found = options->num_setenv == 0; in process_server_config_line_depth()
2434 options->setenv = strs; in process_server_config_line_depth()
2435 options->num_setenv = nstrs; in process_server_config_line_depth()
2442 intptr = &options->permit_tun; in process_server_config_line_depth()
2490 parse_server_config_depth(options, in process_server_config_line_depth()
2537 parse_server_config_depth(options, in process_server_config_line_depth()
2576 uintptr = &options->num_permitted_listens; in process_server_config_line_depth()
2577 chararrayptr = &options->permitted_listens; in process_server_config_line_depth()
2579 uintptr = &options->num_permitted_opens; in process_server_config_line_depth()
2580 chararrayptr = &options->permitted_opens; in process_server_config_line_depth()
2638 if (*activep && options->adm_forced_command == NULL) in process_server_config_line_depth()
2639 options->adm_forced_command = xstrdup(str + len); in process_server_config_line_depth()
2644 charptr = &options->chroot_directory; in process_server_config_line_depth()
2655 charptr = &options->trusted_user_ca_keys; in process_server_config_line_depth()
2659 charptr = &options->revoked_keys_file; in process_server_config_line_depth()
2663 charptr = &options->sk_provider; in process_server_config_line_depth()
2692 options->ip_qos_interactive = value; in process_server_config_line_depth()
2693 options->ip_qos_bulk = value2; in process_server_config_line_depth()
2710 if (*activep && options->version_addendum == NULL) { in process_server_config_line_depth()
2712 options->version_addendum = xstrdup(""); in process_server_config_line_depth()
2714 options->version_addendum = xstrdup(str + len); in process_server_config_line_depth()
2720 charptr = &options->authorized_keys_command; in process_server_config_line_depth()
2733 charptr = &options->authorized_keys_command_user; in process_server_config_line_depth()
2745 charptr = &options->authorized_principals_command; in process_server_config_line_depth()
2749 charptr = &options->authorized_principals_command_user; in process_server_config_line_depth()
2753 found = options->num_auth_methods == 0; in process_server_config_line_depth()
2778 options->auth_methods = strs; in process_server_config_line_depth()
2779 options->num_auth_methods = nstrs; in process_server_config_line_depth()
2796 options->fwd_opts.streamlocal_bind_mask = (mode_t)value; in process_server_config_line_depth()
2800 intptr = &options->fwd_opts.streamlocal_bind_unlink; in process_server_config_line_depth()
2812 options->fingerprint_hash = value; in process_server_config_line_depth()
2816 intptr = &options->expose_userauth_info; in process_server_config_line_depth()
2824 charptr = &options->routing_domain; in process_server_config_line_depth()
2838 intptr = &options->required_rsa_size; in process_server_config_line_depth()
2842 found = options->num_channel_timeouts == 0; in process_server_config_line_depth()
2865 options->channel_timeouts = strs; in process_server_config_line_depth()
2866 options->num_channel_timeouts = nstrs; in process_server_config_line_depth()
2873 intptr = &options->unused_connection_timeout; in process_server_config_line_depth()
2884 charptr = &options->sshd_session_path; in process_server_config_line_depth()
2888 charptr = &options->sshd_auth_path; in process_server_config_line_depth()
2892 intptr = &options->refuse_connection; in process_server_config_line_depth()
2909 intptr = &options->lpk.on; in process_server_config_line_depth()
2919 if ((options->lpk.servers = ldap_parse_servers(arg)) == NULL) in process_server_config_line_depth()
2928 options->lpk.u_basedn = xstrdup(arg); in process_server_config_line_depth()
2936 options->lpk.g_basedn = xstrdup(arg); in process_server_config_line_depth()
2944 options->lpk.binddn = xstrdup(arg); in process_server_config_line_depth()
2952 options->lpk.bindpw = xstrdup(arg); in process_server_config_line_depth()
2960 options->lpk.sgroup = xstrdup(arg); in process_server_config_line_depth()
2961 if (options->lpk.sgroup) in process_server_config_line_depth()
2962 options->lpk.fgroup = ldap_parse_groups(options->lpk.sgroup); in process_server_config_line_depth()
2970 options->lpk.filter = xstrdup(arg); in process_server_config_line_depth()
2974 intptr = &options->lpk.tls; in process_server_config_line_depth()
2993 timetptr = &options->lpk.b_timeout.tv_sec; in process_server_config_line_depth()
3005 timetptr = &options->lpk.s_timeout.tv_sec; in process_server_config_line_depth()
3013 options->lpk.l_conf = xstrdup(arg); in process_server_config_line_depth()
3021 options->lpk.pub_key_attr = xstrdup(arg); in process_server_config_line_depth()
3047 process_server_config_line(ServerOptions *options, char *line, in process_server_config_line() argument
3053 return process_server_config_line_depth(options, line, filename, in process_server_config_line()
3097 parse_server_match_config(ServerOptions *options, in parse_server_match_config() argument
3105 copy_set_server_options(options, &mo, 0); in parse_server_match_config()
3302 parse_server_config_depth(ServerOptions *options, const char *filename, in parse_server_config_depth() argument
3319 if (process_server_config_line_depth(options, cp, in parse_server_config_depth()
3331 parse_server_config(ServerOptions *options, const char *filename, in parse_server_config() argument
3336 parse_server_config_depth(options, filename, conf, includes, in parse_server_config()
3339 process_queued_listen_addrs(options); in parse_server_config()