Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp The port number might have changed in the proxy ...



details:   https://anonhg.NetBSD.org/src/rev/84598ad508de
branches:  trunk
changeset: 475962:84598ad508de
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 31 22:05:22 1999 +0000

description:
The port number might have changed in the proxy case. Re-evaluate it.

diffstat:

 usr.bin/ftp/fetch.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 419c512930b7 -r 84598ad508de usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Tue Aug 31 21:30:25 1999 +0000
+++ b/usr.bin/ftp/fetch.c       Tue Aug 31 22:05:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 christos Exp $      */
+/*     $NetBSD: fetch.c,v 1.68 1999/08/31 22:05:22 christos Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.68 1999/08/31 22:05:22 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -652,6 +652,12 @@
                        warnx("Unknown port for URL `%s'", url);
                        goto cleanup_fetch_url;
                }
+               portnum = strtol(port, &ep, 10);
+               if (*ep || port == ep) {
+                       struct servent *svp = getservbyname(port, "tcp");
+                       if (svp != NULL)
+                               portnum = ntohs(svp->s_port);
+               }
                sin.sin_port = portnum;
 
                s = socket(AF_INET, SOCK_STREAM, 0);



Home | Main Index | Thread Index | Old Index