From 5928575bac20bbf43132e32759693c921485d665 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 3 Jan 2011 14:58:52 +1100 Subject: [PATCH] Allow setting the CHAP username/password via environment variables so that the password will not be showing up in log where the application logs the "filename/iscsi url" or in ps aux output. LIBISCSI_CHAP_USERNAME and LIBISCSI_CHAP_PASSWORD environment variables are available to set these outside of the url. If hte username/password is ALSO set in the URL, the settings in the URL will override the environment variables. --- lib/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/init.c b/lib/init.c index 34924b8..4d8a2a3 100644 --- a/lib/init.c +++ b/lib/init.c @@ -262,6 +262,9 @@ iscsi_parse_full_url(struct iscsi_context *iscsi, const char *url) } portal = str; + user = getenv("LIBISCSI_CHAP_USERNAME"); + passwd = getenv("LIBISCSI_CHAP_PASSWORD"); + tmp = index(portal, '@'); if (tmp != NULL) { user = portal;