diff options
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r-- | usr.sbin/makefs/Makefile | 22 | ||||
-rw-r--r-- | usr.sbin/makefs/compat/Makefile.inc | 8 | ||||
-rw-r--r-- | usr.sbin/makefs/compat/pwcache.c | 616 | ||||
-rw-r--r-- | usr.sbin/makefs/compat/pwcache.h | 73 | ||||
-rw-r--r-- | usr.sbin/makefs/compat/strsuftoll.c | 222 | ||||
-rw-r--r-- | usr.sbin/makefs/getid.c | 429 | ||||
-rw-r--r-- | usr.sbin/makefs/makefs.h | 18 | ||||
-rw-r--r-- | usr.sbin/makefs/walk.c | 29 |
8 files changed, 16 insertions, 1401 deletions
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile index 6fa0679..6253148 100644 --- a/usr.sbin/makefs/Makefile +++ b/usr.sbin/makefs/Makefile @@ -5,7 +5,6 @@ PROG= makefs CFLAGS+=-I${.CURDIR} SRCS= cd9660.c ffs.c \ - getid.c \ makefs.c \ mtree.c \ walk.c @@ -15,19 +14,28 @@ WARNS?= 2 .include "${.CURDIR}/cd9660/Makefile.inc" .include "${.CURDIR}/ffs/Makefile.inc" -.include "${.CURDIR}/compat/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -.PATH: ${.CURDIR}/../mtree -CFLAGS+=-I${.CURDIR}/../mtree -SRCS+= misc.c spec.c +.PATH: ${.CURDIR}/../../contrib/mtree +CFLAGS+=-I${.CURDIR}/../../contrib/mtree +SRCS+= getid.c misc.c spec.c + +.PATH: ${.CURDIR}/../../contrib/mknod +CFLAGS+=-I${.CURDIR}/../../contrib/mknod +SRCS+= pack_dev.c .PATH: ${.CURDIR}/../../sys/ufs/ffs SRCS+= ffs_tables.c -DPADD= ${LIBSBUF} -LDADD= -lsbuf +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a +DPADD+= ${LIBNETBSD} +LDADD+= ${LIBNETBSD} + +DPADD+= ${LIBSBUF} ${LIBUTIL} +LDADD+= -lsbuf -lutil .include <bsd.prog.mk> diff --git a/usr.sbin/makefs/compat/Makefile.inc b/usr.sbin/makefs/compat/Makefile.inc deleted file mode 100644 index 5fdffa1..0000000 --- a/usr.sbin/makefs/compat/Makefile.inc +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ -# - -.PATH: ${.CURDIR}/compat - -CFLAGS+= -I${.CURDIR}/compat - -SRCS+= pwcache.c strsuftoll.c diff --git a/usr.sbin/makefs/compat/pwcache.c b/usr.sbin/makefs/compat/pwcache.c deleted file mode 100644 index d0c45c2..0000000 --- a/usr.sbin/makefs/compat/pwcache.c +++ /dev/null @@ -1,616 +0,0 @@ -/* $NetBSD: pwcache.c,v 1.29 2004/06/20 22:20:14 jmc Exp $ */ - -/*- - * Copyright (c) 1992 Keith Muller. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Keith Muller of the University of California, San Diego. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/param.h> - -#include <assert.h> -#include <grp.h> -#include <pwd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifdef __weak_alias -__weak_alias(user_from_uid,_user_from_uid) -__weak_alias(group_from_gid,_group_from_gid) -__weak_alias(pwcache_userdb,_pwcache_userdb) -__weak_alias(pwcache_groupdb,_pwcache_groupdb) -#endif - -#include "pwcache.h" - -/* - * routines that control user, group, uid and gid caches (for the archive - * member print routine). - * IMPORTANT: - * these routines cache BOTH hits and misses, a major performance improvement - */ - -/* - * function pointers to various name lookup routines. - * these may be changed as necessary. - */ -static int (*_pwcache_setgroupent)(int) = setgroupent; -static void (*_pwcache_endgrent)(void) = endgrent; -static struct group * (*_pwcache_getgrnam)(const char *) = getgrnam; -static struct group * (*_pwcache_getgrgid)(gid_t) = getgrgid; -static int (*_pwcache_setpassent)(int) = setpassent; -static void (*_pwcache_endpwent)(void) = endpwent; -static struct passwd * (*_pwcache_getpwnam)(const char *) = getpwnam; -static struct passwd * (*_pwcache_getpwuid)(uid_t) = getpwuid; - -/* - * internal state - */ -static int pwopn; /* is password file open */ -static int gropn; /* is group file open */ -static UIDC **uidtb; /* uid to name cache */ -static GIDC **gidtb; /* gid to name cache */ -static UIDC **usrtb; /* user name to uid cache */ -static GIDC **grptb; /* group name to gid cache */ - -static int uidtb_fail; /* uidtb_start() failed ? */ -static int gidtb_fail; /* gidtb_start() failed ? */ -static int usrtb_fail; /* usrtb_start() failed ? */ -static int grptb_fail; /* grptb_start() failed ? */ - - -static u_int st_hash(const char *, size_t, int); -static int uidtb_start(void); -static int gidtb_start(void); -static int usrtb_start(void); -static int grptb_start(void); - - -static u_int -st_hash(const char *name, size_t len, int tabsz) -{ - u_int key = 0; - - while (len--) { - key += *name++; - key = (key << 8) | (key >> 24); - } - - return (key % tabsz); -} - -/* - * uidtb_start - * creates an an empty uidtb - * Return: - * 0 if ok, -1 otherwise - */ -static int -uidtb_start(void) -{ - - if (uidtb != NULL) - return (0); - if (uidtb_fail) - return (-1); - if ((uidtb = (UIDC **)calloc(UID_SZ, sizeof(UIDC *))) == NULL) { - ++uidtb_fail; - return (-1); - } - return (0); -} - -/* - * gidtb_start - * creates an an empty gidtb - * Return: - * 0 if ok, -1 otherwise - */ -static int -gidtb_start(void) -{ - - if (gidtb != NULL) - return (0); - if (gidtb_fail) - return (-1); - if ((gidtb = (GIDC **)calloc(GID_SZ, sizeof(GIDC *))) == NULL) { - ++gidtb_fail; - return (-1); - } - return (0); -} - -/* - * usrtb_start - * creates an an empty usrtb - * Return: - * 0 if ok, -1 otherwise - */ -static int -usrtb_start(void) -{ - - if (usrtb != NULL) - return (0); - if (usrtb_fail) - return (-1); - if ((usrtb = (UIDC **)calloc(UNM_SZ, sizeof(UIDC *))) == NULL) { - ++usrtb_fail; - return (-1); - } - return (0); -} - -/* - * grptb_start - * creates an an empty grptb - * Return: - * 0 if ok, -1 otherwise - */ -static int -grptb_start(void) -{ - - if (grptb != NULL) - return (0); - if (grptb_fail) - return (-1); - if ((grptb = (GIDC **)calloc(GNM_SZ, sizeof(GIDC *))) == NULL) { - ++grptb_fail; - return (-1); - } - return (0); -} - -/* - * user_from_uid() - * caches the name (if any) for the uid. If noname clear, we always - * return the stored name (if valid or invalid match). - * We use a simple hash table. - * Return - * Pointer to stored name (or a empty string) - */ -const char * -user_from_uid(uid_t uid, int noname) -{ - struct passwd *pw; - UIDC *ptr, **pptr; - - if ((uidtb == NULL) && (uidtb_start() < 0)) - return (NULL); - - /* - * see if we have this uid cached - */ - pptr = uidtb + (uid % UID_SZ); - ptr = *pptr; - - if ((ptr != NULL) && (ptr->valid > 0) && (ptr->uid == uid)) { - /* - * have an entry for this uid - */ - if (!noname || (ptr->valid == VALID)) - return (ptr->name); - return (NULL); - } - - /* - * No entry for this uid, we will add it - */ - if (!pwopn) { - if (_pwcache_setpassent != NULL) - (*_pwcache_setpassent)(1); - ++pwopn; - } - - if (ptr == NULL) - *pptr = ptr = (UIDC *)malloc(sizeof(UIDC)); - - if ((pw = (*_pwcache_getpwuid)(uid)) == NULL) { - /* - * no match for this uid in the local password file - * a string that is the uid in numeric format - */ - if (ptr == NULL) - return (NULL); - ptr->uid = uid; - (void)snprintf(ptr->name, UNMLEN, "%lu", (long) uid); - ptr->valid = INVALID; - if (noname) - return (NULL); - } else { - /* - * there is an entry for this uid in the password file - */ - if (ptr == NULL) - return (pw->pw_name); - ptr->uid = uid; - (void)strlcpy(ptr->name, pw->pw_name, UNMLEN); - ptr->valid = VALID; - } - return (ptr->name); -} - -/* - * group_from_gid() - * caches the name (if any) for the gid. If noname clear, we always - * return the stored name (if valid or invalid match). - * We use a simple hash table. - * Return - * Pointer to stored name (or a empty string) - */ -const char * -group_from_gid(gid_t gid, int noname) -{ - struct group *gr; - GIDC *ptr, **pptr; - - if ((gidtb == NULL) && (gidtb_start() < 0)) - return (NULL); - - /* - * see if we have this gid cached - */ - pptr = gidtb + (gid % GID_SZ); - ptr = *pptr; - - if ((ptr != NULL) && (ptr->valid > 0) && (ptr->gid == gid)) { - /* - * have an entry for this gid - */ - if (!noname || (ptr->valid == VALID)) - return (ptr->name); - return (NULL); - } - - /* - * No entry for this gid, we will add it - */ - if (!gropn) { - if (_pwcache_setgroupent != NULL) - (*_pwcache_setgroupent)(1); - ++gropn; - } - - if (ptr == NULL) - *pptr = ptr = (GIDC *)malloc(sizeof(GIDC)); - - if ((gr = (*_pwcache_getgrgid)(gid)) == NULL) { - /* - * no match for this gid in the local group file, put in - * a string that is the gid in numberic format - */ - if (ptr == NULL) - return (NULL); - ptr->gid = gid; - (void)snprintf(ptr->name, GNMLEN, "%lu", (long) gid); - ptr->valid = INVALID; - if (noname) - return (NULL); - } else { - /* - * there is an entry for this group in the group file - */ - if (ptr == NULL) - return (gr->gr_name); - ptr->gid = gid; - (void)strlcpy(ptr->name, gr->gr_name, GNMLEN); - ptr->valid = VALID; - } - return (ptr->name); -} - -/* - * uid_from_user() - * caches the uid for a given user name. We use a simple hash table. - * Return - * the uid (if any) for a user name, or a -1 if no match can be found - */ -int -uid_from_user(const char *name, uid_t *uid) -{ - struct passwd *pw; - UIDC *ptr, **pptr; - size_t namelen; - - /* - * return -1 for mangled names - */ - if (name == NULL || ((namelen = strlen(name)) == 0)) - return (-1); - if ((usrtb == NULL) && (usrtb_start() < 0)) - return (-1); - - /* - * look up in hash table, if found and valid return the uid, - * if found and invalid, return a -1 - */ - pptr = usrtb + st_hash(name, namelen, UNM_SZ); - ptr = *pptr; - - if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { - if (ptr->valid == INVALID) - return (-1); - *uid = ptr->uid; - return (0); - } - - if (!pwopn) { - if (_pwcache_setpassent != NULL) - (*_pwcache_setpassent)(1); - ++pwopn; - } - - if (ptr == NULL) - *pptr = ptr = (UIDC *)malloc(sizeof(UIDC)); - - /* - * no match, look it up, if no match store it as an invalid entry, - * or store the matching uid - */ - if (ptr == NULL) { - if ((pw = (*_pwcache_getpwnam)(name)) == NULL) - return (-1); - *uid = pw->pw_uid; - return (0); - } - (void)strlcpy(ptr->name, name, UNMLEN); - if ((pw = (*_pwcache_getpwnam)(name)) == NULL) { - ptr->valid = INVALID; - return (-1); - } - ptr->valid = VALID; - *uid = ptr->uid = pw->pw_uid; - return (0); -} - -/* - * gid_from_group() - * caches the gid for a given group name. We use a simple hash table. - * Return - * the gid (if any) for a group name, or a -1 if no match can be found - */ -int -gid_from_group(const char *name, gid_t *gid) -{ - struct group *gr; - GIDC *ptr, **pptr; - size_t namelen; - - /* - * return -1 for mangled names - */ - if (name == NULL || ((namelen = strlen(name)) == 0)) - return (-1); - if ((grptb == NULL) && (grptb_start() < 0)) - return (-1); - - /* - * look up in hash table, if found and valid return the uid, - * if found and invalid, return a -1 - */ - pptr = grptb + st_hash(name, namelen, GID_SZ); - ptr = *pptr; - - if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) { - if (ptr->valid == INVALID) - return (-1); - *gid = ptr->gid; - return (0); - } - - if (!gropn) { - if (_pwcache_setgroupent != NULL) - (*_pwcache_setgroupent)(1); - ++gropn; - } - - if (ptr == NULL) - *pptr = ptr = (GIDC *)malloc(sizeof(GIDC)); - - /* - * no match, look it up, if no match store it as an invalid entry, - * or store the matching gid - */ - if (ptr == NULL) { - if ((gr = (*_pwcache_getgrnam)(name)) == NULL) - return (-1); - *gid = gr->gr_gid; - return (0); - } - - (void)strlcpy(ptr->name, name, GNMLEN); - if ((gr = (*_pwcache_getgrnam)(name)) == NULL) { - ptr->valid = INVALID; - return (-1); - } - ptr->valid = VALID; - *gid = ptr->gid = gr->gr_gid; - return (0); -} - -#define FLUSHTB(arr, len, fail) \ - do { \ - if (arr != NULL) { \ - for (i = 0; i < len; i++) \ - if (arr[i] != NULL) \ - free(arr[i]); \ - arr = NULL; \ - } \ - fail = 0; \ - } while (/* CONSTCOND */0); - -int -pwcache_userdb( - int (*a_setpassent)(int), - void (*a_endpwent)(void), - struct passwd * (*a_getpwnam)(const char *), - struct passwd * (*a_getpwuid)(uid_t)) -{ - int i; - - /* a_setpassent and a_endpwent may be NULL */ - if (a_getpwnam == NULL || a_getpwuid == NULL) - return (-1); - - if (_pwcache_endpwent != NULL) - (*_pwcache_endpwent)(); - FLUSHTB(uidtb, UID_SZ, uidtb_fail); - FLUSHTB(usrtb, UNM_SZ, usrtb_fail); - pwopn = 0; - _pwcache_setpassent = a_setpassent; - _pwcache_endpwent = a_endpwent; - _pwcache_getpwnam = a_getpwnam; - _pwcache_getpwuid = a_getpwuid; - - return (0); -} - -int -pwcache_groupdb( - int (*a_setgroupent)(int), - void (*a_endgrent)(void), - struct group * (*a_getgrnam)(const char *), - struct group * (*a_getgrgid)(gid_t)) -{ - int i; - - /* a_setgroupent and a_endgrent may be NULL */ - if (a_getgrnam == NULL || a_getgrgid == NULL) - return (-1); - - if (_pwcache_endgrent != NULL) - (*_pwcache_endgrent)(); - FLUSHTB(gidtb, GID_SZ, gidtb_fail); - FLUSHTB(grptb, GNM_SZ, grptb_fail); - gropn = 0; - _pwcache_setgroupent = a_setgroupent; - _pwcache_endgrent = a_endgrent; - _pwcache_getgrnam = a_getgrnam; - _pwcache_getgrgid = a_getgrgid; - - return (0); -} - - -#ifdef TEST_PWCACHE - -struct passwd * -test_getpwnam(const char *name) -{ - static struct passwd foo; - - memset(&foo, 0, sizeof(foo)); - if (strcmp(name, "toor") == 0) { - foo.pw_uid = 666; - return &foo; - } - return (getpwnam(name)); -} - -int -main(int argc, char *argv[]) -{ - uid_t u; - int r, i; - - printf("pass 1 (default userdb)\n"); - for (i = 1; i < argc; i++) { - printf("i: %d, pwopn %d usrtb_fail %d usrtb %p\n", - i, pwopn, usrtb_fail, usrtb); - r = uid_from_user(argv[i], &u); - if (r == -1) - printf(" uid_from_user %s: failed\n", argv[i]); - else - printf(" uid_from_user %s: %d\n", argv[i], u); - } - printf("pass 1 finish: pwopn %d usrtb_fail %d usrtb %p\n", - pwopn, usrtb_fail, usrtb); - - puts(""); - printf("pass 2 (replacement userdb)\n"); - printf("pwcache_userdb returned %d\n", - pwcache_userdb(setpassent, test_getpwnam, getpwuid)); - printf("pwopn %d usrtb_fail %d usrtb %p\n", pwopn, usrtb_fail, usrtb); - - for (i = 1; i < argc; i++) { - printf("i: %d, pwopn %d usrtb_fail %d usrtb %p\n", - i, pwopn, usrtb_fail, usrtb); - u = -1; - r = uid_from_user(argv[i], &u); - if (r == -1) - printf(" uid_from_user %s: failed\n", argv[i]); - else - printf(" uid_from_user %s: %d\n", argv[i], u); - } - printf("pass 2 finish: pwopn %d usrtb_fail %d usrtb %p\n", - pwopn, usrtb_fail, usrtb); - - puts(""); - printf("pass 3 (null pointers)\n"); - printf("pwcache_userdb returned %d\n", - pwcache_userdb(NULL, NULL, NULL)); - - return (0); -} -#endif /* TEST_PWCACHE */ diff --git a/usr.sbin/makefs/compat/pwcache.h b/usr.sbin/makefs/compat/pwcache.h deleted file mode 100644 index 1708951..0000000 --- a/usr.sbin/makefs/compat/pwcache.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: pwcache.h,v 1.5 2003/11/10 08:51:51 wiz Exp $ */ - -/*- - * Copyright (c) 1992 Keith Muller. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Keith Muller of the University of California, San Diego. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cache.h 8.1 (Berkeley) 5/31/93 - * $FreeBSD$ - */ - -/* - * Constants and data structures used to implement group and password file - * caches. Traditional passwd/group cache routines perform quite poorly with - * archives. The chances of hitting a valid lookup with an archive is quite a - * bit worse than with files already resident on the file system. These misses - * create a MAJOR performance cost. To address this problem, these routines - * cache both hits and misses. - * - * NOTE: name lengths must be as large as those stored in ANY PROTOCOL and - * as stored in the passwd and group files. CACHE SIZES MUST BE PRIME - */ -#define UNMLEN 32 /* >= user name found in any protocol */ -#define GNMLEN 32 /* >= group name found in any protocol */ -#define UID_SZ 317 /* size of uid to user_name cache */ -#define UNM_SZ 317 /* size of user_name to uid cache */ -#define GID_SZ 251 /* size of gid to group_name cache */ -#define GNM_SZ 251 /* size of group_name to gid cache */ -#define VALID 1 /* entry and name are valid */ -#define INVALID 2 /* entry valid, name NOT valid */ - -/* - * Node structures used in the user, group, uid, and gid caches. - */ - -typedef struct uidc { - int valid; /* is this a valid or a miss entry */ - char name[UNMLEN]; /* uid name */ - uid_t uid; /* cached uid */ -} UIDC; - -typedef struct gidc { - int valid; /* is this a valid or a miss entry */ - char name[GNMLEN]; /* gid name */ - gid_t gid; /* cached gid */ -} GIDC; diff --git a/usr.sbin/makefs/compat/strsuftoll.c b/usr.sbin/makefs/compat/strsuftoll.c deleted file mode 100644 index 657e525..0000000 --- a/usr.sbin/makefs/compat/strsuftoll.c +++ /dev/null @@ -1,222 +0,0 @@ -/* $NetBSD: strsuftoll.c,v 1.6 2004/03/05 05:58:29 lukem Exp $ */ -/*- - * Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Luke Mewburn. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/*- - * Copyright (c) 1991, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Keith Muller of the University of California, San Diego and Lance - * Visser of Convex Computer Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/time.h> - -#include <assert.h> -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef _LIBC -# ifdef __weak_alias -__weak_alias(strsuftoll, _strsuftoll) -__weak_alias(strsuftollx, _strsuftollx) -# endif -#endif /* LIBC */ - -/* - * Convert an expression of the following forms to a (u)int64_t. - * 1) A positive decimal number. - * 2) A positive decimal number followed by a b (mult by 512). - * 3) A positive decimal number followed by a k (mult by 1024). - * 4) A positive decimal number followed by a m (mult by 1048576). - * 5) A positive decimal number followed by a g (mult by 1073741824). - * 6) A positive decimal number followed by a t (mult by 1099511627776). - * 7) A positive decimal number followed by a w (mult by sizeof int) - * 8) Two or more positive decimal numbers (with/without k,b or w). - * separated by x (also * for backwards compatibility), specifying - * the product of the indicated values. - * Returns the result upon successful conversion, or exits with an - * appropriate error. - * - */ - -/* - * As strsuftoll(), but returns the error message into the provided buffer - * rather than exiting with it. - */ -/* LONGLONG */ -long long -strsuftollx(const char *desc, const char *val, - long long min, long long max, char *ebuf, size_t ebuflen) -{ - long long num, t; - char *expr; - - errno = 0; - ebuf[0] = '\0'; - - while (isspace((unsigned char)*val)) /* Skip leading space */ - val++; - - num = strtoll(val, &expr, 10); - if (errno == ERANGE) - goto erange; /* Overflow */ - - if (expr == val) /* No digits */ - goto badnum; - - switch (*expr) { - case 'b': - t = num; - num *= 512; /* 1 block */ - if (t > num) - goto erange; - ++expr; - break; - case 'k': - t = num; - num *= 1024; /* 1 kilobyte */ - if (t > num) - goto erange; - ++expr; - break; - case 'm': - t = num; - num *= 1048576; /* 1 megabyte */ - if (t > num) - goto erange; - ++expr; - break; - case 'g': - t = num; - num *= 1073741824; /* 1 gigabyte */ - if (t > num) - goto erange; - ++expr; - break; - case 't': - t = num; - num *= 1099511627776LL; /* 1 terabyte */ - if (t > num) - goto erange; - ++expr; - break; - case 'w': - t = num; - num *= sizeof(int); /* 1 word */ - if (t > num) - goto erange; - ++expr; - break; - } - - switch (*expr) { - case '\0': - break; - case '*': /* Backward compatible */ - case 'x': - t = num; - num *= strsuftollx(desc, expr + 1, min, max, ebuf, ebuflen); - if (*ebuf != '\0') - return (0); - if (t > num) { - erange: - snprintf(ebuf, ebuflen, - "%s: %s", desc, strerror(ERANGE)); - return (0); - } - break; - default: - badnum: snprintf(ebuf, ebuflen, - "%s `%s': illegal number", desc, val); - return (0); - } - if (num < min) { - /* LONGLONG */ - snprintf(ebuf, ebuflen, "%s %lld is less than %lld.", - desc, (long long)num, (long long)min); - return (0); - } - if (num > max) { - /* LONGLONG */ - snprintf(ebuf, ebuflen, - "%s %lld is greater than %lld.", - desc, (long long)num, (long long)max); - return (0); - } - *ebuf = '\0'; - return (num); -} - -/* LONGLONG */ -long long -strsuftoll(const char *desc, const char *val, - long long min, long long max) -{ - long long result; - char errbuf[100]; - - result = strsuftollx(desc, val, min, max, errbuf, sizeof(errbuf)); - if (*errbuf != '\0') - errx(1, "%s", errbuf); - return (result); -} diff --git a/usr.sbin/makefs/getid.c b/usr.sbin/makefs/getid.c deleted file mode 100644 index 939d943..0000000 --- a/usr.sbin/makefs/getid.c +++ /dev/null @@ -1,429 +0,0 @@ -/* $NetBSD: getid.c,v 1.5 2004/06/20 22:20:18 jmc Exp $ */ -/* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */ -/* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */ - -/* - * Copyright (c) 1987, 1988, 1989, 1993, 1994, 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Luke Mewburn of Wasabi Systems. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> - -#include <grp.h> -#include <limits.h> -#include <pwd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <time.h> -#include <unistd.h> - -#include "makefs.h" - -#include "mtree.h" -#include "extern.h" - -static struct group * gi_getgrnam(const char *); -static struct group * gi_getgrgid(gid_t); -static int gi_setgroupent(int); -static void gi_endgrent(void); -static int grstart(void); -static int grscan(int, gid_t, const char *); -static int grmatchline(int, gid_t, const char *); - -static struct passwd * gi_getpwnam(const char *); -static struct passwd * gi_getpwuid(uid_t); -static int gi_setpassent(int); -static void gi_endpwent(void); -static int pwstart(void); -static int pwscan(int, uid_t, const char *); -static int pwmatchline(int, uid_t, const char *); - -#define MAXGRP 200 -#define MAXLINELENGTH 1024 - -static FILE *_gr_fp; -static struct group _gr_group; -static int _gr_stayopen; -static int _gr_filesdone; -static FILE *_pw_fp; -static struct passwd _pw_passwd; /* password structure */ -static int _pw_stayopen; /* keep fd's open */ -static int _pw_filesdone; - -static char grfile[MAXPATHLEN]; -static char pwfile[MAXPATHLEN]; - -static char *members[MAXGRP]; -static char grline[MAXLINELENGTH]; -static char pwline[MAXLINELENGTH]; - -int -setup_getid(const char *dir) -{ - if (dir == NULL) - return (0); - - /* close existing databases */ - gi_endgrent(); - gi_endpwent(); - - /* build paths to new databases */ - snprintf(grfile, sizeof(grfile), "%s/group", dir); - snprintf(pwfile, sizeof(pwfile), "%s/master.passwd", dir); - - /* try to open new databases */ - if (!grstart() || !pwstart()) - return (0); - - /* switch pwcache(3) lookup functions */ - if (pwcache_groupdb(gi_setgroupent, gi_endgrent, - gi_getgrnam, gi_getgrgid) == -1 - || pwcache_userdb(gi_setpassent, gi_endpwent, - gi_getpwnam, gi_getpwuid) == -1) - return (0); - - return (1); -} - - -/* - * group lookup functions - */ - -static struct group * -gi_getgrnam(const char *name) -{ - int rval; - - if (!grstart()) - return NULL; - rval = grscan(1, 0, name); - if (!_gr_stayopen) - endgrent(); - return (rval) ? &_gr_group : NULL; -} - -static struct group * -gi_getgrgid(gid_t gid) -{ - int rval; - - if (!grstart()) - return NULL; - rval = grscan(1, gid, NULL); - if (!_gr_stayopen) - endgrent(); - return (rval) ? &_gr_group : NULL; -} - -static int -gi_setgroupent(int stayopen) -{ - - if (!grstart()) - return 0; - _gr_stayopen = stayopen; - return 1; -} - -static void -gi_endgrent(void) -{ - - _gr_filesdone = 0; - if (_gr_fp) { - (void)fclose(_gr_fp); - _gr_fp = NULL; - } -} - -static int -grstart(void) -{ - - _gr_filesdone = 0; - if (_gr_fp) { - rewind(_gr_fp); - return 1; - } - if (grfile[0] == '\0') /* sanity check */ - return 0; - return (_gr_fp = fopen(grfile, "r")) ? 1 : 0; -} - - -static int -grscan(int search, gid_t gid, const char *name) -{ - - if (_gr_filesdone) - return 0; - for (;;) { - if (!fgets(grline, sizeof(grline), _gr_fp)) { - if (!search) - _gr_filesdone = 1; - return 0; - } - /* skip lines that are too big */ - if (!strchr(grline, '\n')) { - int ch; - - while ((ch = getc(_gr_fp)) != '\n' && ch != EOF) - ; - continue; - } - if (grmatchline(search, gid, name)) - return 1; - } - /* NOTREACHED */ -} - -static int -grmatchline(int search, gid_t gid, const char *name) -{ - unsigned long id; - char **m; - char *cp, *bp, *ep; - - /* name may be NULL if search is nonzero */ - - bp = grline; - memset(&_gr_group, 0, sizeof(_gr_group)); - _gr_group.gr_name = strsep(&bp, ":\n"); - if (search && name && strcmp(_gr_group.gr_name, name)) - return 0; - _gr_group.gr_passwd = strsep(&bp, ":\n"); - if (!(cp = strsep(&bp, ":\n"))) - return 0; - id = strtoul(cp, &ep, 10); - if (id > GID_MAX || *ep != '\0') - return 0; - _gr_group.gr_gid = (gid_t)id; - if (search && name == NULL && _gr_group.gr_gid != gid) - return 0; - cp = NULL; - if (bp == NULL) - return 0; - for (_gr_group.gr_mem = m = members;; bp++) { - if (m == &members[MAXGRP - 1]) - break; - if (*bp == ',') { - if (cp) { - *bp = '\0'; - *m++ = cp; - cp = NULL; - } - } else if (*bp == '\0' || *bp == '\n' || *bp == ' ') { - if (cp) { - *bp = '\0'; - *m++ = cp; - } - break; - } else if (cp == NULL) - cp = bp; - } - *m = NULL; - return 1; -} - - -/* - * user lookup functions - */ - -static struct passwd * -gi_getpwnam(const char *name) -{ - int rval; - - if (!pwstart()) - return NULL; - rval = pwscan(1, 0, name); - if (!_pw_stayopen) - endpwent(); - return (rval) ? &_pw_passwd : NULL; -} - -static struct passwd * -gi_getpwuid(uid_t uid) -{ - int rval; - - if (!pwstart()) - return NULL; - rval = pwscan(1, uid, NULL); - if (!_pw_stayopen) - endpwent(); - return (rval) ? &_pw_passwd : NULL; -} - -static int -gi_setpassent(int stayopen) -{ - - if (!pwstart()) - return 0; - _pw_stayopen = stayopen; - return 1; -} - -static void -gi_endpwent(void) -{ - - _pw_filesdone = 0; - if (_pw_fp) { - (void)fclose(_pw_fp); - _pw_fp = NULL; - } -} - -static int -pwstart(void) -{ - - _pw_filesdone = 0; - if (_pw_fp) { - rewind(_pw_fp); - return 1; - } - if (pwfile[0] == '\0') /* sanity check */ - return 0; - return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0; -} - - -static int -pwscan(int search, uid_t uid, const char *name) -{ - - if (_pw_filesdone) - return 0; - for (;;) { - if (!fgets(pwline, sizeof(pwline), _pw_fp)) { - if (!search) - _pw_filesdone = 1; - return 0; - } - /* skip lines that are too big */ - if (!strchr(pwline, '\n')) { - int ch; - - while ((ch = getc(_pw_fp)) != '\n' && ch != EOF) - ; - continue; - } - if (pwmatchline(search, uid, name)) - return 1; - } - /* NOTREACHED */ -} - -static int -pwmatchline(int search, uid_t uid, const char *name) -{ - unsigned long id; - char *cp, *bp, *ep; - - /* name may be NULL if search is nonzero */ - - bp = pwline; - memset(&_pw_passwd, 0, sizeof(_pw_passwd)); - _pw_passwd.pw_name = strsep(&bp, ":\n"); /* name */ - if (search && name && strcmp(_pw_passwd.pw_name, name)) - return 0; - - _pw_passwd.pw_passwd = strsep(&bp, ":\n"); /* passwd */ - - if (!(cp = strsep(&bp, ":\n"))) /* uid */ - return 0; - id = strtoul(cp, &ep, 10); - if (id > UID_MAX || *ep != '\0') - return 0; - _pw_passwd.pw_uid = (uid_t)id; - if (search && name == NULL && _pw_passwd.pw_uid != uid) - return 0; - - if (!(cp = strsep(&bp, ":\n"))) /* gid */ - return 0; - id = strtoul(cp, &ep, 10); - if (id > GID_MAX || *ep != '\0') - return 0; - _pw_passwd.pw_gid = (gid_t)id; - - if (!(ep = strsep(&bp, ":"))) /* class */ - return 0; - if (!(ep = strsep(&bp, ":"))) /* change */ - return 0; - if (!(ep = strsep(&bp, ":"))) /* expire */ - return 0; - - if (!(_pw_passwd.pw_gecos = strsep(&bp, ":\n"))) /* gecos */ - return 0; - if (!(_pw_passwd.pw_dir = strsep(&bp, ":\n"))) /* directory */ - return 0; - if (!(_pw_passwd.pw_shell = strsep(&bp, ":\n"))) /* shell */ - return 0; - - if (strchr(bp, ':') != NULL) - return 0; - - return 1; -} diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h index c6707d9..5ab0444 100644 --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -282,22 +282,4 @@ void ffs_fragacct_swap(struct fs *, int, int32_t [], int, int); fsinode *link_check(fsinode *); -/* - * Declarations for compat routines. - */ -long long strsuftoll(const char *, const char *, long long, long long); -long long strsuftollx(const char *, const char *, - long long, long long, char *, size_t); - -struct passwd; -int uid_from_user(const char *, uid_t *); -int pwcache_userdb(int (*)(int), void (*)(void), - struct passwd * (*)(const char *), struct passwd * (*)(uid_t)); -struct group; -int gid_from_group(const char *, gid_t *); -int pwcache_groupdb(int (*)(int), void (*)(void), - struct group * (*)(const char *), struct group * (*)(gid_t)); - -int setup_getid(const char *dir); - #endif /* _MAKEFS_H */ diff --git a/usr.sbin/makefs/walk.c b/usr.sbin/makefs/walk.c index 7af92bb..2fc964a 100644 --- a/usr.sbin/makefs/walk.c +++ b/usr.sbin/makefs/walk.c @@ -304,7 +304,7 @@ apply_specfile(const char *specfile, const char *dir, fsnode *parent, int specon if ((fp = fopen(specfile, "r")) == NULL) err(1, "Can't open `%s'", specfile); TIMER_START(start); - root = mtree_readspec(fp); + root = spec(fp); TIMER_RESULTS(start, "spec"); if (fclose(fp) == EOF) err(1, "Can't close `%s'", specfile); @@ -320,33 +320,6 @@ apply_specfile(const char *specfile, const char *dir, fsnode *parent, int specon } -static u_int -nodetoino(u_int type) -{ - - switch (type) { - case F_BLOCK: - return S_IFBLK; - case F_CHAR: - return S_IFCHR; - case F_DIR: - return S_IFDIR; - case F_FIFO: - return S_IFIFO; - case F_FILE: - return S_IFREG; - case F_LINK: - return S_IFLNK; - case F_SOCK: - return S_IFSOCK; - default: - printf("unknown type %d", type); - abort(); - } - /* NOTREACHED */ -} - - static void apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly) { |