diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-10-15 17:00:56 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-10-15 17:02:51 +0200 |
commit | 2523ed0779843e6074717cdcdf8bcaffb4b87ad9 (patch) | |
tree | 1523fb7b6d6b8517bab2dabcd5d8fbae0ddfce61 /libssh/options.c | |
parent | e736b1a40e1b3d9d27d535a34a0e6e018b1d591a (diff) | |
download | libssh-2523ed0779843e6074717cdcdf8bcaffb4b87ad9.tar.gz libssh-2523ed0779843e6074717cdcdf8bcaffb4b87ad9.tar.xz libssh-2523ed0779843e6074717cdcdf8bcaffb4b87ad9.zip |
Added an option to set the port as string.
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libssh/options.c b/libssh/options.c index d506981..31a5232 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -621,10 +621,8 @@ static int ssh_bind_options_set_algo(ssh_bind sshbind, int algo, int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, const void *value) { -#if 0 char *p, *q; int i; -#endif if (sshbind == NULL) { return -1; @@ -661,6 +659,24 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, sshbind->bindport = *x & 0xffff; } break; + case SSH_BIND_OPTIONS_BINDPORT_STR: + if (value == NULL) { + sshbind->bindport = 22 & 0xffff; + } else { + q = strdup(value); + if (q == NULL) { + ssh_set_error_oom(sshbind); + return -1; + } + i = strtol(q, &p, 10); + if (q == p) { + SAFE_FREE(q); + } + SAFE_FREE(q); + + sshbind->bindport = i & 0xffff; + } + break; case SSH_BIND_OPTIONS_DSAKEY: if (value == NULL) { ssh_set_error_invalid(sshbind, __FUNCTION__); |