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.
This commit is contained in:
Ronnie Sahlberg
2011-01-03 14:58:52 +11:00
parent 87072d5622
commit 5928575bac

View File

@@ -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;