Lines Matching refs:options

124  * General data structure for command line options and options configurable
127 Options options;
198 * Expands the set of percent_expand options used by the majority of keywords
212 * Expands the set of percent_expand options used by the majority of keywords
234 * NB. this function must operate with a options having undefined members.
253 hints.ai_family = options.address_family == -1 ?
254 AF_UNSPEC : options.address_family;
299 hints.ai_family = options.address_family == -1 ?
300 AF_UNSPEC : options.address_family;
317 * NB. this function must operate with a options having undefined members.
330 hints.ai_family = options.address_family == -1 ?
331 AF_UNSPEC : options.address_family;
368 * NB. this function must operate with a options having undefined members.
376 if (*cname == '\0' || !config_has_permitted_cnames(&options) ||
379 if (options.canonicalize_hostname == SSH_CANONICALISE_NO)
386 options.canonicalize_hostname != SSH_CANONICALISE_ALWAYS)
389 for (i = 0; i < options.num_permitted_cnames; i++) {
390 rule = options.permitted_cnames + i;
407 * NB. this function must operate with a options having undefined members.
442 if (options.canonicalize_hostname == SSH_CANONICALISE_NO)
449 direct = option_clear_or_none(options.proxy_command) &&
450 option_clear_or_none(options.jump_host);
452 options.canonicalize_hostname != SSH_CANONICALISE_ALWAYS)
472 if (ndots > options.canonicalize_max_dots) {
474 *hostp, options.canonicalize_max_dots);
478 for (i = 0; i < options.num_canonical_domains; i++) {
479 if (strcasecmp(options.canonical_domains[i], "none") == 0)
482 options.canonical_domains[i]);
502 if (!options.canonicalize_fallback_local)
520 options.required_rsa_size)) != 0) {
553 !read_config_file(config, pw, host, host_name, &options,
563 &options, SSHCONF_CHECKPERM | SSHCONF_USERCONF |
568 host, host_name, &options,
706 initialize_options(&options);
732 options.address_family = AF_INET;
735 options.address_family = AF_INET6;
738 options.stdin_null = 1;
741 options.fork_after_authentication = 1;
742 options.stdin_null = 1;
745 options.forward_x11 = 0;
748 options.forward_x11 = 1;
760 options.forward_x11 = 1;
761 options.forward_x11_trusted = 1;
764 options.fwd_opts.gateway_ports = 1;
767 if (options.stdio_forward_host != NULL)
788 if (options.tag == NULL)
789 options.tag = xstrdup(optarg);
844 options.forward_agent = 0;
847 options.forward_agent = 1;
850 options.gss_deleg_creds = 0;
853 options.gss_authentication = 1;
854 options.gss_deleg_creds = 1;
863 add_identity_file(&options, NULL, p, 1);
868 free(options.pkcs11_provider);
869 options.pkcs11_provider = xstrdup(optarg);
875 if (options.jump_host != NULL) {
880 if (options.proxy_command != NULL)
882 if (parse_jump(optarg, &options, 1) == -1)
884 options.proxy_command = xstrdup("none");
887 if (options.request_tty == REQUEST_TTY_YES)
888 options.request_tty = REQUEST_TTY_FORCE;
890 options.request_tty = REQUEST_TTY_YES;
895 options.log_level = SYSLOG_LEVEL_DEBUG1;
897 if (options.log_level < SYSLOG_LEVEL_DEBUG3) {
899 options.log_level++;
909 if (options.tun_open == -1)
910 options.tun_open = SSH_TUNMODE_DEFAULT;
911 options.tun_local = a2tun(optarg, &options.tun_remote);
912 if (options.tun_local == SSH_TUNID_ERR) {
919 if (options.stdio_forward_host != NULL)
924 options.stdio_forward_host =
927 options.stdio_forward_port = fwd.listen_port;
935 options.request_tty = REQUEST_TTY_NO;
936 options.session_type = SESSION_TYPE_NONE;
939 options.log_level = SYSLOG_LEVEL_QUIET;
945 options.escape_char = (u_char) optarg[1] & 31;
947 options.escape_char = (u_char) optarg[0];
949 options.escape_char = SSH_ESCAPECHAR_NONE;
963 free(options.ciphers);
964 options.ciphers = xstrdup(optarg);
968 free(options.macs);
969 options.macs = xstrdup(optarg);
977 if (options.control_master == SSHCTL_MASTER_YES)
978 options.control_master = SSHCTL_MASTER_ASK;
980 options.control_master = SSHCTL_MASTER_YES;
983 if (options.port == -1) {
984 options.port = a2port(optarg);
985 if (options.port <= 0) {
993 if (options.user == NULL)
994 options.user = optarg;
999 add_local_forward(&options, &fwd);
1011 add_remote_forward(&options, &fwd);
1022 add_local_forward(&options, &fwd);
1033 options.compression = 1;
1039 if (options.session_type != -1 &&
1040 options.session_type != SESSION_TYPE_NONE)
1042 options.session_type = SESSION_TYPE_NONE;
1043 options.request_tty = REQUEST_TTY_NO;
1046 options.request_tty = REQUEST_TTY_NO;
1050 if (process_config_line(&options, pw,
1057 if (options.session_type != -1 &&
1058 options.session_type != SESSION_TYPE_SUBSYSTEM)
1060 options.session_type = SESSION_TYPE_SUBSYSTEM;
1063 free(options.control_path);
1064 options.control_path = xstrdup(optarg);
1067 options.bind_address = optarg;
1070 options.bind_interface = optarg;
1094 if (options.user == NULL) {
1095 options.user = tuser;
1099 if (options.port == -1 && tport != -1)
1100 options.port = tport;
1108 if (options.user == NULL) {
1109 options.user = p;
1132 if (options.user != NULL && !valid_ruser(options.user))
1134 options.host_arg = xstrdup(host);
1152 if (options.session_type == SESSION_TYPE_SUBSYSTEM) {
1177 options.log_level == SYSLOG_LEVEL_NOT_SET ?
1178 SYSLOG_LEVEL_INFO : options.log_level,
1179 options.log_facility == SYSLOG_FACILITY_NOT_SET ?
1180 SYSLOG_FACILITY_USER : options.log_facility,
1187 process_config_files(options.host_arg, pw, 0, &want_final_pass);
1191 /* Hostname canonicalisation needs a few options filled. */
1192 fill_default_options_for_canonicalization(&options);
1195 if (options.hostname != NULL) {
1197 cp = percent_expand(options.hostname,
1201 free(options.hostname);
1202 options.hostname = xstrdup(host);
1213 if (options.canonicalize_hostname != SSH_CANONICALISE_NO || was_addr)
1214 addrs = resolve_canonicalize(&host, options.port);
1229 direct = option_clear_or_none(options.proxy_command) &&
1230 option_clear_or_none(options.jump_host);
1231 if (addrs == NULL && config_has_permitted_cnames(&options) && (direct ||
1232 options.canonicalize_hostname == SSH_CANONICALISE_ALWAYS)) {
1233 if ((addrs = resolve_host(host, options.port,
1246 if (options.canonicalize_hostname != 0 && !want_final_pass) {
1254 free(options.hostname);
1255 options.hostname = xstrdup(host);
1256 process_config_files(options.host_arg, pw, 1, NULL);
1262 if (addrs != NULL && options.port > 0)
1263 set_addrinfo_port(addrs, options.port);
1267 if (fill_default_options(&options) != 0)
1270 if (options.user == NULL)
1271 options.user = xstrdup(pw->pw_name);
1276 if (options.jump_host != NULL) {
1278 const char *jumpuser = options.jump_user, *sshbin = argv0;
1279 int port = options.port, jumpport = options.jump_port;
1286 jumpuser = options.user;
1287 if (strcmp(options.jump_host, host) == 0 && port == jumpport &&
1288 strcmp(options.user, jumpuser) == 0)
1289 fatal("jumphost loop via %s", options.jump_host);
1299 if (options.proxy_command != NULL)
1300 fatal("inconsistent options: ProxyCommand+ProxyJump");
1302 options.proxy_use_fdpass = 0;
1303 snprintf(port_s, sizeof(port_s), "%d", options.jump_port);
1304 xasprintf(&options.proxy_command,
1308 options.jump_user == NULL ? "" : " -l ",
1309 options.jump_user == NULL ? "" : options.jump_user,
1311 options.jump_port <= 0 ? "" : " -p ",
1312 options.jump_port <= 0 ? "" : port_s,
1314 options.jump_extra == NULL ? "" : " -J ",
1315 options.jump_extra == NULL ? "" : options.jump_extra,
1323 options.jump_host);
1325 options.proxy_command);
1328 if (options.port == 0)
1329 options.port = default_ssh_port();
1330 channel_set_af(ssh, options.address_family);
1332 /* Tidy and check options */
1333 if (options.host_key_alias != NULL)
1334 lowercase(options.host_key_alias);
1335 if (options.proxy_command != NULL &&
1336 strcmp(options.proxy_command, "-") == 0 &&
1337 options.proxy_use_fdpass)
1339 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
1340 if (options.control_persist && options.control_path != NULL) {
1343 options.update_hostkeys = 0;
1345 options.remote_command != NULL ||
1346 options.request_tty == REQUEST_TTY_NO) {
1349 options.update_hostkeys = 0;
1350 } else if (options.log_level < SYSLOG_LEVEL_INFO) {
1352 options.update_hostkeys = 0;
1355 if (options.connection_attempts <= 0)
1358 if (sshbuf_len(command) != 0 && options.remote_command != NULL)
1362 if (options.fork_after_authentication && sshbuf_len(command) == 0 &&
1363 options.remote_command == NULL &&
1364 options.session_type != SESSION_TYPE_NONE)
1369 log_init(argv0, options.log_level, options.log_facility, !use_syslog);
1370 for (j = 0; j < options.num_log_verbose; j++) {
1371 if (strcasecmp(options.log_verbose[j], "none") == 0)
1373 log_verbose_add(options.log_verbose[j]);
1376 if (options.request_tty == REQUEST_TTY_YES ||
1377 options.request_tty == REQUEST_TTY_FORCE)
1381 if (sshbuf_len(command) == 0 && options.remote_command == NULL)
1382 tty_flag = options.request_tty != REQUEST_TTY_NO;
1385 if (options.request_tty == REQUEST_TTY_NO ||
1387 options.session_type == SESSION_TYPE_NONE)
1390 if ((!isatty(fileno(stdin)) || options.stdin_null) &&
1391 options.request_tty != REQUEST_TTY_FORCE) {
1405 xasprintf(&cinfo->portstr, "%d", options.port);
1408 cinfo->keyalias = xstrdup(options.host_key_alias ?
1409 options.host_key_alias : options.host_arg);
1410 cinfo->host_arg = xstrdup(options.host_arg);
1412 cinfo->remuser = xstrdup(options.user);
1415 cinfo->jmphost = xstrdup(options.jump_host == NULL ?
1416 "" : options.jump_host);
1425 if (options.remote_command != NULL) {
1426 debug3("expanding RemoteCommand: %s", options.remote_command);
1427 cp = options.remote_command;
1428 options.remote_command = default_client_percent_expand(cp,
1430 debug3("expanded RemoteCommand: %s", options.remote_command);
1432 if ((r = sshbuf_put(command, options.remote_command,
1433 strlen(options.remote_command))) != 0)
1437 if (options.control_path != NULL) {
1438 cp = tilde_expand_filename(options.control_path, getuid());
1439 free(options.control_path);
1440 options.control_path = default_client_percent_dollar_expand(cp,
1445 if (options.identity_agent != NULL) {
1446 p = tilde_expand_filename(options.identity_agent, getuid());
1449 free(options.identity_agent);
1450 options.identity_agent = cp;
1453 if (options.revoked_host_keys != NULL) {
1454 p = tilde_expand_filename(options.revoked_host_keys, getuid());
1457 free(options.revoked_host_keys);
1458 options.revoked_host_keys = cp;
1461 if (options.forward_agent_sock_path != NULL) {
1462 p = tilde_expand_filename(options.forward_agent_sock_path,
1466 free(options.forward_agent_sock_path);
1467 options.forward_agent_sock_path = cp;
1468 if (stat(options.forward_agent_sock_path, &st) != 0) {
1470 options.forward_agent_sock_path, strerror(errno));
1471 if (options.exit_on_forward_failure)
1476 if (options.num_system_hostfiles > 0 &&
1477 strcasecmp(options.system_hostfiles[0], "none") == 0) {
1478 if (options.num_system_hostfiles > 1)
1481 free(options.system_hostfiles[0]);
1482 options.system_hostfiles[0] = NULL;
1483 options.num_system_hostfiles = 0;
1486 if (options.num_user_hostfiles > 0 &&
1487 strcasecmp(options.user_hostfiles[0], "none") == 0) {
1488 if (options.num_user_hostfiles > 1)
1491 free(options.user_hostfiles[0]);
1492 options.user_hostfiles[0] = NULL;
1493 options.num_user_hostfiles = 0;
1495 for (j = 0; j < options.num_user_hostfiles; j++) {
1496 if (options.user_hostfiles[j] == NULL)
1498 cp = tilde_expand_filename(options.user_hostfiles[j], getuid());
1500 if (strcmp(options.user_hostfiles[j], p) != 0)
1502 "'%s'", options.user_hostfiles[j], p);
1503 free(options.user_hostfiles[j]);
1505 options.user_hostfiles[j] = p;
1508 for (i = 0; i < options.num_local_forwards; i++) {
1509 if (options.local_forwards[i].listen_path != NULL) {
1510 cp = options.local_forwards[i].listen_path;
1511 p = options.local_forwards[i].listen_path =
1518 if (options.local_forwards[i].connect_path != NULL) {
1519 cp = options.local_forwards[i].connect_path;
1520 p = options.local_forwards[i].connect_path =
1529 for (i = 0; i < options.num_remote_forwards; i++) {
1530 if (options.remote_forwards[i].listen_path != NULL) {
1531 cp = options.remote_forwards[i].listen_path;
1532 p = options.remote_forwards[i].listen_path =
1539 if (options.remote_forwards[i].connect_path != NULL) {
1540 cp = options.remote_forwards[i].connect_path;
1541 p = options.remote_forwards[i].connect_path =
1551 dump_client_config(&options, host);
1556 if (options.sk_provider != NULL && *options.sk_provider == '$' &&
1557 strlen(options.sk_provider) > 1) {
1558 if ((cp = getenv(options.sk_provider + 1)) == NULL) {
1560 "disabling", options.sk_provider);
1561 free(options.sk_provider);
1562 options.sk_provider = NULL;
1565 options.sk_provider, cp);
1566 free(options.sk_provider);
1567 options.sk_provider = xstrdup(cp);
1571 if (muxclient_command != 0 && options.control_path == NULL)
1573 if (options.control_path != NULL) {
1575 if ((sock = muxclient(options.control_path)) >= 0) {
1586 if (addrs == NULL && options.proxy_command == NULL) {
1587 debug2("resolving \"%s\" port %d", host, options.port);
1588 if ((addrs = resolve_host(host, options.port, 1,
1593 if (options.connection_timeout >= INT_MAX/1000)
1596 timeout_ms = options.connection_timeout * 1000;
1600 for (j = 0; j < options.num_channel_timeouts; j++) {
1602 options.channel_timeouts[j]);
1603 if (parse_pattern_interval(options.channel_timeouts[j],
1606 options.channel_timeouts[j]);
1613 if (ssh_connect(ssh, host, options.host_arg, addrs, &hostaddr,
1614 options.port, options.connection_attempts,
1615 &timeout_ms, options.tcp_keep_alive) != 0)
1621 ssh_packet_set_timeout(ssh, options.server_alive_interval,
1622 options.server_alive_count_max);
1634 if (options.hostbased_authentication) {
1665 if (options.hostbased_authentication == 1) {
1686 /* load options.identity_files */
1690 if (options.identity_agent &&
1691 strcmp(options.identity_agent, SSH_AUTHSOCKET_ENV_NAME) != 0) {
1692 if (strcmp(options.identity_agent, "none") == 0) {
1695 cp = options.identity_agent;
1713 if (options.forward_agent && options.forward_agent_sock_path != NULL) {
1714 cp = options.forward_agent_sock_path;
1722 options.forward_agent = 0;
1730 tilde_expand_paths(options.system_hostfiles,
1731 options.num_system_hostfiles);
1732 tilde_expand_paths(options.user_hostfiles, options.num_user_hostfiles);
1738 options.port, pw, timeout_ms, cinfo);
1752 for (i = 0; i < options.num_identity_files; i++) {
1753 free(options.identity_files[i]);
1754 options.identity_files[i] = NULL;
1755 if (options.identity_keys[i]) {
1756 sshkey_free(options.identity_keys[i]);
1757 options.identity_keys[i] = NULL;
1760 for (i = 0; i < options.num_certificate_files; i++) {
1761 free(options.certificate_files[i]);
1762 options.certificate_files[i] = NULL;
1766 (void)pkcs11_del_provider(options.pkcs11_provider);
1774 if (options.control_path != NULL && muxserver_sock != -1)
1775 unlink(options.control_path);
1806 options.stdin_null = ostdin_null_flag;
1807 options.request_tty = orequest_tty;
1809 options.fork_after_authentication = ofork_after_authentication;
1810 options.session_type = osession_type;
1813 options.control_master = SSHCTL_MASTER_NO;
1814 (void)muxclient(options.control_path);
1821 setproctitle("%s [mux]", options.control_path);
1831 options.fork_after_authentication = 0;
1845 if (options.fork_after_authentication)
1897 if (options.exit_on_forward_failure) {
1935 if (options.exit_on_forward_failure)
1949 if (options.stdio_forward_host == NULL)
1952 debug3_f("%s:%d", options.stdio_forward_host,
1953 options.stdio_forward_port);
1958 if ((c = channel_connect_stdio_fwd(ssh, options.stdio_forward_host,
1959 options.stdio_forward_port, in, out,
2009 options.permitted_remote_opens,
2010 options.num_permitted_remote_opens);
2012 if (options.exit_on_forward_failure)
2015 for (i = 0; i < options.num_local_forwards; i++) {
2018 (options.local_forwards[i].listen_path != NULL) ?
2019 options.local_forwards[i].listen_path :
2020 (options.local_forwards[i].listen_host == NULL) ?
2021 (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") :
2022 options.local_forwards[i].listen_host,
2023 options.local_forwards[i].listen_port,
2024 (options.local_forwards[i].connect_path != NULL) ?
2025 options.local_forwards[i].connect_path :
2026 options.local_forwards[i].connect_host,
2027 options.local_forwards[i].connect_port);
2029 &options.local_forwards[i], &options.fwd_opts);
2031 if (i > 0 && success != i && options.exit_on_forward_failure)
2037 for (i = 0; i < options.num_remote_forwards; i++) {
2040 (options.remote_forwards[i].listen_path != NULL) ?
2041 options.remote_forwards[i].listen_path :
2042 (options.remote_forwards[i].listen_host == NULL) ?
2043 "LOCALHOST" : options.remote_forwards[i].listen_host,
2044 options.remote_forwards[i].listen_port,
2045 (options.remote_forwards[i].connect_path != NULL) ?
2046 options.remote_forwards[i].connect_path :
2047 options.remote_forwards[i].connect_host,
2048 options.remote_forwards[i].connect_port);
2049 if ((options.remote_forwards[i].handle =
2051 &options.remote_forwards[i])) >= 0) {
2054 &options.remote_forwards[i]);
2056 } else if (options.exit_on_forward_failure)
2063 if (options.tun_open != SSH_TUNMODE_NO) {
2065 options.tun_open, options.tun_local,
2066 options.tun_remote, ssh_tun_confirm, NULL)) != NULL)
2068 else if (options.exit_on_forward_failure)
2084 if (options.forward_agent) {
2087 options.forward_agent = 0;
2106 if (display == NULL && options.forward_x11)
2108 if (options.forward_x11 && client_x11_get_proto(ssh, display,
2109 options.xauth_location, options.forward_x11_trusted,
2110 options.forward_x11_timeout, &proto, &data) == 0) {
2122 if (options.forward_agent) {
2131 options.ip_qos_interactive, options.ip_qos_bulk);
2133 if ((term = lookup_env_in_list("TERM", options.setenv,
2134 options.num_setenv)) == NULL || *term == '\0')
2137 options.session_type == SESSION_TYPE_SUBSYSTEM, term,
2148 if (options.stdin_null) {
2173 if (options.session_type != SESSION_TYPE_NONE)
2187 if (!options.control_persist)
2192 if (options.local_command != NULL) {
2193 debug3("expanding LocalCommand: %s", options.local_command);
2194 cp = options.local_command;
2195 options.local_command = percent_expand(cp,
2199 debug3("expanded LocalCommand: %s", options.local_command);
2216 if (options.control_persist && muxserver_sock != -1) {
2217 ostdin_null_flag = options.stdin_null;
2218 osession_type = options.session_type;
2219 orequest_tty = options.request_tty;
2221 ofork_after_authentication = options.fork_after_authentication;
2222 options.stdin_null = 1;
2223 options.session_type = SESSION_TYPE_NONE;
2226 options.stdio_forward_host != NULL))
2228 options.fork_after_authentication = 1;
2234 if (options.control_persist && muxserver_sock == -1)
2237 if (options.session_type != SESSION_TYPE_NONE)
2240 interactive = options.control_master == SSHCTL_MASTER_NO;
2245 options.ip_qos_interactive, options.ip_qos_bulk);
2249 if (options.control_master == SSHCTL_MASTER_NO &&
2261 if (options.local_command != NULL &&
2262 options.permit_local_command)
2263 ssh_local_cmd(options.local_command);
2278 if (options.fork_after_authentication) {
2279 if (options.exit_on_forward_failure &&
2280 options.num_remote_forwards > 0) {
2288 options.escape_char : SSH_ESCAPECHAR_NONE, id);
2322 if (options.pkcs11_provider != NULL &&
2323 options.num_identity_files < SSH_MAX_IDENTITY_FILES &&
2324 (pkcs11_init(!options.batch_mode) == 0) &&
2325 (nkeys = pkcs11_add_provider(options.pkcs11_provider, NULL,
2341 for (i = 0; i < options.num_identity_files; i++) {
2343 strcasecmp(options.identity_files[i], "none") == 0) {
2344 free(options.identity_files[i]);
2345 options.identity_files[i] = NULL;
2348 cp = tilde_expand_filename(options.identity_files[i], getuid());
2355 free(options.identity_files[i]);
2359 options.identity_file_userprovided[i];
2367 if (options.num_certificate_files != 0)
2389 options.identity_file_userprovided[i];
2393 if (options.num_certificate_files > SSH_MAX_CERTIFICATE_FILES)
2395 for (i = 0; i < options.num_certificate_files; i++) {
2396 cp = tilde_expand_filename(options.certificate_files[i],
2405 free(options.certificate_files[i]);
2406 options.certificate_files[i] = NULL;
2421 options.certificate_file_userprovided[i];
2425 options.num_identity_files = n_ids;
2426 memcpy(options.identity_files, identity_files, sizeof(identity_files));
2427 memcpy(options.identity_keys, identity_keys, sizeof(identity_keys));
2428 memcpy(options.identity_file_userprovided,
2431 options.num_certificate_files = n_certs;
2432 memcpy(options.certificate_files,
2434 memcpy(options.certificates, certificates, sizeof(certificates));
2435 memcpy(options.certificate_file_userprovided,