Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ftp do not pass scoped IPv6 address notation on Host...
details: https://anonhg.NetBSD.org/src/rev/b3fcd4f3a4a1
branches: trunk
changeset: 486552:b3fcd4f3a4a1
user: itojun <itojun%NetBSD.org@localhost>
date: Thu May 25 15:35:51 2000 +0000
description:
do not pass scoped IPv6 address notation on Host: directive, since
scope identifier is local to the originating node.
do not allow scoped IPv6 address notation in URL, if it is via proxy.
diffstat:
usr.bin/ftp/fetch.c | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diffs (57 lines):
diff -r bffc92805ec3 -r b3fcd4f3a4a1 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c Thu May 25 14:50:34 2000 +0000
+++ b/usr.bin/ftp/fetch.c Thu May 25 15:35:51 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.111 2000/05/01 10:35:17 lukem Exp $ */
+/* $NetBSD: fetch.c,v 1.112 2000/05/25 15:35:51 itojun Exp $ */
/*-
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.111 2000/05/01 10:35:17 lukem Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.112 2000/05/25 15:35:51 itojun Exp $");
#endif /* not lint */
/*
@@ -637,6 +637,16 @@
FREEPTR(ppath);
goto cleanup_fetch_url;
}
+ if (isipv6addr(host) &&
+ strchr(host, '%') != NULL) {
+ warnx(
+"Scoped address notation `%s' disallowed via web proxy",
+ host);
+ FREEPTR(phost);
+ FREEPTR(pport);
+ FREEPTR(ppath);
+ goto cleanup_fetch_url;
+ }
FREEPTR(host);
host = phost;
@@ -777,8 +787,19 @@
} else {
fprintf(fin, "GET %s HTTP/1.1\r\n", path);
if (strchr(host, ':')) {
- fprintf(fin, "Host: [%s]:%d\r\n", host,
- portnum);
+ char *h, *p;
+
+ /*
+ * strip off IPv6 scope identifier, since it is
+ * local to the node
+ */
+ h = xstrdup(host);
+ if (isipv6addr(h) &&
+ (p = strchr(h, '%')) != NULL) {
+ *p = '\0';
+ }
+ fprintf(fin, "Host: [%s]:%d\r\n", h, portnum);
+ free(h);
} else
fprintf(fin, "Host: %s:%d\r\n", host, portnum);
fprintf(fin, "Accept: */*\r\n");
Home |
Main Index |
Thread Index |
Old Index