version 1.375, 2021/01/26 05:32:21 |
version 1.376, 2021/02/15 20:36:35 |
|
|
free(def_sig); |
free(def_sig); |
} |
} |
|
|
static void |
|
array_append2(const char *file, const int line, const char *directive, |
|
char ***array, int **iarray, u_int *lp, const char *s, int i) |
|
{ |
|
|
|
if (*lp >= INT_MAX) |
|
fatal("%s line %d: Too many %s entries", file, line, directive); |
|
|
|
if (iarray != NULL) { |
|
*iarray = xrecallocarray(*iarray, *lp, *lp + 1, |
|
sizeof(**iarray)); |
|
(*iarray)[*lp] = i; |
|
} |
|
|
|
*array = xrecallocarray(*array, *lp, *lp + 1, sizeof(**array)); |
|
(*array)[*lp] = xstrdup(s); |
|
(*lp)++; |
|
} |
|
|
|
static void |
|
array_append(const char *file, const int line, const char *directive, |
|
char ***array, u_int *lp, const char *s) |
|
{ |
|
array_append2(file, line, directive, array, NULL, lp, s, 0); |
|
} |
|
|
|
void |
void |
servconf_add_hostkey(const char *file, const int line, |
servconf_add_hostkey(const char *file, const int line, |
ServerOptions *options, const char *path, int userprovided) |
ServerOptions *options, const char *path, int userprovided) |
{ |
{ |
char *apath = derelativise_path(path); |
char *apath = derelativise_path(path); |
|
|
array_append2(file, line, "HostKey", |
opt_array_append2(file, line, "HostKey", |
&options->host_key_files, &options->host_key_file_userprovided, |
&options->host_key_files, &options->host_key_file_userprovided, |
&options->num_host_key_files, apath, userprovided); |
&options->num_host_key_files, apath, userprovided); |
free(apath); |
free(apath); |
|
|
{ |
{ |
char *apath = derelativise_path(path); |
char *apath = derelativise_path(path); |
|
|
array_append(file, line, "HostCertificate", |
opt_array_append(file, line, "HostCertificate", |
&options->host_cert_files, &options->num_host_cert_files, apath); |
&options->host_cert_files, &options->num_host_cert_files, apath); |
free(apath); |
free(apath); |
} |
} |
|
|
if (options->client_alive_count_max == -1) |
if (options->client_alive_count_max == -1) |
options->client_alive_count_max = 3; |
options->client_alive_count_max = 3; |
if (options->num_authkeys_files == 0) { |
if (options->num_authkeys_files == 0) { |
array_append("[default]", 0, "AuthorizedKeysFiles", |
opt_array_append("[default]", 0, "AuthorizedKeysFiles", |
&options->authorized_keys_files, |
&options->authorized_keys_files, |
&options->num_authkeys_files, |
&options->num_authkeys_files, |
_PATH_SSH_USER_PERMITTED_KEYS); |
_PATH_SSH_USER_PERMITTED_KEYS); |
array_append("[default]", 0, "AuthorizedKeysFiles", |
opt_array_append("[default]", 0, "AuthorizedKeysFiles", |
&options->authorized_keys_files, |
&options->authorized_keys_files, |
&options->num_authkeys_files, |
&options->num_authkeys_files, |
_PATH_SSH_USER_PERMITTED_KEYS2); |
_PATH_SSH_USER_PERMITTED_KEYS2); |
|
|
while ((arg = strdelim(&cp)) && *arg != '\0') { |
while ((arg = strdelim(&cp)) && *arg != '\0') { |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "oLogVerbose", |
opt_array_append(filename, linenum, "oLogVerbose", |
&options->log_verbose, &options->num_log_verbose, |
&options->log_verbose, &options->num_log_verbose, |
arg); |
arg); |
} |
} |
|
|
"\"%.100s\"", filename, linenum, arg); |
"\"%.100s\"", filename, linenum, arg); |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "AllowUsers", |
opt_array_append(filename, linenum, "AllowUsers", |
&options->allow_users, &options->num_allow_users, |
&options->allow_users, &options->num_allow_users, |
arg); |
arg); |
} |
} |
|
|
"\"%.100s\"", filename, linenum, arg); |
"\"%.100s\"", filename, linenum, arg); |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "DenyUsers", |
opt_array_append(filename, linenum, "DenyUsers", |
&options->deny_users, &options->num_deny_users, |
&options->deny_users, &options->num_deny_users, |
arg); |
arg); |
} |
} |
|
|
while ((arg = strdelim(&cp)) && *arg != '\0') { |
while ((arg = strdelim(&cp)) && *arg != '\0') { |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "AllowGroups", |
opt_array_append(filename, linenum, "AllowGroups", |
&options->allow_groups, &options->num_allow_groups, |
&options->allow_groups, &options->num_allow_groups, |
arg); |
arg); |
} |
} |
|
|
while ((arg = strdelim(&cp)) && *arg != '\0') { |
while ((arg = strdelim(&cp)) && *arg != '\0') { |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "DenyGroups", |
opt_array_append(filename, linenum, "DenyGroups", |
&options->deny_groups, &options->num_deny_groups, |
&options->deny_groups, &options->num_deny_groups, |
arg); |
arg); |
} |
} |
|
|
if (*activep && options->num_authkeys_files == 0) { |
if (*activep && options->num_authkeys_files == 0) { |
while ((arg = strdelim(&cp)) && *arg != '\0') { |
while ((arg = strdelim(&cp)) && *arg != '\0') { |
arg = tilde_expand_filename(arg, getuid()); |
arg = tilde_expand_filename(arg, getuid()); |
array_append(filename, linenum, |
opt_array_append(filename, linenum, |
"AuthorizedKeysFile", |
"AuthorizedKeysFile", |
&options->authorized_keys_files, |
&options->authorized_keys_files, |
&options->num_authkeys_files, arg); |
&options->num_authkeys_files, arg); |
|
|
filename, linenum); |
filename, linenum); |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, "AcceptEnv", |
opt_array_append(filename, linenum, "AcceptEnv", |
&options->accept_env, &options->num_accept_env, |
&options->accept_env, &options->num_accept_env, |
arg); |
arg); |
} |
} |
|
|
filename, linenum); |
filename, linenum); |
if (!*activep || uvalue != 0) |
if (!*activep || uvalue != 0) |
continue; |
continue; |
array_append(filename, linenum, "SetEnv", |
opt_array_append(filename, linenum, "SetEnv", |
&options->setenv, &options->num_setenv, arg); |
&options->setenv, &options->num_setenv, arg); |
} |
} |
break; |
break; |
|
|
lookup_opcode_name(opcode)); |
lookup_opcode_name(opcode)); |
} |
} |
if (*activep && uvalue == 0) { |
if (*activep && uvalue == 0) { |
array_append(filename, linenum, |
opt_array_append(filename, linenum, |
lookup_opcode_name(opcode), |
lookup_opcode_name(opcode), |
chararrayptr, uintptr, arg2); |
chararrayptr, uintptr, arg2); |
} |
} |
|
|
value2 = 1; |
value2 = 1; |
if (!*activep) |
if (!*activep) |
continue; |
continue; |
array_append(filename, linenum, |
opt_array_append(filename, linenum, |
"AuthenticationMethods", |
"AuthenticationMethods", |
&options->auth_methods, |
&options->auth_methods, |
&options->num_auth_methods, arg); |
&options->num_auth_methods, arg); |