Mercurial > dropbear
comparison cli-runopts.c @ 165:0cfba3034be5
Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 02 Jan 2005 20:25:56 +0000 |
parents | 6b306ad5f5b5 |
children | 1916df7df911 |
comparison
equal
deleted
inserted
replaced
161:b9d3f725e00b | 165:0cfba3034be5 |
---|---|
114 continue; | 114 continue; |
115 } | 115 } |
116 #endif | 116 #endif |
117 #ifdef ENABLE_CLI_REMOTETCPFWD | 117 #ifdef ENABLE_CLI_REMOTETCPFWD |
118 if (nextisremote) { | 118 if (nextisremote) { |
119 TRACE(("nextisremote true")); | 119 TRACE(("nextisremote true")) |
120 addforward(argv[i], &cli_opts.remotefwds); | 120 addforward(argv[i], &cli_opts.remotefwds); |
121 nextisremote = 0; | 121 nextisremote = 0; |
122 continue; | 122 continue; |
123 } | 123 } |
124 #endif | 124 #endif |
125 #ifdef ENABLE_CLI_LOCALTCPFWD | 125 #ifdef ENABLE_CLI_LOCALTCPFWD |
126 if (nextislocal) { | 126 if (nextislocal) { |
127 TRACE(("nextislocal true")); | 127 TRACE(("nextislocal true")) |
128 addforward(argv[i], &cli_opts.localfwds); | 128 addforward(argv[i], &cli_opts.localfwds); |
129 nextislocal = 0; | 129 nextislocal = 0; |
130 continue; | 130 continue; |
131 } | 131 } |
132 #endif | 132 #endif |
212 } | 212 } |
213 | 213 |
214 continue; /* next argument */ | 214 continue; /* next argument */ |
215 | 215 |
216 } else { | 216 } else { |
217 TRACE(("non-flag arg: '%s'", argv[i])); | 217 TRACE(("non-flag arg: '%s'", argv[i])) |
218 | 218 |
219 /* Either the hostname or commands */ | 219 /* Either the hostname or commands */ |
220 | 220 |
221 if (cli_opts.remotehost == NULL) { | 221 if (cli_opts.remotehost == NULL) { |
222 | 222 |
341 char * connectport = NULL; | 341 char * connectport = NULL; |
342 char * connectaddr = NULL; | 342 char * connectaddr = NULL; |
343 struct TCPFwdList* newfwd = NULL; | 343 struct TCPFwdList* newfwd = NULL; |
344 char * str = NULL; | 344 char * str = NULL; |
345 | 345 |
346 TRACE(("enter addforward")); | 346 TRACE(("enter addforward")) |
347 | 347 |
348 /* We probably don't want to be editing argvs */ | 348 /* We probably don't want to be editing argvs */ |
349 str = m_strdup(origstr); | 349 str = m_strdup(origstr); |
350 | 350 |
351 listenport = str; | 351 listenport = str; |
352 | 352 |
353 connectaddr = strchr(str, ':'); | 353 connectaddr = strchr(str, ':'); |
354 if (connectaddr == NULL) { | 354 if (connectaddr == NULL) { |
355 TRACE(("connectaddr == NULL")); | 355 TRACE(("connectaddr == NULL")) |
356 goto fail; | 356 goto fail; |
357 } | 357 } |
358 | 358 |
359 connectaddr[0] = '\0'; | 359 connectaddr[0] = '\0'; |
360 connectaddr++; | 360 connectaddr++; |
361 | 361 |
362 connectport = strchr(connectaddr, ':'); | 362 connectport = strchr(connectaddr, ':'); |
363 if (connectport == NULL) { | 363 if (connectport == NULL) { |
364 TRACE(("connectport == NULL")); | 364 TRACE(("connectport == NULL")) |
365 goto fail; | 365 goto fail; |
366 } | 366 } |
367 | 367 |
368 connectport[0] = '\0'; | 368 connectport[0] = '\0'; |
369 connectport++; | 369 connectport++; |
372 | 372 |
373 /* Now we check the ports - note that the port ints are unsigned, | 373 /* Now we check the ports - note that the port ints are unsigned, |
374 * the check later only checks for >= MAX_PORT */ | 374 * the check later only checks for >= MAX_PORT */ |
375 newfwd->listenport = strtol(listenport, NULL, 10); | 375 newfwd->listenport = strtol(listenport, NULL, 10); |
376 if (errno != 0) { | 376 if (errno != 0) { |
377 TRACE(("bad listenport strtol")); | 377 TRACE(("bad listenport strtol")) |
378 goto fail; | 378 goto fail; |
379 } | 379 } |
380 | 380 |
381 newfwd->connectport = strtol(connectport, NULL, 10); | 381 newfwd->connectport = strtol(connectport, NULL, 10); |
382 if (errno != 0) { | 382 if (errno != 0) { |
383 TRACE(("bad connectport strtol")); | 383 TRACE(("bad connectport strtol")) |
384 goto fail; | 384 goto fail; |
385 } | 385 } |
386 | 386 |
387 newfwd->connectaddr = connectaddr; | 387 newfwd->connectaddr = connectaddr; |
388 | 388 |
389 if (newfwd->listenport > 65535) { | 389 if (newfwd->listenport > 65535) { |
390 TRACE(("listenport > 65535")); | 390 TRACE(("listenport > 65535")) |
391 goto badport; | 391 goto badport; |
392 } | 392 } |
393 | 393 |
394 if (newfwd->connectport > 65535) { | 394 if (newfwd->connectport > 65535) { |
395 TRACE(("connectport > 65535")); | 395 TRACE(("connectport > 65535")) |
396 goto badport; | 396 goto badport; |
397 } | 397 } |
398 | 398 |
399 newfwd->next = *fwdlist; | 399 newfwd->next = *fwdlist; |
400 *fwdlist = newfwd; | 400 *fwdlist = newfwd; |
401 | 401 |
402 TRACE(("leave addforward: done")); | 402 TRACE(("leave addforward: done")) |
403 return; | 403 return; |
404 | 404 |
405 fail: | 405 fail: |
406 dropbear_exit("Bad TCP forward '%s'", origstr); | 406 dropbear_exit("Bad TCP forward '%s'", origstr); |
407 | 407 |