iscsi-target: chap auth shouldn't match username with trailing garbage
authorEric Seppanen <eric@purestorage.com>
Wed, 20 Nov 2013 22:19:52 +0000 (14:19 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 18:56:15 +0000 (10:56 -0800)
commit6aec95b47deb9e3dad4cb2e6db87f3b03544224d
treecbcd2847d3c3b246b2697bf2dab3eb16157c0c44
parente97f132f0e66893138f64b681cddff2d2ff37b53
iscsi-target: chap auth shouldn't match username with trailing garbage

commit 86784c6bdeeef78eed94d298be7a8879f6a97ee2 upstream.

In iSCSI negotiations with initiator CHAP enabled, usernames with
trailing garbage are permitted, because the string comparison only
checks the strlen of the configured username.

e.g. "usernameXXXXX" will be permitted to match "username".

Just check one more byte so the trailing null char is also matched.

Signed-off-by: Eric Seppanen <eric@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/iscsi/iscsi_target_auth.c