summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorSam Cramer <Sam.Cramer@Sun.COM>2009-02-13 11:14:37 -0800
committerSam Cramer <Sam.Cramer@Sun.COM>2009-02-13 11:14:37 -0800
commit836fc322d4b4884a4c64c7b5d172a4a3bb6a5772 (patch)
treec35dcefc381be2081ee1bc2aaea3f4cd75b7b0cf /usr/src/cmd
parentb2634b9c57bbcfa01bb5dec2e196aec32957925f (diff)
downloadillumos-joyent-836fc322d4b4884a4c64c7b5d172a4a3bb6a5772.tar.gz
6749221 itadm fail to update data with error 32768 when maximum targets are created
6750227 itadm can create targets with node name which are not allowed by section 6.2 of the rfc3722 6782333 itadm modify-target core dumps when using incorrect syntax 6785308 Partial silent failure of itadm delete-tpg when multiple TPGs are listed. 6785409 Partial silent failure of itadm create-tpg when a comma is used in portal list
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/itadm/itadm.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/usr/src/cmd/itadm/itadm.c b/usr/src/cmd/itadm/itadm.c
index e252509d42..2ca55fbe48 100644
--- a/usr/src/cmd/itadm/itadm.c
+++ b/usr/src/cmd/itadm/itadm.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
@@ -464,6 +464,26 @@ main(int argc, char *argv[])
}
}
+ if (newargc > 1) {
+ switch ((itadm_sub_t)idx) {
+ case MODIFY_TGT:
+ case DELETE_TGT:
+ case LIST_TGT:
+ case DELETE_TPG:
+ case LIST_TPG:
+ case CREATE_INI:
+ case MODIFY_INI:
+ case LIST_INI:
+ case DELETE_INI:
+ /* These subcommands should have at most one operand */
+ ret = 1;
+ goto usage_error;
+
+ default:
+ break;
+ }
+ }
+
/*
* XXX - this should probably get pushed down to the library
* depending on the decision to allow/disallow configuratoin
@@ -621,6 +641,10 @@ create_target(char *tgt, nvlist_t *proplist)
(void) fprintf(stderr,
gettext("iSCSI target %s already configured"),
tgt);
+ } else if (ret == E2BIG) {
+ (void) fprintf(stderr,
+ gettext("Maximum of %d iSCSI targets"),
+ MAX_TARGETS);
} else {
(void) fprintf(stderr,
gettext("Error creating target: %d"), ret);
@@ -982,14 +1006,14 @@ modify_target(char *tgt, char *newname, nvlist_t *proplist)
int ret;
it_config_t *cfg = NULL;
it_tgt_t *ptr = NULL;
- it_tgt_t *tgtp;
+ it_tgt_t *tgtp = NULL;
char **tags = NULL;
uint32_t count = 0;
nvlist_t *errlist = NULL;
int i;
it_tpg_t *tpg = NULL;
uint16_t tagid;
- it_tpgt_t *tpgt;
+ it_tpgt_t *tpgt = NULL;
char *sec = "solaris.smf.modify.stmf";
ITADM_CHKAUTH(sec);
@@ -1225,6 +1249,7 @@ create_tpg(char *tpg, int addrc, char **addrs)
int count = 0;
it_portal_t *ptl;
char *sec = "solaris.smf.modify.stmf";
+ int i = 0;
ITADM_CHKAUTH(sec);
@@ -1271,6 +1296,21 @@ create_tpg(char *tpg, int addrc, char **addrs)
}
/*
+ * Ensure that the addrs don't contain commas.
+ */
+ for (i = 0; i < addrc; i++) {
+ if (strchr(addrs[i], ',')) {
+ (void) fprintf(stderr,
+ gettext("Bad portal name %s"),
+ addrs[i]);
+ (void) fprintf(stderr, "\n");
+
+ it_config_free(cfg);
+ return (EINVAL);
+ }
+ }
+
+ /*
* Create the portal group and first portal
*/
ret = it_tpg_create(cfg, &tpgp, tpg, addrs[count]);