mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
Allow specifying server "-p" options with ipv6 bracket notation,
patch from Ben Jencks
This commit is contained in:
parent
5ff341206e
commit
8393c5f016
@ -329,8 +329,23 @@ static void addportandaddress(char* spec) {
|
|||||||
/* We don't free it, it becomes part of the runopt state */
|
/* We don't free it, it becomes part of the runopt state */
|
||||||
myspec = m_strdup(spec);
|
myspec = m_strdup(spec);
|
||||||
|
|
||||||
|
if (myspec[0] == '[') {
|
||||||
|
myspec++;
|
||||||
|
svr_opts.ports[svr_opts.portcount] = strchr(myspec, ']');
|
||||||
|
if (svr_opts.ports[svr_opts.portcount] == NULL) {
|
||||||
|
/* Unmatched [ -> exit */
|
||||||
|
dropbear_exit("Bad listen address");
|
||||||
|
}
|
||||||
|
svr_opts.ports[svr_opts.portcount][0] = '\0';
|
||||||
|
svr_opts.ports[svr_opts.portcount]++;
|
||||||
|
if (svr_opts.ports[svr_opts.portcount][0] != ':') {
|
||||||
|
/* Missing port -> exit */
|
||||||
|
dropbear_exit("Missing port");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* search for ':', that separates address and port */
|
/* search for ':', that separates address and port */
|
||||||
svr_opts.ports[svr_opts.portcount] = strrchr(myspec, ':');
|
svr_opts.ports[svr_opts.portcount] = strrchr(myspec, ':');
|
||||||
|
}
|
||||||
|
|
||||||
if (svr_opts.ports[svr_opts.portcount] == NULL) {
|
if (svr_opts.ports[svr_opts.portcount] == NULL) {
|
||||||
/* no ':' -> the whole string specifies just a port */
|
/* no ':' -> the whole string specifies just a port */
|
||||||
|
Loading…
Reference in New Issue
Block a user