Lines Matching defs:options
66 # 1. command line options
111 # Defaults for various options
288 * Adds a local TCP/IP port forward to options. Never returns if there is an
293 add_local_forward(Options *options, const Forward *newfwd)
313 options->local_forwards = xrealloc(options->local_forwards,
314 options->num_local_forwards + 1,
315 sizeof(*options->local_forwards));
316 fwd = &options->local_forwards[options->num_local_forwards++];
325 * Adds a remote TCP/IP port forward to options. Never returns if there is
330 add_remote_forward(Options *options, const Forward *newfwd)
334 options->remote_forwards = xrealloc(options->remote_forwards,
335 options->num_remote_forwards + 1,
336 sizeof(*options->remote_forwards));
337 fwd = &options->remote_forwards[options->num_remote_forwards++];
348 clear_forwardings(Options *options)
352 for (i = 0; i < options->num_local_forwards; i++) {
353 free(options->local_forwards[i].listen_host);
354 free(options->local_forwards[i].connect_host);
356 if (options->num_local_forwards > 0) {
357 free(options->local_forwards);
358 options->local_forwards = NULL;
360 options->num_local_forwards = 0;
361 for (i = 0; i < options->num_remote_forwards; i++) {
362 free(options->remote_forwards[i].listen_host);
363 free(options->remote_forwards[i].connect_host);
365 if (options->num_remote_forwards > 0) {
366 free(options->remote_forwards);
367 options->remote_forwards = NULL;
369 options->num_remote_forwards = 0;
370 options->tun_open = SSH_TUNMODE_NO;
374 add_identity_file(Options *options, const char *dir, const char *filename,
379 if (options->num_identity_files >= SSH_MAX_IDENTITY_FILES)
388 options->identity_file_userprovided[options->num_identity_files] =
390 options->identity_files[options->num_identity_files++] = path;
484 match_cfg_line(Options *options, char **condition, struct passwd *pw,
497 port = options->port <= 0 ? default_ssh_port() : options->port;
498 ruser = options->user == NULL ? pw->pw_name : options->user;
499 if (options->hostname != NULL) {
501 host = percent_expand(options->hostname,
727 process_config_line(Options *options, struct passwd *pw, const char *host,
766 options->ignored_unknown);
770 /* don't panic, but count bad options */
778 intptr = &options->connection_timeout;
792 intptr = &options->forward_agent;
815 intptr = &options->forward_x11;
819 intptr = &options->forward_x11_trusted;
823 intptr = &options->forward_x11_timeout;
827 intptr = &options->gateway_ports;
831 intptr = &options->exit_on_forward_failure;
835 intptr = &options->use_privileged_port;
839 intptr = &options->password_authentication;
843 intptr = &options->kbd_interactive_authentication;
847 charptr = &options->kbd_interactive_devices;
851 intptr = &options->pubkey_authentication;
855 intptr = &options->rsa_authentication;
859 intptr = &options->rhosts_rsa_authentication;
863 intptr = &options->hostbased_authentication;
867 intptr = &options->challenge_response_authentication;
871 intptr = &options->gss_authentication;
875 intptr = &options->gss_deleg_creds;
879 intptr = &options->batch_mode;
883 intptr = &options->check_host_ip;
887 intptr = &options->verify_host_key_dns;
892 intptr = &options->strict_host_key_checking;
897 intptr = &options->compression;
901 intptr = &options->tcp_keep_alive;
905 intptr = &options->no_host_authentication_for_localhost;
909 intptr = &options->number_of_password_prompts;
913 intptr = &options->compression_level;
935 if (*activep && options->rekey_limit == -1)
936 options->rekey_limit = (u_int32_t)val64;
942 intptr = &options->rekey_interval;
952 intptr = &options->num_identity_files;
956 add_identity_file(options, NULL, arg, userconfig);
961 charptr=&options->xauth_location;
965 charptr = &options->user;
976 cpptr = (char **)&options->system_hostfiles;
977 uintptr = &options->num_system_hostfiles;
992 cpptr = (char **)&options->user_hostfiles;
993 uintptr = &options->num_user_hostfiles;
998 charptr = &options->hostname;
1002 charptr = &options->host_key_alias;
1006 charptr = &options->preferred_authentications;
1010 charptr = &options->bind_address;
1014 charptr = &options->pkcs11_provider;
1018 charptr = &options->proxy_command;
1028 intptr = &options->port;
1045 intptr = &options->connection_attempts;
1049 intptr = &options->cipher;
1068 if (*activep && options->ciphers == NULL)
1069 options->ciphers = xstrdup(arg);
1079 if (*activep && options->macs == NULL)
1080 options->macs = xstrdup(arg);
1091 if (*activep && options->kex_algorithms == NULL)
1092 options->kex_algorithms = xstrdup(arg);
1102 if (*activep && options->hostkeyalgorithms == NULL)
1103 options->hostkeyalgorithms = xstrdup(arg);
1107 intptr = &options->protocol;
1120 log_level_ptr = &options->log_level;
1160 add_local_forward(options, &fwd);
1162 add_remote_forward(options, &fwd);
1167 intptr = &options->clear_forwardings;
1195 debug("%.200s line %d: Applying options for %.100s",
1204 value = match_cfg_line(options, &s, pw, host,
1213 intptr = &options->escape_char;
1235 intptr = &options->address_family;
1240 intptr = &options->enable_ssh_keysign;
1244 intptr = &options->identities_only;
1248 intptr = &options->server_alive_interval;
1252 intptr = &options->server_alive_count_max;
1262 if (options->num_send_env >= MAX_SEND_ENV)
1265 options->send_env[options->num_send_env++] =
1271 charptr = &options->control_path;
1275 intptr = &options->control_master;
1281 intptr = &options->control_persist;
1299 options->control_persist_timeout = value2;
1304 intptr = &options->hash_known_hosts;
1308 intptr = &options->tun_open;
1320 options->tun_local = value;
1321 options->tun_remote = value2;
1326 charptr = &options->local_command;
1330 intptr = &options->permit_local_command;
1334 intptr = &options->visual_host_key;
1349 options->ip_qos_interactive = value;
1350 options->ip_qos_bulk = value2;
1355 intptr = &options->use_roaming;
1359 intptr = &options->request_tty;
1364 intptr = &options->hpn_disabled;
1368 intptr = &options->hpn_buffer_size;
1372 intptr = &options->tcp_rcv_buf_poll;
1376 intptr = &options->tcp_rcv_buf;
1381 intptr = &options->none_enabled;
1391 intptr = &options->none_switch;
1409 if (*activep && options->version_addendum == NULL) {
1411 options->version_addendum = xstrdup("");
1416 options->version_addendum = xstrdup(s + len);
1421 charptr = &options->ignored_unknown;
1425 intptr = &options->proxy_use_fdpass;
1429 value = options->num_canonical_domains != 0;
1434 if (options->num_canonical_domains >= MAX_CANON_DOMAINS)
1437 options->canonical_domains[
1438 options->num_canonical_domains++] = xstrdup(arg);
1443 value = options->num_permitted_cnames != 0;
1461 if (options->num_permitted_cnames >= MAX_CANON_DOMAINS)
1464 cname = options->permitted_cnames +
1465 options->num_permitted_cnames++;
1472 intptr = &options->canonicalize_hostname;
1477 intptr = &options->canonicalize_max_dots;
1481 intptr = &options->canonicalize_fallback_local;
1508 * Reads the config file and modifies the options accordingly. Options
1515 Options *options, int flags)
1538 * Mark that we are now processing the options. This flag is turned
1546 if (process_config_line(options, pw, host, line, filename,
1552 fatal("%s: terminating, %d bad configuration options",
1565 * Initializes options to special values that indicate that they have not yet
1566 * been set. Read_config_file will only set options with this value. Options
1572 initialize_options(Options * options)
1574 memset(options, 'X', sizeof(*options));
1575 options->forward_agent = -1;
1576 options->forward_x11 = -1;
1577 options->forward_x11_trusted = -1;
1578 options->forward_x11_timeout = -1;
1579 options->exit_on_forward_failure = -1;
1580 options->xauth_location = NULL;
1581 options->gateway_ports = -1;
1582 options->use_privileged_port = -1;
1583 options->rsa_authentication = -1;
1584 options->pubkey_authentication = -1;
1585 options->challenge_response_authentication = -1;
1586 options->gss_authentication = -1;
1587 options->gss_deleg_creds = -1;
1588 options->password_authentication = -1;
1589 options->kbd_interactive_authentication = -1;
1590 options->kbd_interactive_devices = NULL;
1591 options->rhosts_rsa_authentication = -1;
1592 options->hostbased_authentication = -1;
1593 options->batch_mode = -1;
1594 options->check_host_ip = -1;
1595 options->strict_host_key_checking = -1;
1596 options->compression = -1;
1597 options->tcp_keep_alive = -1;
1598 options->compression_level = -1;
1599 options->port = -1;
1600 options->address_family = -1;
1601 options->connection_attempts = -1;
1602 options->connection_timeout = -1;
1603 options->number_of_password_prompts = -1;
1604 options->cipher = -1;
1605 options->ciphers = NULL;
1606 options->macs = NULL;
1607 options->kex_algorithms = NULL;
1608 options->hostkeyalgorithms = NULL;
1609 options->protocol = SSH_PROTO_UNKNOWN;
1610 options->num_identity_files = 0;
1611 options->hostname = NULL;
1612 options->host_key_alias = NULL;
1613 options->proxy_command = NULL;
1614 options->user = NULL;
1615 options->escape_char = -1;
1616 options->num_system_hostfiles = 0;
1617 options->num_user_hostfiles = 0;
1618 options->local_forwards = NULL;
1619 options->num_local_forwards = 0;
1620 options->remote_forwards = NULL;
1621 options->num_remote_forwards = 0;
1622 options->clear_forwardings = -1;
1623 options->log_level = SYSLOG_LEVEL_NOT_SET;
1624 options->preferred_authentications = NULL;
1625 options->bind_address = NULL;
1626 options->pkcs11_provider = NULL;
1627 options->enable_ssh_keysign = - 1;
1628 options->no_host_authentication_for_localhost = - 1;
1629 options->identities_only = - 1;
1630 options->rekey_limit = - 1;
1631 options->rekey_interval = -1;
1632 options->verify_host_key_dns = -1;
1633 options->server_alive_interval = -1;
1634 options->server_alive_count_max = -1;
1635 options->num_send_env = 0;
1636 options->control_path = NULL;
1637 options->control_master = -1;
1638 options->control_persist = -1;
1639 options->control_persist_timeout = 0;
1640 options->hash_known_hosts = -1;
1641 options->tun_open = -1;
1642 options->tun_local = -1;
1643 options->tun_remote = -1;
1644 options->local_command = NULL;
1645 options->permit_local_command = -1;
1646 options->use_roaming = 0;
1647 options->visual_host_key = -1;
1648 options->ip_qos_interactive = -1;
1649 options->ip_qos_bulk = -1;
1650 options->request_tty = -1;
1651 options->proxy_use_fdpass = -1;
1652 options->ignored_unknown = NULL;
1653 options->num_canonical_domains = 0;
1654 options->num_permitted_cnames = 0;
1655 options->canonicalize_max_dots = -1;
1656 options->canonicalize_fallback_local = -1;
1657 options->canonicalize_hostname = -1;
1658 options->version_addendum = NULL;
1659 options->hpn_disabled = -1;
1660 options->hpn_buffer_size = -1;
1661 options->tcp_rcv_buf_poll = -1;
1662 options->tcp_rcv_buf = -1;
1664 options->none_enabled = -1;
1665 options->none_switch = -1;
1670 * A petite version of fill_default_options() that just fills the options
1674 fill_default_options_for_canonicalization(Options *options)
1676 if (options->canonicalize_max_dots == -1)
1677 options->canonicalize_max_dots = 1;
1678 if (options->canonicalize_fallback_local == -1)
1679 options->canonicalize_fallback_local = 1;
1680 if (options->canonicalize_hostname == -1)
1681 options->canonicalize_hostname = SSH_CANONICALISE_NO;
1686 * options for which no value has been specified with their default values.
1689 fill_default_options(Options * options)
1691 if (options->forward_agent == -1)
1692 options->forward_agent = 0;
1693 if (options->forward_x11 == -1)
1694 options->forward_x11 = 0;
1695 if (options->forward_x11_trusted == -1)
1696 options->forward_x11_trusted = 0;
1697 if (options->forward_x11_timeout == -1)
1698 options->forward_x11_timeout = 1200;
1699 if (options->exit_on_forward_failure == -1)
1700 options->exit_on_forward_failure = 0;
1701 if (options->xauth_location == NULL)
1702 options->xauth_location = _PATH_XAUTH;
1703 if (options->gateway_ports == -1)
1704 options->gateway_ports = 0;
1705 if (options->use_privileged_port == -1)
1706 options->use_privileged_port = 0;
1707 if (options->rsa_authentication == -1)
1708 options->rsa_authentication = 1;
1709 if (options->pubkey_authentication == -1)
1710 options->pubkey_authentication = 1;
1711 if (options->challenge_response_authentication == -1)
1712 options->challenge_response_authentication = 1;
1713 if (options->gss_authentication == -1)
1714 options->gss_authentication = 0;
1715 if (options->gss_deleg_creds == -1)
1716 options->gss_deleg_creds = 0;
1717 if (options->password_authentication == -1)
1718 options->password_authentication = 1;
1719 if (options->kbd_interactive_authentication == -1)
1720 options->kbd_interactive_authentication = 1;
1721 if (options->rhosts_rsa_authentication == -1)
1722 options->rhosts_rsa_authentication = 0;
1723 if (options->hostbased_authentication == -1)
1724 options->hostbased_authentication = 0;
1725 if (options->batch_mode == -1)
1726 options->batch_mode = 0;
1727 if (options->check_host_ip == -1)
1728 options->check_host_ip = 0;
1729 if (options->strict_host_key_checking == -1)
1730 options->strict_host_key_checking = 2; /* 2 is default */
1731 if (options->compression == -1)
1732 options->compression = 0;
1733 if (options->tcp_keep_alive == -1)
1734 options->tcp_keep_alive = 1;
1735 if (options->compression_level == -1)
1736 options->compression_level = 6;
1737 if (options->port == -1)
1738 options->port = 0; /* Filled in ssh_connect. */
1739 if (options->address_family == -1)
1740 options->address_family = AF_UNSPEC;
1741 if (options->connection_attempts == -1)
1742 options->connection_attempts = 1;
1743 if (options->number_of_password_prompts == -1)
1744 options->number_of_password_prompts = 3;
1746 if (options->cipher == -1)
1747 options->cipher = SSH_CIPHER_NOT_SET;
1748 /* options->ciphers, default set in myproposals.h */
1749 /* options->macs, default set in myproposals.h */
1750 /* options->kex_algorithms, default set in myproposals.h */
1751 /* options->hostkeyalgorithms, default set in myproposals.h */
1752 if (options->protocol == SSH_PROTO_UNKNOWN)
1753 options->protocol = SSH_PROTO_2;
1754 if (options->num_identity_files == 0) {
1755 if (options->protocol & SSH_PROTO_1) {
1756 add_identity_file(options, "~/",
1759 if (options->protocol & SSH_PROTO_2) {
1760 add_identity_file(options, "~/",
1762 add_identity_file(options, "~/",
1765 add_identity_file(options, "~/",
1768 add_identity_file(options, "~/",
1772 if (options->escape_char == -1)
1773 options->escape_char = '~';
1774 if (options->num_system_hostfiles == 0) {
1775 options->system_hostfiles[options->num_system_hostfiles++] =
1777 options->system_hostfiles[options->num_system_hostfiles++] =
1780 if (options->num_user_hostfiles == 0) {
1781 options->user_hostfiles[options->num_user_hostfiles++] =
1783 options->user_hostfiles[options->num_user_hostfiles++] =
1786 if (options->log_level == SYSLOG_LEVEL_NOT_SET)
1787 options->log_level = SYSLOG_LEVEL_INFO;
1788 if (options->clear_forwardings == 1)
1789 clear_forwardings(options);
1790 if (options->no_host_authentication_for_localhost == - 1)
1791 options->no_host_authentication_for_localhost = 0;
1792 if (options->identities_only == -1)
1793 options->identities_only = 0;
1794 if (options->enable_ssh_keysign == -1)
1795 options->enable_ssh_keysign = 0;
1796 if (options->rekey_limit == -1)
1797 options->rekey_limit = 0;
1798 if (options->rekey_interval == -1)
1799 options->rekey_interval = 0;
1801 if (options->verify_host_key_dns == -1)
1803 options->verify_host_key_dns = 1;
1805 if (options->verify_host_key_dns == -1)
1806 options->verify_host_key_dns = 0;
1808 if (options->server_alive_interval == -1)
1809 options->server_alive_interval = 0;
1810 if (options->server_alive_count_max == -1)
1811 options->server_alive_count_max = 3;
1812 if (options->control_master == -1)
1813 options->control_master = 0;
1814 if (options->control_persist == -1) {
1815 options->control_persist = 0;
1816 options->control_persist_timeout = 0;
1818 if (options->hash_known_hosts == -1)
1819 options->hash_known_hosts = 0;
1820 if (options->tun_open == -1)
1821 options->tun_open = SSH_TUNMODE_NO;
1822 if (options->tun_local == -1)
1823 options->tun_local = SSH_TUNID_ANY;
1824 if (options->tun_remote == -1)
1825 options->tun_remote = SSH_TUNID_ANY;
1826 if (options->permit_local_command == -1)
1827 options->permit_local_command = 0;
1828 options->use_roaming = 0;
1829 if (options->visual_host_key == -1)
1830 options->visual_host_key = 0;
1831 if (options->ip_qos_interactive == -1)
1832 options->ip_qos_interactive = IPTOS_LOWDELAY;
1833 if (options->ip_qos_bulk == -1)
1834 options->ip_qos_bulk = IPTOS_THROUGHPUT;
1835 if (options->request_tty == -1)
1836 options->request_tty = REQUEST_TTY_AUTO;
1837 if (options->proxy_use_fdpass == -1)
1838 options->proxy_use_fdpass = 0;
1839 if (options->canonicalize_max_dots == -1)
1840 options->canonicalize_max_dots = 1;
1841 if (options->canonicalize_fallback_local == -1)
1842 options->canonicalize_fallback_local = 1;
1843 if (options->canonicalize_hostname == -1)
1844 options->canonicalize_hostname = SSH_CANONICALISE_NO;
1852 CLEAR_ON_NONE(options->local_command);
1853 CLEAR_ON_NONE(options->proxy_command);
1854 CLEAR_ON_NONE(options->control_path);
1855 /* options->user will be set in the main program if appropriate */
1856 /* options->hostname will be set in the main program if appropriate */
1857 /* options->host_key_alias should not be set by default */
1858 /* options->preferred_authentications will be set in ssh */
1859 if (options->version_addendum == NULL)
1860 options->version_addendum = xstrdup(SSH_VERSION_FREEBSD);
1861 if (options->hpn_disabled == -1)
1862 options->hpn_disabled = 0;
1863 if (options->hpn_buffer_size > -1)
1868 if (options->hpn_buffer_size == 0)
1869 options->hpn_buffer_size = 1024;
1872 if (options->hpn_buffer_size > (maxlen / 1024)) {
1875 options->hpn_buffer_size * 1024, maxlen);
1876 options->hpn_buffer_size = maxlen;
1878 debug("hpn_buffer_size set to %d", options->hpn_buffer_size);
1880 if (options->tcp_rcv_buf == 0)
1881 options->tcp_rcv_buf = 1;
1882 if (options->tcp_rcv_buf > -1)
1883 options->tcp_rcv_buf *= 1024;
1884 if (options->tcp_rcv_buf_poll == -1)
1885 options->tcp_rcv_buf_poll = 1;
1887 /* options->none_enabled must not be set by default */
1888 if (options->none_switch == -1)
1889 options->none_switch = 0;