comparison svr-runopts.c @ 706:002cf09827c0

Allow specifying server "-p" options with ipv6 bracket notation, patch from Ben Jencks
author Matt Johnston <matt@ucc.asn.au>
date Tue, 19 Mar 2013 20:55:11 +0800
parents c58a15983808
children af4ef98b8591
comparison
equal deleted inserted replaced
705:2e573f39b88e 706:002cf09827c0
327 if (svr_opts.portcount < DROPBEAR_MAX_PORTS) { 327 if (svr_opts.portcount < DROPBEAR_MAX_PORTS) {
328 328
329 /* We don't free it, it becomes part of the runopt state */ 329 /* We don't free it, it becomes part of the runopt state */
330 myspec = m_strdup(spec); 330 myspec = m_strdup(spec);
331 331
332 /* search for ':', that separates address and port */ 332 if (myspec[0] == '[') {
333 svr_opts.ports[svr_opts.portcount] = strrchr(myspec, ':'); 333 myspec++;
334 svr_opts.ports[svr_opts.portcount] = strchr(myspec, ']');
335 if (svr_opts.ports[svr_opts.portcount] == NULL) {
336 /* Unmatched [ -> exit */
337 dropbear_exit("Bad listen address");
338 }
339 svr_opts.ports[svr_opts.portcount][0] = '\0';
340 svr_opts.ports[svr_opts.portcount]++;
341 if (svr_opts.ports[svr_opts.portcount][0] != ':') {
342 /* Missing port -> exit */
343 dropbear_exit("Missing port");
344 }
345 } else {
346 /* search for ':', that separates address and port */
347 svr_opts.ports[svr_opts.portcount] = strrchr(myspec, ':');
348 }
334 349
335 if (svr_opts.ports[svr_opts.portcount] == NULL) { 350 if (svr_opts.ports[svr_opts.portcount] == NULL) {
336 /* no ':' -> the whole string specifies just a port */ 351 /* no ':' -> the whole string specifies just a port */
337 svr_opts.ports[svr_opts.portcount] = myspec; 352 svr_opts.ports[svr_opts.portcount] = myspec;
338 } else { 353 } else {