summaryrefslogtreecommitdiff
path: root/pkgtools/mtree
diff options
context:
space:
mode:
authorjschauma <jschauma@pkgsrc.org>2008-11-06 02:14:52 +0000
committerjschauma <jschauma@pkgsrc.org>2008-11-06 02:14:52 +0000
commit9cad8681aca3550ba9b8d3e13c6b78292067b3f4 (patch)
tree991f512037f6231ea881e3f46d125845268fe993 /pkgtools/mtree
parent147e5aad178803894a004e9d74c95ca824a497c6 (diff)
downloadpkgsrc-9cad8681aca3550ba9b8d3e13c6b78292067b3f4.tar.gz
update mtree to 20081105, most notably providing support for sha256,
sha384 and sha512; while here, fix a minor build error discovered on RHEL
Diffstat (limited to 'pkgtools/mtree')
-rw-r--r--pkgtools/mtree/Makefile.common6
-rw-r--r--pkgtools/mtree/files/compare.c70
-rw-r--r--pkgtools/mtree/files/config.h.in3
-rwxr-xr-xpkgtools/mtree/files/configure2
-rw-r--r--pkgtools/mtree/files/crc.c22
-rw-r--r--pkgtools/mtree/files/create.c47
-rw-r--r--pkgtools/mtree/files/extern.h6
-rw-r--r--pkgtools/mtree/files/getid.c9
-rw-r--r--pkgtools/mtree/files/misc.c31
-rw-r--r--pkgtools/mtree/files/mtree.839
-rw-r--r--pkgtools/mtree/files/mtree.cat8119
-rw-r--r--pkgtools/mtree/files/mtree.h12
-rw-r--r--pkgtools/mtree/files/pack_dev.c18
-rw-r--r--pkgtools/mtree/files/pack_dev.h9
-rw-r--r--pkgtools/mtree/files/spec.c86
-rw-r--r--pkgtools/mtree/files/stat_flags.c10
-rw-r--r--pkgtools/mtree/files/verify.c16
17 files changed, 357 insertions, 148 deletions
diff --git a/pkgtools/mtree/Makefile.common b/pkgtools/mtree/Makefile.common
index 7b045277d6b..aa063e573e2 100644
--- a/pkgtools/mtree/Makefile.common
+++ b/pkgtools/mtree/Makefile.common
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.5 2008/10/02 17:15:22 joerg Exp $
+# $NetBSD: Makefile.common,v 1.6 2008/11/06 02:14:52 jschauma Exp $
#
# This Makefile fragment is included by:
#
@@ -6,7 +6,7 @@
# pkgsrc/sysutils/mtree/Makefile
#
-DISTNAME= mtree-20070710
+DISTNAME= mtree-20081105
MASTER_SITES= # empty
DISTFILES= # empty
@@ -16,7 +16,7 @@ COMMENT= Utility for mapping and checking directory hierarchies
GNU_CONFIGURE= yes
-USE_FEATURES= nbcompat
+USE_FEATURES= nbcompat
FILESDIR= ${.CURDIR}/../../pkgtools/mtree/files
PKGDIR= ${.CURDIR}/../../pkgtools/mtree
diff --git a/pkgtools/mtree/files/compare.c b/pkgtools/mtree/files/compare.c
index 94ba6bb7586..9e187cf7635 100644
--- a/pkgtools/mtree/files/compare.c
+++ b/pkgtools/mtree/files/compare.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compare.c,v 1.4 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: compare.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: compare.c,v 1.4 2004/08/21 04:10:45 jlam Exp $");
+__RCSID("$NetBSD: compare.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -86,6 +86,11 @@ __RCSID("$NetBSD: compare.c,v 1.4 2004/08/21 04:10:45 jlam Exp $");
#include <sha1.h>
#endif
#endif
+#ifndef NO_SHA2
+#if HAVE_SHA2_H
+#include <sha2.h>
+#endif
+#endif
#include "extern.h"
@@ -103,7 +108,7 @@ do { \
} while (0)
#define LABEL if (!label++) MARK
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
#define CHANGEFLAGS \
@@ -141,7 +146,7 @@ do { \
flags = (~(s->st_flags & (mask)) & CH_MASK) & (pflags); \
CHANGEFLAGS; \
} while (0)
-#endif /* HAVE_FILE_FLAGS */
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
int
compare(NODE *s, FTSENT *p)
@@ -149,8 +154,8 @@ compare(NODE *s, FTSENT *p)
u_int32_t len, val, flags;
int fd, label;
const char *cp, *tab;
-#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1)
- char digestbuf[41]; /* large enough for {MD5,RMD160,SHA1}File() */
+#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
+ char digestbuf[MAXHASHLEN + 1];
#endif
tab = NULL;
@@ -193,7 +198,7 @@ typeerr: LABEL;
}
if (mtree_Wflag)
goto afterpermwhack;
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (iflag && !uflag) {
if (s->flags & F_FLAGS)
SETFLAGS(p->fts_statp->st_flags, SP_FLGS);
@@ -349,7 +354,7 @@ typeerr: LABEL;
tab = "\t";
}
}
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
/*
* XXX
* since lchflags(2) will reset file times, the utimes() above
@@ -376,7 +381,7 @@ typeerr: LABEL;
printf(")\n");
tab = "\t";
}
-#endif /* HAVE_FILE_FLAGS */
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
/*
* from this point, no more permission checking or whacking
@@ -456,6 +461,53 @@ typeerr: LABEL;
}
}
#endif /* ! NO_SHA1 */
+#ifndef NO_SHA2
+ if (s->flags & F_SHA256) {
+ if (SHA256_File(p->fts_accpath, digestbuf) == NULL) {
+ LABEL;
+ printf("%ssha256: %s: %s\n",
+ tab, p->fts_accpath, strerror(errno));
+ tab = "\t";
+ } else {
+ if (strcmp(s->sha256digest, digestbuf)) {
+ LABEL;
+ printf("%ssha256 (0x%s, 0x%s)\n",
+ tab, s->sha256digest, digestbuf);
+ }
+ tab = "\t";
+ }
+ }
+ if (s->flags & F_SHA384) {
+ if (SHA384_File(p->fts_accpath, digestbuf) == NULL) {
+ LABEL;
+ printf("%ssha384: %s: %s\n",
+ tab, p->fts_accpath, strerror(errno));
+ tab = "\t";
+ } else {
+ if (strcmp(s->sha384digest, digestbuf)) {
+ LABEL;
+ printf("%ssha384 (0x%s, 0x%s)\n",
+ tab, s->sha384digest, digestbuf);
+ }
+ tab = "\t";
+ }
+ }
+ if (s->flags & F_SHA512) {
+ if (SHA512_File(p->fts_accpath, digestbuf) == NULL) {
+ LABEL;
+ printf("%ssha512: %s: %s\n",
+ tab, p->fts_accpath, strerror(errno));
+ tab = "\t";
+ } else {
+ if (strcmp(s->sha512digest, digestbuf)) {
+ LABEL;
+ printf("%ssha512 (0x%s, 0x%s)\n",
+ tab, s->sha512digest, digestbuf);
+ }
+ tab = "\t";
+ }
+ }
+#endif /* ! NO_SHA2 */
if (s->flags & F_SLINK &&
strcmp(cp = rlink(p->fts_accpath), s->slink)) {
LABEL;
diff --git a/pkgtools/mtree/files/config.h.in b/pkgtools/mtree/files/config.h.in
index a594ed6087b..648a196797f 100644
--- a/pkgtools/mtree/files/config.h.in
+++ b/pkgtools/mtree/files/config.h.in
@@ -81,6 +81,9 @@
/* Define to 1 if <wchar.h> declares mbstate_t. */
#undef HAVE_MBSTATE_T
+/* Define to 1 if you have the <md5global.h> header file. */
+#undef HAVE_MD5GLOBAL_H
+
/* Define to 1 if you have the <md5.h> header file. */
#undef HAVE_MD5_H
diff --git a/pkgtools/mtree/files/configure b/pkgtools/mtree/files/configure
index 7bf7add7bde..ab835c7f6e1 100755
--- a/pkgtools/mtree/files/configure
+++ b/pkgtools/mtree/files/configure
@@ -2929,7 +2929,7 @@ done
for ac_header in ctype.h dirent.h err.h errno.h fcntl.h fnmatch.h fts.h \
- grp.h limits.h md5.h netdb.h pwd.h rmd160.h sha1.h \
+ grp.h limits.h md5.h md5global.h netdb.h pwd.h rmd160.h sha1.h \
stdarg.h stddef.h stdio.h stdlib.h string.h time.h unistd.h \
util.h vis.h
do
diff --git a/pkgtools/mtree/files/crc.c b/pkgtools/mtree/files/crc.c
index 3d4008ea6dd..bde45ab5161 100644
--- a/pkgtools/mtree/files/crc.c
+++ b/pkgtools/mtree/files/crc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crc.c,v 1.3 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: crc.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
#else
-__RCSID("$NetBSD: crc.c,v 1.3 2004/08/21 04:10:45 jlam Exp $");
+__RCSID("$NetBSD: crc.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -132,19 +132,17 @@ extern int sflag;
u_int32_t crc_total = ~0; /* The crc over a number of files. */
int
-crc(fd, cval, clen)
- register int fd;
- u_int32_t *cval, *clen;
+crc(int fd, u_int32_t *cval, u_int32_t *clen)
{
- register u_char *p;
- register int nr;
- register u_int32_t thecrc, len;
- register u_int32_t crctot;
+ u_char *p;
+ int nr;
+ u_int32_t thecrc, len;
+ u_int32_t crctot;
u_char buf[16 * 1024];
#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
- thecrc = len = 0;
+ thecrc = len = crctot = 0;
if (sflag)
crctot = ~crc_total;
while ((nr = read(fd, buf, sizeof(buf))) > 0)
@@ -158,7 +156,7 @@ crc(fd, cval, clen)
COMPUTE(thecrc, *p);
}
if (nr < 0)
- return (1);
+ return 1;
*clen = len;
@@ -176,5 +174,5 @@ crc(fd, cval, clen)
*cval = ~thecrc;
if (sflag)
crc_total = ~crctot;
- return (0);
+ return 0;
}
diff --git a/pkgtools/mtree/files/create.c b/pkgtools/mtree/files/create.c
index a0e1fba7f2e..668f2306c32 100644
--- a/pkgtools/mtree/files/create.c
+++ b/pkgtools/mtree/files/create.c
@@ -1,4 +1,4 @@
-/* $NetBSD: create.c,v 1.5 2007/11/19 08:41:25 rillig Exp $ */
+/* $NetBSD: create.c,v 1.6 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -36,9 +36,7 @@
#include "nbtool_config.h"
#endif
-#if HAVE_NBCOMPAT_H
#include <nbcompat.h>
-#endif
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
@@ -46,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: create.c,v 1.5 2007/11/19 08:41:25 rillig Exp $");
+__RCSID("$NetBSD: create.c,v 1.6 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -109,6 +107,11 @@ __RCSID("$NetBSD: create.c,v 1.5 2007/11/19 08:41:25 rillig Exp $");
#include <sha1.h>
#endif
#endif
+#ifndef NO_SHA2
+#if HAVE_SHA2_H
+#include <sha2.h>
+#endif
+#endif
#include "extern.h"
@@ -185,14 +188,13 @@ statf(FTSENT *p)
{
u_int32_t len, val;
int fd, indent;
- const char *name, *path;
-#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1)
- char digestbuf[41]; /* large enough for {MD5,RMD160,SHA1}File() */
+ const char *name;
+#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
+ char digestbuf[MAXHASHLEN + 1];
#endif
- path = vispath(p->fts_name);
indent = printf("%s%s",
- S_ISDIR(p->fts_statp->st_mode) ? "" : " ", path);
+ S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name));
if (indent > INDENTNAMELEN)
indent = MAXLINELEN;
@@ -224,8 +226,8 @@ statf(FTSENT *p)
output(&indent, "nlink=%u", p->fts_statp->st_nlink);
if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
output(&indent, "size=%lld", (long long)p->fts_statp->st_size);
- if (keys & F_TIME)
#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
+ if (keys & F_TIME)
output(&indent, "time=%ld.%ld",
(long)p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
@@ -261,10 +263,27 @@ statf(FTSENT *p)
output(&indent, "sha1=%s", digestbuf);
}
#endif /* ! NO_SHA1 */
+#ifndef NO_SHA2
+ if (keys & F_SHA256 && S_ISREG(p->fts_statp->st_mode)) {
+ if (SHA256_File(p->fts_accpath, digestbuf) == NULL)
+ mtree_err("%s: %s", p->fts_accpath, "SHA256_File");
+ output(&indent, "sha256=%s", digestbuf);
+ }
+ if (keys & F_SHA384 && S_ISREG(p->fts_statp->st_mode)) {
+ if (SHA384_File(p->fts_accpath, digestbuf) == NULL)
+ mtree_err("%s: %s", p->fts_accpath, "SHA384_File");
+ output(&indent, "sha384=%s", digestbuf);
+ }
+ if (keys & F_SHA512 && S_ISREG(p->fts_statp->st_mode)) {
+ if (SHA512_File(p->fts_accpath, digestbuf) == NULL)
+ mtree_err("%s: %s", p->fts_accpath, "SHA512_File");
+ output(&indent, "sha512=%s", digestbuf);
+ }
+#endif /* ! NO_SHA2 */
if (keys & F_SLINK &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
- output(&indent, "link=%s", rlink(p->fts_accpath));
-#if HAVE_FILE_FLAGS
+ output(&indent, "link=%s", vispath(rlink(p->fts_accpath)));
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (keys & F_FLAGS && p->fts_statp->st_flags != flags)
output(&indent, "flags=%s",
flags_to_string(p->fts_statp->st_flags, "none"));
@@ -281,7 +300,7 @@ statf(FTSENT *p)
#define MTREE_MAXGID 5000
#define MTREE_MAXUID 5000
#define MTREE_MAXMODE (MBITS + 1)
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
#define MTREE_MAXFLAGS (FLAGS2INDEX(CH_MASK) + 1) /* 1808 */
#else
#define MTREE_MAXFLAGS 1
@@ -340,7 +359,7 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode,
maxuid = u[suid];
}
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
sflags = FLAGS2INDEX(p->fts_statp->st_flags);
if (sflags < MTREE_MAXFLAGS && ++f[sflags] > maxflags) {
saveflags = p->fts_statp->st_flags;
diff --git a/pkgtools/mtree/files/extern.h b/pkgtools/mtree/files/extern.h
index df10fde4164..0d2aa102301 100644
--- a/pkgtools/mtree/files/extern.h
+++ b/pkgtools/mtree/files/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.2 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: extern.h,v 1.3 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -38,10 +38,12 @@
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
+#else
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
#endif
#include <nbcompat.h>
-#if HAVE_ERR_H
+#if HAVE_ERR_H
#include <err.h>
#endif
#if HAVE_FTS_H
diff --git a/pkgtools/mtree/files/getid.c b/pkgtools/mtree/files/getid.c
index ab640e19948..769b2303fb2 100644
--- a/pkgtools/mtree/files/getid.c
+++ b/pkgtools/mtree/files/getid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getid.c,v 1.3 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: getid.c,v 1.4 2008/11/06 02:14:52 jschauma 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 */
@@ -46,6 +46,13 @@
* 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
diff --git a/pkgtools/mtree/files/misc.c b/pkgtools/mtree/files/misc.c
index 4a759116fc5..fff571e3712 100644
--- a/pkgtools/mtree/files/misc.c
+++ b/pkgtools/mtree/files/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.2 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: misc.c,v 1.3 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#endif
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: misc.c,v 1.2 2004/08/21 04:10:45 jlam Exp $");
+__RCSID("$NetBSD: misc.c,v 1.3 2008/11/06 02:14:52 jschauma Exp $");
#endif /* not lint */
#if HAVE_SYS_TYPES_H
@@ -94,6 +94,12 @@ static KEY keylist[] = {
{"rmd160digest",F_RMD160, NEEDVALUE},
{"sha1", F_SHA1, NEEDVALUE},
{"sha1digest", F_SHA1, NEEDVALUE},
+ {"sha256", F_SHA256, NEEDVALUE},
+ {"sha256digest",F_SHA256, NEEDVALUE},
+ {"sha384", F_SHA384, NEEDVALUE},
+ {"sha384digest",F_SHA384, NEEDVALUE},
+ {"sha512", F_SHA512, NEEDVALUE},
+ {"sha512digest",F_SHA512, NEEDVALUE},
{"size", F_SIZE, NEEDVALUE},
{"tags", F_TAGS, NEEDVALUE},
{"time", F_TIME, NEEDVALUE},
@@ -103,13 +109,16 @@ static KEY keylist[] = {
};
static KEY typelist[] = {
- {"block", F_BLOCK, },
- {"char", F_CHAR, },
- {"dir", F_DIR, },
- {"fifo", F_FIFO, },
- {"file", F_FILE, },
- {"link", F_LINK, },
- {"socket", F_SOCK, },
+ {"block", F_BLOCK, 0},
+ {"char", F_CHAR, 0},
+ {"dir", F_DIR, 0},
+#ifdef S_IFDOOR
+ {"door", F_DOOR, 0},
+#endif
+ {"fifo", F_FIFO, 0},
+ {"file", F_FILE, 0},
+ {"link", F_LINK, 0},
+ {"socket", F_SOCK, 0},
};
slist_t excludetags, includetags;
@@ -306,6 +315,10 @@ inotype(u_int type)
case S_IFSOCK:
return ("socket");
#endif
+#ifdef S_IFDOOR
+ case S_IFDOOR:
+ return ("door");
+#endif
default:
return ("unknown");
}
diff --git a/pkgtools/mtree/files/mtree.8 b/pkgtools/mtree/files/mtree.8
index 1166a07fef3..9f91aa1be0b 100644
--- a/pkgtools/mtree/files/mtree.8
+++ b/pkgtools/mtree/files/mtree.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: mtree.8,v 1.3 2004/08/21 04:10:45 jlam Exp $
+.\" $NetBSD: mtree.8,v 1.4 2008/11/06 02:14:52 jschauma Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -63,7 +63,7 @@
.\"
.\" @(#)mtree.8 8.2 (Berkeley) 12/11/93
.\"
-.Dd July 22, 2004
+.Dd September 12, 2006
.Dt MTREE 8
.Os
.Sh NAME
@@ -178,6 +178,10 @@ keywords instead of the current set of keywords.
If
.Ql all
is specified, use all of the other keywords.
+If the
+.Sy type
+keyword is not desired, suppress it with
+.Fl R Ar type .
.It Fl l
Do
.Dq loose
@@ -197,7 +201,7 @@ flags.
Follow all symbolic links in the file hierarchy.
.It Fl m
If the schg and/or sappnd flags are specified, reset these flags. Note that
-this is only possible with securelevel less than 1 (i. e. in single user mode
+this is only possible with securelevel less than 1 (i.e. in single user mode
or while the system is running in insecure mode). See
.Xr init 8
for information on security levels.
@@ -416,6 +420,27 @@ cryptographic message digest of the file.
.It Sy sha1digest
Synonym for
.Sy sha1 .
+.It Sy sha256
+The 256-bits
+.Tn SHA-2
+cryptographic message digest of the file.
+.It Sy sha256digest
+Synonym for
+.Sy sha256 .
+.It Sy sha384
+The 384-bits
+.Tn SHA-2
+cryptographic message digest of the file.
+.It Sy sha384digest
+Synonym for
+.Sy sha384 .
+.It Sy sha512
+The 512-bits
+.Tn SHA-2
+cryptographic message digest of the file.
+.It Sy sha512digest
+Synonym for
+.Sy sha512 .
.It Sy size
The size, in bytes, of the file.
.It Sy tags
@@ -606,7 +631,6 @@ for distributions and other such things.
.Xr chgrp 1 ,
.Xr chmod 1 ,
.Xr cksum 1 ,
-.Xr md5 1 ,
.Xr stat 2 ,
.Xr fnmatch 3 ,
.Xr fts 3 ,
@@ -658,3 +682,10 @@ and
.Fl X
flags, and support for full paths appeared in
.Nx 1.6 .
+The
+.Sy sha256 ,
+.Sy sha384 ,
+and
+.Sy sha512
+keywords appeared in
+.Nx 3.0 .
diff --git a/pkgtools/mtree/files/mtree.cat8 b/pkgtools/mtree/files/mtree.cat8
index 9b93e35ef96..ebc2b8939af 100644
--- a/pkgtools/mtree/files/mtree.cat8
+++ b/pkgtools/mtree/files/mtree.cat8
@@ -1,7 +1,7 @@
MTREE(8) NetBSD System Manager's Manual MTREE(8)
NNAAMMEE
- mmttrreeee - map a directory hierarchy
+ mmttrreeee -- map a directory hierarchy
SSYYNNOOPPSSIISS
mmttrreeee [--ccCCddDDeellLLMMPPrruuUUWWxx] [--ii | --mm] [--ff _s_p_e_c] [--pp _p_a_t_h] [--kk _k_e_y_w_o_r_d_s]
@@ -9,8 +9,8 @@ SSYYNNOOPPSSIISS
[--ss _s_e_e_d] [--XX _e_x_c_l_u_d_e_-_f_i_l_e]
DDEESSCCRRIIPPTTIIOONN
- The mmttrreeee utility compares the file hierarchy rooted in the current di-
- rectory against a specification read from the standard input. Messages
+ The mmttrreeee utility compares the file hierarchy rooted in the current
+ directory against a specification read from the standard input. Messages
are written to the standard output for any files whose characteristics do
not match the specification, or which are missing from either the file
hierarchy or the specification.
@@ -40,14 +40,14 @@ DDEESSCCRRIIPPTTIIOONN
in the specification.
--ff _s_p_e_c
- Read the specification from _f_i_l_e, instead of from the standard in-
- put.
+ Read the specification from _f_i_l_e, instead of from the standard
+ input.
--II _t_a_g_s
Add the comma separated tags to the ``inclusion'' list. Non-direc-
tories with tags which are in the inclusion list are printed with
- --DD. If no inclusion list is provided, the default is to display all
- files.
+ --DD. If no inclusion list is provided, the default is to display
+ all files.
--ii If specified, set the schg and/or sappnd flags.
@@ -59,7 +59,8 @@ DDEESSCCRRIIPPTTIIOONN
--kk _k_e_y_w_o_r_d_s
Use the ttyyppee keyword plus the specified (whitespace or comma sepa-
rated) keywords instead of the current set of keywords. If `all'
- is specified, use all of the other keywords.
+ is specified, use all of the other keywords. If the ttyyppee keyword
+ is not desired, suppress it with --RR _t_y_p_e.
--ll Do ``loose'' permissions checks, in which more stringent permis-
sions will match less stringent ones. For example, a file marked
@@ -72,7 +73,7 @@ DDEESSCCRRIIPPTTIIOONN
--LL Follow all symbolic links in the file hierarchy.
--mm If the schg and/or sappnd flags are specified, reset these flags.
- Note that this is only possible with securelevel less than 1 (i. e.
+ Note that this is only possible with securelevel less than 1 (i.e.
in single user mode or while the system is running in insecure
mode). See init(8) for information on security levels.
@@ -85,8 +86,8 @@ DDEESSCCRRIIPPTTIIOONN
system's getpwnam(3) and getgrnam(3) (and related) library calls.
--pp _p_a_t_h
- Use the file hierarchy rooted in _p_a_t_h, instead of the current di-
- rectory.
+ Use the file hierarchy rooted in _p_a_t_h, instead of the current
+ directory.
--PP Don't follow symbolic links in the file hierarchy, instead consider
the symbolic link itself in any comparisons. This is the default.
@@ -118,9 +119,9 @@ DDEESSCCRRIIPPTTIIOONN
if it was corrected.
--WW Don't attempt to set various file attributes such as the ownership,
- mode, flags, or time when creating new directories or changing ex-
- isting entries. This option will be most useful when used in con-
- junction with --uu or --UU.
+ mode, flags, or time when creating new directories or changing
+ existing entries. This option will be most useful when used in
+ conjunction with --uu or --UU.
--xx Don't descend below mount points in the file hierarchy.
@@ -150,8 +151,8 @@ DDEESSCCRRIIPPTTIIOONN
_f_o_r_m_a_t,_m_a_j_o_r,_u_n_i_t,_s_u_b_u_n_i_t
A device with _m_a_j_o_r, _u_n_i_t, and _s_u_b_u_n_i_t fields, for an oper-
- ating system specified with _f_o_r_m_a_t. (Currently this is on-
- ly supported by the bbssddooss format.)
+ ating system specified with _f_o_r_m_a_t. (Currently this is
+ only supported by the bbssddooss format.)
_n_u_m_b_e_r
Opaque number (as stored on the file system).
@@ -165,8 +166,8 @@ DDEESSCCRRIIPPTTIIOONN
ffllaaggss The file flags as a symbolic name. See chflags(1) for informa-
tion on these names. If no flags are to be set the string `none'
may be used to override the current default. Note that the schg
- and sappnd flags are treated specially (see the --ii and --mm op-
- tions).
+ and sappnd flags are treated specially (see the --ii and --mm
+ options).
iiggnnoorree Ignore any file hierarchy below this file.
@@ -200,9 +201,24 @@ DDEESSCCRRIIPPTTIIOONN
sshhaa11ddiiggeesstt
Synonym for sshhaa11.
+ sshhaa225566 The 256-bits SHA-2 cryptographic message digest of the file.
+
+ sshhaa225566ddiiggeesstt
+ Synonym for sshhaa225566.
+
+ sshhaa338844 The 384-bits SHA-2 cryptographic message digest of the file.
+
+ sshhaa338844ddiiggeesstt
+ Synonym for sshhaa338844.
+
+ sshhaa551122 The 512-bits SHA-2 cryptographic message digest of the file.
+
+ sshhaa551122ddiiggeesstt
+ Synonym for sshhaa551122.
+
ssiizzee The size, in bytes, of the file.
- ttaaggss Comma delimited tags to be matched with --EE and --II. These may be
+ ttaaggss Comma delimited tags to be matched with --EE and --II. These may be
specified without leading or trailing commas, but will be stored
internally with them.
@@ -231,16 +247,16 @@ DDEESSCCRRIIPPTTIIOONN
followed by whitespace, followed by sets of keyword/value pairs,
separated by whitespace. Keyword/value pairs consist of a keyword,
followed by an equals sign (`='), followed by a value, without
- whitespace characters. Once a keyword has been set, its value re-
- mains unchanged until either reset or unset.
+ whitespace characters. Once a keyword has been set, its value
+ remains unchanged until either reset or unset.
2. Unset global values for a keyword. This consists of the string
`/unset', followed by whitespace, followed by one or more keywords,
separated by whitespace. If `all' is specified, unset all of the
keywords.
- 3. A file specification, consisting of a path name, followed by whites-
- pace, followed by zero or more whitespace separated keyword/value
+ 3. A file specification, consisting of a path name, followed by white-
+ space, followed by zero or more whitespace separated keyword/value
pairs.
The path name may be preceded by whitespace characters. The path
@@ -254,9 +270,9 @@ DDEESSCCRRIIPPTTIIOONN
from comments.
Each of the keyword/value pairs consist of a keyword, followed by an
- equals sign (`='), followed by the keyword's value, without whites-
- pace characters. These values override, without changing, the glob-
- al value of the corresponding keyword.
+ equals sign (`='), followed by the keyword's value, without white-
+ space characters. These values override, without changing, the
+ global value of the corresponding keyword.
The first path name entry listed must be a directory named `.', as
this ensures that intermixing full and relative path names will work
@@ -266,25 +282,25 @@ DDEESSCCRRIIPPTTIIOONN
A path name that contains a slash (`/') that is not the first char-
acter will be treated as a full path (relative to the root of the
- tree). All parent directories referenced in the path name must ex-
- ist. The current directory path used by relative path names will be
- updated appropriately. Multiple entries for the same full path are
- permitted if the types are the same (unless --MM is given, and then
- the types may differ); in this case the settings for the last entry
- take precedence.
+ tree). All parent directories referenced in the path name must
+ exist. The current directory path used by relative path names will
+ be updated appropriately. Multiple entries for the same full path
+ are permitted if the types are the same (unless --MM is given, and
+ then the types may differ); in this case the settings for the last
+ entry take precedence.
A path name that does not contain a slash will be treated as a rela-
tive path. Specifying a directory will cause subsequent files to be
searched for in that directory hierarchy.
- 4. A line containing only the string `..' which causes the current di-
- rectory path (used by relative paths) to ascend one level.
+ 4. A line containing only the string `..' which causes the current
+ directory path (used by relative paths) to ascend one level.
Empty lines and lines whose first non-whitespace character is a hash mark
(`#') are ignored.
- The mmttrreeee utility exits with a status of 0 on success, 1 if any error oc-
- curred, and 2 if the file hierarchy did not match the specification.
+ The mmttrreeee utility exits with a status of 0 on success, 1 if any error
+ occurred, and 2 if the file hierarchy did not match the specification.
FFIILLEESS
/etc/mtree system specification directory
@@ -294,27 +310,28 @@ EEXXAAMMPPLLEESS
mended that mmttrreeee be run on the file systems, and a copy of the results
stored on a different machine, or, at least, in encrypted form. The seed
for the --ss option should not be an obvious value and the final checksum
- should not be stored on-line under any circumstances! Then, periodical-
- ly, mmttrreeee should be run against the on-line specifications and the final
- checksum compared with the previous value. While it is possible for the
- bad guys to change the on-line specifications to conform to their modi-
- fied binaries, it shouldn't be possible for them to make it produce the
- same final checksum value. If the final checksum value changes, the off-
- line copies of the specification can be used to detect which of the bina-
- ries have actually been modified.
-
- The --dd and --uu options can be used in combination to create directory hi-
- erarchies for distributions and other such things.
+ should not be stored on-line under any circumstances! Then, periodi-
+ cally, mmttrreeee should be run against the on-line specifications and the
+ final checksum compared with the previous value. While it is possible
+ for the bad guys to change the on-line specifications to conform to their
+ modified binaries, it shouldn't be possible for them to make it produce
+ the same final checksum value. If the final checksum value changes, the
+ off-line copies of the specification can be used to detect which of the
+ binaries have actually been modified.
+
+ The --dd and --uu options can be used in combination to create directory
+ hierarchies for distributions and other such things.
SSEEEE AALLSSOO
- chflags(1), chgrp(1), chmod(1), cksum(1), md5(1), stat(2), fnmatch(3),
- fts(3), strsvis(3), chown(8), mknod(8)
+ chflags(1), chgrp(1), chmod(1), cksum(1), stat(2), fnmatch(3), fts(3),
+ strsvis(3), chown(8), mknod(8)
HHIISSTTOORRYY
The mmttrreeee utility appeared in 4.3BSD-Reno. The ooppttiioonnaall keyword appeared
in NetBSD 1.2. The --UU flag appeared in NetBSD 1.3. The ffllaaggss and mmdd55
keywords, and --ii and --mm flags appeared in NetBSD 1.4. The ddeevviiccee,
rrmmdd116600, sshhaa11, ttaaggss, and aallll keywords, --DD, --EE, --II, --ll, --LL, --NN, --PP, --RR, --WW,
- and --XX flags, and support for full paths appeared in NetBSD 1.6.
+ and --XX flags, and support for full paths appeared in NetBSD 1.6. The
+ sshhaa225566, sshhaa338844, and sshhaa551122 keywords appeared in NetBSD 3.0.
-NetBSD 1.6.2 July 22, 2004 5
+NetBSD 3.0 September 12, 2006 NetBSD 3.0
diff --git a/pkgtools/mtree/files/mtree.h b/pkgtools/mtree/files/mtree.h
index 30b81722354..4675a873c8f 100644
--- a/pkgtools/mtree/files/mtree.h
+++ b/pkgtools/mtree/files/mtree.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mtree.h,v 1.2 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: mtree.h,v 1.3 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -39,6 +39,9 @@
#define MISMATCHEXIT 2
+/* Max. length of hash -- update this if needed when adding a new algorithm. */
+#define MAXHASHLEN 128 /* SHA512 */
+
typedef struct _node {
struct _node *parent, *child; /* up, down */
struct _node *prev, *next; /* left, right */
@@ -56,6 +59,9 @@ typedef struct _node {
char *md5digest; /* MD5 digest */
char *rmd160digest; /* RMD-160 digest */
char *sha1digest; /* SHA1 digest */
+ char *sha256digest; /* SHA256 digest */
+ char *sha384digest; /* SHA384 digest */
+ char *sha512digest; /* SHA512 digest */
char *tags; /* tags, comma delimited */
size_t lineno; /* line # entry came from */
@@ -81,6 +87,9 @@ typedef struct _node {
#define F_UID 0x00080000 /* uid */
#define F_UNAME 0x00100000 /* user name */
#define F_VISIT 0x00200000 /* file visited */
+#define F_SHA256 0x00800000 /* SHA256 digest */
+#define F_SHA384 0x01000000 /* SHA384 digest */
+#define F_SHA512 0x02000000 /* SHA512 digest */
int flags; /* items set */
@@ -91,6 +100,7 @@ typedef struct _node {
#define F_FILE 0x010 /* regular file */
#define F_LINK 0x020 /* symbolic link */
#define F_SOCK 0x040 /* socket */
+#define F_DOOR 0x080 /* door */
int type; /* file type */
char name[1]; /* file name (must be last) */
diff --git a/pkgtools/mtree/files/pack_dev.c b/pkgtools/mtree/files/pack_dev.c
index 8d7faac1ce9..f91e894ffdc 100644
--- a/pkgtools/mtree/files/pack_dev.c
+++ b/pkgtools/mtree/files/pack_dev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pack_dev.c,v 1.4 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: pack_dev.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -15,6 +15,13 @@
* 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -41,7 +48,7 @@
#include <sys/cdefs.h>
#endif
#if !defined(lint)
-__RCSID("$NetBSD: pack_dev.c,v 1.4 2008/04/29 05:46:08 martin Exp $");
+__RCSID("$NetBSD: pack_dev.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $");
#endif /* not lint */
#if HAVE_SYS_TYPES_H
@@ -66,9 +73,6 @@ __RCSID("$NetBSD: pack_dev.c,v 1.4 2008/04/29 05:46:08 martin Exp $");
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef __QNXNTO__
-#include <sys/netmgr.h>
-#endif
#include "pack_dev.h"
@@ -92,11 +96,7 @@ pack_native(int n, u_long numbers[], const char **error)
portdev_t dev = 0;
if (n == 2) {
-#ifdef __QNXNTO__
- dev = makedev(ND_LOCAL_NODE, numbers[0], numbers[1]);
-#else
dev = makedev(numbers[0], numbers[1]);
-#endif
if (major(dev) != numbers[0])
*error = iMajorError;
else if (minor(dev) != numbers[1])
diff --git a/pkgtools/mtree/files/pack_dev.h b/pkgtools/mtree/files/pack_dev.h
index e7d1774aab0..7398b125102 100644
--- a/pkgtools/mtree/files/pack_dev.h
+++ b/pkgtools/mtree/files/pack_dev.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pack_dev.h,v 1.3 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: pack_dev.h,v 1.4 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -15,6 +15,13 @@
* 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
diff --git a/pkgtools/mtree/files/spec.c b/pkgtools/mtree/files/spec.c
index 57dda79a21a..4d402b10d09 100644
--- a/pkgtools/mtree/files/spec.c
+++ b/pkgtools/mtree/files/spec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spec.c,v 1.4 2008/04/29 05:46:08 martin Exp $ */
+/* $NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -44,6 +44,13 @@
* 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -73,7 +80,7 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: spec.c,v 1.4 2008/04/29 05:46:08 martin Exp $");
+__RCSID("$NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -145,7 +152,7 @@ spec(FILE *fp)
memset(&ginfo, 0, sizeof(ginfo));
for (mtree_lineno = 0;
(buf = fparseln(fp, NULL, &mtree_lineno, NULL,
- FPARSELN_UNESCCOMM | FPARSELN_UNESCCONT | FPARSELN_UNESCESC));
+ FPARSELN_UNESCCOMM));
free(buf)) {
/* Skip leading whitespace. */
for (p = buf; *p && isspace((unsigned char)*p); ++p)
@@ -316,6 +323,9 @@ free_nodes(NODE *root)
REPLACEPTR(cur->md5digest, NULL);
REPLACEPTR(cur->rmd160digest, NULL);
REPLACEPTR(cur->sha1digest, NULL);
+ REPLACEPTR(cur->sha256digest, NULL);
+ REPLACEPTR(cur->sha384digest, NULL);
+ REPLACEPTR(cur->sha512digest, NULL);
REPLACEPTR(cur->tags, NULL);
REPLACEPTR(cur, NULL);
}
@@ -371,7 +381,7 @@ dump_nodes(const char *dir, NODE *root, int pathlast)
if (MATCHFLAG(F_NLINK))
printf("nlink=%d ", cur->st_nlink);
if (MATCHFLAG(F_SLINK))
- printf("link=%s ", cur->slink);
+ printf("link=%s ", vispath(cur->slink));
if (MATCHFLAG(F_SIZE))
printf("size=%lld ", (long long)cur->st_size);
if (MATCHFLAG(F_TIME))
@@ -385,6 +395,12 @@ dump_nodes(const char *dir, NODE *root, int pathlast)
printf("rmd160=%s ", cur->rmd160digest);
if (MATCHFLAG(F_SHA1))
printf("sha1=%s ", cur->sha1digest);
+ if (MATCHFLAG(F_SHA256))
+ printf("sha256=%s ", cur->sha256digest);
+ if (MATCHFLAG(F_SHA384))
+ printf("sha384=%s ", cur->sha384digest);
+ if (MATCHFLAG(F_SHA512))
+ printf("sha512=%s ", cur->sha512digest);
if (MATCHFLAG(F_FLAGS))
printf("flags=%s ",
flags_to_string(cur->st_flags, "none"));
@@ -485,6 +501,13 @@ replacenode(NODE *cur, NODE *new)
REPLACE(st_size);
REPLACE(st_mtimespec);
REPLACESTR(slink);
+ if (cur->slink != NULL) {
+ if ((cur->slink = strdup(new->slink)) == NULL)
+ mtree_err("memory allocation error");
+ if (strunvis(cur->slink, new->slink) == -1)
+ mtree_err("strunvis failed on `%s'", new->slink);
+ free(new->slink);
+ }
REPLACE(st_uid);
REPLACE(st_gid);
REPLACE(st_mode);
@@ -495,6 +518,9 @@ replacenode(NODE *cur, NODE *new)
REPLACESTR(md5digest);
REPLACESTR(rmd160digest);
REPLACESTR(sha1digest);
+ REPLACESTR(sha256digest);
+ REPLACESTR(sha384digest);
+ REPLACESTR(sha512digest);
REPLACESTR(tags);
REPLACE(lineno);
REPLACE(flags);
@@ -510,21 +536,20 @@ set(char *t, NODE *ip)
char *kw, *val, *md, *ep;
void *m;
- val = NULL;
while ((kw = strsep(&t, "= \t")) != NULL) {
if (*kw == '\0')
continue;
if (strcmp(kw, "all") == 0)
mtree_err("invalid keyword `all'");
ip->flags |= type = parsekey(kw, &value);
- if (value) {
- while ((val = strsep(&t, " \t")) != NULL &&
- *val == '\0')
- continue;
- if (val == NULL)
- mtree_err("missing value");
- }
- switch(type) {
+ if (!value)
+ /* Just set flag bit (F_IGN and F_OPT) */
+ continue;
+ while ((val = strsep(&t, " \t")) != NULL && *val == '\0')
+ continue;
+ if (val == NULL)
+ mtree_err("missing value");
+ switch (type) {
case F_CKSUM:
ip->cksum = strtoul(val, &ep, 10);
if (*ep)
@@ -552,9 +577,6 @@ set(char *t, NODE *ip)
mtree_err("unknown group `%s'", val);
ip->st_gid = gid;
break;
- case F_IGN:
- /* just set flag bit */
- break;
case F_MD5:
if (val[0]=='0' && val[1]=='x')
md=&val[2];
@@ -565,7 +587,8 @@ set(char *t, NODE *ip)
break;
case F_MODE:
if ((m = setmode(val)) == NULL)
- mtree_err("invalid file mode `%s'", val);
+ mtree_err("cannot set file mode `%s' (%s)",
+ val, strerror(errno));
ip->st_mode = getmode(m, 0);
free(m);
break;
@@ -574,9 +597,6 @@ set(char *t, NODE *ip)
if (*ep)
mtree_err("invalid link count `%s'", val);
break;
- case F_OPT:
- /* just set flag bit */
- break;
case F_RMD160:
if (val[0]=='0' && val[1]=='x')
md=&val[2];
@@ -601,6 +621,8 @@ set(char *t, NODE *ip)
case F_SLINK:
if ((ip->slink = strdup(val)) == NULL)
mtree_err("memory allocation error");
+ if (strunvis(ip->slink, val) == -1)
+ mtree_err("strunvis failed on `%s'", val);
break;
case F_TAGS:
len = strlen(val) + 3; /* "," + str + ",\0" */
@@ -633,6 +655,30 @@ set(char *t, NODE *ip)
mtree_err("unknown user `%s'", val);
ip->st_uid = uid;
break;
+ case F_SHA256:
+ if (val[0]=='0' && val[1]=='x')
+ md=&val[2];
+ else
+ md=val;
+ if ((ip->sha256digest = strdup(md)) == NULL)
+ mtree_err("memory allocation error");
+ break;
+ case F_SHA384:
+ if (val[0]=='0' && val[1]=='x')
+ md=&val[2];
+ else
+ md=val;
+ if ((ip->sha384digest = strdup(md)) == NULL)
+ mtree_err("memory allocation error");
+ break;
+ case F_SHA512:
+ if (val[0]=='0' && val[1]=='x')
+ md=&val[2];
+ else
+ md=val;
+ if ((ip->sha512digest = strdup(md)) == NULL)
+ mtree_err("memory allocation error");
+ break;
default:
mtree_err(
"set(): unsupported key type 0x%x (INTERNAL ERROR)",
diff --git a/pkgtools/mtree/files/stat_flags.c b/pkgtools/mtree/files/stat_flags.c
index 5d5986d074c..f036745f9c3 100644
--- a/pkgtools/mtree/files/stat_flags.c
+++ b/pkgtools/mtree/files/stat_flags.c
@@ -1,4 +1,4 @@
-/* $NetBSD: stat_flags.c,v 1.3 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: stat_flags.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1993
@@ -34,6 +34,8 @@
#endif
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
+#else
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
#endif
#include <nbcompat.h>
@@ -44,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94";
#else
-__RCSID("$NetBSD: stat_flags.c,v 1.3 2004/08/21 04:10:45 jlam Exp $");
+__RCSID("$NetBSD: stat_flags.c,v 1.4 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -86,7 +88,7 @@ flags_to_string(u_long flags, const char *def)
string[0] = '\0';
prefix = NULL;
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
if (flags & UF_APPEND)
SAPPEND("uappnd");
if (flags & UF_IMMUTABLE)
@@ -145,7 +147,7 @@ string_to_flags(char **stringp, u_long *setp, u_long *clrp)
if (clrp)
*clrp = 0;
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
string = *stringp;
while ((p = strsep(&string, "\t ,")) != NULL) {
clear = 0;
diff --git a/pkgtools/mtree/files/verify.c b/pkgtools/mtree/files/verify.c
index ade36f92b8a..028fd4e7618 100644
--- a/pkgtools/mtree/files/verify.c
+++ b/pkgtools/mtree/files/verify.c
@@ -1,4 +1,4 @@
-/* $NetBSD: verify.c,v 1.4 2004/08/21 04:10:45 jlam Exp $ */
+/* $NetBSD: verify.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: verify.c,v 1.4 2004/08/21 04:10:45 jlam Exp $");
+__RCSID("$NetBSD: verify.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $");
#endif
#endif /* not lint */
@@ -149,10 +149,12 @@ vwalk(void)
if (compare(ep, p))
rval = MISMATCHEXIT;
if (!(ep->flags & F_IGN) &&
- ep->child && ep->type == F_DIR &&
+ ep->type == F_DIR &&
p->fts_info == FTS_D) {
- level = ep->child;
- ++specdepth;
+ if (ep->child) {
+ level = ep->child;
+ ++specdepth;
+ }
} else
fts_set(t, p, FTS_SKIP);
break;
@@ -298,7 +300,7 @@ miss(NODE *p, char *tail)
printf("%s: permissions not set: %s\n",
path, strerror(errno));
}
-#if HAVE_FILE_FLAGS
+#if HAVE_STRUCT_STAT_ST_FLAGS
if ((p->flags & F_FLAGS) && p->st_flags) {
if (iflag)
flags = p->st_flags;
@@ -308,6 +310,6 @@ miss(NODE *p, char *tail)
printf("%s: file flags not set: %s\n",
path, strerror(errno));
}
-#endif /* HAVE_FILE_FLAGS */
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
}
}