BUG 103: Disable proxy command if set to 'none'.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
89be6d0309
Коммит
e52cc613e4
@ -780,11 +780,15 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
|
||||
return -1;
|
||||
} else {
|
||||
SAFE_FREE(session->opts.ProxyCommand);
|
||||
q = strdup(v);
|
||||
if (q == NULL) {
|
||||
return -1;
|
||||
/* Setting the command to 'none' disables this option. */
|
||||
rc = strcasecmp(v, "none");
|
||||
if (rc != 0) {
|
||||
q = strdup(v);
|
||||
if (q == NULL) {
|
||||
return -1;
|
||||
}
|
||||
session->opts.ProxyCommand = q;
|
||||
}
|
||||
session->opts.ProxyCommand = q;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -176,6 +176,23 @@ static void torture_options_get_identity(void **state) {
|
||||
free(identity);
|
||||
}
|
||||
|
||||
static void torture_options_proxycommand(void **state) {
|
||||
ssh_session session = *state;
|
||||
int rc;
|
||||
|
||||
/* Enable ProxyCommand */
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "ssh -q -A -X -W %h:%p JUMPHOST");
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
assert_string_equal(session->opts.ProxyCommand, "ssh -q -A -X -W %h:%p JUMPHOST");
|
||||
|
||||
/* Disable ProxyCommand */
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "none");
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
assert_null(session->opts.ProxyCommand);
|
||||
}
|
||||
|
||||
int torture_run_tests(void) {
|
||||
int rc;
|
||||
const UnitTest tests[] = {
|
||||
@ -188,6 +205,7 @@ int torture_run_tests(void) {
|
||||
unit_test_setup_teardown(torture_options_get_user, setup, teardown),
|
||||
unit_test_setup_teardown(torture_options_set_identity, setup, teardown),
|
||||
unit_test_setup_teardown(torture_options_get_identity, setup, teardown),
|
||||
unit_test_setup_teardown(torture_options_proxycommand, setup, teardown),
|
||||
};
|
||||
|
||||
ssh_init();
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user