From: Hannes Reinecke <[email protected]> Instead of requiring a configuration file we should be allowing the server to be specified on the commandline.
Signed-off-by: Hannes Reinecke <[email protected]> --- utils/open-isns/client.c | 3 +++ utils/open-isns/doc/isnsadm.8 | 4 ++++ utils/open-isns/isnsadm.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/utils/open-isns/client.c b/utils/open-isns/client.c index c191736510f6..501f716eca8a 100644 --- a/utils/open-isns/client.c +++ b/utils/open-isns/client.c @@ -43,6 +43,9 @@ isns_create_client(isns_security_t *ctx, const char *source_name) const char *server_name; server_name = isns_config.ic_server_name; + if (!server_name) + return NULL; + if (!strcasecmp(server_name, "SLP:") && !(server_name = isns_slp_find())) { isns_error("Unable to locate iSNS server through SLP\n"); diff --git a/utils/open-isns/doc/isnsadm.8 b/utils/open-isns/doc/isnsadm.8 index 88ec4cfff85d..864e8dc3822e 100644 --- a/utils/open-isns/doc/isnsadm.8 +++ b/utils/open-isns/doc/isnsadm.8 @@ -79,6 +79,10 @@ management tasks, such as enrolling new clients, editing access control and so on. Local mode is only available to the super user. .TP +.BI \--server " servername\fR, " \-s " servername +specifies the server to use (if not specified +in the configuration file). +.TP .BI \--control makes .B isnsadm diff --git a/utils/open-isns/isnsadm.c b/utils/open-isns/isnsadm.c index a24fa75510d8..5860463f6da3 100644 --- a/utils/open-isns/isnsadm.c +++ b/utils/open-isns/isnsadm.c @@ -43,6 +43,7 @@ static struct option options[] = { { "debug", required_argument, NULL, 'd' }, { "keyfile", required_argument, NULL, 'K', }, { "key", required_argument, NULL, 'k', }, + { "server", required_argument, NULL, 's', }, { "local", no_argument, NULL, 'l' }, { "control", no_argument, NULL, 'C' }, { "replace", no_argument, NULL, 'r' }, @@ -71,6 +72,7 @@ static int opt_control = 0; static int opt_replace = 0; static const char * opt_keyfile = NULL; static char * opt_key = NULL; +static const char * opt_servername = NULL; static struct sockaddr_storage opt_myaddr; static void usage(int, const char *); @@ -95,7 +97,7 @@ main(int argc, char **argv) isns_security_t *security = NULL; int c, status; - while ((c = getopt_long(argc, argv, "46Cc:d:hK:k:l", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "46Cc:d:hK:k:ls:", options, NULL)) != -1) { switch (c) { case '4': opt_af = AF_INET; @@ -137,6 +139,9 @@ main(int argc, char **argv) opt_replace = 1; break; + case 's': + opt_servername = optarg; + case 'V': printf("Open-iSNS version %s\n" "Copyright (C) 2007, Olaf Kirch <[email protected]>\n", @@ -167,8 +172,11 @@ main(int argc, char **argv) if (!isns_config.ic_source_name) usage(1, "Please specify an iSNS source name"); - if (!isns_config.ic_server_name) + if (!isns_config.ic_server_name && opt_servername) + isns_config.ic_server_name = strdup(opt_servername); + if (!isns_config.ic_server_name && !opt_local) usage(1, "Please specify an iSNS server name"); + if (!opt_action) usage(1, "Please specify an operating mode"); -- 2.1.2 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
