summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2009-02-17 13:10:35 +0100
committerMichael Brown2009-02-17 13:10:35 +0100
commit3206e470d016ff0dff907e500ad8cc327a1c418e (patch)
tree335b62fd3e4f7f3d16f007b2bfa0d93c53beaeeb
parent[login] Add "login" command and UI (diff)
downloadipxe-3206e470d016ff0dff907e500ad8cc327a1c418e.tar.gz
ipxe-3206e470d016ff0dff907e500ad8cc327a1c418e.tar.xz
ipxe-3206e470d016ff0dff907e500ad8cc327a1c418e.zip
[image] Redact password from URIs displayed by imgfetch()
-rw-r--r--src/usr/imgmgmt.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c
index be153f87..bd53d824 100644
--- a/src/usr/imgmgmt.c
+++ b/src/usr/imgmgmt.c
@@ -43,7 +43,10 @@
*/
int imgfetch ( struct image *image, const char *uri_string,
int ( * image_register ) ( struct image *image ) ) {
+ char uri_string_redacted[ strlen ( uri_string ) + 3 /* "***" */
+ + 1 /* NUL */ ];
struct uri *uri;
+ const char *password;
int rc;
if ( ! ( uri = parse_uri ( uri_string ) ) )
@@ -51,9 +54,17 @@ int imgfetch ( struct image *image, const char *uri_string,
image_set_uri ( image, uri );
+ /* Redact password portion of URI, if necessary */
+ password = uri->password;
+ if ( password )
+ uri->password = "***";
+ unparse_uri ( uri_string_redacted, sizeof ( uri_string_redacted ),
+ uri );
+ uri->password = password;
+
if ( ( rc = create_downloader ( &monojob, image, image_register,
LOCATION_URI, uri ) ) == 0 )
- rc = monojob_wait ( uri_string );
+ rc = monojob_wait ( uri_string_redacted );
uri_put ( uri );
return rc;