aboutsummaryrefslogtreecommitdiff
path: root/libssh/options.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-07-07 12:40:49 +0200
committerAndreas Schneider <asn@cynapses.org>2010-07-07 12:43:50 +0200
commit82beeea61927ad789ac9a728b09c32bb8d9a9a42 (patch)
tree10ab22bb5a68ad4e9c794030ea95f9fc6ab61ef2 /libssh/options.c
parenta18a3813fbf5454b9d52af05dd8118a054baf021 (diff)
downloadlibssh-82beeea61927ad789ac9a728b09c32bb8d9a9a42.tar.gz
libssh-82beeea61927ad789ac9a728b09c32bb8d9a9a42.tar.xz
libssh-82beeea61927ad789ac9a728b09c32bb8d9a9a42.zip
options: Added option to bind a client to an ip address.
Thanks to Donatello Boccaforno <donatello.boccaforno@gmail.com>.
Diffstat (limited to 'libssh/options.c')
-rw-r--r--libssh/options.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libssh/options.c b/libssh/options.c
index b7eeb27..13986d5 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -192,6 +192,9 @@ int ssh_options_set_algo(ssh_session session, int algo,
* set the hostname as the hostname is used as a key in
* the known_host mechanism.
*
+ * - SSH_OPTIONS_BINDADDR:
+ * The address to bind the client to (string).
+ *
* - SSH_OPTIONS_USER:
* The username for authentication (string).\n
* \n
@@ -405,6 +408,18 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
session->fd = *x & 0xffff;
}
break;
+ case SSH_OPTIONS_BINDADDR:
+ if (value == NULL) {
+ ssh_set_error_invalid(session, __FUNCTION__);
+ return -1;
+ }
+ q = strdup(value);
+ if (q == NULL) {
+ return -1;
+ }
+ SAFE_FREE(session->bindaddr);
+ session->bindaddr = q;
+ break;
case SSH_OPTIONS_USER:
SAFE_FREE(session->username);
if (value == NULL) { /* set default username */