aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-09-22 13:01:06 +0200
committerAndreas Schneider <mail@cynapses.org>2009-09-22 13:14:23 +0200
commitf78045dfd364a546d475eea3f3f502a2e28b0bd8 (patch)
tree608d292f2482f0c8a4f919ebdc5ae07e1f5028e5 /libssh
parent39729bd3de3483adca74488d04da49b91b4cfee3 (diff)
downloadlibssh-f78045dfd364a546d475eea3f3f502a2e28b0bd8.tar.gz
libssh-f78045dfd364a546d475eea3f3f502a2e28b0bd8.tar.xz
libssh-f78045dfd364a546d475eea3f3f502a2e28b0bd8.zip
Use the new options interface in config parser.
Diffstat (limited to 'libssh')
-rw-r--r--libssh/config.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/libssh/config.c b/libssh/config.c
index eaf3a91f..85f4c727 100644
--- a/libssh/config.c
+++ b/libssh/config.c
@@ -193,39 +193,43 @@ static int ssh_config_parse_line(ssh_options opt, const char *line,
case SOC_HOSTNAME:
p = ssh_config_get_str(&s, NULL);
if (p && *parsing) {
- ssh_options_set_host(opt, p);
+ ssh_options_set(opt, SSH_OPTIONS_HOST, p);
}
break;
case SOC_PORT:
- i = ssh_config_get_int(&s, -1);
- if (i > 0 && *parsing) {
- ssh_options_set_port(opt, (unsigned int) i);
+ p = ssh_config_get_str(&s, NULL);
+ if (p && *parsing) {
+ ssh_options_set(opt, SSH_OPTIONS_PORT_STR, p);
}
break;
case SOC_USERNAME:
p = ssh_config_get_str(&s, NULL);
if (p && *parsing) {
- ssh_options_set_username(opt, p);
+ ssh_options_set(opt, SSH_OPTIONS_USER, p);
}
break;
case SOC_IDENTITY:
p = ssh_config_get_str(&s, NULL);
if (p && *parsing) {
- ssh_options_set_identity(opt, p);
+ ssh_options_set(opt, SSH_OPTIONS_IDENTITY, p);
}
break;
case SOC_CIPHERS:
- /* TODO */
+ p = ssh_config_get_str(&s, NULL);
+ if (p && *parsing) {
+ ssh_options_set(opt, SSH_OPTIONS_CIPHERS_C_S, p);
+ ssh_options_set(opt, SSH_OPTIONS_CIPHERS_S_C, p);
+ }
break;
case SOC_COMPRESSION:
i = ssh_config_get_yesno(&s, -1);
if (i >= 0 && *parsing) {
if (i) {
- ssh_options_set_wanted_algos(opt, SSH_COMP_C_S, "zlib");
- ssh_options_set_wanted_algos(opt, SSH_COMP_S_C, "zlib");
+ ssh_options_set(opt, SSH_OPTIONS_COMPRESSION_C_S, "zlib");
+ ssh_options_set(opt, SSH_OPTIONS_COMPRESSION_S_C, "zlib");
} else {
- ssh_options_set_wanted_algos(opt, SSH_COMP_C_S, "none");
- ssh_options_set_wanted_algos(opt, SSH_COMP_S_C, "none");
+ ssh_options_set(opt, SSH_OPTIONS_COMPRESSION_C_S, "none");
+ ssh_options_set(opt, SSH_OPTIONS_COMPRESSION_S_C, "none");
}
}
break;
@@ -238,16 +242,19 @@ static int ssh_config_parse_line(ssh_options opt, const char *line,
SAFE_FREE(x);
return -1;
}
- ssh_options_allow_ssh1(opt, 0);
- ssh_options_allow_ssh2(opt, 0);
+ i = 0;
+ ssh_options_set(opt, SSH_OPTIONS_SSH1, &i);
+ ssh_options_set(opt, SSH_OPTIONS_SSH2, &i);
for (a = strtok(b, ","); a; a = strtok(NULL, ",")) {
switch (atoi(a)) {
case 1:
- ssh_options_allow_ssh1(opt, 1);
+ i = 1;
+ ssh_options_set(opt, SSH_OPTIONS_SSH1, &i);
break;
case 2:
- ssh_options_allow_ssh2(opt, 1);
+ i = 1;
+ ssh_options_set(opt, SSH_OPTIONS_SSH2, &i);
break;
default:
break;
@@ -259,7 +266,7 @@ static int ssh_config_parse_line(ssh_options opt, const char *line,
case SOC_TIMEOUT:
i = ssh_config_get_int(&s, -1);
if (i >= 0 && *parsing) {
- ssh_options_set_timeout(opt, (long) i, 0);
+ ssh_options_set(opt, SSH_OPTIONS_TIMEOUT, &i);
}
break;
case SOC_UNSUPPORTED: