Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
@@ -98,7 +98,7 @@ struct iscsi_in_pdu {
|
||||
void iscsi_free_iscsi_in_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in);
|
||||
|
||||
/* size of chap response field */
|
||||
#define MAX_CHAP_R_SIZE 20 /* md5:16 sha1:20 */
|
||||
#define MAX_CHAP_R_SIZE 32 /* md5:16 sha1:20 */
|
||||
|
||||
/* max length of chap challange */
|
||||
#define MAX_CHAP_C_LENGTH 2048
|
||||
@@ -124,7 +124,7 @@ struct iscsi_context {
|
||||
char target_user[MAX_STRING_SIZE+1];
|
||||
char target_passwd[MAX_STRING_SIZE+1];
|
||||
int target_chap_i;
|
||||
char target_chap_r[MAX_CHAP_R_SIZE];
|
||||
unsigned char target_chap_r[MAX_CHAP_R_SIZE];
|
||||
|
||||
char error_string[MAX_STRING_SIZE+1];
|
||||
|
||||
|
||||
@@ -936,8 +936,9 @@ iscsi_login_add_chap_response(struct iscsi_context *iscsi, struct iscsi_pdu *pdu
|
||||
|
||||
/* bidirectional chap */
|
||||
if (iscsi->target_user[0]) {
|
||||
char target_chap_c[MAX_CHAP_R_SIZE * 2];
|
||||
|
||||
char target_chap_c[MAX_CHAP_R_SIZE * 2] = {0};
|
||||
char target_chap_c_hex[MAX_CHAP_R_SIZE * 4 + 1] = { 0 };
|
||||
|
||||
iscsi->target_chap_i++;
|
||||
snprintf(str, MAX_STRING_SIZE, "CHAP_I=%d",
|
||||
iscsi->target_chap_i);
|
||||
@@ -962,6 +963,7 @@ iscsi_login_add_chap_response(struct iscsi_context *iscsi, struct iscsi_pdu *pdu
|
||||
c = target_chap_c[i];
|
||||
cc[0] = i2h((c >> 4)&0x0f);
|
||||
cc[1] = i2h((c )&0x0f);
|
||||
memcpy(target_chap_c_hex + i * 2, cc, 2);
|
||||
if (iscsi_pdu_add_data(iscsi, pdu, &cc[0], 2) != 0) {
|
||||
iscsi_set_error(iscsi, "Out-of-memory: pdu add "
|
||||
"data failed.");
|
||||
@@ -977,7 +979,7 @@ iscsi_login_add_chap_response(struct iscsi_context *iscsi, struct iscsi_pdu *pdu
|
||||
|
||||
compute_chap_r(iscsi, iscsi->target_chap_i,
|
||||
(unsigned char *)iscsi->target_passwd,
|
||||
(unsigned char *)target_chap_c,
|
||||
(unsigned char *)target_chap_c_hex,
|
||||
(unsigned char *)iscsi->target_chap_r);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user