|
Lines 863-868
static const struct multistate multistate_compression[] = {
Link Here
|
| 863 |
{ NULL, -1 } |
863 |
{ NULL, -1 } |
| 864 |
}; |
864 |
}; |
| 865 |
|
865 |
|
|
|
866 |
static int |
| 867 |
parse_multistate_value(const char *arg, const char *filename, int linenum, |
| 868 |
const struct multistate *multistate_ptr) |
| 869 |
{ |
| 870 |
int i; |
| 871 |
|
| 872 |
if (!arg || *arg == '\0') |
| 873 |
fatal("%s line %d: missing argument.", filename, linenum); |
| 874 |
for (i = 0; multistate_ptr[i].key != NULL; i++) { |
| 875 |
if (strcasecmp(arg, multistate_ptr[i].key) == 0) |
| 876 |
return multistate_ptr[i].value; |
| 877 |
} |
| 878 |
return -1; |
| 879 |
} |
| 880 |
|
| 866 |
/* |
881 |
/* |
| 867 |
* Processes a single option line as used in the configuration files. This |
882 |
* Processes a single option line as used in the configuration files. This |
| 868 |
* only sets those values that have not already been set. |
883 |
* only sets those values that have not already been set. |
|
Lines 986-1004
parse_time:
Link Here
|
| 986 |
multistate_ptr = multistate_flag; |
1001 |
multistate_ptr = multistate_flag; |
| 987 |
parse_multistate: |
1002 |
parse_multistate: |
| 988 |
arg = strdelim(&s); |
1003 |
arg = strdelim(&s); |
| 989 |
if (!arg || *arg == '\0') |
1004 |
if ((value = parse_multistate_value(arg, filename, linenum, |
| 990 |
fatal("%s line %d: missing argument.", |
1005 |
multistate_ptr)) == -1) { |
| 991 |
filename, linenum); |
|
|
| 992 |
value = -1; |
| 993 |
for (i = 0; multistate_ptr[i].key != NULL; i++) { |
| 994 |
if (strcasecmp(arg, multistate_ptr[i].key) == 0) { |
| 995 |
value = multistate_ptr[i].value; |
| 996 |
break; |
| 997 |
} |
| 998 |
} |
| 999 |
if (value == -1) |
| 1000 |
fatal("%s line %d: unsupported option \"%s\".", |
1006 |
fatal("%s line %d: unsupported option \"%s\".", |
| 1001 |
filename, linenum, arg); |
1007 |
filename, linenum, arg); |
|
|
1008 |
} |
| 1002 |
if (*activep && *intptr == -1) |
1009 |
if (*activep && *intptr == -1) |
| 1003 |
*intptr = value; |
1010 |
*intptr = value; |
| 1004 |
break; |
1011 |
break; |
|
Lines 1786-1794
parse_keytypes:
Link Here
|
| 1786 |
goto parse_keytypes; |
1793 |
goto parse_keytypes; |
| 1787 |
|
1794 |
|
| 1788 |
case oAddKeysToAgent: |
1795 |
case oAddKeysToAgent: |
| 1789 |
intptr = &options->add_keys_to_agent; |
1796 |
arg = strdelim(&s); |
| 1790 |
multistate_ptr = multistate_yesnoaskconfirm; |
1797 |
arg2 = strdelim(&s); |
| 1791 |
goto parse_multistate; |
1798 |
value = parse_multistate_value(arg, filename, linenum, |
|
|
1799 |
multistate_yesnoaskconfirm); |
| 1800 |
value2 = 0; /* unlimited lifespan by default */ |
| 1801 |
if (value == 3 && arg2 != NULL) { |
| 1802 |
/* allow "AddKeysToAgent confirm 5m" */ |
| 1803 |
if ((value2 = convtime(arg2)) == -1 || value2 > INT_MAX) |
| 1804 |
fatal("%s line %d: invalid time value.", |
| 1805 |
filename, linenum); |
| 1806 |
} else if (value == -1 && arg2 == NULL) { |
| 1807 |
if ((value2 = convtime(arg)) == -1 || value2 > INT_MAX) |
| 1808 |
fatal("%s line %d: unsupported option", |
| 1809 |
filename, linenum); |
| 1810 |
value = 1; /* yes */ |
| 1811 |
} else if (value == -1 || arg2 != NULL) { |
| 1812 |
fatal("%s line %d: unsupported option", |
| 1813 |
filename, linenum); |
| 1814 |
} |
| 1815 |
if (*activep && options->add_keys_to_agent == -1) { |
| 1816 |
options->add_keys_to_agent = value; |
| 1817 |
options->add_keys_to_agent_lifespan = value2; |
| 1818 |
} |
| 1819 |
break; |
| 1820 |
|
| 1821 |
arg = strdelim(&s); |
| 1822 |
if (!arg || *arg == '\0') |
| 1823 |
fatal("%s line %d: missing time value.", |
| 1824 |
filename, linenum); |
| 1825 |
if (strcmp(arg, "none") == 0) |
| 1826 |
value = -1; |
| 1827 |
else if ((value = convtime(arg)) == -1 || value > INT_MAX) |
| 1828 |
fatal("%s line %d: invalid time value.", |
| 1829 |
filename, linenum); |
| 1830 |
if (*activep && *intptr == -1) |
| 1831 |
*intptr = value; |
| 1792 |
|
1832 |
|
| 1793 |
case oIdentityAgent: |
1833 |
case oIdentityAgent: |
| 1794 |
charptr = &options->identity_agent; |
1834 |
charptr = &options->identity_agent; |
|
Lines 2002-2007
initialize_options(Options * options)
Link Here
|
| 2002 |
options->permit_local_command = -1; |
2042 |
options->permit_local_command = -1; |
| 2003 |
options->remote_command = NULL; |
2043 |
options->remote_command = NULL; |
| 2004 |
options->add_keys_to_agent = -1; |
2044 |
options->add_keys_to_agent = -1; |
|
|
2045 |
options->add_keys_to_agent_lifespan = -1; |
| 2005 |
options->identity_agent = NULL; |
2046 |
options->identity_agent = NULL; |
| 2006 |
options->visual_host_key = -1; |
2047 |
options->visual_host_key = -1; |
| 2007 |
options->ip_qos_interactive = -1; |
2048 |
options->ip_qos_interactive = -1; |
|
Lines 2109-2116
fill_default_options(Options * options)
Link Here
|
| 2109 |
if (options->number_of_password_prompts == -1) |
2150 |
if (options->number_of_password_prompts == -1) |
| 2110 |
options->number_of_password_prompts = 3; |
2151 |
options->number_of_password_prompts = 3; |
| 2111 |
/* options->hostkeyalgorithms, default set in myproposals.h */ |
2152 |
/* options->hostkeyalgorithms, default set in myproposals.h */ |
| 2112 |
if (options->add_keys_to_agent == -1) |
2153 |
if (options->add_keys_to_agent == -1) { |
| 2113 |
options->add_keys_to_agent = 0; |
2154 |
options->add_keys_to_agent = 0; |
|
|
2155 |
options->add_keys_to_agent_lifespan = 0; |
| 2156 |
} |
| 2114 |
if (options->num_identity_files == 0) { |
2157 |
if (options->num_identity_files == 0) { |
| 2115 |
add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_RSA, 0); |
2158 |
add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_RSA, 0); |
| 2116 |
add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_DSA, 0); |
2159 |
add_identity_file(options, "~/", _PATH_SSH_CLIENT_ID_DSA, 0); |
|
Lines 2707-2713
dump_client_config(Options *o, const char *host)
Link Here
|
| 2707 |
dump_cfg_int(oPort, o->port); |
2750 |
dump_cfg_int(oPort, o->port); |
| 2708 |
|
2751 |
|
| 2709 |
/* Flag options */ |
2752 |
/* Flag options */ |
| 2710 |
dump_cfg_fmtint(oAddKeysToAgent, o->add_keys_to_agent); |
|
|
| 2711 |
dump_cfg_fmtint(oAddressFamily, o->address_family); |
2753 |
dump_cfg_fmtint(oAddressFamily, o->address_family); |
| 2712 |
dump_cfg_fmtint(oBatchMode, o->batch_mode); |
2754 |
dump_cfg_fmtint(oBatchMode, o->batch_mode); |
| 2713 |
dump_cfg_fmtint(oCanonicalizeFallbackLocal, o->canonicalize_fallback_local); |
2755 |
dump_cfg_fmtint(oCanonicalizeFallbackLocal, o->canonicalize_fallback_local); |
|
Lines 2795-2800
dump_client_config(Options *o, const char *host)
Link Here
|
| 2795 |
|
2837 |
|
| 2796 |
/* Special cases */ |
2838 |
/* Special cases */ |
| 2797 |
|
2839 |
|
|
|
2840 |
/* AddKeysToAgent */ |
| 2841 |
if (o->add_keys_to_agent_lifespan <= 0) |
| 2842 |
dump_cfg_fmtint(oAddKeysToAgent, o->add_keys_to_agent); |
| 2843 |
else { |
| 2844 |
printf("addkeystoagent%s %d\n", |
| 2845 |
o->add_keys_to_agent == 3 ? " confirm" : "", |
| 2846 |
o->add_keys_to_agent_lifespan); |
| 2847 |
} |
| 2848 |
|
| 2798 |
/* oForwardAgent */ |
2849 |
/* oForwardAgent */ |
| 2799 |
if (o->forward_agent_sock_path == NULL) |
2850 |
if (o->forward_agent_sock_path == NULL) |
| 2800 |
dump_cfg_fmtint(oForwardAgent, o->forward_agent); |
2851 |
dump_cfg_fmtint(oForwardAgent, o->forward_agent); |