On 09/29/2009 08:46 AM, Hannes Reinecke wrote: > > Some iSCSI implementations (eg HP) is using an empty username for > CHAP negotiations. So we should be allowing the same. >
I updated this patch so you can also support empty usernames for discovery. I do not have a target where I cannot add a empty username for discovery or normal sessions (or I cannot figured out how to set it if I do) so the patch is only tested for regressions. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to open-iscsi@googlegroups.com To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/open-iscsi -~----------~----~----~----~------~----~------~--~---
diff --git a/usr/auth.c b/usr/auth.c index 4b9afb5..cc232a0 100644 --- a/usr/auth.c +++ b/usr/auth.c @@ -1892,8 +1892,10 @@ acl_set_user_name(struct iscsi_acl *client, const char *username) return AUTH_STATUS_ERROR; } - if (strlcpy(client->username, username, AUTH_STR_MAX_LEN) >= - AUTH_STR_MAX_LEN) { + if (!username) + client->username[0] = '\0'; + else if (strlcpy(client->username, username, AUTH_STR_MAX_LEN) >= + AUTH_STR_MAX_LEN) { client->phase = AUTH_PHASE_ERROR; return AUTH_STATUS_ERROR; } diff --git a/usr/discovery.c b/usr/discovery.c index 5c7ea66..4a6dd86 100644 --- a/usr/discovery.c +++ b/usr/discovery.c @@ -666,8 +666,7 @@ setup_authentication(iscsi_session_t *session, session->bidirectional_auth = 1; /* sanity check the config */ - if ((config->auth.username[0] == '\0') - || (config->auth.password_length == 0)) { + if (config->auth.password_length == 0) { log_error( "discovery process to %s:%d has incoming " "authentication credentials but has no outgoing " diff --git a/usr/initiator.c b/usr/initiator.c index 7c6bd89..55c2893 100644 --- a/usr/initiator.c +++ b/usr/initiator.c @@ -260,8 +260,7 @@ __setup_authentication(iscsi_session_t *session, if (auth_cfg->username_in[0] || auth_cfg->password_in_length) { /* sanity check the config */ - if ((auth_cfg->username[0] == '\0') - || (auth_cfg->password_length == 0)) { + if (auth_cfg->password_length == 0) { log_debug(1, "node record has incoming " "authentication credentials but has no outgoing "