version 1.121.2.1, 2004/02/28 03:51:33 |
version 1.121.2.2, 2004/08/19 22:37:31 |
|
|
oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
oServerAliveInterval, oServerAliveCountMax, |
oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
|
oSendEnv, oControlPath, oControlMaster, |
oDeprecated, oUnsupported |
oDeprecated, oUnsupported |
} OpCodes; |
} OpCodes; |
|
|
|
|
{ "usersh", oDeprecated }, |
{ "usersh", oDeprecated }, |
{ "identityfile", oIdentityFile }, |
{ "identityfile", oIdentityFile }, |
{ "identityfile2", oIdentityFile }, /* alias */ |
{ "identityfile2", oIdentityFile }, /* alias */ |
|
{ "identitiesonly", oIdentitiesOnly }, |
{ "hostname", oHostName }, |
{ "hostname", oHostName }, |
{ "hostkeyalias", oHostKeyAlias }, |
{ "hostkeyalias", oHostKeyAlias }, |
{ "proxycommand", oProxyCommand }, |
{ "proxycommand", oProxyCommand }, |
|
|
{ "addressfamily", oAddressFamily }, |
{ "addressfamily", oAddressFamily }, |
{ "serveraliveinterval", oServerAliveInterval }, |
{ "serveraliveinterval", oServerAliveInterval }, |
{ "serveralivecountmax", oServerAliveCountMax }, |
{ "serveralivecountmax", oServerAliveCountMax }, |
|
{ "sendenv", oSendEnv }, |
|
{ "controlpath", oControlPath }, |
|
{ "controlmaster", oControlMaster }, |
{ NULL, oBadOption } |
{ NULL, oBadOption } |
}; |
}; |
|
|
|
|
intptr = &options->enable_ssh_keysign; |
intptr = &options->enable_ssh_keysign; |
goto parse_flag; |
goto parse_flag; |
|
|
|
case oIdentitiesOnly: |
|
intptr = &options->identities_only; |
|
goto parse_flag; |
|
|
case oServerAliveInterval: |
case oServerAliveInterval: |
intptr = &options->server_alive_interval; |
intptr = &options->server_alive_interval; |
goto parse_time; |
goto parse_time; |
|
|
intptr = &options->server_alive_count_max; |
intptr = &options->server_alive_count_max; |
goto parse_int; |
goto parse_int; |
|
|
|
case oSendEnv: |
|
while ((arg = strdelim(&s)) != NULL && *arg != '\0') { |
|
if (strchr(arg, '=') != NULL) |
|
fatal("%s line %d: Invalid environment name.", |
|
filename, linenum); |
|
if (options->num_send_env >= MAX_SEND_ENV) |
|
fatal("%s line %d: too many send env.", |
|
filename, linenum); |
|
options->send_env[options->num_send_env++] = |
|
xstrdup(arg); |
|
} |
|
break; |
|
|
|
case oControlPath: |
|
charptr = &options->control_path; |
|
goto parse_string; |
|
|
|
case oControlMaster: |
|
intptr = &options->control_master; |
|
goto parse_yesnoask; |
|
|
case oDeprecated: |
case oDeprecated: |
debug("%s line %d: Deprecated option \"%s\"", |
debug("%s line %d: Deprecated option \"%s\"", |
filename, linenum, keyword); |
filename, linenum, keyword); |
|
|
*/ |
*/ |
|
|
int |
int |
read_config_file(const char *filename, const char *host, Options *options) |
read_config_file(const char *filename, const char *host, Options *options, |
|
int checkperm) |
{ |
{ |
FILE *f; |
FILE *f; |
char line[1024]; |
char line[1024]; |
|
|
int bad_options = 0; |
int bad_options = 0; |
|
|
/* Open the file. */ |
/* Open the file. */ |
f = fopen(filename, "r"); |
if ((f = fopen(filename, "r")) == NULL) |
if (!f) |
|
return 0; |
return 0; |
|
|
|
if (checkperm) { |
|
struct stat sb; |
|
|
|
if (fstat(fileno(f), &sb) == -1) |
|
fatal("fstat %s: %s", filename, strerror(errno)); |
|
if (((sb.st_uid != 0 && sb.st_uid != getuid()) || |
|
(sb.st_mode & 022) != 0)) |
|
fatal("Bad owner or permissions on %s", filename); |
|
} |
|
|
debug("Reading configuration data %.200s", filename); |
debug("Reading configuration data %.200s", filename); |
|
|
/* |
/* |
|
|
options->smartcard_device = NULL; |
options->smartcard_device = NULL; |
options->enable_ssh_keysign = - 1; |
options->enable_ssh_keysign = - 1; |
options->no_host_authentication_for_localhost = - 1; |
options->no_host_authentication_for_localhost = - 1; |
|
options->identities_only = - 1; |
options->rekey_limit = - 1; |
options->rekey_limit = - 1; |
options->verify_host_key_dns = -1; |
options->verify_host_key_dns = -1; |
options->server_alive_interval = -1; |
options->server_alive_interval = -1; |
options->server_alive_count_max = -1; |
options->server_alive_count_max = -1; |
|
options->num_send_env = 0; |
|
options->control_path = NULL; |
|
options->control_master = -1; |
} |
} |
|
|
/* |
/* |
|
|
clear_forwardings(options); |
clear_forwardings(options); |
if (options->no_host_authentication_for_localhost == - 1) |
if (options->no_host_authentication_for_localhost == - 1) |
options->no_host_authentication_for_localhost = 0; |
options->no_host_authentication_for_localhost = 0; |
|
if (options->identities_only == -1) |
|
options->identities_only = 0; |
if (options->enable_ssh_keysign == -1) |
if (options->enable_ssh_keysign == -1) |
options->enable_ssh_keysign = 0; |
options->enable_ssh_keysign = 0; |
if (options->rekey_limit == -1) |
if (options->rekey_limit == -1) |
|
|
options->server_alive_interval = 0; |
options->server_alive_interval = 0; |
if (options->server_alive_count_max == -1) |
if (options->server_alive_count_max == -1) |
options->server_alive_count_max = 3; |
options->server_alive_count_max = 3; |
|
if (options->control_master == -1) |
|
options->control_master = 0; |
/* options->proxy_command should not be set by default */ |
/* options->proxy_command should not be set by default */ |
/* 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 */ |