/*
* 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
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* add_allocatable -
* a command-line interface to add device to device_allocate and
* device_maps.
*/
#ifndef __EXTENSIONS__
#endif
#include <unistd.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include <pwd.h>
#include <nss_dbdefs.h>
#include <auth_attr.h>
#include <auth_list.h>
#include <zone.h>
#include <bsm/devalloc.h>
int check_args(da_args *);
int process_args(int, char **, da_args *, char *);
int scan_label(char *, char *);
int system_labeled = 0;
int
{
int rc;
char *progname;
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
else
progname++;
if (system_labeled) {
/*
* this command can be run only in the global zone.
*/
if (getzoneid() != GLOBAL_ZONEID) {
gettext(" : must be run in global zone\n"));
exit(1);
}
} else {
/*
* this command works in Trusted Extensions only.
*/
gettext(" : need to install Trusted Extensions\n"));
exit(1);
}
} else {
exit(1);
}
gettext(" : getpwuid_r failed: "));
exit(2);
}
gettext(" : user lacks authorization: \n"),
exit(4);
}
exit(1);
}
gettext(" : entry exists for "),
exit(3);
}
}
else
if (rc == -2)
gettext(" : error removing device\n"));
}
return (rc);
}
int
{
int c;
extern char *optarg;
switch (c) {
case 'a':
aflag++;
break;
case 'c':
gettext(" : device clean program"
" name not found\n"));
return (1);
}
cflag++;
break;
case 'd':
dflag++;
break;
case 'l':
gettext(" : device file list"
" not found\n"));
return (1);
}
lflag++;
break;
case 'f':
fflag++;
break;
case 'n':
gettext(" : device name "
"not found\n"));
return (1);
}
nflag++;
break;
case 'o':
/* check for field delimiters in the option */
gettext(" : invalid "
"key=val string: "),
optarg);
gettext("\n"));
}
return (1);
}
return (1);
}
oflag++;
break;
case 's':
break;
case 't':
gettext(" : device type "
"not found\n"));
return (1);
}
tflag++;
break;
default :
return (1);
}
}
if (dflag) {
/* -d requires -t, but does not like -n */
return (1);
/* require at least -n or -t or -l to be specified */
gettext(" : required options missing\n"));
return (1);
}
if (dflag) {
/* -d requires -t, but does not like -n */
return (1);
/* require at least -n or -t to be specified */
gettext(" : required options missing\n"));
return (1);
}
/* there's a bunch not accepted by remove_allocatable */
return (1);
} else {
return (1);
}
/* check for option specified more than once */
gettext(" : multiple-defined options\n"));
return (1);
}
return (0);
}
int
{
int error = 0;
/* no label specified */
return (0);
}
return (1);
val++;
/*
* if non-default labels are specified, check if they are correct
*/
/* get rid of double quotes if they exist */
while (*str == '"')
str++;
*p = '\0';
&error) == -1) {
gettext(" : bad label input: "),
val);
return (1);
}
}
return (0);
}
int
{
return (0);
return (1);
return (1);
return (1);
}
return (1);
}
}
return (0);
}
int
{
int nlen;
/*
* check if we're updating an existing entry without -f
*/
setdaent();
enddaent();
return (NO_OVERRIDE);
}
/* fill in defaults as required */
setdadefent();
}
enddadefent();
/* add default minlabel and maxlabel */
}
} else {
/* add default minlabel */
"%s%s%s%s%s",
}
}
/* add default maxlabel */
"%s%s%s%s%s",
}
}
}
}
return (0);
}
void
{
return;
gettext(" [-f][-s][-d] -n name -t type -l device-list"
"\n\t[-a authorization] [-c cleaning program] "
"[-o key=value]\n"));
gettext(" [-f][-s][-d] [-n name|-t type]\n"));
else
}