5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER START
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The contents of this file are subject to the terms of the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Common Development and Distribution License (the "License").
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You may not use this file except in compliance with the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * or http://www.opensolaris.org/os/licensing.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * See the License for the specific language governing permissions
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and limitations under the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * When distributing Covered Code, include this CDDL HEADER in each
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If applicable, add the following below this CDDL HEADER, with the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER END
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Use is subject to license terms.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* All Rights Reserved */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandextern int Lflag, lflag, aflag, cflag, fflag, qflag, nflag, xflag, vflag;
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik#define NXTENTRY(P, VFP) (gpkgmapvfp((P), (VFP)))
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_SPOOLED "ERROR: unable to locate spooled object <%s>"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define MSG_NET_OBJ "It is remote and may be available from the network."
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_RMHIDDEN "unable to remove hidden file"
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland#define ERR_HIDDEN "ERROR: hidden file in exclusive directory"
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dikstatic int xdir(int maptyp, VFP_T *vfp, PKGserver server, char *dirname);
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dikckentry(int envflag, int maptyp, struct cfent *ept, VFP_T *vfp,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland basepath(ept->path, maptyp ? NULL : basedir, ir);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (!RELATIVE(ept->ainfo.local)) { /* Absolute Path */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (!RELATIVE(ept->ainfo.local)) /* Absolute Path */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If the package file attributes are to be sync'd up with
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * the pkgmap, we fix the attributes here.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Clear dangerous bits. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland ept->ainfo.mode = (ept->ainfo.mode & S_IAMB);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Make sure the file is readable by the world and
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * writeable by root.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Set the safe attributes. */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Report invalid modtimes by passing cverify a -1 */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland c_err = cverify((!fflag ? (-1) : fflag), &ept->ftype, path,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* validate attributes */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (a_err = averify(fflag, &ept->ftype, ept->path,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (!nflag || ept->ftype != 'v') && /* bug # 1082144 */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* validate contents */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* Report invalid modtimes by passing cverify a -1 */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (c_err = cverify((!fflag ? (-1) : fflag),
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* must do verbose here since ept->path will change */
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dikxdir(int maptyp, VFP_T *vfp, PKGserver server, char *dirname)
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik pos = vfpGetCurrCharPtr(vfp); /* get current position in file */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland progerr(gettext("unable to open directory <%s>"), dirname);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (void) memset((char *)&mine, '\0', sizeof (struct cfent));
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik (void) snprintf(badpath, sizeof (badpath), "%s/%s",
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik if (strcmp(drp->d_name, &mine.path[len+1]) ==
62224350e5355e6834f7deb9d8a7d062a50cb7c2Casper H.S. Dik if (srchcfile(&mine, badpath, server) == 1) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland (void) snprintf(path, sizeof (path), "%s/%s", host,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if ((ept->ftype != 'i') && (ept->volno > 0)) {