svn commit: r234838 - head/lib/libfetch

Dag-Erling Smorgrav des at FreeBSD.org
Mon Apr 30 12:12:49 UTC 2012


Author: des
Date: Mon Apr 30 12:12:48 2012
New Revision: 234838
URL: http://svn.freebsd.org/changeset/base/234838

Log:
  Don't reuse credentials if redirected to a different host.
  
  Submitted by:	Niels Heinen <heinenn at google.com>
  MFC after:	3 weeks

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==============================================================================
--- head/lib/libfetch/http.c	Mon Apr 30 12:11:45 2012	(r234837)
+++ head/lib/libfetch/http.c	Mon Apr 30 12:12:48 2012	(r234838)
@@ -1779,7 +1779,9 @@ http_request(struct url *URL, const char
 					DEBUG(fprintf(stderr, "failed to parse new URL\n"));
 					goto ouch;
 				}
-				if (!*new->user && !*new->pwd) {
+
+				/* Only copy credentials if the host matches */
+				if (!strcmp(new->host, url->host) && !*new->user && !*new->pwd) {
 					strcpy(new->user, url->user);
 					strcpy(new->pwd, url->pwd);
 				}


More information about the svn-src-head mailing list