URL encoded Targetnames

Assume target names are URL encoded with '%' as the special character.

Any sequence of '%' followed by two bytes in the target name will be replaced
with the byte that the second two bytes represent in hexadecimal.

Example
iqn.ronnie.test%3A1234
will be translated to iqn.ronnie.test:1234
This commit is contained in:
Ronnie Sahlberg
2013-06-16 11:35:14 -07:00
parent 12f93b60c7
commit e061cba1b9
3 changed files with 88 additions and 39 deletions

View File

@@ -84,10 +84,10 @@ EXTERN int iscsi_set_timeout(struct iscsi_context *iscsi, int timeout);
EXTERN int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval);
struct iscsi_url {
char portal[MAX_STRING_SIZE+1];
char target[MAX_STRING_SIZE+1];
char user[MAX_STRING_SIZE+1];
char passwd[MAX_STRING_SIZE+1];
char portal[MAX_STRING_SIZE + 1];
char target[MAX_STRING_SIZE + 1];
char user[MAX_STRING_SIZE + 1];
char passwd[MAX_STRING_SIZE + 1];
int lun;
struct iscsi_context *iscsi;
};
@@ -125,6 +125,10 @@ iscsi_set_initial_r2t(struct iscsi_context *iscsi, enum iscsi_initial_r2t initia
* iSCSI URL format :
* iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>
*
* Target names are url encoded with '%' as a special character.
* Example:
* "iqn.ronnie.test%3A1234" will be translated to "iqn.ronnie.test:1234"
*
* Function will return a pointer to an iscsi url structure if successful,
* or it will return NULL and set iscsi_get_error() accrodingly if there was a problem
* with the URL.