Patch to improve -p error message.

Mo DeJong mdejong at cygnus.com
Thu Jan 11 17:03:23 EST 2001


Hi all.

I got sick of getting a lame error message when I typed
the wrong thing in for a -p argument, so I wrote
up this patch.

Bad:

% ssh -p L4501 localhost
Secure connection to localhost refused.

Good:

./ssh -p L4501 localhost
Bad port specification 'L4501'.

Mo DeJong
Red Hat Inc

Index: ssh.c
===================================================================
RCS file: /cvs/openssh_cvs/ssh.c,v
retrieving revision 1.56
diff -u -r1.56 ssh.c
--- ssh.c       2000/12/28 16:40:05     1.56
+++ ssh.c       2001/01/11 06:01:18
@@ -437,6 +437,12 @@
                        break;
                case 'p':
                        options.port = atoi(optarg);
+                       if (options.port == 0) {
+                           fprintf(stderr,
+                               "Bad port specification '%s'.\n",
+                                   optarg);
+                           exit(1);
+                       }
                        break;
                case 'l':
                        options.user = optarg;






More information about the openssh-unix-dev mailing list