All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: compare full CHAP_A Algorithm strings
@ 2019-08-30 17:16 David Disseldorp
  2019-09-02  8:36 ` David Disseldorp
  2019-09-04 22:49 ` Lee Duncan
  0 siblings, 2 replies; 3+ messages in thread
From: David Disseldorp @ 2019-08-30 17:16 UTC (permalink / raw
  To: target-devel

RFC 2307 states:

  For CHAP [RFC1994], in the first step, the initiator MUST send:

      CHAP_A=<A1,A2...>

   Where A1,A2... are proposed algorithms, in order of preference.
...
   For the Algorithm, as stated in [RFC1994], one value is required to
   be implemented:

       5     (CHAP with MD5)

LIO currently checks for this value by only comparing a single byte in
the tokenized Algorithm string, which means that any value starting with
a '5' (e.g. "55") is interpreted as "CHAP with MD5". Fix this by
comparing the entire tokenized string.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 drivers/target/iscsi/iscsi_target_auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
index 51ddca2033e0..8fe9b12a07a4 100644
--- a/drivers/target/iscsi/iscsi_target_auth.c
+++ b/drivers/target/iscsi/iscsi_target_auth.c
@@ -70,7 +70,7 @@ static int chap_check_algorithm(const char *a_str)
 		if (!token)
 			goto out;
 
-		if (!strncmp(token, "5", 1)) {
+		if (!strcmp(token, "5")) {
 			pr_debug("Selected MD5 Algorithm\n");
 			kfree(orig);
 			return CHAP_DIGEST_MD5;
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] target: compare full CHAP_A Algorithm strings
  2019-08-30 17:16 [PATCH] target: compare full CHAP_A Algorithm strings David Disseldorp
@ 2019-09-02  8:36 ` David Disseldorp
  2019-09-04 22:49 ` Lee Duncan
  1 sibling, 0 replies; 3+ messages in thread
From: David Disseldorp @ 2019-09-02  8:36 UTC (permalink / raw
  To: target-devel

On Fri, 30 Aug 2019 19:16:11 +0200, David Disseldorp wrote:

...
> LIO currently checks for this value by only comparing a single byte in
> the tokenized Algorithm string, which means that any value starting with
> a '5' (e.g. "55") is interpreted as "CHAP with MD5".

FWIW, this can be triggered via a simple libiscsi hack:
https://github.com/ddiss/libiscsi/commit/a6a41fd002c18edaad5d7df320373ec0232b460d.patch

Cheers, David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] target: compare full CHAP_A Algorithm strings
  2019-08-30 17:16 [PATCH] target: compare full CHAP_A Algorithm strings David Disseldorp
  2019-09-02  8:36 ` David Disseldorp
@ 2019-09-04 22:49 ` Lee Duncan
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Duncan @ 2019-09-04 22:49 UTC (permalink / raw
  To: target-devel

T24gOC8zMC8xOSAxMDoxNiBBTSwgRGF2aWQgRGlzc2VsZG9ycCB3cm90ZToNCj4gUkZDIDIzMDcg
c3RhdGVzOg0KPiANCj4gICBGb3IgQ0hBUCBbUkZDMTk5NF0sIGluIHRoZSBmaXJzdCBzdGVwLCB0
aGUgaW5pdGlhdG9yIE1VU1Qgc2VuZDoNCj4gDQo+ICAgICAgIENIQVBfQT08QTEsQTIuLi4+DQo+
IA0KPiAgICBXaGVyZSBBMSxBMi4uLiBhcmUgcHJvcG9zZWQgYWxnb3JpdGhtcywgaW4gb3JkZXIg
b2YgcHJlZmVyZW5jZS4NCj4gLi4uDQo+ICAgIEZvciB0aGUgQWxnb3JpdGhtLCBhcyBzdGF0ZWQg
aW4gW1JGQzE5OTRdLCBvbmUgdmFsdWUgaXMgcmVxdWlyZWQgdG8NCj4gICAgYmUgaW1wbGVtZW50
ZWQ6DQo+IA0KPiAgICAgICAgNSAgICAgKENIQVAgd2l0aCBNRDUpDQo+IA0KPiBMSU8gY3VycmVu
dGx5IGNoZWNrcyBmb3IgdGhpcyB2YWx1ZSBieSBvbmx5IGNvbXBhcmluZyBhIHNpbmdsZSBieXRl
IGluDQo+IHRoZSB0b2tlbml6ZWQgQWxnb3JpdGhtIHN0cmluZywgd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JpdGhtXG4iKTsNCj4gIAkJCWtmcmVlKG9yaWcpOw0KPiAgCQkJ
cmV0dXJuIENIQVBfRElHRVNUX01ENTsNCj4gDQoNClJldmlld2VkLWJ5OiBMZWUgRHVuY2FuIDxs
ZHVuY2FuQHN1c2UuY29tPg0K

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-04 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-30 17:16 [PATCH] target: compare full CHAP_A Algorithm strings David Disseldorp
2019-09-02  8:36 ` David Disseldorp
2019-09-04 22:49 ` Lee Duncan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.