diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-02-17 12:10:35 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-02-17 12:10:35 +0000 |
commit | 3206e470d016ff0dff907e500ad8cc327a1c418e (patch) | |
tree | 335b62fd3e4f7f3d16f007b2bfa0d93c53beaeeb | |
parent | 6de4db5da089c7926f08dd15164676bc8b88f285 (diff) | |
download | ipxe-3206e470d016ff0dff907e500ad8cc327a1c418e.tar.gz |
[image] Redact password from URIs displayed by imgfetch()
-rw-r--r-- | src/usr/imgmgmt.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/usr/imgmgmt.c b/src/usr/imgmgmt.c index be153f875..bd53d824a 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; |