options: Added option to bind a client to an ip address.
Thanks to Donatello Boccaforno <donatello.boccaforno@gmail.com>.
Этот коммит содержится в:
родитель
a18a3813fb
Коммит
82beeea619
@ -289,7 +289,8 @@ enum ssh_options_e {
|
||||
SSH_OPTIONS_COMPRESSION_C_S,
|
||||
SSH_OPTIONS_COMPRESSION_S_C,
|
||||
SSH_OPTIONS_HOSTKEYCHECK,
|
||||
SSH_OPTIONS_PROXYCOMMAND
|
||||
SSH_OPTIONS_PROXYCOMMAND,
|
||||
SSH_OPTIONS_BINDADDR
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -129,7 +129,7 @@ struct ssh_session_struct {
|
||||
#endif
|
||||
char *username;
|
||||
char *host;
|
||||
char *bindaddr; /* TODO: check if needed */
|
||||
char *bindaddr; /* bind the client to an ip addr */
|
||||
char *xbanner; /* TODO: looks like it is not needed */
|
||||
struct ssh_list *identity;
|
||||
char *sshdir;
|
||||
|
@ -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 */
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user