Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2012 12:12:48 +0000 (UTC)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234838 - head/lib/libfetch
Message-ID:  <201204301212.q3UCCmXc065270@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204301212.q3UCCmXc065270>