version 1.256, 2014/12/21 22:27:56 |
version 1.257, 2014/12/22 07:55:51 |
|
|
options->fingerprint_hash = -1; |
options->fingerprint_hash = -1; |
} |
} |
|
|
|
/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */ |
|
static int |
|
option_clear_or_none(const char *o) |
|
{ |
|
return o == NULL || strcasecmp(o, "none") == 0; |
|
} |
|
|
void |
void |
fill_default_server_options(ServerOptions *options) |
fill_default_server_options(ServerOptions *options) |
{ |
{ |
|
int i; |
|
|
if (options->protocol == SSH_PROTO_UNKNOWN) |
if (options->protocol == SSH_PROTO_UNKNOWN) |
options->protocol = SSH_PROTO_2; |
options->protocol = SSH_PROTO_2; |
if (options->num_host_key_files == 0) { |
if (options->num_host_key_files == 0) { |
|
|
if (options->listen_addrs == NULL) |
if (options->listen_addrs == NULL) |
add_listen_addr(options, NULL, 0); |
add_listen_addr(options, NULL, 0); |
if (options->pid_file == NULL) |
if (options->pid_file == NULL) |
options->pid_file = _PATH_SSH_DAEMON_PID_FILE; |
options->pid_file = xstrdup(_PATH_SSH_DAEMON_PID_FILE); |
if (options->server_key_bits == -1) |
if (options->server_key_bits == -1) |
options->server_key_bits = 1024; |
options->server_key_bits = 1024; |
if (options->login_grace_time == -1) |
if (options->login_grace_time == -1) |
|
|
if (options->x11_use_localhost == -1) |
if (options->x11_use_localhost == -1) |
options->x11_use_localhost = 1; |
options->x11_use_localhost = 1; |
if (options->xauth_location == NULL) |
if (options->xauth_location == NULL) |
options->xauth_location = _PATH_XAUTH; |
options->xauth_location = xstrdup(_PATH_XAUTH); |
if (options->permit_tty == -1) |
if (options->permit_tty == -1) |
options->permit_tty = 1; |
options->permit_tty = 1; |
if (options->permit_user_rc == -1) |
if (options->permit_user_rc == -1) |
|
|
/* Turn privilege separation on by default */ |
/* Turn privilege separation on by default */ |
if (use_privsep == -1) |
if (use_privsep == -1) |
use_privsep = PRIVSEP_NOSANDBOX; |
use_privsep = PRIVSEP_NOSANDBOX; |
|
|
|
#define CLEAR_ON_NONE(v) \ |
|
do { \ |
|
if (option_clear_or_none(v)) { \ |
|
free(v); \ |
|
v = NULL; \ |
|
} \ |
|
} while(0) |
|
CLEAR_ON_NONE(options->pid_file); |
|
CLEAR_ON_NONE(options->xauth_location); |
|
CLEAR_ON_NONE(options->banner); |
|
CLEAR_ON_NONE(options->trusted_user_ca_keys); |
|
CLEAR_ON_NONE(options->revoked_keys_file); |
|
for (i = 0; i < options->num_host_key_files; i++) |
|
CLEAR_ON_NONE(options->host_key_files[i]); |
|
for (i = 0; i < options->num_host_cert_files; i++) |
|
CLEAR_ON_NONE(options->host_cert_files[i]); |
|
#undef CLEAR_ON_NONE |
} |
} |
|
|
/* Keyword tokens. */ |
/* Keyword tokens. */ |
|
|
{ |
{ |
char *expanded, *ret, cwd[MAXPATHLEN]; |
char *expanded, *ret, cwd[MAXPATHLEN]; |
|
|
|
if (strcasecmp(path, "none") == 0) |
|
return xstrdup("none"); |
expanded = tilde_expand_filename(path, getuid()); |
expanded = tilde_expand_filename(path, getuid()); |
if (*expanded == '/') |
if (*expanded == '/') |
return expanded; |
return expanded; |
|
|
{ |
{ |
if (val == NULL) |
if (val == NULL) |
return; |
return; |
printf("%s %s\n", lookup_opcode_name(code), val); |
printf("%s %s\n", lookup_opcode_name(code), |
|
val == NULL ? "none" : val); |
} |
} |
|
|
static void |
static void |