aboutsummaryrefslogtreecommitdiffstats
path: root/src/usr/imgmgmt.c
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2017-12-28 13:38:50 +0000
committerMichael Brown <mcb30@ipxe.org>2017-12-28 13:42:44 +0000
commitbe9ed2848dde771307d9089dbfd4481ed16e2607 (patch)
tree4784f069ed93e36e9d4e45c80a0d14cd8bd3bffa /src/usr/imgmgmt.c
parent659c484efcb04c434cc562162eb0231be41cb816 (diff)
downloadipxe-be9ed2848dde771307d9089dbfd4481ed16e2607.tar.gz
[image] Omit URI query string and fragment from download progress messages
The URIs printed as part of download progress messages are intended to provide a quick visual progress indication to the user. Very long query strings can render this visual indication useless in practice, since the most important information (generally the URI host and path) is drowned out by multiple lines of human-illegible URI-encoded data. Omit the query string entirely from the download progress message. For consistency and brevity, also omit the URI fragment along with the username and password (which was previously redacted anyway). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr/imgmgmt.c')
-rw-r--r--src/usr/imgmgmt.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c
index 352dd0242..a01d6e291 100644
--- a/src/usr/imgmgmt.c
+++ b/src/usr/imgmgmt.c
@@ -50,16 +50,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
int imgdownload ( struct uri *uri, unsigned long timeout,
struct image **image ) {
- const char *password;
+ struct uri uri_redacted;
char *uri_string_redacted;
int rc;
/* Construct redacted URI */
- password = uri->password;
- if ( password )
- uri->password = "***";
- uri_string_redacted = format_uri_alloc ( uri );
- uri->password = password;
+ memcpy ( &uri_redacted, uri, sizeof ( uri_redacted ) );
+ uri_redacted.user = NULL;
+ uri_redacted.password = NULL;
+ uri_redacted.query = NULL;
+ uri_redacted.fragment = NULL;
+ uri_string_redacted = format_uri_alloc ( &uri_redacted );
if ( ! uri_string_redacted ) {
rc = -ENOMEM;
goto err_uri_string;