Changeset View
Changeset View
Standalone View
Standalone View
readconf.c
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
#include "misc.h" | #include "misc.h" | ||||
#include "readconf.h" | #include "readconf.h" | ||||
#include "match.h" | #include "match.h" | ||||
#include "kex.h" | #include "kex.h" | ||||
#include "mac.h" | #include "mac.h" | ||||
#include "uidswap.h" | #include "uidswap.h" | ||||
#include "myproposal.h" | #include "myproposal.h" | ||||
#include "digest.h" | #include "digest.h" | ||||
#include "version.h" | |||||
/* Format of the configuration file: | /* Format of the configuration file: | ||||
# Configuration data is parsed as follows: | # Configuration data is parsed as follows: | ||||
# 1. command line options | # 1. command line options | ||||
# 2. user-specific file | # 2. user-specific file | ||||
# 3. system-wide file | # 3. system-wide file | ||||
# Any configuration value is only changed the first time it is set. | # Any configuration value is only changed the first time it is set. | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | static int process_config_line_depth(Options *options, struct passwd *pw, | ||||
const char *host, const char *original_host, char *line, | const char *host, const char *original_host, char *line, | ||||
const char *filename, int linenum, int *activep, int flags, | const char *filename, int linenum, int *activep, int flags, | ||||
int *want_final_pass, int depth); | int *want_final_pass, int depth); | ||||
/* Keyword tokens. */ | /* Keyword tokens. */ | ||||
typedef enum { | typedef enum { | ||||
oBadOption, | oBadOption, | ||||
oVersionAddendum, | |||||
oHost, oMatch, oInclude, | oHost, oMatch, oInclude, | ||||
oForwardAgent, oForwardX11, oForwardX11Trusted, oForwardX11Timeout, | oForwardAgent, oForwardX11, oForwardX11Trusted, oForwardX11Timeout, | ||||
oGatewayPorts, oExitOnForwardFailure, | oGatewayPorts, oExitOnForwardFailure, | ||||
oPasswordAuthentication, | oPasswordAuthentication, | ||||
oChallengeResponseAuthentication, oXAuthLocation, | oChallengeResponseAuthentication, oXAuthLocation, | ||||
oIdentityFile, oHostname, oPort, oRemoteForward, oLocalForward, | oIdentityFile, oHostname, oPort, oRemoteForward, oLocalForward, | ||||
oPermitRemoteOpen, | oPermitRemoteOpen, | ||||
oCertificateFile, oAddKeysToAgent, oIdentityAgent, | oCertificateFile, oAddKeysToAgent, oIdentityAgent, | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | #endif | ||||
{ "hostbasedalgorithms", oHostbasedAcceptedAlgorithms }, | { "hostbasedalgorithms", oHostbasedAcceptedAlgorithms }, | ||||
{ "hostbasedkeytypes", oHostbasedAcceptedAlgorithms }, /* obsolete */ | { "hostbasedkeytypes", oHostbasedAcceptedAlgorithms }, /* obsolete */ | ||||
{ "pubkeyacceptedalgorithms", oPubkeyAcceptedAlgorithms }, | { "pubkeyacceptedalgorithms", oPubkeyAcceptedAlgorithms }, | ||||
{ "pubkeyacceptedkeytypes", oPubkeyAcceptedAlgorithms }, /* obsolete */ | { "pubkeyacceptedkeytypes", oPubkeyAcceptedAlgorithms }, /* obsolete */ | ||||
{ "ignoreunknown", oIgnoreUnknown }, | { "ignoreunknown", oIgnoreUnknown }, | ||||
{ "proxyjump", oProxyJump }, | { "proxyjump", oProxyJump }, | ||||
{ "securitykeyprovider", oSecurityKeyProvider }, | { "securitykeyprovider", oSecurityKeyProvider }, | ||||
{ "knownhostscommand", oKnownHostsCommand }, | { "knownhostscommand", oKnownHostsCommand }, | ||||
{ "versionaddendum", oVersionAddendum }, | |||||
{ NULL, oBadOption } | { NULL, oBadOption } | ||||
}; | }; | ||||
static const char *lookup_opcode_name(OpCodes code); | static const char *lookup_opcode_name(OpCodes code); | ||||
const char * | const char * | ||||
kex_default_pk_alg(void) | kex_default_pk_alg(void) | ||||
▲ Show 20 Lines • Show All 1,529 Lines • ▼ Show 20 Lines | case oIPQoS: | ||||
} | } | ||||
break; | break; | ||||
case oRequestTTY: | case oRequestTTY: | ||||
intptr = &options->request_tty; | intptr = &options->request_tty; | ||||
multistate_ptr = multistate_requesttty; | multistate_ptr = multistate_requesttty; | ||||
goto parse_multistate; | goto parse_multistate; | ||||
case oVersionAddendum: | |||||
if (s == NULL) | |||||
fatal("%.200s line %d: Missing argument.", filename, | |||||
linenum); | |||||
len = strspn(s, WHITESPACE); | |||||
if (*activep && options->version_addendum == NULL) { | |||||
if (strcasecmp(s + len, "none") == 0) | |||||
options->version_addendum = xstrdup(""); | |||||
else if (strchr(s + len, '\r') != NULL) | |||||
fatal("%.200s line %d: Invalid argument", | |||||
filename, linenum); | |||||
else | |||||
options->version_addendum = xstrdup(s + len); | |||||
} | |||||
return 0; | |||||
case oIgnoreUnknown: | case oIgnoreUnknown: | ||||
charptr = &options->ignored_unknown; | charptr = &options->ignored_unknown; | ||||
goto parse_string; | goto parse_string; | ||||
case oProxyUseFdpass: | case oProxyUseFdpass: | ||||
intptr = &options->proxy_use_fdpass; | intptr = &options->proxy_use_fdpass; | ||||
goto parse_flag; | goto parse_flag; | ||||
▲ Show 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | |||||
* are processed in the following order: command line, user config file, | * are processed in the following order: command line, user config file, | ||||
* system config file. Last, fill_default_options is called. | * system config file. Last, fill_default_options is called. | ||||
*/ | */ | ||||
void | void | ||||
initialize_options(Options * options) | initialize_options(Options * options) | ||||
{ | { | ||||
memset(options, 'X', sizeof(*options)); | memset(options, 'X', sizeof(*options)); | ||||
options->version_addendum = NULL; | |||||
options->forward_agent = -1; | options->forward_agent = -1; | ||||
options->forward_agent_sock_path = NULL; | options->forward_agent_sock_path = NULL; | ||||
options->forward_x11 = -1; | options->forward_x11 = -1; | ||||
options->forward_x11_trusted = -1; | options->forward_x11_trusted = -1; | ||||
options->forward_x11_timeout = -1; | options->forward_x11_timeout = -1; | ||||
options->stdio_forward_host = NULL; | options->stdio_forward_host = NULL; | ||||
options->stdio_forward_port = 0; | options->stdio_forward_port = 0; | ||||
options->clear_forwardings = -1; | options->clear_forwardings = -1; | ||||
▲ Show 20 Lines • Show All 340 Lines • ▼ Show 20 Lines | if (options->jump_host != NULL && | ||||
free(options->jump_host); | free(options->jump_host); | ||||
options->jump_host = NULL; | options->jump_host = NULL; | ||||
} | } | ||||
/* options->identity_agent distinguishes NULL from 'none' */ | /* options->identity_agent distinguishes NULL from 'none' */ | ||||
/* options->user will be set in the main program if appropriate */ | /* options->user will be set in the main program if appropriate */ | ||||
/* options->hostname will be set in the main program if appropriate */ | /* options->hostname will be set in the main program if appropriate */ | ||||
/* options->host_key_alias should not be set by default */ | /* options->host_key_alias should not be set by default */ | ||||
/* options->preferred_authentications will be set in ssh */ | /* options->preferred_authentications will be set in ssh */ | ||||
if (options->version_addendum == NULL) | |||||
options->version_addendum = xstrdup(SSH_VERSION_FREEBSD); | |||||
/* success */ | /* success */ | ||||
ret = 0; | ret = 0; | ||||
fail: | fail: | ||||
free(all_cipher); | free(all_cipher); | ||||
free(all_mac); | free(all_mac); | ||||
free(all_kex); | free(all_kex); | ||||
free(all_key); | free(all_key); | ||||
▲ Show 20 Lines • Show All 751 Lines • Show Last 20 Lines |