Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ftp fix proxy code. strtol() does not work very well...
details: https://anonhg.NetBSD.org/src/rev/419c512930b7
branches: trunk
changeset: 475961:419c512930b7
user: christos <christos%NetBSD.org@localhost>
date: Tue Aug 31 21:30:25 1999 +0000
description:
fix proxy code. strtol() does not work very well for parsing port names.
diffstat:
usr.bin/ftp/fetch.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r e8742d117bad -r 419c512930b7 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c Tue Aug 31 21:05:07 1999 +0000
+++ b/usr.bin/ftp/fetch.c Tue Aug 31 21:30:25 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.66 1999/08/29 22:21:57 christos Exp $ */
+/* $NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 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.66 1999/08/29 22:21:57 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 christos Exp $");
#endif /* not lint */
/*
@@ -481,7 +481,12 @@
if (parse_url(url, "URL", &urltype, &user, &pass, &host, &port, &path)
== -1)
goto cleanup_fetch_url;
- portnum = strtol(port, NULL, 10);
+ portnum = strtol(port, &ep, 10);
+ if (*ep || port == ep) {
+ struct servent *svp = getservbyname(port, "tcp");
+ if (svp != NULL)
+ portnum = ntohs(svp->s_port);
+ }
if (urltype == FILE_URL_T && ! EMPTYSTRING(host)
&& strcasecmp(host, "localhost") != 0) {
Home |
Main Index |
Thread Index |
Old Index