mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
Added handling of bindport in getopt.
This commit is contained in:
@@ -1087,6 +1087,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
|
|||||||
char *localaddr = NULL;
|
char *localaddr = NULL;
|
||||||
char *identity = NULL;
|
char *identity = NULL;
|
||||||
char *port = NULL;
|
char *port = NULL;
|
||||||
|
char *bindport = NULL;
|
||||||
char **save = NULL;
|
char **save = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int argc = *argcptr;
|
int argc = *argcptr;
|
||||||
@@ -1115,7 +1116,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
opterr = 0; /* shut up getopt */
|
opterr = 0; /* shut up getopt */
|
||||||
while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1)) {
|
while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:t:rd12")) != -1)) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 'l':
|
case 'l':
|
||||||
user = optarg;
|
user = optarg;
|
||||||
@@ -1123,6 +1124,9 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
|
|||||||
case 'p':
|
case 'p':
|
||||||
port = optarg;
|
port = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 't':
|
||||||
|
bindport = optarg;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
debuglevel++;
|
debuglevel++;
|
||||||
break;
|
break;
|
||||||
@@ -1246,6 +1250,10 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssh_options_set(options, SSH_OPTIONS_PORT_STR, port);
|
ssh_options_set(options, SSH_OPTIONS_PORT_STR, port);
|
||||||
|
if (bindport) {
|
||||||
|
i = atoi(bindport);
|
||||||
|
ssh_options_set(options, SSH_OPTIONS_BINDPORT, &i);
|
||||||
|
}
|
||||||
ssh_options_set(options, SSH_OPTIONS_SSH1, &ssh1);
|
ssh_options_set(options, SSH_OPTIONS_SSH1, &ssh1);
|
||||||
ssh_options_set(options, SSH_OPTIONS_SSH2, &ssh2);
|
ssh_options_set(options, SSH_OPTIONS_SSH2, &ssh2);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user