Skip to content

Commit

Permalink
Don't reuse credentials if redirected to a different host.
Browse files Browse the repository at this point in the history
Submitted by:	Niels Heinen <[email protected]>
MFC after:	3 weeks
  • Loading branch information
dag-erling committed Apr 30, 2012
1 parent f695f4d commit 17b92ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libfetch/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,9 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
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);
}
Expand Down

0 comments on commit 17b92ca

Please sign in to comment.