/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <strings.h>
#include <ctype.h>
#include <libnvpair.h>
#include <libintl.h>
#include <libgen.h>
#include <pwd.h>
#include <auth_attr.h>
#include <secdb.h>
#include <libscf.h>
#include <limits.h>
#include <locale.h>
#include <dirent.h>
#include <libstmf.h>
#include <libsrpt.h>
/* SMF service info */
if (ret == STMF_ERROR_PROV_DATA_STALE) {\
gettext("Configuration changed during processing. "\
"Check the configuration, then retry this command "\
"if appropriate."));\
}\
}
gettext("Error, operation requires authorization %s"),\
sec);\
return (1);\
}\
}
};
/* keep the order of this enum in the same order as the 'subcmds' struct */
typedef enum {
typedef struct {
char *name;
char *shortopts;
char *usemsg;
};
/* used for checking if user is authorized */
/* prototypes */
static int print_target_props(char *hca);
static int list_target(char *hca);
static int disable_target(char *hca);
static int reset_target(char *hca);
static int list_defaults(void);
static int enable_target(char *hca);
int
{
int ret = 0;
char c;
char *objp;
int srptind = 0;
int dflag = 0;
int eflag = 0;
(void) textdomain(TEXT_DOMAIN);
if (argc < 2) {
ret = 1;
goto usage_error;
}
break;
}
}
/* get the caller's user name for subsequent chkauthattr() calls */
gettext("Could not determine callers user name."));
return (1);
}
/* increment past command & subcommand */
newargc--;
srptadm_long, &srptind);
if (c == -1) {
break;
}
switch (c) {
case 0:
/* flag set by getopt */
break;
case 'd':
dflag++;
break;
case 'e':
eflag++;
break;
case 'r':
break;
case '?':
/*
* '?' is returned for both unrecognized
* options and if explicitly provided on
* the command line. The latter should
* be handled the same as -h.
*/
gettext("Unrecognized option %s"),
ret = 1;
}
goto usage_error;
case 'h':
goto usage_error;
case ':':
gettext("Option %s requires an operand."),
/* fall through to default */
default:
ret = 1;
break;
}
}
if (ret != 0) {
goto usage_error;
}
/* after getopt() to allow handling of -h option */
gettext("Error, no subcommand specified"));
ret = 1;
goto usage_error;
}
if (newargc == 0) {
} else {
}
switch ((srptadm_sub_t)idx) {
case MODIFY_TARGET:
/* These subcommands need operands */
ret = 1;
goto usage_error;
default:
break;
}
}
if (newargc > 1) {
switch ((srptadm_sub_t)idx) {
case MODIFY_TARGET:
case LIST_TARGET:
/* These subcommands should have at most one operand */
ret = 1;
goto usage_error;
default:
break;
}
}
/*
* Make sure STMF service is enabled before proceeding.
*/
if (!smfstate ||
gettext("The STMF service must be online "
"before running this command."));
gettext("to enable the service and its prerequisite "
gettext("'svcs -x %s' to determine why it is not online."),
STMF_SVC);
return (1);
}
switch ((srptadm_sub_t)idx) {
case MODIFY_DEFAULT:
if (eflag) {
} else if (dflag) {
} else {
ret = 1;
goto usage_error;
}
break;
case LIST_DEFAULT:
ret = list_defaults();
break;
case MODIFY_TARGET:
if (reset) {
} else if (eflag) {
} else if (dflag) {
} else {
ret = 1;
goto usage_error;
}
break;
case LIST_TARGET:
break;
default:
ret = 1;
goto usage_error;
}
if (ret != 0) {
gettext("srptadm %s failed with error %d"),
}
return (ret);
} else {
/* overall usage */
continue;
}
}
}
return (ret);
}
static int
{
int ret;
return (ret);
}
static int
{
int ret;
return (ret);
}
static int
{
int ret;
return (ret);
}
static int
{
int ret;
return (ret);
}
static int
list_defaults(void)
{
int ret;
/* only state set as default for now */
if (ret == 0) {
(void) printf("%s:\n\n",
gettext("SRP Target Service Default Properties"));
(void) printf(" %s:\t",
gettext("Target creation enabled by default"));
if (enabled) {
} else {
}
}
return (ret);
}
static int
{
int ret;
int i;
return (ret);
}
if (ret == ETOOMANYREFS) {
goto done;
} else if (ret != 0) {
goto done;
}
for (i = 0; i < 1024; i++) {
break;
}
}
done:
for (i = 0; i < 1024; i++) {
break;
}
}
return (ret);
}
static int
{
int ret;
char *state;
if (ret != 0) {
hca);
return (ret);
}
/* only property set is enabled */
if (ret != 0) {
"Could not get enabled state for %s: %d\n",
return (ret);
}
if (enabled) {
} else {
}
state = "-";
if (ret == STMF_STATUS_SUCCESS) {
if (ret == STMF_STATUS_SUCCESS) {
state = "online";
} else {
state = "offline";
}
}
}
(void) printf("\n");
return (0);
}
static int
{
int ret = 0;
int idx = 0;
char *bufp;
return (EINVAL);
}
return (ret);
}
continue;
}
bufp += 4;
break;
}
idx++;
ret = ETOOMANYREFS;
break;
}
}
return (ret);
}