ndmpadm_main.c revision 1e05b03fa76ee89d509f0c461b36cb865f1e6794
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * BSD 3 Clause License
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 2007, The Storage Networking Industry Association.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * - Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * - Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the documentation and/or other materials provided with the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * - Neither the name of The Storage Networking Industry Association (SNIA)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * nor the names of its contributors may be used to endorse or promote
199767f8919635c4928607450d9e0abb932109ceToomas Soome * products derived from this software without specific prior written
199767f8919635c4928607450d9e0abb932109ceToomas Soome * permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
199767f8919635c4928607450d9e0abb932109ceToomas Soome * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * POSSIBILITY OF SUCH DAMAGE.
#include "ndmpadm.h"
} ndmp_help_t;
typedef struct ndmp_command {
const char *nc_name;
static void ndmp_get_config_process(char *);
static int ndmp_get_password(char **);
static char *prop_table[] = {
typedef struct ndmp_auth {
const char *auth_type;
const char *username;
const char *password;
} ndmp_auth_t;
#if !defined(TEXT_DOMAIN)
switch (idx) {
case HELP_SET_CONFIG:
case HELP_GET_CONFIG:
case HELP_SHOW_DEVICES:
case HELP_SHOW_SESSIONS:
case HELP_KILL_SESSIONS:
case HELP_ENABLE_AUTH:
case HELP_DISABLE_AUTH:
return (NULL);
for (i = 0; i < NCOMMAND; i++) {
if (show_properties) {
for (i = 0; i < NDMPADM_NPROP; i++)
char *propval;
for (i = 0; i < NDMPADM_NPROP; i++) {
prop_table[i]);
for (i = 0; i < argc; i++) {
char *propval;
for (j = 0; j < NDMPADM_NPROP; j++) {
if (j == NDMPADM_NPROP) {
for (i = 0; i < argc; i++) {
char *propvalue;
int ret, j;
propvalue++;
for (j = 0; j < NDMPADM_NPROP; j++) {
if (j == NDMPADM_NPROP) {
if (!ndmp_door_status()) {
int ret;
if (ndmp_door_status()) {
int c, ret, i, j;
int statarg = 0;
char *value;
if (ndmp_door_status()) {
statarg = 0;
&value)) {
if (statarg == 0)
if (argc == 0) {
for (i = 0; i < argc; i++) {
if (j == num) {
int ret, i;
if (ndmp_door_status()) {
for (i = 0; i < NDMP_PASSWORD_RETRIES; i++) {
if ((pw1 =
if ((pw1 =
!= NULL) {
int c, i, auth_type_flag = 0;
char *enc_password;
for (i = 0; i < NAUTH; i++) {
if (!ndmp_door_status() &&
if (!auth_type_flag)
char *auth_type;
int c, i, auth_type_flag = 0;
for (i = 0; i < NAUTH; i++) {
if (!ndmp_door_status() &&
if (!auth_type_flag)
int ret;
char *cmdname;
opterr = 0;
for (i = 0; i < NCOMMAND; i++) {
if (i == NCOMMAND) {
return (ret);