version 1.402, 2023/09/08 06:34:24 |
version 1.403, 2023/10/11 22:42:26 |
|
|
options->num_permitted_listens); |
options->num_permitted_listens); |
} |
} |
|
|
/* Parse a ChannelTimeout clause "pattern=interval" */ |
|
static int |
|
parse_timeout(const char *s, char **typep, int *secsp) |
|
{ |
|
char *cp, *sdup; |
|
int secs; |
|
|
|
if (typep != NULL) |
|
*typep = NULL; |
|
if (secsp != NULL) |
|
*secsp = 0; |
|
if (s == NULL) |
|
return -1; |
|
sdup = xstrdup(s); |
|
|
|
if ((cp = strchr(sdup, '=')) == NULL || cp == sdup) { |
|
free(sdup); |
|
return -1; |
|
} |
|
*cp++ = '\0'; |
|
if ((secs = convtime(cp)) < 0) { |
|
free(sdup); |
|
return -1; |
|
} |
|
/* success */ |
|
if (typep != NULL) |
|
*typep = xstrdup(sdup); |
|
if (secsp != NULL) |
|
*secsp = secs; |
|
free(sdup); |
|
return 0; |
|
} |
|
|
|
void |
void |
process_channel_timeouts(struct ssh *ssh, ServerOptions *options) |
process_channel_timeouts(struct ssh *ssh, ServerOptions *options) |
{ |
{ |
|
|
debug3_f("setting %u timeouts", options->num_channel_timeouts); |
debug3_f("setting %u timeouts", options->num_channel_timeouts); |
channel_clear_timeouts(ssh); |
channel_clear_timeouts(ssh); |
for (i = 0; i < options->num_channel_timeouts; i++) { |
for (i = 0; i < options->num_channel_timeouts; i++) { |
if (parse_timeout(options->channel_timeouts[i], |
if (parse_pattern_interval(options->channel_timeouts[i], |
&type, &secs) != 0) { |
&type, &secs) != 0) { |
fatal_f("internal error: bad timeout %s", |
fatal_f("internal error: bad timeout %s", |
options->channel_timeouts[i]); |
options->channel_timeouts[i]); |
|
|
filename, linenum, keyword); |
filename, linenum, keyword); |
goto out; |
goto out; |
} |
} |
} else if (parse_timeout(arg, NULL, NULL) != 0) { |
} else if (parse_pattern_interval(arg, |
|
NULL, NULL) != 0) { |
fatal("%s line %d: invalid channel timeout %s", |
fatal("%s line %d: invalid channel timeout %s", |
filename, linenum, arg); |
filename, linenum, arg); |
} |
} |