init: fix segfaul in iscsi_parse_url

We allowed iscsi to be NULL in iscsi_parse_url. Especially
qemu does this and currently segfaults at start. Change the
usage guidelines for target username/password to be the same
as for chap username/password.

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-03-26 10:07:52 +01:00
parent b55ce5cc09
commit a45094b7a7
3 changed files with 23 additions and 30 deletions

View File

@@ -282,12 +282,8 @@ try_again:
iscsi_set_header_digest(iscsi, old_iscsi->want_header_digest);
if (old_iscsi->user[0]) {
iscsi_set_initiator_username_pwd(iscsi, old_iscsi->user, old_iscsi->passwd);
}
if (old_iscsi->target_user[0]) {
iscsi_set_target_username_pwd(iscsi, old_iscsi->target_user, old_iscsi->target_passwd);
}
iscsi_set_initiator_username_pwd(iscsi, old_iscsi->user, old_iscsi->passwd);
iscsi_set_target_username_pwd(iscsi, old_iscsi->target_user, old_iscsi->target_passwd);
iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL);