USERNAME / PASSWORD

When failing iscsi-ls due to a missing url, print the url syntax
in the error message before aborting
This commit is contained in:
Ronnie Sahlberg
2010-12-25 12:04:29 +11:00
parent 60718652a4
commit 240e250b11
2 changed files with 7 additions and 2 deletions

View File

@@ -234,7 +234,7 @@ iscsi_parse_full_url(struct iscsi_context *iscsi, const char *url)
char *tmp;
if (strncmp(url, "iscsi://", 8)) {
iscsi_set_error(iscsi, "Invalid URL %s\niSCSI URL must be of the form \"iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn>/<lun>\"\n", url);
iscsi_set_error(iscsi, "Invalid URL %s\niSCSI URL must be of the form \"iscsi://[<username>[%%<password>]@]<host>[:<port>]/<target-iqn>/<lun>\"\n", url);
return NULL;
}

View File

@@ -192,9 +192,14 @@ int main(int argc, const char *argv[])
exit(10);
}
if (url == NULL) {
fprintf(stderr, "You must specify the URL\n");
fprintf(stderr, " iscsi://[<username>[%%<password>]@]<host>[:<port>]/<target-iqn>/<lun>\n");
exit(10);
}
iscsi_url = iscsi_parse_full_url(iscsi, url);
if (iscsi_url == NULL) {
fprintf(stderr, "Failed to parse URL : %s\n", url);
fprintf(stderr, "Failed to parse URL : %s %s\n", url, iscsi_get_error(iscsi));
exit(10);
}