/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dirent.h>
#include <pkginfo.h>
#include <pkglocs.h>
#include <pkgstrct.h>
#include <pkgtrans.h>
#include <locale.h>
#include <libintl.h>
#include <pkglib.h>
#include <libadm.h>
#include <libinst.h>
"<%s> from <%s>\n"
"<%s> from <%s>\n"
"validate all objects in the client filesystem."
"execute properly."
" defined maximum supported length of 16 characters."
"\t%s [-l|vqacnxf] [-R rootdir] [-p path[, ...] | " \
"-P path[, ...]]\n" \
"\t\t[-i file] [options]\n" \
"\t%s -d device [-f][-l|v] [-p path[, ...] | " \
"-P path[, ...]]\n" \
"\t\t[-V ...] [-M] [-i file] [-Y category[, ...] | " \
"pkginst [...]]\n" \
"\twhere options may include ONE of the " \
"following:\n " \
"\t\t-m pkgmap [-e envfile]\n" \
"\t\tpkginst [...]\n" \
"\t\t-Y category[, ...]\n"
int pkgcnt = 0;
char *basedir;
short npaths;
int vflag = 0;
int nflag = 0;
int lflag = 0;
int Lflag = 0;
int fflag = 0;
int xflag = 0;
int qflag = 0;
int Rflag = 0;
int dflag = 0;
char *device;
char *uniTmp;
static char *mapfile,
*spooldir,
*tmpdir,
*envfile;
static int errflg = 0;
void quit(int);
static void setpathlist(char *);
static void usage(void);
extern char **environ;
extern char *pkgdir;
/* checkmap.c */
extern int checkmap(int, int, char *, char *, char *, char *, int);
/* scriptvfy.c */
int
{
/* 18N is compromised. */
int c;
int n = 0;
char *prog,
*Rvalue,
*dvalue;
int dbcreate = 0;
int pathtype;
/* initialize locale mechanism */
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
/* determine program name */
/* establish installation root directory */
quit(1);
}
/* check if not ABI compliant mode */
}
/* bugId 4012147 */
map_client = 0;
!= EOF) {
switch (c) {
case 'p':
quit(1);
}
MAXPATHS);
quit(1);
}
}
break;
case 'd':
dflag = 1;
break;
case 'n':
nflag++;
break;
case 'M':
map_client = 0;
break;
/*
* Allow admin to establish the client filesystem using a
* vfstab-like file of stable format.
*/
case 'V':
map_client = 1;
break;
case 'f':
if (getuid()) {
quit(1);
}
fflag++;
break;
case 'i':
break;
case 'v':
vflag++;
break;
case 'l':
lflag++;
break;
case 'L':
Lflag++;
break;
case 'x':
if (aflag < 0)
aflag = 0;
if (cflag < 0)
cflag = 0;
xflag++;
break;
case 'q':
qflag++;
break;
case 'a':
if (cflag < 0)
cflag = 0;
aflag = 1;
break;
case 'c':
if (aflag < 0)
aflag = 0;
cflag = 1;
break;
case 'e':
break;
case 'm':
break;
case 'R':
Rflag = 1;
break;
case 'Y':
quit(1);
} else if (is_not_valid_length(category)) {
quit(1);
}
break;
case 'Q':
dbcreate++;
break;
case 'P':
quit(1);
}
npaths++;
MAXPATHS);
quit(1);
}
}
break;
default:
usage();
/*NOTREACHED*/
/*
* Although usage() calls a noreturn function,
* needed to add return (1); so that main() would
* pass compilation checks. The statement below
* should never be executed.
*/
return (1);
}
}
/* Check for incompatible options */
usage();
/* Check for root dir and device dir if set */
if (Rflag) {
if (!set_inst_root(Rvalue)) {
quit(1);
}
}
if (dflag)
/* we're only supposed to list information */
usage();
}
usage();
}
quit(1);
} else {
}
usage();
} else {
}
/* read the environment for the pkgserver */
if (vcfile() == 0) {
quit(99);
}
errflg = 0;
if (mapfile) {
/* check for incompatible options */
usage();
put_path_params(); /* Restore what's needed. */
/* send pathtype if partial path */
errflg++;
} else if (device) {
/* check for incompatible options */
usage();
usage();
if (fflag) {
fflag = 0;
}
quit(99);
}
quit(n);
else
pkgfmt = 0;
} else {
else
pkgfmt = 1;
}
/*
* At this point pkg[] is the list of packages to check. They
* are in directory format in spooldir.
*/
quit(1);
} else {
quit(1);
}
}
aflag = 0;
for (n = 0; pkg[n]; n++) {
if (pkgfmt)
(void) printf(
else
(void) printf(
/* Here we check the install scripts. */
(void) printf(
gettext("## Checking control scripts.\n"));
(void) checkscripts(file, 0);
/* Verify consistency with the pkgmap. */
(void) printf(
gettext("## Checking package objects.\n"));
/*
* NOTE : checkmap() frees the environ data and
* pointer when it's through with them.
*/
errflg++;
(void) printf(
gettext("## Checking is complete.\n"));
}
} else {
if (envfile)
usage();
put_path_params(); /* Restore what's needed. */
/*
* If this is a check of a client of some sort, we'll need to
* mount up the client's filesystems. If the caller isn't
* root, this may not be possible.
*/
if (is_an_inst_root()) {
if (getuid()) {
} else {
map_client = 0;
if (map_client)
mount_client();
}
}
"%s/contents", get_PKGADM());
for (n = 0; ppathlist[n]; n++) {
errflg++;
}
errflg++;
}
} else {
errflg++;
}
}
if (map_client) {
}
}
/* LINTED: no return */
}
static void
{
int fd;
/*
* This trap laid to catch a mismatch between the declaration above and
* the hard-coded constant in the fscanf below
*/
#if PATH_MAX != 1024
#error "PATH_MAX changed, so we have a bug to fix"
#endif
} else {
quit(1);
}
quit(1);
}
quit(1);
}
quit(1);
}
}
if (*pathname == '\0') {
quit(1);
}
quit(1);
}
}
if (npaths == 0) {
quit(1);
}
}
void
quit(int n)
{
/* cleanup any temporary directories */
(void) chdir("/");
}
exit(n);
/*NOTREACHED*/
}
static void
usage(void)
{
quit(1);
/*NOTREACHED*/
}