summaryrefslogtreecommitdiff
path: root/src/apk_print.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-10-05 12:58:46 +0300
committerTimo Teräs <timo.teras@iki.fi>2020-10-05 12:58:46 +0300
commit6cedfe27ac566e7de7d0c24778c4280e8311bbec (patch)
tree3d217fe42e9e7095954c3279eda778cc26fd4552 /src/apk_print.h
parent8a794021c42baf8e1c12ae5e8e8313b66443002e (diff)
downloadapk-tools-6cedfe27ac566e7de7d0c24778c4280e8311bbec.tar.gz
apk-tools-6cedfe27ac566e7de7d0c24778c4280e8311bbec.tar.bz2
apk-tools-6cedfe27ac566e7de7d0c24778c4280e8311bbec.tar.xz
apk-tools-6cedfe27ac566e7de7d0c24778c4280e8311bbec.zip
db: mask password component of printed URLs
fixes #10710
Diffstat (limited to 'src/apk_print.h')
-rw-r--r--src/apk_print.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/apk_print.h b/src/apk_print.h
index acc6981..8e4dd46 100644
--- a/src/apk_print.h
+++ b/src/apk_print.h
@@ -12,6 +12,18 @@
#include "apk_blob.h"
+struct apk_url_print {
+ const char *url;
+ const char *pwmask;
+ const char *url_or_host;
+ size_t len_before_pw;
+};
+
+void apk_url_parse(struct apk_url_print *, const char *);
+
+#define URL_FMT "%.*s%s%s"
+#define URL_PRINTF(u) u.len_before_pw, u.url, u.pwmask, u.url_or_host
+
#define apk_error(args...) do { apk_log_err("ERROR: ", args); } while (0)
#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log_err("WARNING: ", args); } } while (0)
#define apk_message(args...) do { if (apk_verbosity > 0) { apk_log(NULL, args); } } while (0)