From 4ad78287979d383284de5355976fe820daec1e48 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 7 Jul 2010 12:40:49 +0200 Subject: options: Added option to bind a client to an ip address. Thanks to Donatello Boccaforno . --- libssh/options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libssh') diff --git a/libssh/options.c b/libssh/options.c index 35180847..c6b654cb 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -187,6 +187,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 @@ -397,6 +400,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 */ -- cgit