summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-12 23:39:26 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-12 23:39:26 +0000
commit19066a112baff6107781dc337b27e557f43098c2 (patch)
tree55200517aa7e6912f8d623b4b8ef340dc9de6495 /ssh.c
parentd69dab3cde47c7e17382de556449bfda0fb28deb (diff)
- stevesk@cvs.openbsd.org 2001/04/12 20:09:38
[misc.c misc.h readconf.c servconf.c ssh.c sshd.c] robust port validation; ok markus@ jakob@
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ssh.c b/ssh.c
index f14fbac23..eda443751 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.112 2001/04/12 19:15:25 markus Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.113 2001/04/12 20:09:37 stevesk Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -247,7 +247,7 @@ main(int ac, char **av)
247{ 247{
248 int i, opt, optind, exit_status, ok; 248 int i, opt, optind, exit_status, ok;
249 u_short fwd_port, fwd_host_port; 249 u_short fwd_port, fwd_host_port;
250 char *optarg, *cp, *endofnumber, buf[256]; 250 char *optarg, *cp, buf[256];
251 struct stat st; 251 struct stat st;
252 struct passwd *pw; 252 struct passwd *pw;
253 int dummy; 253 int dummy;
@@ -460,8 +460,8 @@ main(int ac, char **av)
460 } 460 }
461 break; 461 break;
462 case 'p': 462 case 'p':
463 options.port = strtol(optarg, &endofnumber, 0); 463 options.port = a2port(optarg);
464 if (optarg == endofnumber) { 464 if (options.port == 0) {
465 fprintf(stderr, "Bad port '%s'\n", optarg); 465 fprintf(stderr, "Bad port '%s'\n", optarg);
466 exit(1); 466 exit(1);
467 } 467 }
@@ -493,9 +493,9 @@ main(int ac, char **av)
493 break; 493 break;
494 494
495 case 'D': 495 case 'D':
496 fwd_port = strtol(optarg, &endofnumber, 0); 496 fwd_port = a2port(optarg);
497 if (optarg == endofnumber) { 497 if (fwd_port == 0) {
498 fprintf(stderr, "Bad port '%s'\n", optarg); 498 fprintf(stderr, "Bad dynamic port '%s'\n", optarg);
499 exit(1); 499 exit(1);
500 } 500 }
501 add_local_forward(&options, fwd_port, "socks4", 0); 501 add_local_forward(&options, fwd_port, "socks4", 0);