Add unidirectional chap support so we can authenticate to the target.

Make the login phase more "intelligent" so we can iterate over login
pdus until we have reached full feature phase

Add a new helper functions to parse a iscsi url and break it down
into elements in a structure

Update iscsi-inq to allow CHAP authentication
This commit is contained in:
Ronnie Sahlberg
2010-12-22 22:23:55 +11:00
parent d53b882682
commit 40abe849b0
5 changed files with 703 additions and 123 deletions

View File

@@ -44,6 +44,10 @@ struct iscsi_context {
const char *initiator_name;
const char *target_name;
const char *alias;
const char *user;
const char *passwd;
enum iscsi_session_type session_type;
unsigned char isid[6];
uint32_t itt;
@@ -56,8 +60,20 @@ struct iscsi_context {
int fd;
int is_connected;
int current_phase;
int next_phase;
#define ISCSI_LOGIN_SECNEG_PHASE_OFFER_CHAP 0
#define ISCSI_LOGIN_SECNEG_PHASE_SELECT_ALGORITHM 1
#define ISCSI_LOGIN_SECNEG_PHASE_SEND_RESPONSE 2
int secneg_phase;
int login_attempts;
int is_loggedin;
int chap_a;
int chap_i;
char *chap_c;
iscsi_command_cb socket_status_cb;
void *connect_data;

View File

@@ -21,6 +21,8 @@ struct sockaddr;
struct iscsi_url {
const char *portal;
const char *target;
const char *user;
const char *passwd;
int lun;
};
@@ -134,6 +136,12 @@ enum iscsi_header_digest {
int iscsi_set_header_digest(struct iscsi_context *iscsi,
enum iscsi_header_digest header_digest);
/*
* Specify the username and password to use for chap authentication
*/
int iscsi_set_initiator_username_pwd(struct iscsi_context *iscsi,
const char *user,
const char *passwd);
/*
* check if the context is logged in or not