Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/iscsi/dist man page claims that you can use aut...
details: https://anonhg.NetBSD.org/src/rev/c3f1b0336d17
branches: trunk
changeset: 762480:c3f1b0336d17
user: sborrill <sborrill%NetBSD.org@localhost>
date: Mon Feb 21 17:48:43 2011 +0000
description:
man page claims that you can use auth type = none, but in reality this
didn't work (insisted on a username being given and then used, plus always
advertised CHAP to the target). Make initiator work as advertised (i.e.
defaults to auth type none and so don't require a username).
To use CHAP you should explicitly request CHAP:
iscsi-initiator -a chap -u user -h targetname /mountpoint
For backwards compatibility, if a username is given (-u) and no auth type
is specified (-a), it will default to CHAP, i.e. to use none, just give no
username:
iscsi-initiator -h targetname /mountpoint
diffstat:
external/bsd/iscsi/dist/configure.ac | 2 +-
external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c | 15 ++++++++++-
external/bsd/iscsi/dist/src/lib/initiator.c | 22 ++++++++++++----
3 files changed, 30 insertions(+), 9 deletions(-)
diffs (97 lines):
diff -r 8f553d839381 -r c3f1b0336d17 external/bsd/iscsi/dist/configure.ac
--- a/external/bsd/iscsi/dist/configure.ac Mon Feb 21 17:24:19 2011 +0000
+++ b/external/bsd/iscsi/dist/configure.ac Mon Feb 21 17:48:43 2011 +0000
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT([netbsd-iscsi],[20100416],[Alistair Crooks <agc%NetBSD.org@localhost>])
+AC_INIT([netbsd-iscsi],[20110221],[Alistair Crooks <agc%NetBSD.org@localhost>])
AC_CONFIG_SRCDIR([src/lib/protocol.c])
AC_CONFIG_AUX_DIR([buildaux])
diff -r 8f553d839381 -r c3f1b0336d17 external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
--- a/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c Mon Feb 21 17:24:19 2011 +0000
+++ b/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c Mon Feb 21 17:48:43 2011 +0000
@@ -618,11 +618,22 @@
*argv, i);
}
}
- if (iscsi_initiator_getvar(&ini, "user") == NULL) {
- iscsi_err(__FILE__, __LINE__, "user must be specified with -u\n");
+ if (!strcmp(iscsi_initiator_getvar(&ini, "auth type"), "chap") &&
+ iscsi_initiator_getvar(&ini, "user") == NULL) {
+ iscsi_err(__FILE__, __LINE__, "user must be specified with "
+ "-u if using CHAP authentication\n");
exit(EXIT_FAILURE);
}
+ if (strcmp(iscsi_initiator_getvar(&ini, "auth type"), "none") &&
+ iscsi_initiator_getvar(&ini, "user") != NULL) {
+ /*
+ * For backwards compatibility, default to using CHAP
+ * if username given
+ */
+ iscsi_initiator_setvar(&ini, "auth type", "chap");
+ }
+
if (iscsi_initiator_start(&ini) == -1) {
iscsi_err(__FILE__, __LINE__, "initiator_init() failed\n");
exit(EXIT_FAILURE);
diff -r 8f553d839381 -r c3f1b0336d17 external/bsd/iscsi/dist/src/lib/initiator.c
--- a/external/bsd/iscsi/dist/src/lib/initiator.c Mon Feb 21 17:24:19 2011 +0000
+++ b/external/bsd/iscsi/dist/src/lib/initiator.c Mon Feb 21 17:48:43 2011 +0000
@@ -211,10 +211,10 @@
}
s = *sess;
user = NULL;
- if (s->sess_params.cred.user) {
+ auth_type = s->sess_params.auth_type;
+ if (s->sess_params.cred.user && auth_type != AuthNone) {
user = s->sess_params.cred.user;
}
- auth_type = s->sess_params.auth_type;
mutual_auth = s->sess_params.mutual_auth;
(void) memset(s, 0x0, sizeof(*s));
s->state = INITIATOR_SESSION_STATE_INITIALIZING;
@@ -468,7 +468,11 @@
if (security == IS_SECURITY) {
PARAM_TEXT_ADD(sess->params, "InitiatorName", "iqn.1994-04.org.NetBSD.iscsi-initiator:agc", text, len, textsize, 1, return -1);
PARAM_TEXT_ADD(sess->params, "InitiatorAlias", "NetBSD", text, len, textsize, 1, return -1);
- PARAM_TEXT_ADD(sess->params, "AuthMethod", "CHAP,None", text, len, textsize, 1, return -1);
+ if (sess->sess_params.auth_type != AuthNone) {
+ PARAM_TEXT_ADD(sess->params, "AuthMethod", "CHAP,None", text, len, textsize, 1, return -1);
+ } else {
+ PARAM_TEXT_ADD(sess->params, "AuthMethod", "None", text, len, textsize, 1, return -1);
+ }
} else {
PARAM_TEXT_ADD(sess->params, "HeaderDigest", "None", text, len, textsize, 1, return -1);
PARAM_TEXT_ADD(sess->params, "DataDigest", "None", text, len, textsize, 1, return -1);
@@ -890,11 +894,13 @@
INIT_CLEANUP;
return -1;
}
- sess->sess_params.cred.user =
- strdup(iscsi_initiator_getvar(ini, "user"));
cp = iscsi_initiator_getvar(ini, "auth type");
if (strcmp(cp, "none") == 0) {
sess->sess_params.auth_type = AuthNone;
+ sess->sess_params.cred.user = NULL;
+ } else {
+ sess->sess_params.cred.user =
+ strdup(iscsi_initiator_getvar(ini, "user"));
}
cp = iscsi_initiator_getvar(ini, "mutual auth");
if (strcmp(cp, "none") == 0) {
@@ -3678,7 +3684,11 @@
INIT_CLEANUP;
return -1;
}
- sess->sess_params.cred.user = strdup(user);
+ if (user)
+ sess->sess_params.cred.user = strdup(user);
+ else
+ sess->sess_params.cred.user = NULL;
+
sess->sess_params.auth_type = auth_type;
sess->sess_params.mutual_auth = mutual_auth;
sess->sess_params.digest_wanted = digest_type;
Home |
Main Index |
Thread Index |
Old Index