Add support for bidirectional CHAP

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2015-03-14 10:43:03 -07:00
parent b03959dbb5
commit b1d0ac45f1
8 changed files with 270 additions and 15 deletions

View File

@@ -60,6 +60,9 @@ struct iscsi_in_pdu {
void iscsi_free_iscsi_in_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in);
void iscsi_free_iscsi_inqueue(struct iscsi_context *iscsi, struct iscsi_in_pdu *inqueue);
/* size of chap response field */
#define CHAP_R_SIZE 16
struct iscsi_context {
char initiator_name[MAX_STRING_SIZE+1];
char target_name[MAX_STRING_SIZE+1];
@@ -73,6 +76,11 @@ struct iscsi_context {
char passwd[MAX_STRING_SIZE+1];
char chap_c[MAX_STRING_SIZE+1];
char target_user[MAX_STRING_SIZE+1];
char target_passwd[MAX_STRING_SIZE+1];
uint32_t target_chap_i;
unsigned char target_chap_r[CHAP_R_SIZE];
char error_string[MAX_STRING_SIZE+1];
enum iscsi_session_type session_type;

View File

@@ -268,6 +268,16 @@ EXTERN int iscsi_set_header_digest(struct iscsi_context *iscsi,
EXTERN int iscsi_set_initiator_username_pwd(struct iscsi_context *iscsi,
const char *user,
const char *passwd);
/*
* Specify the username and password to use for target chap authentication.
* Target/bidirectional CHAP is only supported if you also have normal
* CHAP authentication.
* You must configure CHAP first using iscsi_set_initiator_username_pwd()
`* before you can set up target authentication.
*/
EXTERN int iscsi_set_target_username_pwd(struct iscsi_context *iscsi,
const char *user,
const char *passwd);
/*
* check if the context is logged in or not