- MFC from head@196987

This commit is contained in:
Oleksandr Tymoshenko 2009-09-08 19:15:29 +00:00
commit cbd59a4f65
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/mips/; revision=196988
699 changed files with 22478 additions and 12294 deletions

View File

@ -14,6 +14,15 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
# 20090904: remove lukemftpd
OLD_FILES+=usr/libexec/lukemftpd
OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz
OLD_FILES+=usr/share/man/man5/ftpusers.5.gz
OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz
# 20090902: BSD.{x11,x11-4}.dist are dead and BSD.local.dist lives in ports/
OLD_FILES+=etc/mtree/BSD.local.dist
OLD_FILES+=etc/mtree/BSD.x11.dist
OLD_FILES+=etc/mtree/BSD.x11-4.dist
# 20090801: vimage.h removed in favour of vnet.h
OLD_FILES+=usr/include/sys/vimage.h
# 20090719: library version bump for 8.0
@ -803,8 +812,6 @@ OLD_FILES+=rescue/bsdlabel
OLD_FILES+=rescue/fdisk
OLD_FILES+=rescue/gpt
.endif
# 20071026: kthread(9)/kproc(9) API changes
OLD_FILES+=usr/share/man/man9/kthread_create.9.gz
# 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd
OLD_FILES+=etc/rc.d/nfslocking
# 20070930: rename of cached to nscd

946
UPDATING

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
static void usage(void);
static int may_have_nfs4acl(const FTSENT *ent);
static int may_have_nfs4acl(const FTSENT *ent, int hflag);
int
main(int argc, char *argv[])
@ -62,11 +62,10 @@ main(int argc, char *argv[])
FTS *ftsp;
FTSENT *p;
mode_t *set;
int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval;
int Hflag, Lflag, Rflag, ch, error, fflag, fts_options, hflag, rval;
int vflag;
char *mode;
mode_t newmode;
int (*change_mode)(const char *, mode_t);
set = NULL;
Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
@ -140,11 +139,6 @@ done: argv += optind;
} else
fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
if (hflag)
change_mode = lchmod;
else
change_mode = chmod;
mode = *argv;
if ((set = setmode(mode)) == NULL)
errx(1, "invalid file mode: %s", mode);
@ -175,7 +169,6 @@ done: argv += optind;
*/
if (!hflag)
continue;
/* else */
/* FALLTHROUGH */
default:
break;
@ -186,12 +179,18 @@ done: argv += optind;
* identical to the one computed from an ACL will change
* that ACL.
*/
if (may_have_nfs4acl(p) == 0 &&
if (may_have_nfs4acl(p, hflag) == 0 &&
(newmode & ALLPERMS) == (p->fts_statp->st_mode & ALLPERMS))
continue;
if ((*change_mode)(p->fts_accpath, newmode) && !fflag) {
warn("%s", p->fts_path);
rval = 1;
if (hflag)
error = lchmod(p->fts_accpath, newmode);
else
error = chmod(p->fts_accpath, newmode);
if (error) {
if (!fflag) {
warn("%s", p->fts_path);
rval = 1;
}
} else {
if (vflag) {
(void)printf("%s", p->fts_path);
@ -202,7 +201,6 @@ done: argv += optind;
strmode(p->fts_statp->st_mode, m1);
strmode((p->fts_statp->st_mode &
S_IFMT) | newmode, m2);
(void)printf(": 0%o [%s] -> 0%o [%s]",
p->fts_statp->st_mode, m1,
(p->fts_statp->st_mode & S_IFMT) |
@ -210,12 +208,10 @@ done: argv += optind;
}
(void)printf("\n");
}
}
}
if (errno)
err(1, "fts_read");
free(set);
exit(rval);
}
@ -228,17 +224,20 @@ usage(void)
}
static int
may_have_nfs4acl(const FTSENT *ent)
may_have_nfs4acl(const FTSENT *ent, int hflag)
{
int ret;
static dev_t previous_dev = (dev_t)-1;
static dev_t previous_dev = NODEV;
static int supports_acls = -1;
if (previous_dev != ent->fts_statp->st_dev) {
previous_dev = ent->fts_statp->st_dev;
supports_acls = 0;
ret = pathconf(ent->fts_accpath, _PC_ACL_NFS4);
if (hflag)
ret = lpathconf(ent->fts_accpath, _PC_ACL_NFS4);
else
ret = pathconf(ent->fts_accpath, _PC_ACL_NFS4);
if (ret > 0)
supports_acls = 1;
else if (ret < 0 && errno != EINVAL)

View File

@ -377,24 +377,52 @@ setfile(struct stat *fs, int fd)
int
preserve_fd_acls(int source_fd, int dest_fd)
{
struct acl *aclp;
acl_t acl;
acl_type_t acl_type;
int acl_supported = 0, ret, trivial;
if (fpathconf(source_fd, _PC_ACL_EXTENDED) != 1 ||
fpathconf(dest_fd, _PC_ACL_EXTENDED) != 1)
ret = fpathconf(source_fd, _PC_ACL_NFS4);
if (ret > 0 ) {
acl_supported = 1;
acl_type = ACL_TYPE_NFS4;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", to.p_path);
return (1);
}
if (acl_supported == 0) {
ret = fpathconf(source_fd, _PC_ACL_EXTENDED);
if (ret > 0 ) {
acl_supported = 1;
acl_type = ACL_TYPE_ACCESS;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s",
to.p_path);
return (1);
}
}
if (acl_supported == 0)
return (0);
acl = acl_get_fd(source_fd);
acl = acl_get_fd_np(source_fd, acl_type);
if (acl == NULL) {
warn("failed to get acl entries while setting %s", to.p_path);
return (1);
}
aclp = &acl->ats_acl;
if (aclp->acl_cnt == 3)
return (0);
if (acl_set_fd(dest_fd, acl) < 0) {
warn("failed to set acl entries for %s", to.p_path);
if (acl_is_trivial_np(acl, &trivial)) {
warn("acl_is_trivial() failed for %s", to.p_path);
acl_free(acl);
return (1);
}
if (trivial) {
acl_free(acl);
return (0);
}
if (acl_set_fd_np(dest_fd, acl, acl_type) < 0) {
warn("failed to set acl entries for %s", to.p_path);
acl_free(acl);
return (1);
}
acl_free(acl);
return (0);
}
@ -405,10 +433,31 @@ preserve_dir_acls(struct stat *fs, char *source_dir, char *dest_dir)
int (*aclsetf)(const char *, acl_type_t, acl_t);
struct acl *aclp;
acl_t acl;
acl_type_t acl_type;
int acl_supported = 0, ret, trivial;
if (pathconf(source_dir, _PC_ACL_EXTENDED) != 1 ||
pathconf(dest_dir, _PC_ACL_EXTENDED) != 1)
ret = pathconf(source_dir, _PC_ACL_NFS4);
if (ret > 0) {
acl_supported = 1;
acl_type = ACL_TYPE_NFS4;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", source_dir);
return (1);
}
if (acl_supported == 0) {
ret = pathconf(source_dir, _PC_ACL_EXTENDED);
if (ret > 0) {
acl_supported = 1;
acl_type = ACL_TYPE_ACCESS;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s",
source_dir);
return (1);
}
}
if (acl_supported == 0)
return (0);
/*
* If the file is a link we will not follow it
*/
@ -419,34 +468,48 @@ preserve_dir_acls(struct stat *fs, char *source_dir, char *dest_dir)
aclgetf = acl_get_file;
aclsetf = acl_set_file;
}
/*
* Even if there is no ACL_TYPE_DEFAULT entry here, a zero
* size ACL will be returned. So it is not safe to simply
* check the pointer to see if the default ACL is present.
*/
acl = aclgetf(source_dir, ACL_TYPE_DEFAULT);
if (acl == NULL) {
warn("failed to get default acl entries on %s",
source_dir);
return (1);
if (acl_type == ACL_TYPE_ACCESS) {
/*
* Even if there is no ACL_TYPE_DEFAULT entry here, a zero
* size ACL will be returned. So it is not safe to simply
* check the pointer to see if the default ACL is present.
*/
acl = aclgetf(source_dir, ACL_TYPE_DEFAULT);
if (acl == NULL) {
warn("failed to get default acl entries on %s",
source_dir);
return (1);
}
aclp = &acl->ats_acl;
if (aclp->acl_cnt != 0 && aclsetf(dest_dir,
ACL_TYPE_DEFAULT, acl) < 0) {
warn("failed to set default acl entries on %s",
dest_dir);
acl_free(acl);
return (1);
}
acl_free(acl);
}
aclp = &acl->ats_acl;
if (aclp->acl_cnt != 0 && aclsetf(dest_dir,
ACL_TYPE_DEFAULT, acl) < 0) {
warn("failed to set default acl entries on %s",
dest_dir);
return (1);
}
acl = aclgetf(source_dir, ACL_TYPE_ACCESS);
acl = aclgetf(source_dir, acl_type);
if (acl == NULL) {
warn("failed to get acl entries on %s", source_dir);
return (1);
}
aclp = &acl->ats_acl;
if (aclsetf(dest_dir, ACL_TYPE_ACCESS, acl) < 0) {
warn("failed to set acl entries on %s", dest_dir);
if (acl_is_trivial_np(acl, &trivial)) {
warn("acl_is_trivial() failed on %s", source_dir);
acl_free(acl);
return (1);
}
if (trivial) {
acl_free(acl);
return (0);
}
if (aclsetf(dest_dir, acl_type, acl) < 0) {
warn("failed to set acl entries on %s", dest_dir);
acl_free(acl);
return (1);
}
acl_free(acl);
return (0);
}

View File

@ -30,7 +30,7 @@
.\" Developed by the TrustedBSD Project.
.\" Support for POSIX.1e access control lists.
.\"
.Dd March 13, 2006
.Dd September 04, 2009
.Dt GETFACL 1
.Os
.Sh NAME
@ -38,7 +38,7 @@
.Nd get ACL information
.Sh SYNOPSIS
.Nm
.Op Fl dhq
.Op Fl dhinqv
.Op Ar
.Sh DESCRIPTION
The
@ -61,13 +61,25 @@ The operation applies to the default ACL of a directory instead of the
access ACL.
An error is generated if a default ACL cannot be associated with
.Ar file .
This option is not valid for NFSv4 ACLs.
.It Fl h
If the target of the operation is a symbolic link, return the ACL from
the symbolic link itself rather than following the link.
.It Fl i
For NFSv4 ACLs, append numerical ID at the end of each entry containing
user or group name.
Ignored for POSIX.1e ACLs.
.It Fl n
Display user and group IDs numerically rather than converting to
a user or group name.
Ignored for POSIX.1e ACLs.
.It Fl q
Do not write commented information about file name and ownership.
This is
useful when dealing with filenames with unprintable characters.
.It Fl v
For NFSv4 ACLs, display access mask and flags in a verbose form.
Ignored for POSIX.1e ACLs.
.El
.Pp
The following operand is available:

View File

@ -54,7 +54,7 @@ static void
usage(void)
{
fprintf(stderr, "getfacl [-dhq] [file ...]\n");
fprintf(stderr, "getfacl [-dhnqv] [file ...]\n");
}
static char *
@ -175,22 +175,39 @@ acl_from_stat(struct stat sb)
}
static int
print_acl(char *path, acl_type_t type, int hflag, int qflag)
print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag,
int qflag, int vflag)
{
struct stat sb;
acl_t acl;
char *acl_text;
int error;
int error, flags = 0, ret;
if (hflag)
error = lstat(path, &sb);
else
error = stat(path, &sb);
if (error == -1) {
warn("%s", path);
warn("%s: stat() failed", path);
return(-1);
}
if (hflag)
ret = lpathconf(path, _PC_ACL_NFS4);
else
ret = pathconf(path, _PC_ACL_NFS4);
if (ret > 0) {
if (type == ACL_TYPE_DEFAULT) {
warnx("%s: there are no default entries in NFSv4 ACLs",
path);
return (-1);
}
type = ACL_TYPE_NFS4;
} else if (ret < 0 && errno != EINVAL) {
warn("%s: pathconf(..., _PC_ACL_NFS4) failed", path);
return (-1);
}
if (more_than_one)
printf("\n");
else
@ -210,18 +227,27 @@ print_acl(char *path, acl_type_t type, int hflag, int qflag)
return(-1);
}
errno = 0;
if (type != ACL_TYPE_ACCESS)
if (type == ACL_TYPE_DEFAULT)
return(0);
acl = acl_from_stat(sb);
if (!acl) {
warn("acl_from_stat()");
warn("%s: acl_from_stat() failed", path);
return(-1);
}
}
acl_text = acl_to_text(acl, 0);
if (iflag)
flags |= ACL_TEXT_APPEND_ID;
if (nflag)
flags |= ACL_TEXT_NUMERIC_IDS;
if (vflag)
flags |= ACL_TEXT_VERBOSE;
acl_text = acl_to_text_np(acl, 0, flags);
if (!acl_text) {
warn("%s", path);
warn("%s: acl_to_text_np() failed", path);
return(-1);
}
@ -234,7 +260,8 @@ print_acl(char *path, acl_type_t type, int hflag, int qflag)
}
static int
print_acl_from_stdin(acl_type_t type, int hflag, int qflag)
print_acl_from_stdin(acl_type_t type, int hflag, int iflag, int nflag,
int qflag, int vflag)
{
char *p, pathname[PATH_MAX];
int carried_error = 0;
@ -242,7 +269,8 @@ print_acl_from_stdin(acl_type_t type, int hflag, int qflag)
while (fgets(pathname, (int)sizeof(pathname), stdin)) {
if ((p = strchr(pathname, '\n')) != NULL)
*p = '\0';
if (print_acl(pathname, type, hflag, qflag) == -1) {
if (print_acl(pathname, type, hflag, iflag, nflag,
qflag, vflag) == -1) {
carried_error = -1;
}
}
@ -256,11 +284,14 @@ main(int argc, char *argv[])
acl_type_t type = ACL_TYPE_ACCESS;
int carried_error = 0;
int ch, error, i;
int hflag, qflag;
int hflag, iflag, qflag, nflag, vflag;
hflag = 0;
iflag = 0;
qflag = 0;
while ((ch = getopt(argc, argv, "dhq")) != -1)
nflag = 0;
vflag = 0;
while ((ch = getopt(argc, argv, "dhinqv")) != -1)
switch(ch) {
case 'd':
type = ACL_TYPE_DEFAULT;
@ -268,9 +299,18 @@ main(int argc, char *argv[])
case 'h':
hflag = 1;
break;
case 'i':
iflag = 1;
break;
case 'n':
nflag = 1;
break;
case 'q':
qflag = 1;
break;
case 'v':
vflag = 1;
break;
default:
usage();
return(-1);
@ -279,17 +319,20 @@ main(int argc, char *argv[])
argv += optind;
if (argc == 0) {
error = print_acl_from_stdin(type, hflag, qflag);
error = print_acl_from_stdin(type, hflag, iflag, nflag,
qflag, vflag);
return(error ? 1 : 0);
}
for (i = 0; i < argc; i++) {
if (!strcmp(argv[i], "-")) {
error = print_acl_from_stdin(type, hflag, qflag);
error = print_acl_from_stdin(type, hflag, iflag, nflag,
qflag, vflag);
if (error == -1)
carried_error = -1;
} else {
error = print_acl(argv[i], type, hflag, qflag);
error = print_acl(argv[i], type, hflag, iflag, nflag,
qflag, vflag);
if (error == -1)
carried_error = -1;
}

View File

@ -70,7 +70,7 @@ static void printsize(size_t, off_t);
static void endcolor(int);
static int colortype(mode_t);
#endif
static void aclmode(char *, const FTSENT *, int *);
static void aclmode(char *, const FTSENT *);
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
@ -139,16 +139,12 @@ printlong(const DISPLAY *dp)
#ifdef COLORLS
int color_printed = 0;
#endif
int haveacls;
dev_t prevdev;
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) &&
(f_longform || f_size)) {
(void)printf("total %lu\n", howmany(dp->btotal, blocksize));
}
haveacls = 1;
prevdev = (dev_t)-1;
for (p = dp->list; p; p = p->fts_link) {
if (IS_NOPRINT(p))
continue;
@ -159,14 +155,7 @@ printlong(const DISPLAY *dp)
(void)printf("%*jd ",
dp->s_block, howmany(sp->st_blocks, blocksize));
strmode(sp->st_mode, buf);
/*
* Cache whether or not the filesystem supports ACL's to
* avoid expensive syscalls. Try again when we change devices.
*/
if (haveacls || sp->st_dev != prevdev) {
aclmode(buf, p, &haveacls);
prevdev = sp->st_dev;
}
aclmode(buf, p);
np = p->fts_pointer;
(void)printf("%s %*u %-*s %-*s ", buf, dp->s_nlink,
sp->st_nlink, dp->s_user, np->user, dp->s_group,
@ -612,56 +601,73 @@ printsize(size_t width, off_t bytes)
(void)printf("%*jd ", (u_int)width, bytes);
}
/*
* Add a + after the standard rwxrwxrwx mode if the file has an
* ACL. strmode() reserves space at the end of the string.
*/
static void
aclmode(char *buf, const FTSENT *p, int *haveacls)
aclmode(char *buf, const FTSENT *p)
{
char name[MAXPATHLEN + 1];
int entries, ret;
int ret, trivial;
static dev_t previous_dev = NODEV;
static int supports_acls = -1;
static int type = ACL_TYPE_ACCESS;
acl_t facl;
acl_entry_t ae;
/*
* Add a + after the standard rwxrwxrwx mode if the file has an
* extended ACL. strmode() reserves space at the end of the string.
* XXX: ACLs are not supported on whiteouts and device files
* residing on UFS.
*/
if (S_ISCHR(p->fts_statp->st_mode) || S_ISBLK(p->fts_statp->st_mode) ||
S_ISWHT(p->fts_statp->st_mode))
return;
if (previous_dev == p->fts_statp->st_dev && supports_acls == 0)
return;
if (p->fts_level == FTS_ROOTLEVEL)
snprintf(name, sizeof(name), "%s", p->fts_name);
else
snprintf(name, sizeof(name), "%s/%s",
p->fts_parent->fts_accpath, p->fts_name);
/*
* We have no way to tell whether a symbolic link has an ACL since
* pathconf() and acl_get_file() both follow them. They also don't
* support whiteouts.
*/
if (S_ISLNK(p->fts_statp->st_mode) || S_ISWHT(p->fts_statp->st_mode)) {
*haveacls = 1;
return;
}
if ((ret = pathconf(name, _PC_ACL_EXTENDED)) <= 0) {
if (ret < 0 && errno != EINVAL)
if (previous_dev != p->fts_statp->st_dev) {
previous_dev = p->fts_statp->st_dev;
supports_acls = 0;
ret = lpathconf(name, _PC_ACL_NFS4);
if (ret > 0) {
type = ACL_TYPE_NFS4;
supports_acls = 1;
} else if (ret < 0 && errno != EINVAL) {
warn("%s", name);
else
*haveacls = 0;
return;
}
if (supports_acls == 0) {
ret = lpathconf(name, _PC_ACL_EXTENDED);
if (ret > 0) {
type = ACL_TYPE_ACCESS;
supports_acls = 1;
} else if (ret < 0 && errno != EINVAL) {
warn("%s", name);
return;
}
}
}
if (supports_acls == 0)
return;
facl = acl_get_link_np(name, type);
if (facl == NULL) {
warn("%s", name);
return;
}
*haveacls = 1;
if ((facl = acl_get_file(name, ACL_TYPE_ACCESS)) != NULL) {
if (acl_get_entry(facl, ACL_FIRST_ENTRY, &ae) == 1) {
entries = 1;
while (acl_get_entry(facl, ACL_NEXT_ENTRY, &ae) == 1)
if (++entries > 3)
break;
/*
* POSIX.1e requires that ACLs of type ACL_TYPE_ACCESS
* must have at least three entries (owner, group,
* and other). So anything with more than 3 ACLs looks
* interesting to us.
*/
if (entries > 3)
buf[10] = '+';
}
if (acl_is_trivial_np(facl, &trivial)) {
acl_free(facl);
} else
warn("%s", name);
return;
}
if (!trivial)
buf[10] = '+';
acl_free(facl);
}

View File

@ -74,6 +74,8 @@ static int copy(const char *, const char *);
static int do_move(const char *, const char *);
static int fastcopy(const char *, const char *, struct stat *);
static void usage(void);
static void preserve_fd_acls(int source_fd, int dest_fd, const char *source_path,
const char *dest_path);
int
main(int argc, char *argv[])
@ -260,7 +262,6 @@ fastcopy(const char *from, const char *to, struct stat *sbp)
struct timeval tval[2];
static u_int blen;
static char *bp;
acl_t acl;
mode_t oldmode;
int nread, from_fd, to_fd;
@ -311,23 +312,15 @@ err: if (unlink(to))
sbp->st_mode &= ~(S_ISUID | S_ISGID);
}
}
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode (was: 0%03o)", to, oldmode);
/*
* POSIX 1003.2c states that if _POSIX_ACL_EXTENDED is in effect
* for dest_file, then its ACLs shall reflect the ACLs of the
* source_file.
*/
if (fpathconf(to_fd, _PC_ACL_EXTENDED) == 1 &&
fpathconf(from_fd, _PC_ACL_EXTENDED) == 1) {
acl = acl_get_fd(from_fd);
if (acl == NULL)
warn("failed to get acl entries while setting %s",
from);
else if (acl_set_fd(to_fd, acl) < 0)
warn("failed to set acl entries for %s", to);
}
preserve_fd_acls(from_fd, to_fd, from, to);
(void)close(from_fd);
if (fchmod(to_fd, sbp->st_mode))
warn("%s: set mode (was: 0%03o)", to, oldmode);
/*
* XXX
* NFS doesn't support chflags; ignore errors unless there's reason
@ -438,6 +431,59 @@ copy(const char *from, const char *to)
return (0);
}
static void
preserve_fd_acls(int source_fd, int dest_fd, const char *source_path,
const char *dest_path)
{
acl_t acl;
acl_type_t acl_type;
int acl_supported = 0, ret, trivial;
ret = fpathconf(source_fd, _PC_ACL_NFS4);
if (ret > 0 ) {
acl_supported = 1;
acl_type = ACL_TYPE_NFS4;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_NFS4) failed for %s",
source_path);
return;
}
if (acl_supported == 0) {
ret = fpathconf(source_fd, _PC_ACL_EXTENDED);
if (ret > 0 ) {
acl_supported = 1;
acl_type = ACL_TYPE_ACCESS;
} else if (ret < 0 && errno != EINVAL) {
warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s",
source_path);
return;
}
}
if (acl_supported == 0)
return;
acl = acl_get_fd_np(source_fd, acl_type);
if (acl == NULL) {
warn("failed to get acl entries for %s", source_path);
return;
}
if (acl_is_trivial_np(acl, &trivial)) {
warn("acl_is_trivial() failed for %s", source_path);
acl_free(acl);
return;
}
if (trivial) {
acl_free(acl);
return;
}
if (acl_set_fd_np(dest_fd, acl, acl_type) < 0) {
warn("failed to set acl entries for %s", dest_path);
acl_free(acl);
return;
}
acl_free(acl);
}
static void
usage(void)
{

View File

@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
/* set the appropriate mask the given ACL's */
int
set_acl_mask(acl_t *prev_acl)
set_acl_mask(acl_t *prev_acl, const char *filename)
{
acl_entry_t entry;
acl_t acl;
@ -59,7 +59,7 @@ set_acl_mask(acl_t *prev_acl)
acl = acl_dup(*prev_acl);
if (acl == NULL)
err(1, "acl_dup() failed");
err(1, "%s: acl_dup() failed", filename);
if (n_flag == 0) {
/*
@ -70,7 +70,7 @@ set_acl_mask(acl_t *prev_acl)
* class in the resulting ACL
*/
if (acl_calc_mask(&acl)) {
warn("acl_calc_mask() failed");
warn("%s: acl_calc_mask() failed", filename);
acl_free(acl);
return (-1);
}
@ -86,7 +86,8 @@ set_acl_mask(acl_t *prev_acl)
while (acl_get_entry(acl, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed");
err(1, "%s: acl_get_tag_type() failed",
filename);
if (tag == ACL_MASK) {
acl_free(acl);
@ -100,7 +101,7 @@ set_acl_mask(acl_t *prev_acl)
* file, then write an error message to standard error and
* continue with the next file.
*/
warnx("warning: no mask entry");
warnx("%s: warning: no mask entry", filename);
acl_free(acl);
return (0);
}

View File

@ -36,12 +36,15 @@ __FBSDID("$FreeBSD$");
#include "setfacl.h"
static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new);
static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new,
int acl_brand);
static int
merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new)
merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new, int acl_brand)
{
acl_permset_t permset;
acl_entry_type_t entry_type;
acl_flagset_t flagset;
int have_entry;
uid_t *id, *id_new;
@ -59,6 +62,18 @@ merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new)
err(1, "acl_get_permset() failed");
if (acl_set_permset(*entry_new, permset) == -1)
err(1, "acl_set_permset() failed");
if (acl_brand == ACL_BRAND_NFS4) {
if (acl_get_entry_type_np(*entry, &entry_type))
err(1, "acl_get_entry_type_np() failed");
if (acl_set_entry_type_np(*entry_new, entry_type))
err(1, "acl_set_entry_type_np() failed");
if (acl_get_flagset_np(*entry, &flagset))
err(1, "acl_get_flagset_np() failed");
if (acl_set_flagset_np(*entry_new, flagset))
err(1, "acl_set_flagset_np() failed");
}
have_entry = 1;
}
acl_free(id);
@ -71,20 +86,31 @@ merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new)
* merge an ACL into existing file's ACL
*/
int
merge_acl(acl_t acl, acl_t *prev_acl)
merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
{
acl_entry_t entry, entry_new;
acl_permset_t permset;
acl_t acl_new;
acl_tag_t tag, tag_new;
int entry_id, entry_id_new, have_entry;
acl_entry_type_t entry_type, entry_type_new;
acl_flagset_t flagset;
int entry_id, entry_id_new, have_entry, entry_number = 0;
int acl_brand, prev_acl_brand;
if (acl_type == ACL_TYPE_ACCESS)
acl_new = acl_dup(prev_acl[ACCESS_ACL]);
else
acl_new = acl_dup(prev_acl[DEFAULT_ACL]);
acl_get_brand_np(acl, &acl_brand);
acl_get_brand_np(*prev_acl, &prev_acl_brand);
if (acl_brand != prev_acl_brand) {
warnx("%s: branding mismatch; existing ACL is %s, "
"entry to be merged is %s", filename,
prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
return (-1);
}
acl_new = acl_dup(*prev_acl);
if (acl_new == NULL)
err(1, "acl_dup() failed");
err(1, "%s: acl_dup() failed", filename);
entry_id = ACL_FIRST_ENTRY;
@ -94,28 +120,45 @@ merge_acl(acl_t acl, acl_t *prev_acl)
/* keep track of existing ACL_MASK entries */
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed - invalid ACL entry");
err(1, "%s: acl_get_tag_type() failed - "
"invalid ACL entry", filename);
if (tag == ACL_MASK)
have_mask = 1;
/* check against the existing ACL entries */
entry_id_new = ACL_FIRST_ENTRY;
while (have_entry == 0 &&
acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) {
while (acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) {
entry_id_new = ACL_NEXT_ENTRY;
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed");
err(1, "%s: acl_get_tag_type() failed",
filename);
if (acl_get_tag_type(entry_new, &tag_new) == -1)
err(1, "acl_get_tag_type() failed");
err(1, "%s: acl_get_tag_type() failed",
filename);
if (tag != tag_new)
continue;
/*
* For NFSv4, in addition to "tag" and "id" we also
* compare "entry_type".
*/
if (acl_brand == ACL_BRAND_NFS4) {
if (acl_get_entry_type_np(entry, &entry_type))
err(1, "%s: acl_get_entry_type_np() "
"failed", filename);
if (acl_get_entry_type_np(entry_new, &entry_type_new))
err(1, "%s: acl_get_entry_type_np() "
"failed", filename);
if (entry_type != entry_type_new)
continue;
}
switch(tag) {
case ACL_USER:
case ACL_GROUP:
have_entry = merge_user_group(&entry,
&entry_new);
&entry_new, acl_brand);
if (have_entry == 0)
break;
/* FALLTHROUGH */
@ -123,37 +166,127 @@ merge_acl(acl_t acl, acl_t *prev_acl)
case ACL_GROUP_OBJ:
case ACL_OTHER:
case ACL_MASK:
case ACL_EVERYONE:
if (acl_get_permset(entry, &permset) == -1)
err(1, "acl_get_permset() failed");
err(1, "%s: acl_get_permset() failed",
filename);
if (acl_set_permset(entry_new, permset) == -1)
err(1, "acl_set_permset() failed");
err(1, "%s: acl_set_permset() failed",
filename);
if (acl_brand == ACL_BRAND_NFS4) {
if (acl_get_entry_type_np(entry, &entry_type))
err(1, "%s: acl_get_entry_type_np() failed",
filename);
if (acl_set_entry_type_np(entry_new, entry_type))
err(1, "%s: acl_set_entry_type_np() failed",
filename);
if (acl_get_flagset_np(entry, &flagset))
err(1, "%s: acl_get_flagset_np() failed",
filename);
if (acl_set_flagset_np(entry_new, flagset))
err(1, "%s: acl_set_flagset_np() failed",
filename);
}
have_entry = 1;
break;
default:
/* should never be here */
errx(1, "Invalid tag type: %i", tag);
errx(1, "%s: invalid tag type: %i", filename, tag);
break;
}
}
/* if this entry has not been found, it must be new */
if (have_entry == 0) {
if (acl_create_entry(&acl_new, &entry_new) == -1) {
acl_free(acl_new);
return (-1);
/*
* NFSv4 ACL entries must be prepended to the ACL.
* Appending them at the end makes no sense, since
* in most cases they wouldn't even get evaluated.
*/
if (acl_brand == ACL_BRAND_NFS4) {
if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) {
warn("%s: acl_create_entry_np() failed", filename);
acl_free(acl_new);
return (-1);
}
/*
* Without this increment, adding several
* entries at once, for example
* "setfacl -m user:1:r:allow,user:2:r:allow",
* would make them appear in reverse order.
*/
entry_number++;
} else {
if (acl_create_entry(&acl_new, &entry_new) == -1) {
warn("%s: acl_create_entry() failed", filename);
acl_free(acl_new);
return (-1);
}
}
if (acl_copy_entry(entry_new, entry) == -1)
err(1, "acl_copy_entry() failed");
err(1, "%s: acl_copy_entry() failed", filename);
}
}
if (acl_type == ACL_TYPE_ACCESS) {
acl_free(prev_acl[ACCESS_ACL]);
prev_acl[ACCESS_ACL] = acl_new;
} else {
acl_free(prev_acl[DEFAULT_ACL]);
prev_acl[DEFAULT_ACL] = acl_new;
}
acl_free(*prev_acl);
*prev_acl = acl_new;
return (0);
}
int
add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename)
{
acl_entry_t entry, entry_new;
acl_t acl_new;
int entry_id, acl_brand, prev_acl_brand;
acl_get_brand_np(acl, &acl_brand);
acl_get_brand_np(*prev_acl, &prev_acl_brand);
if (prev_acl_brand != ACL_BRAND_NFS4) {
warnx("%s: the '-a' option is only applicable to NFSv4 ACLs",
filename);
return (-1);
}
if (acl_brand != ACL_BRAND_NFS4) {
warnx("%s: branding mismatch; existing ACL is NFSv4, "
"entry to be added is POSIX.1e", filename);
return (-1);
}
acl_new = acl_dup(*prev_acl);
if (acl_new == NULL)
err(1, "%s: acl_dup() failed", filename);
entry_id = ACL_FIRST_ENTRY;
while (acl_get_entry(acl, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) {
warn("%s: acl_create_entry_np() failed", filename);
acl_free(acl_new);
return (-1);
}
/*
* Without this increment, adding several
* entries at once, for example
* "setfacl -m user:1:r:allow,user:2:r:allow",
* would make them appear in reverse order.
*/
entry_number++;
if (acl_copy_entry(entry_new, entry) == -1)
err(1, "%s: acl_copy_entry() failed", filename);
}
acl_free(*prev_acl);
*prev_acl = acl_new;
return (0);
}

View File

@ -41,21 +41,31 @@ __FBSDID("$FreeBSD$");
* remove ACL entries from an ACL
*/
int
remove_acl(acl_t acl, acl_t *prev_acl)
remove_acl(acl_t acl, acl_t *prev_acl, const char *filename)
{
acl_entry_t entry;
acl_t acl_new;
acl_tag_t tag;
int carried_error, entry_id;
int carried_error, entry_id, acl_brand, prev_acl_brand;
carried_error = 0;
if (acl_type == ACL_TYPE_ACCESS)
acl_new = acl_dup(prev_acl[ACCESS_ACL]);
else
acl_new = acl_dup(prev_acl[DEFAULT_ACL]);
acl_get_brand_np(acl, &acl_brand);
acl_get_brand_np(*prev_acl, &prev_acl_brand);
if (acl_brand != prev_acl_brand) {
warnx("%s: branding mismatch; existing ACL is %s, "
"entry to be removed is %s", filename,
prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
return (-1);
}
carried_error = 0;
acl_new = acl_dup(*prev_acl);
if (acl_new == NULL)
err(1, "acl_dup() failed");
err(1, "%s: acl_dup() failed", filename);
tag = ACL_UNDEFINED_TAG;
@ -64,23 +74,68 @@ remove_acl(acl_t acl, acl_t *prev_acl)
while (acl_get_entry(acl, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed");
err(1, "%s: acl_get_tag_type() failed", filename);
if (tag == ACL_MASK)
have_mask++;
if (acl_delete_entry(acl_new, entry) == -1) {
carried_error++;
warnx("cannot remove non-existent acl entry");
warnx("%s: cannot remove non-existent ACL entry",
filename);
}
}
if (acl_type == ACL_TYPE_ACCESS) {
acl_free(prev_acl[ACCESS_ACL]);
prev_acl[ACCESS_ACL] = acl_new;
} else {
acl_free(prev_acl[DEFAULT_ACL]);
prev_acl[DEFAULT_ACL] = acl_new;
acl_free(*prev_acl);
*prev_acl = acl_new;
if (carried_error)
return (-1);
return (0);
}
int
remove_by_number(uint entry_number, acl_t *prev_acl, const char *filename)
{
acl_entry_t entry;
acl_t acl_new;
acl_tag_t tag;
int carried_error, entry_id;
uint i;
carried_error = 0;
acl_new = acl_dup(*prev_acl);
if (acl_new == NULL)
err(1, "%s: acl_dup() failed", filename);
tag = ACL_UNDEFINED_TAG;
/*
* Find out whether we're removing the mask entry,
* to behave the same as the routine above.
*
* XXX: Is this loop actually needed?
*/
entry_id = ACL_FIRST_ENTRY;
i = 0;
while (acl_get_entry(acl_new, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (i != entry_number)
continue;
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "%s: acl_get_tag_type() failed", filename);
if (tag == ACL_MASK)
have_mask++;
}
if (acl_delete_entry_np(acl_new, entry_number) == -1) {
carried_error++;
warn("%s: acl_delete_entry_np() failed", filename);
}
acl_free(*prev_acl);
*prev_acl = acl_new;
if (carried_error)
return (-1);
@ -91,18 +146,14 @@ remove_acl(acl_t acl, acl_t *prev_acl)
* remove default entries
*/
int
remove_default(acl_t *prev_acl)
remove_default(acl_t *prev_acl, const char *filename)
{
if (prev_acl[1]) {
acl_free(prev_acl[1]);
prev_acl[1] = acl_init(ACL_MAX_ENTRIES);
if (prev_acl[1] == NULL)
err(1, "acl_init() failed");
} else {
warn("cannot remove default ACL");
return (-1);
}
acl_free(*prev_acl);
*prev_acl = acl_init(ACL_MAX_ENTRIES);
if (*prev_acl == NULL)
err(1, "%s: acl_init() failed", filename);
return (0);
}
@ -110,71 +161,14 @@ remove_default(acl_t *prev_acl)
* remove extended entries
*/
void
remove_ext(acl_t *prev_acl)
remove_ext(acl_t *prev_acl, const char *filename)
{
acl_t acl_new, acl_old;
acl_entry_t entry, entry_new;
acl_permset_t perm;
acl_tag_t tag;
int entry_id, have_mask_entry;
acl_t acl_new;
if (acl_type == ACL_TYPE_ACCESS)
acl_old = acl_dup(prev_acl[ACCESS_ACL]);
else
acl_old = acl_dup(prev_acl[DEFAULT_ACL]);
if (acl_old == NULL)
err(1, "acl_dup() failed");
have_mask_entry = 0;
acl_new = acl_init(ACL_MAX_ENTRIES);
acl_new = acl_strip_np(*prev_acl, !n_flag);
if (acl_new == NULL)
err(1, "acl_init() failed");
tag = ACL_UNDEFINED_TAG;
err(1, "%s: acl_strip_np() failed", filename);
/* only save the default user/group/other entries */
entry_id = ACL_FIRST_ENTRY;
while (acl_get_entry(acl_old, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed");
switch(tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_OTHER:
if (acl_get_tag_type(entry, &tag) == -1)
err(1, "acl_get_tag_type() failed");
if (acl_get_permset(entry, &perm) == -1)
err(1, "acl_get_permset() failed");
if (acl_create_entry(&acl_new, &entry_new) == -1)
err(1, "acl_create_entry() failed");
if (acl_set_tag_type(entry_new, tag) == -1)
err(1, "acl_set_tag_type() failed");
if (acl_set_permset(entry_new, perm) == -1)
err(1, "acl_get_permset() failed");
if (acl_copy_entry(entry_new, entry) == -1)
err(1, "acl_copy_entry() failed");
break;
case ACL_MASK:
have_mask_entry = 1;
break;
default:
break;
}
}
if (have_mask_entry && n_flag == 0) {
if (acl_calc_mask(&acl_new) == -1)
err(1, "acl_calc_mask() failed");
} else {
have_mask = 1;
}
if (acl_type == ACL_TYPE_ACCESS) {
acl_free(prev_acl[ACCESS_ACL]);
prev_acl[ACCESS_ACL] = acl_new;
} else {
acl_free(prev_acl[DEFAULT_ACL]);
prev_acl[DEFAULT_ACL] = acl_new;
}
acl_free(*prev_acl);
*prev_acl = acl_new;
}

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 7, 2001
.Dd September 5, 2009
.Dt SETFACL 1
.Os
.Sh NAME
@ -34,9 +34,10 @@
.Sh SYNOPSIS
.Nm
.Op Fl bdhkn
.Op Fl a Ar position entries
.Op Fl m Ar entries
.Op Fl M Ar file
.Op Fl x Ar entries
.Op Fl x Ar entries | position
.Op Fl X Ar file
.Op Ar
.Sh DESCRIPTION
@ -50,9 +51,19 @@ the file names are taken from the standard input.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl a Ar position entries
Modify the ACL on the specified files by inserting new
ACL entries
specified in
.Ar entries ,
starting at position
.Ar position ,
counting from zero.
This option is only applicable to NFSv4 ACLs.
.It Fl b
Remove all ACL entries except for the three required entries.
If the ACL contains a
Remove all ACL entries except for the three required entries
(POSIX.1e ACLs) or six "canonical" entries (NFSv4 ACLs).
If the POSIX.1e ACL contains a
.Dq Li mask
entry, the permissions of the
.Dq Li group
@ -66,7 +77,7 @@ entries of the current ACL.
The operations apply to the default ACL entries instead of
access ACL entries.
Currently only directories may have
default ACL's.
default ACL's. This option is not applicable to NFSv4 ACLs.
.It Fl h
If the target of the operation is a symbolic link, perform the operation
on the symbolic link itself, rather than following the link.
@ -77,7 +88,7 @@ is not considered an error if the specified files do not have
any default ACL entries.
An error will be reported if any of
the specified files cannot have a default entry (i.e.\&
non-directories).
non-directories). This option is not applicable to NFSv4 ACLs.
.It Fl m Ar entries
Modify the ACL entries on the specified files by adding new
entries and modifying existing ACL entries with the ACL entries
@ -95,11 +106,15 @@ is
the input is taken from stdin.
.It Fl n
Do not recalculate the permissions associated with the ACL
mask entry.
.It Fl x Ar entries
Remove the ACL entries specified in
mask entry. This option is not applicable to NFSv4 ACLs.
.It Fl x Ar entries | position
If
.Ar entries
is specified, remove the ACL entries specified there
from the access or default ACL of the specified files.
Otherwise, remove entry at index
.Ar position ,
counting from zero.
.It Fl X Ar file
Remove the ACL entries specified in the file
.Ar file
@ -108,8 +123,8 @@ from the access or default ACL of the specified files.
.Pp
The above options are evaluated in the order specified
on the command-line.
.Sh ACL ENTRIES
An ACL entry contains three colon-separated fields:
.Sh POSIX.1e ACL ENTRIES
A POSIX.1E ACL entry contains three colon-separated fields:
an ACL tag, an ACL qualifier, and discretionary access
permissions:
.Bl -tag -width indent
@ -223,7 +238,7 @@ previously specified; whitespace is ignored; any text after a
.Ql #
is ignored (comments).
.Pp
When ACL entries are evaluated, the access check algorithm checks
When POSIX.1e ACL entries are evaluated, the access check algorithm checks
the ACL entries in the following order: file owner,
.Dq Li user
ACL entries, file owning group,
@ -243,13 +258,135 @@ ACL entries for user, group, other and mask must be set.
For more details see the examples below.
Default ACLs can be created by using
.Fl d .
.Sh NFSv4 ACL ENTRIES
An NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag,
an ACL qualifier (only for
.Dq Li user
and
.Dq Li group
tags), discretionary access permissions, ACL inheritance flags, and ACL type:
.Bl -tag -width indent
.It Ar "ACL tag"
The ACL tag specifies the ACL entry type and consists of
one of the following:
.Dq Li user
or
.Ql u
specifying the access
granted to the specified user;
.Dq Li group
or
.Ql g
specifying the access granted to the specified group;
.Dq Li owner@
specifying the access granted to the owner of the file;
.Dq Li group@
specifying the access granted to the file owning group;
.Dq Li everyone@
specifying everyone. Note that
.Dq Li everyone@
is not the same as traditional Unix
.Dq Li other
- it means,
literally, everyone, including file owner and owning group.
.It Ar "ACL qualifier"
The ACL qualifier field describes the user or group associated with
the ACL entry.
It may consist of one of the following: uid or
user name, or gid or group name. In entries whose tag type is
one of
.Dq Li owner@ ,
.Dq Li group@ ,
or
.Dq Li everyone@ ,
this field is ommited altogether, including the trailing comma.
.It Ar "access permissions"
Access permissions may be specified in either short or long form.
Short and long forms may not be mixed.
Permissions in long form are separated by the
.Ql /
character; in short form, they are concatenated together.
Valid permissions are:
.Bl -tag -width ".Dv short"
.It Short
Long
.It r
read_data
.It w
write_data
.It x
execute
.It p
append_data
.It d
delete_child
.It D
delete
.It a
read_attributes
.It A
write_attributes
.It R
read_xattr
.It W
write_xattr
.It c
read_acl
.It C
write_acl
.It o
write_owner
.It S
synchronize
.El
.It Ar "ACL inheritance flags"
Inheritance flags may be specified in either short or long form.
Short and long forms may not be mixed.
Access flags in long form are separated by the
.Ql /
character; in short form, they are concatenated together.
Valid inheritance flags are:
.Bl -tag -width ".Dv short"
.It Short
Long
.It f
file_inherit
.It d
dir_inherit
.It i
inherit_only
.It n
no_propagate
.El
.Pp
Inheritance flags may be only set on directories.
.It Ar "ACL type"
The ACL type field is either
.Dq Li allow
or
.Dq Li deny .
.El
.Pp
ACL entries applied from a file using the
.Fl M
or
.Fl X
options shall be of the following form: one ACL entry per line, as
previously specified; whitespace is ignored; any text after a
.Ql #
is ignored (comments).
.Pp
NFSv4 ACL entries are evaluated in their visible order.
.Pp
Multiple ACL entries specified on the command line are
separated by commas.
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
.Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir
.Dl setfacl -d -m g:admins:rwx dir
.Pp
The first command sets the mandatory elements of the default ACL.
The first command sets the mandatory elements of the POSIX.1e default ACL.
The second command specifies that users in group admins can have read, write, and execute
permissions for directory named "dir".
It should be noted that any files or directories created underneath "dir" will
@ -259,9 +396,13 @@ inherit these default ACLs upon creation.
.Pp
Sets read, write, and execute permissions for the
.Pa file
owner's ACL entry and read and write permissions for group mail on
owner's POSIX.1e ACL entry and read and write permissions for group mail on
.Pa file .
.Pp
.Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file
.Pp
Semantically equal to the example above, but for NFSv4 ACL.
.Pp
.Dl setfacl -M file1 file2
.Pp
Sets/updates the ACL entries contained in
@ -271,10 +412,15 @@ on
.Pp
.Dl setfacl -x g:mail:rw file
.Pp
Remove the group mail ACL entry containing read/write permissions
Remove the group mail POSIX.1e ACL entry containing read/write permissions
from
.Pa file .
.Pp
.Dl setfacl -x0 file
.Pp
Remove the first entry from the NFSv4 ACL from
.Pa file .
.Pp
.Dl setfacl -bn file
.Pp
Remove all

View File

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -41,9 +42,8 @@ __FBSDID("$FreeBSD$");
#include "setfacl.h"
static void add_filename(const char *filename);
static acl_t *get_file_acls(const char *filename);
static void usage(void);
static void add_filename(const char *filename);
static void usage(void);
static void
add_filename(const char *filename)
@ -59,57 +59,28 @@ add_filename(const char *filename)
TAILQ_INSERT_TAIL(&filelist, file, next);
}
static acl_t *
get_file_acls(const char *filename)
{
acl_t *acl;
struct stat sb;
if (stat(filename, &sb) == -1) {
warn("stat() of %s failed", filename);
return (NULL);
}
acl = zmalloc(sizeof(acl_t) * 2);
if (h_flag)
acl[ACCESS_ACL] = acl_get_link_np(filename, ACL_TYPE_ACCESS);
else
acl[ACCESS_ACL] = acl_get_file(filename, ACL_TYPE_ACCESS);
if (acl[ACCESS_ACL] == NULL)
err(1, "acl_get_file() failed");
if (S_ISDIR(sb.st_mode)) {
if (h_flag)
acl[DEFAULT_ACL] = acl_get_link_np(filename,
ACL_TYPE_DEFAULT);
else
acl[DEFAULT_ACL] = acl_get_file(filename,
ACL_TYPE_DEFAULT);
if (acl[DEFAULT_ACL] == NULL)
err(1, "acl_get_file() failed");
} else
acl[DEFAULT_ACL] = NULL;
return (acl);
}
static void
usage(void)
{
fprintf(stderr, "usage: setfacl [-bdhkn] [-m entries] [-M file] "
"[-x entries] [-X file] [file ...]\n");
fprintf(stderr, "usage: setfacl [-bdhkn] [-a position entries] "
"[-m entries] [-M file] [-x entries] [-X file] [file ...]\n");
exit(1);
}
int
main(int argc, char *argv[])
{
acl_t *acl, final_acl;
acl_t acl;
acl_type_t acl_type;
char filename[PATH_MAX];
int local_error, carried_error, ch, i;
int local_error, carried_error, ch, i, entry_number, ret;
int h_flag;
struct sf_file *file;
struct sf_entry *entry;
const char *fn_dup;
char *end;
struct stat sb;
acl_type = ACL_TYPE_ACCESS;
carried_error = local_error = 0;
@ -118,13 +89,13 @@ main(int argc, char *argv[])
TAILQ_INIT(&entrylist);
TAILQ_INIT(&filelist);
while ((ch = getopt(argc, argv, "M:X:bdhkm:nx:")) != -1)
while ((ch = getopt(argc, argv, "M:X:a:bdhkm:nx:")) != -1)
switch(ch) {
case 'M':
entry = zmalloc(sizeof(struct sf_entry));
entry->acl = get_acl_from_file(optarg);
if (entry->acl == NULL)
err(1, "get_acl_from_file() failed");
err(1, "%s: get_acl_from_file() failed", optarg);
entry->op = OP_MERGE_ACL;
TAILQ_INSERT_TAIL(&entrylist, entry, next);
break;
@ -134,6 +105,25 @@ main(int argc, char *argv[])
entry->op = OP_REMOVE_ACL;
TAILQ_INSERT_TAIL(&entrylist, entry, next);
break;
case 'a':
entry = zmalloc(sizeof(struct sf_entry));
entry_number = strtol(optarg, &end, 10);
if (end - optarg != (int)strlen(optarg))
errx(1, "%s: invalid entry number", optarg);
if (entry_number < 0)
errx(1, "%s: entry number cannot be less than zero", optarg);
entry->entry_number = entry_number;
if (argv[optind] == NULL)
errx(1, "missing ACL");
entry->acl = acl_from_text(argv[optind]);
if (entry->acl == NULL)
err(1, "%s", argv[optind]);
optind++;
entry->op = OP_ADD_ACL;
TAILQ_INSERT_TAIL(&entrylist, entry, next);
break;
case 'b':
entry = zmalloc(sizeof(struct sf_entry));
entry->op = OP_REMOVE_EXT;
@ -163,10 +153,18 @@ main(int argc, char *argv[])
break;
case 'x':
entry = zmalloc(sizeof(struct sf_entry));
entry->acl = acl_from_text(optarg);
if (entry->acl == NULL)
err(1, "%s", optarg);
entry->op = OP_REMOVE_ACL;
entry_number = strtol(optarg, &end, 10);
if (end - optarg == (int)strlen(optarg)) {
if (entry_number < 0)
errx(1, "%s: entry number cannot be less than zero", optarg);
entry->entry_number = entry_number;
entry->op = OP_REMOVE_BY_NUMBER;
} else {
entry->acl = acl_from_text(optarg);
if (entry->acl == NULL)
err(1, "%s", optarg);
entry->op = OP_REMOVE_ACL;
}
TAILQ_INSERT_TAIL(&entrylist, entry, next);
break;
default:
@ -199,16 +197,51 @@ main(int argc, char *argv[])
/* cycle through each file */
TAILQ_FOREACH(file, &filelist, next) {
/* get our initial access and default ACL's */
acl = get_file_acls(file->filename);
if (acl == NULL)
continue;
if ((acl_type == ACL_TYPE_DEFAULT) && !acl[1]) {
warnx("Default ACL not valid for %s", file->filename);
local_error = 0;
if (stat(file->filename, &sb) == -1) {
warn("%s: stat() failed", file->filename);
continue;
}
local_error = 0;
if (acl_type == ACL_TYPE_DEFAULT && S_ISDIR(sb.st_mode) == 0) {
warnx("%s: default ACL may only be set on a directory",
file->filename);
continue;
}
if (h_flag)
ret = lpathconf(file->filename, _PC_ACL_NFS4);
else
ret = pathconf(file->filename, _PC_ACL_NFS4);
if (ret > 0) {
if (acl_type == ACL_TYPE_DEFAULT) {
warnx("%s: there are no default entries "
"in NFSv4 ACLs", file->filename);
continue;
}
acl_type = ACL_TYPE_NFS4;
} else if (ret == 0) {
if (acl_type == ACL_TYPE_NFS4)
acl_type = ACL_TYPE_ACCESS;
} else if (ret < 0 && errno != EINVAL) {
warn("%s: pathconf(..., _PC_ACL_NFS4) failed",
file->filename);
}
if (h_flag)
acl = acl_get_link_np(file->filename, acl_type);
else
acl = acl_get_file(file->filename, acl_type);
if (acl == NULL) {
if (h_flag)
warn("%s: acl_get_link_np() failed",
file->filename);
else
warn("%s: acl_get_file() failed",
file->filename);
continue;
}
/* cycle through each option */
TAILQ_FOREACH(entry, &entrylist, next) {
@ -216,24 +249,44 @@ main(int argc, char *argv[])
continue;
switch(entry->op) {
case OP_ADD_ACL:
local_error += add_acl(entry->acl,
entry->entry_number, &acl, file->filename);
break;
case OP_MERGE_ACL:
local_error += merge_acl(entry->acl, acl);
local_error += merge_acl(entry->acl, &acl,
file->filename);
need_mask = 1;
break;
case OP_REMOVE_EXT:
remove_ext(acl);
remove_ext(&acl, file->filename);
need_mask = 0;
break;
case OP_REMOVE_DEF:
if (acl_type == ACL_TYPE_NFS4) {
warnx("%s: there are no default entries in NFSv4 ACLs; "
"cannot remove", file->filename);
local_error++;
break;
}
if (acl_delete_def_file(file->filename) == -1) {
warn("acl_delete_def_file() failed");
warn("%s: acl_delete_def_file() failed",
file->filename);
local_error++;
}
local_error += remove_default(acl);
if (acl_type == ACL_TYPE_DEFAULT)
local_error += remove_default(&acl,
file->filename);
need_mask = 0;
break;
case OP_REMOVE_ACL:
local_error += remove_acl(entry->acl, acl);
local_error += remove_acl(entry->acl, &acl,
file->filename);
need_mask = 1;
break;
case OP_REMOVE_BY_NUMBER:
local_error += remove_by_number(entry->entry_number,
&acl, file->filename);
need_mask = 1;
break;
}
@ -245,35 +298,27 @@ main(int argc, char *argv[])
continue;
}
if (acl_type == ACL_TYPE_ACCESS) {
final_acl = acl[ACCESS_ACL];
acl_free(acl[DEFAULT_ACL]);
} else {
final_acl = acl[DEFAULT_ACL];
acl_free(acl[ACCESS_ACL]);
}
if (need_mask && (set_acl_mask(&final_acl) == -1)) {
warnx("failed to set ACL mask on %s", file->filename);
if (acl_type != ACL_TYPE_NFS4 && need_mask &&
set_acl_mask(&acl, file->filename) == -1) {
warnx("%s: failed to set ACL mask", file->filename);
carried_error++;
} else if (h_flag) {
if (acl_set_link_np(file->filename, acl_type,
final_acl) == -1) {
acl) == -1) {
carried_error++;
warn("acl_set_link_np() failed for %s",
warn("%s: acl_set_link_np() failed",
file->filename);
}
} else {
if (acl_set_file(file->filename, acl_type,
final_acl) == -1) {
acl) == -1) {
carried_error++;
warn("acl_set_file() failed for %s",
warn("%s: acl_set_file() failed",
file->filename);
}
}
acl_free(final_acl);
free(acl);
acl_free(acl);
}
return (carried_error);

View File

@ -38,15 +38,14 @@
#define OP_REMOVE_DEF 0x01 /* remove default acl's (-k) */
#define OP_REMOVE_EXT 0x02 /* remove extended acl's (-b) */
#define OP_REMOVE_ACL 0x03 /* remove acl's (-xX) */
/* ACL types for the acl array */
#define ACCESS_ACL 0
#define DEFAULT_ACL 1
#define OP_REMOVE_BY_NUMBER 0x04 /* remove acl's (-xX) by acl entry number */
#define OP_ADD_ACL 0x05 /* add acls entries at a given position */
/* TAILQ entry for acl operations */
struct sf_entry {
uint op;
acl_t acl;
uint entry_number;
TAILQ_ENTRY(sf_entry) next;
};
TAILQ_HEAD(, sf_entry) entrylist;
@ -61,21 +60,21 @@ TAILQ_HEAD(, sf_file) filelist;
/* files.c */
acl_t get_acl_from_file(const char *filename);
/* merge.c */
int merge_acl(acl_t acl, acl_t *prev_acl);
int merge_acl(acl_t acl, acl_t *prev_acl, const char *filename);
int add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename);
/* remove.c */
int remove_acl(acl_t acl, acl_t *prev_acl);
int remove_default(acl_t *prev_acl);
void remove_ext(acl_t *prev_acl);
int remove_acl(acl_t acl, acl_t *prev_acl, const char *filename);
int remove_by_number(uint entry_number, acl_t *prev_acl, const char *filename);
int remove_default(acl_t *prev_acl, const char *filename);
void remove_ext(acl_t *prev_acl, const char *filename);
/* mask.c */
int set_acl_mask(acl_t *prev_acl);
int set_acl_mask(acl_t *prev_acl, const char *filename);
/* util.c */
void *zmalloc(size_t size);
acl_type_t acl_type;
uint have_mask;
uint need_mask;
uint have_stdin;
uint h_flag;
uint n_flag;
#endif /* _SETFACL_H */

View File

@ -785,6 +785,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
INTOFF;
savelocalvars = localvars;
localvars = NULL;
reffunc(cmdentry.u.func);
INTON;
savehandler = handler;
if (setjmp(jmploc.loc)) {
@ -794,6 +795,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
freeparam(&shellparam);
shellparam = saveparam;
}
unreffunc(cmdentry.u.func);
poplocalvars();
localvars = savelocalvars;
handler = savehandler;
@ -805,11 +807,12 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
funcnest++;
exitstatus = oexitstatus;
if (flags & EV_TESTED)
evaltree(cmdentry.u.func, EV_TESTED);
evaltree(getfuncnode(cmdentry.u.func), EV_TESTED);
else
evaltree(cmdentry.u.func, 0);
evaltree(getfuncnode(cmdentry.u.func), 0);
funcnest--;
INTOFF;
unreffunc(cmdentry.u.func);
poplocalvars();
localvars = savelocalvars;
freeparam(&shellparam);

View File

@ -286,7 +286,7 @@ printentry(struct tblentry *cmdp, int verbose)
out1fmt("function %s", cmdp->cmdname);
if (verbose) {
INTOFF;
name = commandtext(cmdp->param.func);
name = commandtext(getfuncnode(cmdp->param.func));
out1c(' ');
out1str(name);
ckfree(name);
@ -583,7 +583,7 @@ deletefuncs(void)
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDFUNCTION) {
*pp = cmdp->next;
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
ckfree(cmdp);
} else {
pp = &cmdp->next;
@ -670,7 +670,7 @@ addcmdentry(char *name, struct cmdentry *entry)
INTOFF;
cmdp = cmdlookup(name, 1);
if (cmdp->cmdtype == CMDFUNCTION) {
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
}
cmdp->cmdtype = entry->cmdtype;
cmdp->param = entry->u;
@ -705,7 +705,7 @@ unsetfunc(char *name)
struct tblentry *cmdp;
if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) {
freefunc(cmdp->param.func);
unreffunc(cmdp->param.func);
delete_cmd_entry();
return (0);
}

View File

@ -46,11 +46,12 @@ enum {
TYPECMD_TYPE /* type */
};
union node;
struct cmdentry {
int cmdtype;
union param {
int index;
union node *func;
struct funcdef *func;
} u;
int special;
};

View File

@ -248,8 +248,11 @@ output(char *file)
fputs("\tstruct nodelist *next;\n", hfile);
fputs("\tunion node *n;\n", hfile);
fputs("};\n\n\n", hfile);
fputs("union node *copyfunc(union node *);\n", hfile);
fputs("void freefunc(union node *);\n", hfile);
fputs("struct funcdef;\n", hfile);
fputs("struct funcdef *copyfunc(union node *);\n", hfile);
fputs("union node *getfuncnode(struct funcdef *);\n", hfile);
fputs("void reffunc(struct funcdef *);\n", hfile);
fputs("void unreffunc(struct funcdef *);\n", hfile);
fputs(writer, cfile);
while (fgets(line, sizeof line, patfile) != NULL) {

View File

@ -35,6 +35,7 @@
#include <sys/param.h>
#include <stdlib.h>
#include <stddef.h>
/*
* Routine for dealing with parsed shell commands.
*/
@ -60,25 +61,40 @@ STATIC struct nodelist *copynodelist(struct nodelist *);
STATIC char *nodesavestr(char *);
struct funcdef {
unsigned int refcount;
union node n;
};
/*
* Make a copy of a parse tree.
*/
union node *
struct funcdef *
copyfunc(union node *n)
{
struct funcdef *fn;
if (n == NULL)
return NULL;
funcblocksize = 0;
funcblocksize = offsetof(struct funcdef, n);
funcstringsize = 0;
calcsize(n);
funcblock = ckmalloc(funcblocksize + funcstringsize);
funcstring = (char *)funcblock + funcblocksize;
return copynode(n);
fn = ckmalloc(funcblocksize + funcstringsize);
fn->refcount = 1;
funcblock = (char *)fn + offsetof(struct funcdef, n);
funcstring = (char *)fn + funcblocksize;
copynode(n);
return fn;
}
union node *
getfuncnode(struct funcdef *fn)
{
return fn == NULL ? NULL : &fn->n;
}
STATIC void
calcsize(union node *n)
@ -144,14 +160,26 @@ nodesavestr(char *s)
}
void
reffunc(struct funcdef *fn)
{
if (fn)
fn->refcount++;
}
/*
* Free a parse tree.
* Decrement the reference count of a function definition, freeing it
* if it falls to 0.
*/
void
freefunc(union node *n)
unreffunc(struct funcdef *fn)
{
if (n)
ckfree(n);
if (fn) {
fn->refcount--;
if (fn->refcount > 0)
return;
ckfree(fn);
}
}

View File

@ -1322,6 +1322,14 @@ dump_label(const char *dev)
exit(1);
}
if (S_ISCHR(statbuf.st_mode)) {
if (ioctl(fd, DIOCGMEDIASIZE, &statbuf.st_size) == -1) {
(void) printf("failed to get size of '%s': %s\n", dev,
strerror(errno));
exit(1);
}
}
psize = statbuf.st_size;
psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t));

View File

@ -172,6 +172,7 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
*tab = '\0';
if (strcmp(buf, mountpoint) == 0) {
#if defined(sun)
/*
* the protocol field is the third field
* skip over second field
@ -194,6 +195,10 @@ is_shared(libzfs_handle_t *hdl, const char *mountpoint, zfs_share_proto_t proto)
return (0);
}
}
#else
if (proto == PROTO_NFS)
return (SHARED_NFS);
#endif
}
}

View File

@ -1126,7 +1126,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
uint64_t originguid = 0;
uint64_t stream_originguid = 0;
uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid;
char *fsname, *stream_fsname;
char *fsname, *stream_fsname, *p1, *p2;
nextfselem = nvlist_next_nvpair(local_nv, fselem);
@ -1295,10 +1295,11 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
"parentfromsnap", &stream_parent_fromsnap_guid));
/* check for rename */
p1 = strrchr(fsname, '/');
p2 = strrchr(stream_fsname, '/');
if ((stream_parent_fromsnap_guid != 0 &&
stream_parent_fromsnap_guid != parent_fromsnap_guid) ||
strcmp(strrchr(fsname, '/'),
strrchr(stream_fsname, '/')) != 0) {
(p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0)) {
nvlist_t *parent;
char tryname[ZFS_MAXNAMELEN];
@ -1317,7 +1318,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
VERIFY(0 == nvlist_lookup_string(parent, "name",
&pname));
(void) snprintf(tryname, sizeof (tryname),
"%s%s", pname, strrchr(stream_fsname, '/'));
"%s%s", pname, p2 != NULL ? p2 : "");
} else {
tryname[0] = '\0';
if (flags.verbose) {

View File

@ -13,5 +13,6 @@ SRCS= libnvpair.c \
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../../sys
.include <bsd.lib.mk>

View File

@ -2,6 +2,4 @@
Project: bzip2
ProjectURL: http://www.bzip.org/
Version: 1.0.5
VendorTag: BZIP2
VersionTag: v1_0_5
License: BSD

View File

@ -72,10 +72,7 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
#include <curses.h>
#endif
#ifdef HAS_CTYPE
#include <ctype.h>
#endif
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
@ -83,6 +80,7 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
#include <errno.h>
#include <string.h>
#include <pwd.h>
#include <locale.h>
#ifdef HAS_SYS_WAIT
#include <sys/wait.h>
@ -100,9 +98,7 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.102 $";
#include <unistd.h>
#endif
#ifndef NO_CATGETS
#include <locale.h>
#include <nl_types.h>
nl_catd catalog;
@ -726,7 +722,7 @@ int character; /* new character */
}
*point = character; /* insert new character */
wclrtoeol(text_win);
if (((character >= 0) && (character < ' ')) || (character >= 127)) /* check for TAB character*/
if (!isprint((unsigned char)character)) /* check for TAB character*/
{
scr_pos = scr_horz += out_char(text_win, character, scr_horz);
point++;
@ -734,7 +730,7 @@ int character; /* new character */
}
else
{
waddch(text_win, character);
waddch(text_win, (unsigned char)character);
scr_pos = ++scr_horz;
point++;
position ++;
@ -969,17 +965,17 @@ int column;
}
else
{
waddch(window, (char)character );
waddch(window, (unsigned char)character );
return(1);
}
}
else
{
waddch(window, (char)character);
waddch(window, (unsigned char)character);
return(1);
}
for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++)
waddch(window, string[i2]);
waddch(window, (unsigned char)string[i2]);
return(strlen(string));
}
@ -1044,7 +1040,7 @@ int length; /* length (in bytes) of line */
wclrtoeol(text_win);
while ((posit < length) && (column <= last_col))
{
if ((*temp < 32) || (*temp >= 127))
if (!isprint(*temp))
{
column += len_char(*temp, abs_column);
abs_column += out_char(text_win, *temp, abs_column);
@ -1923,13 +1919,13 @@ int advance; /* if true, skip leading spaces and tabs */
}
*nam_str = in;
g_pos++;
if (((in < ' ') || (in > 126)) && (g_horz < (last_col - 1)))
if (!isprint((unsigned char)in) && (g_horz < (last_col - 1)))
g_horz += out_char(com_win, in, g_horz);
else
{
g_horz++;
if (g_horz < (last_col - 1))
waddch(com_win, in);
waddch(com_win, (unsigned char)in);
}
nam_str++;
}
@ -1974,7 +1970,7 @@ int sensitive;
}
else
{
if (toupper(*strng1) != toupper(*strng2))
if (toupper((unsigned char)*strng1) != toupper((unsigned char)*strng2))
equal = FALSE;
}
strng1++;
@ -2446,7 +2442,7 @@ int noverify;
if ((text_changes) && (!noverify))
{
ans = get_string(changes_made_prompt, TRUE);
if (toupper(*ans) == toupper(*yes_char))
if (toupper((unsigned char)*ans) == toupper((unsigned char)*yes_char))
text_changes = FALSE;
else
return(0);
@ -2523,7 +2519,7 @@ int warn_if_exists;
if ((temp_fp = fopen(file_name, "r")))
{
tmp_point = get_string(file_exists_prompt, TRUE);
if (toupper(*tmp_point) == toupper(*yes_char))
if (toupper((unsigned char)*tmp_point) == toupper((unsigned char)*yes_char))
write_flag = TRUE;
else
write_flag = FALSE;
@ -3438,14 +3434,13 @@ struct menu_entries menu_list[];
if (input == -1)
exit(0);
if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) ||
((input >= '0') && (input <= '9')))
if (isascii(input) && isalnum(input))
{
if ((tolower(input) >= 'a') && (tolower(input) <= 'z'))
if (isalpha(input))
{
temp = 1 + tolower(input) - 'a';
}
else if ((input >= '0') && (input <= '9'))
else if (isdigit(input))
{
temp = (2 + 'z' - 'a') + (input - '0');
}
@ -5085,8 +5080,8 @@ strings_init()
{
int counter;
#ifndef NO_CATGETS
setlocale(LC_ALL, "");
#ifndef NO_CATGETS
catalog = catopen("ee", NL_CAT_LOCALE);
#endif /* NO_CATGETS */

View File

@ -485,7 +485,7 @@ extern pthread_mutex_t __gdtoa_locks[2];
_pthread_mutex_unlock(&__gdtoa_locks[n]); \
} while(0)
#define Kmax 15
#define Kmax 9
struct
Bigint {

View File

@ -55,7 +55,9 @@ Balloc
#endif
ACQUIRE_DTOA_LOCK(0);
if ( (rv = freelist[k]) !=0) {
/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
/* but this case seems very unlikely. */
if (k <= Kmax && (rv = freelist[k]) !=0) {
freelist[k] = rv->next;
}
else {
@ -65,7 +67,7 @@ Balloc
#else
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
/sizeof(double);
if (pmem_next - private_mem + len <= PRIVATE_mem) {
if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
rv = (Bigint*)pmem_next;
pmem_next += len;
}
@ -89,10 +91,14 @@ Bfree
#endif
{
if (v) {
ACQUIRE_DTOA_LOCK(0);
v->next = freelist[v->k];
freelist[v->k] = v;
FREE_DTOA_LOCK(0);
if (v->k > Kmax)
free((void*)v);
else {
ACQUIRE_DTOA_LOCK(0);
v->next = freelist[v->k];
freelist[v->k] = v;
FREE_DTOA_LOCK(0);
}
}
}

View File

@ -2,6 +2,4 @@
Project: netcat (aka src/usr.bin/nc in OpenBSD)
ProjectURL: http://www.openbsd.org/
Version: 4.4
VendorTag: OPENBSD
VersionTag: OPENBSD_4_4
License: BSD

View File

@ -2,7 +2,5 @@
Project: OpenPAM
ProjectURL: http://www.openpam.org/
Version: Hydrangea (20071221)
VendorTag: OPENPAM
VersionTag: OPENPAM_HYDRANGEA
License: BSD
Maintainer: des

View File

@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
lastline++;
/* now walk thru the names and print the line */
Move_to(cpustates_column, y_cpustates + cpu);
while ((thisname = *names++) != NULL)
{
if (*thisname != '\0')
@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
printf("\nCPU %d: ", cpu);
lastline++;
Move_to(cpustates_column, y_cpustates + cpu);
while ((thisname = *names++) != NULL)
{
if (*thisname != '\0')

View File

@ -63,55 +63,42 @@ struct aslookup {
};
void *
as_setup(server)
char *server;
as_setup(char *server)
{
struct aslookup *asn;
struct hostent *he = NULL;
struct servent *se;
struct sockaddr_in in;
struct addrinfo hints, *res0, *res;
FILE *f;
int s;
int s, error;
if (server == NULL)
server = getenv("RA_SERVER");
if (server == NULL)
server = DEFAULT_AS_SERVER;
(void)memset(&in, 0, sizeof(in));
in.sin_family = AF_INET;
in.sin_len = sizeof(in);
if ((se = getservbyname("whois", "tcp")) == NULL) {
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo(server, "whois", &hints, &res0);
if (error == EAI_SERVICE) {
warnx("warning: whois/tcp service not found");
in.sin_port = ntohs(43);
} else
in.sin_port = se->s_port;
if (inet_aton(server, &in.sin_addr) == 0 &&
((he = gethostbyname(server)) == NULL ||
he->h_addr == NULL)) {
warnx("%s: %s", server, hstrerror(h_errno));
error = getaddrinfo(server, "43", &hints, &res0);
}
if (error != 0) {
warnx("%s: %s", server, gai_strerror(error));
return (NULL);
}
if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
warn("socket");
return (NULL);
for (res = res0; res; res = res->ai_next) {
s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (s < 0)
continue;
if (connect(s, res->ai_addr, res->ai_addrlen) >= 0)
break;
close(s);
s = -1;
}
do {
if (he != NULL) {
memcpy(&in.sin_addr, he->h_addr, he->h_length);
he->h_addr_list++;
}
if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0)
break;
if (he == NULL || he->h_addr == NULL) {
close(s);
s = -1;
break;
}
} while (1);
if (s == -1) {
freeaddrinfo(res0);
if (s < 0) {
warn("connect");
return (NULL);
}
@ -137,23 +124,23 @@ as_setup(server)
return (asn);
}
int
as_lookup(_asn, addr)
void *_asn;
struct in_addr *addr;
unsigned int
as_lookup(void *_asn, char *addr, sa_family_t family)
{
struct aslookup *asn = _asn;
char buf[1024];
int as, rc, dlen;
unsigned int as;
int rc, dlen, plen;
as = rc = dlen = 0;
(void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr));
as = 0;
rc = dlen = 0;
plen = (family == AF_INET6) ? 128 : 32;
(void)fprintf(asn->as_f, "!r%s/%d,l\n", addr, plen);
(void)fflush(asn->as_f);
#ifdef AS_DEBUG_FILE
if (asn->as_debug) {
(void)fprintf(asn->as_debug, ">> !r%s/32,l\n",
inet_ntoa(*addr));
(void)fprintf(asn->as_debug, ">> !r%s/%d,l\n", addr, plen);
(void)fflush(asn->as_debug);
}
#endif /* AS_DEBUG_FILE */
@ -182,7 +169,7 @@ as_lookup(_asn, addr)
}
#endif /* AS_DEBUG_FILE */
break;
case 'C':
case 'C':
case 'D':
case 'E':
case 'F':
@ -209,7 +196,7 @@ as_lookup(_asn, addr)
/* origin line is the interesting bit */
if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) {
sscanf(buf + 7, " AS%d", &as);
sscanf(buf + 7, " AS%u", &as);
#ifdef AS_DEBUG_FILE
if (asn->as_debug) {
(void)fprintf(asn->as_debug, "as: %d\n", as);
@ -223,8 +210,7 @@ as_lookup(_asn, addr)
}
void
as_shutdown(_asn)
void *_asn;
as_shutdown(void *_asn)
{
struct aslookup *asn = _asn;

View File

@ -37,6 +37,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
void *as_setup __P((char *));
int as_lookup __P((void *, struct in_addr *));
void as_shutdown __P((void *));
void *as_setup(char *);
unsigned int as_lookup(void *, char *, sa_family_t);
void as_shutdown(void *);

View File

@ -1477,19 +1477,21 @@ print(register u_char *buf, register int cc, register struct sockaddr_in *from)
{
register struct ip *ip;
register int hlen;
char addr[INET_ADDRSTRLEN];
ip = (struct ip *) buf;
hlen = ip->ip_hl << 2;
cc -= hlen;
strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr));
if (as_path)
Printf(" [AS%d]", as_lookup(asn, &from->sin_addr));
Printf(" [AS%u]", as_lookup(asn, addr, AF_INET));
if (nflag)
Printf(" %s", inet_ntoa(from->sin_addr));
Printf(" %s", addr);
else
Printf(" %s (%s)", inetname(from->sin_addr),
inet_ntoa(from->sin_addr));
Printf(" %s (%s)", inetname(from->sin_addr), addr);
if (verbose)
Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst));

View File

@ -1,8 +1,6 @@
# $FreeBSD$
Project: Portable OpenSSH
ProjectURL: http://www.openssh.com/portable.html
Version: 5.1p1
VendorTag: OPENSSH
VersionTag: OpenSSH_5_1p1
Version: 5.2p1
License: BSD
Maintainer: des

View File

@ -1 +0,0 @@
../crypto/md4/md4.c

View File

@ -234,3 +234,17 @@ pqueue_next(pitem **item)
return ret;
}
int
pqueue_size(pqueue_s *pq)
{
pitem *item = pq->items;
int count = 0;
while(item != NULL)
{
count++;
item = item->next;
}
return count;
}

View File

@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq);
pitem *pqueue_next(piterator *iter);
void pqueue_print(pqueue pq);
int pqueue_size(pqueue pq);
#endif /* ! HEADER_PQUEUE_H */

View File

@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)
if ( s->d1->handshake_read_seq == frag->msg_header.seq)
{
unsigned long frag_len = frag->msg_header.frag_len;
pqueue_pop(s->d1->buffered_messages);
al=dtls1_preprocess_fragment(s,&frag->msg_header,max);
@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)
if (al==0)
{
*ok = 1;
return frag->msg_header.frag_len;
return frag_len;
}
ssl3_send_alert(s,SSL3_AL_FATAL,al);
@ -561,7 +562,16 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
goto err;
if (msg_hdr->seq <= s->d1->handshake_read_seq)
/* Try to find item in queue, to prevent duplicate entries */
pq_64bit_init(&seq64);
pq_64bit_assign_word(&seq64, msg_hdr->seq);
item = pqueue_find(s->d1->buffered_messages, seq64);
pq_64bit_free(&seq64);
/* Discard the message if sequence number was already there, is
* too far in the future or the fragment is already in the queue */
if (msg_hdr->seq <= s->d1->handshake_read_seq ||
msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL)
{
unsigned char devnull [256];
@ -575,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
}
}
frag = dtls1_hm_fragment_new(frag_len);
if ( frag == NULL)
goto err;
memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
if (frag_len)
{
/* read the body of the fragment (header has already been read */
{
frag = dtls1_hm_fragment_new(frag_len);
if ( frag == NULL)
goto err;
memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
/* read the body of the fragment (header has already been read) */
i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
frag->fragment,frag_len,0);
if (i<=0 || (unsigned long)i!=frag_len)
goto err;
}
pq_64bit_init(&seq64);
pq_64bit_assign_word(&seq64, msg_hdr->seq);
pq_64bit_init(&seq64);
pq_64bit_assign_word(&seq64, msg_hdr->seq);
item = pitem_new(seq64, frag);
pq_64bit_free(&seq64);
if ( item == NULL)
goto err;
item = pitem_new(seq64, frag);
pq_64bit_free(&seq64);
if ( item == NULL)
goto err;
pqueue_insert(s->d1->buffered_messages, item);
}
pqueue_insert(s->d1->buffered_messages, item);
return DTLS1_HM_FRAGMENT_RETRY;
err:

View File

@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, PQ_64BIT priority)
DTLS1_RECORD_DATA *rdata;
pitem *item;
/* Limit the size of the queue to prevent DOS attacks */
if (pqueue_size(queue->q) >= 100)
return 0;
rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
item = pitem_new(priority, rdata);
if (rdata == NULL || item == NULL)

View File

@ -1 +0,0 @@
../crypto/bf/bftest.c

View File

@ -1 +0,0 @@
../crypto/bn/bntest.c

View File

@ -1 +0,0 @@
../crypto/cast/casttest.c

View File

@ -1 +0,0 @@
../crypto/des/destest.c

View File

@ -1 +0,0 @@
../crypto/dh/dhtest.c

View File

@ -1 +0,0 @@
../crypto/dsa/dsatest.c

View File

@ -1 +0,0 @@
../crypto/ecdh/ecdhtest.c

View File

@ -1 +0,0 @@
../crypto/ecdsa/ecdsatest.c

View File

@ -1 +0,0 @@
../crypto/ec/ectest.c

View File

@ -1 +0,0 @@
../crypto/engine/enginetest.c

View File

@ -1 +0,0 @@
../crypto/evp/evp_test.c

View File

@ -1 +0,0 @@
../crypto/bn/exptest.c

View File

@ -1 +0,0 @@
../fips/aes/fips_aesavs.c

View File

@ -1 +0,0 @@
../fips/des/fips_desmovs.c

View File

@ -1 +0,0 @@
../fips/dsa/fips_dsatest.c

View File

@ -1 +0,0 @@
../fips/dsa/fips_dssvs.c

View File

@ -1 +0,0 @@
../fips/hmac/fips_hmactest.c

View File

@ -1 +0,0 @@
../fips/rand/fips_randtest.c

View File

@ -1 +0,0 @@
../fips/rand/fips_rngvs.c

View File

@ -1 +0,0 @@
../fips/rsa/fips_rsagtest.c

View File

@ -1 +0,0 @@
../fips/rsa/fips_rsastest.c

View File

@ -1 +0,0 @@
../fips/rsa/fips_rsavtest.c

View File

@ -1 +0,0 @@
../fips/sha/fips_shatest.c

View File

@ -1 +0,0 @@
../fips/fips_test_suite.c

View File

@ -1 +0,0 @@
../crypto/hmac/hmactest.c

View File

@ -1 +0,0 @@
../crypto/idea/ideatest.c

View File

@ -1 +0,0 @@
dummytest.c

View File

@ -1 +0,0 @@
../crypto/md2/md2test.c

View File

@ -1 +0,0 @@
../crypto/md4/md4test.c

View File

@ -1 +0,0 @@
../crypto/md5/md5test.c

View File

@ -1 +0,0 @@
dummytest.c

View File

@ -1 +0,0 @@
../crypto/rand/randtest.c

View File

@ -1 +0,0 @@
../crypto/rc2/rc2test.c

View File

@ -1 +0,0 @@
../crypto/rc4/rc4test.c

View File

@ -1 +0,0 @@
dummytest.c

View File

@ -1 +0,0 @@
../crypto/ripemd/rmdtest.c

View File

@ -1 +0,0 @@
../crypto/rsa/rsa_test.c

View File

@ -1 +0,0 @@
../crypto/sha/sha1test.c

View File

@ -1 +0,0 @@
../crypto/sha/sha256t.c

View File

@ -1 +0,0 @@
../crypto/sha/sha512t.c

View File

@ -1 +0,0 @@
../crypto/sha/shatest.c

View File

@ -1 +0,0 @@
../ssl/ssltest.c

View File

@ -99,8 +99,7 @@ BIN1+= regdomain.xml
# -rwxr-xr-x root:wheel, for the new cron root:wheel
BIN2= netstart pccard_ether rc.suspend rc.resume
MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
BSD.var.dist BSD.x11.dist BSD.x11-4.dist
MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
.if ${MK_SENDMAIL} != "no"
MTREE+= BSD.sendmail.dist
.endif

View File

@ -224,7 +224,7 @@ weekly_noid_dirs="/" # Look here
# 400.status-pkg
weekly_status_pkg_enable="NO" # Find out-of-date pkgs
pkg_version=pkg_version # Use this program
pkg_version_index=/usr/ports/INDEX-8 # Use this index file
pkg_version_index=/usr/ports/INDEX-9 # Use this index file
# 999.local
weekly_local="/etc/weekly.local" # Local scripts

View File

@ -357,6 +357,7 @@ bsnmpd_flags="" # Flags for bsnmpd.
### Network routing options: ###
defaultrouter="NO" # Set to default gateway (or NO).
static_arp_pairs="" # Set to static ARP list (or leave empty).
static_routes="" # Set to static route list (or leave empty).
natm_static_routes="" # Set to static route list for NATM (or leave empty).
gateway_enable="NO" # Set to YES if this host will be a gateway.

View File

@ -63,3 +63,14 @@ MergeChanges /etc/ /var/named/etc/ /boot/device.hints
# which *might* be installed of which FreeBSD Update should figure out
# which actually are installed and upgrade those (StrictComponents no)?
# StrictComponents no
# When installing a new kernel perform a backup of the old one first
# so it is possible to boot the old kernel in case of problems.
# BackupKernel yes
# If BackupKernel is enabled, the backup kernel is saved to this
# directory.
# BackupKernelDir /boot/kernel.old
# When backing up a kernel also back up debug symbol files?
# BackupKernelSymbolFiles no

View File

@ -8,8 +8,6 @@
#
#ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
#ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l
#ftp stream tcp nowait root /usr/libexec/lukemftpd ftpd -l -r
#ftp stream tcp6 nowait root /usr/libexec/lukemftpd ftpd -l -r
#ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4
#ssh stream tcp6 nowait root /usr/sbin/sshd sshd -i -6
#telnet stream tcp nowait root /usr/libexec/telnetd telnetd

View File

@ -104,6 +104,8 @@
..
lmc
..
mfi
..
mpt
mpilib
..

View File

@ -1,850 +0,0 @@
# $FreeBSD$
#
# Please see the file src/etc/mtree/README before making changes to this file.
#
/set type=dir uname=root gname=wheel mode=0755
.
bin
..
etc
pam.d
..
rc.d
..
..
include
..
info
..
lib
..
libdata
ldconfig
..
ldconfig32
..
pkgconfig
..
..
libexec
..
man
/set uname=man
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
de.ISO8859-1 uname=root
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
/set uname=root
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
en.ISO8859-1
/set uname=man
cat1
..
cat1aout
..
cat2
..
cat3
..
cat4
i386
..
..
cat5
..
cat6
..
cat7
..
cat8
i386
..
..
cat9
i386
..
..
catn
..
..
ja uname=root
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
/set uname=root
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
ru.KOI8-R
/set uname=man
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
/set uname=root
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
..
sbin
..
share
aclocal
..
dict
..
doc
ja
..
..
emacs
site-lisp
..
..
examples
..
java
classes
..
..
locale
af
LC_MESSAGES
..
..
am
LC_MESSAGES
..
..
ar
LC_MESSAGES
..
..
az
LC_MESSAGES
..
..
bg
LC_MESSAGES
..
..
bn
LC_MESSAGES
..
..
br
LC_MESSAGES
..
..
bs
LC_MESSAGES
..
..
cy
LC_MESSAGES
..
..
da
LC_MESSAGES
..
..
de
LC_MESSAGES
..
..
dk
LC_MESSAGES
..
..
ee
LC_MESSAGES
..
..
en
LC_MESSAGES
..
..
en_CA
LC_MESSAGES
..
..
en_GB
LC_MESSAGES
..
..
eo
LC_MESSAGES
..
..
es
LC_MESSAGES
..
..
es_ES
LC_MESSAGES
..
..
es_MX
LC_MESSAGES
..
..
et
LC_MESSAGES
..
..
eu
LC_MESSAGES
..
..
fa
LC_MESSAGES
..
..
fr
LC_MESSAGES
..
..
ga
LC_MESSAGES
..
..
gu
LC_MESSAGES
..
..
he
LC_MESSAGES
..
..
hi
LC_MESSAGES
..
..
hr
LC_MESSAGES
..
..
hu
LC_MESSAGES
..
..
id
LC_MESSAGES
..
..
is
LC_MESSAGES
..
..
it
LC_MESSAGES
..
..
ja
LC_MESSAGES
..
..
ka
LC_MESSAGES
..
..
kn
LC_MESSAGES
..
..
lt
LC_MESSAGES
..
..
lv
LC_MESSAGES
..
..
mk
LC_MESSAGES
..
..
ml
LC_MESSAGES
..
..
mn
LC_MESSAGES
..
..
ms
LC_MESSAGES
..
..
mt
LC_MESSAGES
..
..
nb
LC_MESSAGES
..
..
nl
LC_MESSAGES
..
..
or
LC_MESSAGES
..
..
pa
LC_MESSAGES
..
..
pt_BR
LC_MESSAGES
..
..
pt_PT
LC_MESSAGES
..
..
ru
LC_MESSAGES
..
..
sq
LC_MESSAGES
..
..
sr@Latn
LC_MESSAGES
..
..
sv
LC_MESSAGES
..
..
ta
LC_MESSAGES
..
..
th
LC_MESSAGES
..
..
tr
LC_MESSAGES
..
..
vi
LC_MESSAGES
..
..
wa
LC_MESSAGES
..
..
zh
LC_MESSAGES
..
..
zh_CN.GB2312
LC_MESSAGES
..
..
zh_TW.Big5
LC_MESSAGES
..
..
..
misc
..
nls
C
..
af_ZA.ISO8859-1
..
af_ZA.ISO8859-15
..
af_ZA.UTF-8
..
am_ET.UTF-8
..
be_BY.CP1131
..
be_BY.CP1251
..
be_BY.ISO8859-5
..
be_BY.UTF-8
..
bg_BG.CP1251
..
bg_BG.UTF-8
..
ca_AD.ISO8859-1
..
ca_ES.ISO8859-1
..
ca_FR.ISO8859-1
..
ca_IT.ISO8859-1
..
ca_AD.ISO8859-15
..
ca_ES.ISO8859-15
..
ca_FR.ISO8859-15
..
ca_IT.ISO8859-15
..
ca_AD.UTF-8
..
ca_ES.UTF-8
..
ca_FR.UTF-8
..
ca_IT.UTF-8
..
cs_CZ.ISO8859-2
..
cs_CZ.UTF-8
..
da_DK.ISO8859-1
..
da_DK.ISO8859-15
..
da_DK.UTF-8
..
de_AT.ISO8859-1
..
de_AT.ISO8859-15
..
de_AT.UTF-8
..
de_CH.ISO8859-1
..
de_CH.ISO8859-15
..
de_CH.UTF-8
..
de_DE.ISO8859-1
..
de_DE.ISO8859-15
..
de_DE.UTF-8
..
el_GR.ISO8859-7
..
el_GR.UTF-8
..
en_AU.ISO8859-1
..
en_AU.ISO8859-15
..
en_AU.US-ASCII
..
en_AU.UTF-8
..
en_CA.ISO8859-1
..
en_CA.ISO8859-15
..
en_CA.US-ASCII
..
en_CA.UTF-8
..
en_GB.ISO8859-1
..
en_GB.ISO8859-15
..
en_GB.US-ASCII
..
en_GB.UTF-8
..
en_IE.UTF-8
..
en_NZ.ISO8859-1
..
en_NZ.ISO8859-15
..
en_NZ.US-ASCII
..
en_NZ.UTF-8
..
en_US.ISO8859-1
..
en_US.ISO8859-15
..
en_US.UTF-8
..
es_ES.ISO8859-1
..
es_ES.ISO8859-15
..
es_ES.UTF-8
..
et_EE.ISO8859-15
..
et_EE.UTF-8
..
fi_FI.ISO8859-1
..
fi_FI.ISO8859-15
..
fi_FI.UTF-8
..
fr_BE.ISO8859-1
..
fr_BE.ISO8859-15
..
fr_BE.UTF-8
..
fr_CA.ISO8859-1
..
fr_CA.ISO8859-15
..
fr_CA.UTF-8
..
fr_CH.ISO8859-1
..
fr_CH.ISO8859-15
..
fr_CH.UTF-8
..
fr_FR.ISO8859-1
..
fr_FR.ISO8859-15
..
fr_FR.UTF-8
..
he_IL.UTF-8
..
hi_IN.ISCII-DEV
..
hr_HR.ISO8859-2
..
hr_HR.UTF-8
..
hu_HU.ISO8859-2
..
hu_HU.UTF-8
..
hy_AM.ARMSCII-8
..
hy_AM.UTF-8
..
is_IS.ISO8859-1
..
is_IS.ISO8859-15
..
is_IS.UTF-8
..
it_CH.ISO8859-1
..
it_CH.ISO8859-15
..
it_CH.UTF-8
..
it_IT.ISO8859-1
..
it_IT.ISO8859-15
..
it_IT.UTF-8
..
ja_JP.SJIS
..
ja_JP.UTF-8
..
ja_JP.eucJP
..
kk_KZ.PT154
..
kk_KZ.UTF-8
..
ko_KR.CP949
..
ko_KR.UTF-8
..
ko_KR.eucKR
..
la_LN.ISO8859-1
..
la_LN.ISO8859-15
..
la_LN.ISO8859-2
..
la_LN.ISO8859-4
..
la_LN.US-ASCII
..
lt_LT.ISO8859-13
..
lt_LT.ISO8859-4
..
lt_LT.UTF-8
..
nl_BE.ISO8859-1
..
nl_BE.ISO8859-15
..
nl_BE.UTF-8
..
nl_NL.ISO8859-1
..
nl_NL.ISO8859-15
..
nl_NL.UTF-8
..
no_NO.ISO8859-1
..
no_NO.ISO8859-15
..
no_NO.UTF-8
..
pl_PL.ISO8859-2
..
pl_PL.UTF-8
..
pt_BR.ISO8859-1
..
pt_BR.UTF-8
..
pt_PT.ISO8859-1
..
pt_PT.ISO8859-15
..
pt_PT.UTF-8
..
ro_RO.ISO8859-2
..
ro_RO.UTF-8
..
ru_RU.CP1251
..
ru_RU.CP866
..
ru_RU.ISO8859-5
..
ru_RU.KOI8-R
..
ru_RU.UTF-8
..
sk_SK.ISO8859-2
..
sk_SK.UTF-8
..
sl_SI.ISO8859-2
..
sl_SI.UTF-8
..
sr_YU.ISO8859-2
..
sr_YU.ISO8859-5
..
sr_YU.UTF-8
..
sv_SE.ISO8859-1
..
sv_SE.ISO8859-15
..
sv_SE.UTF-8
..
tr_TR.ISO8859-9
..
tr_TR.UTF-8
..
uk_UA.ISO8859-5
..
uk_UA.KOI8-U
..
uk_UA.UTF-8
..
zh_CN.GB18030
..
zh_CN.GB2312
..
zh_CN.GBK
..
zh_CN.UTF-8
..
zh_CN.eucCN
..
zh_HK.Big5HKSCS
..
zh_HK.UTF-8
..
zh_TW.Big5
..
zh_TW.UTF-8
..
..
sgml
..
skel
..
xml
..
..
www
..
..

View File

@ -553,6 +553,8 @@
..
la_LN.ISO8859-1
..
la_LN.ISO8859-13
..
la_LN.ISO8859-15
..
la_LN.ISO8859-2
@ -567,6 +569,10 @@
..
lt_LT.UTF-8
..
lv_LV.ISO8859-13
..
lv_LV.UTF-8
..
mn_MN.UTF-8
..
nb_NO.ISO8859-1
@ -1077,6 +1083,8 @@
..
la_LN.ISO8859-1
..
la_LN.ISO8859-13
..
la_LN.ISO8859-15
..
la_LN.ISO8859-2
@ -1091,6 +1099,10 @@
..
lt_LT.UTF-8
..
lv_LV.ISO8859-13
..
lv_LV.UTF-8
..
mn_MN.UTF-8
..
nl_BE.ISO8859-1

View File

@ -1,488 +0,0 @@
# $FreeBSD$
#
# Please see the file src/etc/mtree/README before making changes to this file.
#
/set type=dir uname=root gname=wheel mode=0755
.
bin
..
etc
rc.d
..
..
include
X11
..
..
info
..
lib
X11
app-defaults
..
fonts
local
..
..
..
..
libdata
ldconfig
..
ldconfig32
..
pkgconfig
..
..
libexec
..
man
/set uname=man
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
ja uname=root
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
/set uname=root
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
share
aclocal
..
doc
ja
..
..
examples
..
locale
af
LC_MESSAGES
..
..
am
LC_MESSAGES
..
..
ar
LC_MESSAGES
..
..
az
LC_MESSAGES
..
..
be
LC_MESSAGES
..
..
bg
LC_MESSAGES
..
..
bn
LC_MESSAGES
..
..
bs
LC_MESSAGES
..
..
ca
LC_MESSAGES
..
..
cs
LC_MESSAGES
..
..
cy
LC_MESSAGES
..
..
da
LC_MESSAGES
..
..
de
LC_MESSAGES
..
..
de_AT
LC_MESSAGES
..
..
el
LC_MESSAGES
..
..
en
LC_MESSAGES
..
..
en_AU
LC_MESSAGES
..
..
en_CA
LC_MESSAGES
..
..
en_GB
LC_MESSAGES
..
..
eo
LC_MESSAGES
..
..
es
LC_MESSAGES
..
..
es_ES
LC_MESSAGES
..
..
es_MX
LC_MESSAGES
..
..
et
LC_MESSAGES
..
..
eu
LC_MESSAGES
..
..
fa
LC_MESSAGES
..
..
fa_IR
LC_MESSAGES
..
..
fi
LC_MESSAGES
..
..
fr
LC_MESSAGES
..
..
fr_FR
LC_MESSAGES
..
..
ga
LC_MESSAGES
..
..
gl
LC_MESSAGES
..
..
gu
LC_MESSAGES
..
..
he
LC_MESSAGES
..
..
hi
LC_MESSAGES
..
..
hr
LC_MESSAGES
..
..
hu
LC_MESSAGES
..
..
id
LC_MESSAGES
..
..
is
LC_MESSAGES
..
..
it
LC_MESSAGES
..
..
ja
LC_MESSAGES
..
..
ka
LC_MESSAGES
..
..
kn
LC_MESSAGES
..
..
ko
LC_MESSAGES
..
..
li
LC_MESSAGES
..
..
lt
LC_MESSAGES
..
..
lv
LC_MESSAGES
..
..
mk
LC_MESSAGES
..
..
ml
LC_MESSAGES
..
..
mn
LC_MESSAGES
..
..
ms
LC_MESSAGES
..
..
mt
LC_MESSAGES
..
..
nb
LC_MESSAGES
..
..
ne
LC_MESSAGES
..
..
nl
LC_MESSAGES
..
..
nn
LC_MESSAGES
..
..
no
LC_MESSAGES
..
..
or
LC_MESSAGES
..
..
pa
LC_MESSAGES
..
..
pl
LC_MESSAGES
..
..
pt
LC_MESSAGES
..
..
pt_BR
LC_MESSAGES
..
..
pt_PT
LC_MESSAGES
..
..
ro
LC_MESSAGES
..
..
ru
LC_MESSAGES
..
..
sk
LC_MESSAGES
..
..
sl
LC_MESSAGES
..
..
sq
LC_MESSAGES
..
..
sr
LC_MESSAGES
..
..
sr@Latn
LC_MESSAGES
..
..
sv
LC_MESSAGES
..
..
ta
LC_MESSAGES
..
..
tg
LC_MESSAGES
..
..
th
LC_MESSAGES
..
..
tk
LC_MESSAGES
..
..
tr
LC_MESSAGES
..
..
uk
LC_MESSAGES
..
..
uz
LC_MESSAGES
..
..
vi
LC_MESSAGES
..
..
wa
LC_MESSAGES
..
..
zh
LC_MESSAGES
..
..
zh_CN
LC_MESSAGES
..
..
zh_CN.GB2312
LC_MESSAGES
..
..
zh_TW
LC_MESSAGES
..
..
zh_TW.Big5
LC_MESSAGES
..
..
..
pixmaps
..
..
..

View File

@ -1,306 +0,0 @@
# $FreeBSD$
#
# Please see the file src/etc/mtree/README before making changes to this file.
#
/set type=dir uname=root gname=wheel mode=0755
.
bin
..
etc
rc.d
..
..
include
X11
ICE
..
PEX5
..
PM
..
SM
..
Xaw
..
Xmu
..
bitmaps
..
extensions
..
fonts
..
pixmaps
..
..
..
info
..
lib
X11
XF86Setup
pics
..
scripts
..
tcllib
..
..
app-defaults
..
config
..
doc
..
etc
..
fonts
100dpi
..
75dpi
..
PEX
..
Speedo
..
Type1
..
cyrillic
..
local
..
misc
..
..
fs
..
lbxproxy
..
locale
C
..
en_US.utf
..
iso8859-1
..
iso8859-2
..
iso8859-3
..
iso8859-4
..
iso8859-5
..
iso8859-6
..
iso8859-7
..
iso8859-8
..
iso8859-9
..
ja
..
ja.JIS
..
ja.SJIS
..
ko
..
koi8-r
..
tbl_data
..
th_TH.TACTIS
..
zh
..
zh_TW
..
zh_TW.Big5
..
..
proxymngr
..
rstart
commands
x11r6
..
..
contexts
..
..
twm
..
x11perfcomp
..
xdm
..
xinit
..
xkb
compat
..
compiled
..
geometry
digital
..
sgi
..
..
keycodes
digital
..
sgi
..
..
keymap
digital
..
sgi
..
sun
..
..
rules
..
semantics
..
symbols
digital
..
fujitsu
..
nec
..
sony
..
sun
..
..
..
xserver
..
xsm
..
..
aout
..
modules
..
..
libdata
ldconfig
..
ldconfig32
..
..
libexec
..
man
/set uname=man
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
ja uname=root
cat1
..
cat2
..
cat3
..
cat4
..
cat5
..
cat6
..
cat7
..
cat8
..
cat9
..
catl
..
catn
..
/set uname=root
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
man1
..
man2
..
man3
..
man4
..
man5
..
man6
..
man7
..
man8
..
man9
..
manl
..
mann
..
..
share
aclocal
..
doc
ja
..
..
examples
..
..
..

View File

@ -5,12 +5,10 @@
FILES= ${_BIND.chroot.dist} \
${_BIND.include.dist} \
BSD.include.dist \
BSD.local.dist \
BSD.root.dist \
${_BSD.sendmail.dist} \
BSD.usr.dist \
BSD.var.dist \
BSD.x11-4.dist \
BSD.x11.dist
BSD.var.dist
.if ${MK_BIND} != "no"
_BIND.chroot.dist= BIND.chroot.dist
@ -18,6 +16,9 @@ _BIND.chroot.dist= BIND.chroot.dist
_BIND.include.dist= BIND.include.dist
.endif
.endif
.if ${MK_SENDMAIL} != "no"
_BSD.sendmail.dist= BSD.sendmail.dist
.endif
NO_OBJ=
FILESDIR= /etc/mtree

View File

@ -727,6 +727,13 @@ list_net_interfaces()
;;
*)
_tmplist="${network_interfaces} ${cloned_interfaces}"
# lo0 is effectively mandatory, so help prevent foot-shooting
#
case "$_tmplist" in
lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
*) _tmplist="lo0 ${_tmplist}" ;;
esac
;;
esac
@ -816,6 +823,17 @@ hexprint()
echo ${str}
}
is_wired_interface()
{
local media
case `ifconfig $1 2>/dev/null` in
*media:?Ethernet*) media=Ethernet ;;
esac
test "$media" = "Ethernet"
}
# Setup the interfaces for IPv6
network6_interface_setup()
{
@ -858,14 +876,19 @@ network6_interface_setup()
ifconfig $i inet6 ${ipv6_ifconfig} alias
fi
# Wireless NIC cards are virtualized through the wlan interface
if ! is_wired_interface ${i}; then
case "${i}" in
wlan*) rtsol_interface=yes ;;
*) rtsol_interface=no ;;
esac
fi
if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ]
then
case ${i} in
lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*)
;;
# Wireless NIC cards are virtualized through the wlan interface
an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*)
;;
*)
rtsol_interfaces="${rtsol_interfaces} ${i}"
;;

View File

@ -32,7 +32,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
random rarpd resolv rfcomm_pppd_server root \
route6d routed routing rpcbind rtadvd rwho \
savecore sdpd securelevel sendmail \
serial sppp statd swap1 \
serial sppp statd static_arp swap1 \
syscons sysctl syslogd \
timed tmp \
ugidfw \

View File

@ -41,9 +41,9 @@ ipsec_stop()
{
echo "Clearing ipsec manual keys/policies."
# still not 100% sure if we would like to do this.
# it is very questionable to do this during shutdown session, since
# it can hang any of remaining IPv4/v6 session.
# Still not 100% sure if we would like to do this.
# It is very questionable to do this during shutdown session
# since it can hang any of the remaining IPv4/v6 sessions.
#
${ipsec_program} -F
${ipsec_program} -FP

View File

@ -18,18 +18,6 @@ if [ -z "$ifn" ]; then
return 1
fi
is_wired_interface()
{
media=`ifconfig $1 2>/dev/null | while read line; do
case "$line" in
*media:?Ethernet*)
echo Ethernet
;;
esac
done`
test "$media" = "Ethernet"
}
is_ndis_interface()
{
case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in

View File

@ -66,13 +66,14 @@
.ds doc-volume-as-arm arm
.
.\" Default .Os value
.ds doc-default-operating-system FreeBSD\~8.0
.ds doc-default-operating-system FreeBSD\~9.0
.
.\" FreeBSD releases not found in doc-common
.ds doc-operating-system-FreeBSD-6.3 6.3
.ds doc-operating-system-FreeBSD-6.4 6.4
.ds doc-operating-system-FreeBSD-7.1 7.1
.ds doc-operating-system-FreeBSD-8.0 8.0
.ds doc-operating-system-FreeBSD-9.0 9.0
.
.\" Definitions not (yet) in doc-syms
.ds doc-str-St--p1003.1-2008 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1-2008

View File

@ -211,6 +211,25 @@ there_is_another_patch(void)
return TRUE;
}
static char *
p4_savestr(char *str)
{
char *t, *h;
/* Leading whitespace. */
while (isspace((unsigned char)*str))
str++;
/* Remove the file revision number. */
for (t = str, h = NULL; *t != '\0' && !isspace((unsigned char)*t); t++)
if (*t == '#')
h = t;
if (h != NULL)
*h = '\0';
return savestr(str);
}
/*
* Determine what kind of diff is in the remaining part of the patch file.
*/
@ -298,6 +317,11 @@ intuit_diff_type(void)
free(revision);
revision = Nullch;
}
} else if (strnEQ(s, "==== ", 5)) {
/* Perforce-style diffs. */
if ((t = strstr(s + 5, " - ")) != NULL)
newtmp = p4_savestr(t + 3);
oldtmp = p4_savestr(s + 5);
}
if ((!diff_type || diff_type == ED_DIFF) &&
first_command_line >= 0L &&

View File

@ -40,7 +40,7 @@ LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
LSUBDIRS= cam/ata cam/scsi \
dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi dev/ofw \
dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \

View File

@ -928,9 +928,12 @@ __archive_read_filter_ahead(struct archive_read_filter *filter,
for (;;) {
/*
* If we can satisfy from the copy buffer, we're done.
* If we can satisfy from the copy buffer (and the
* copy buffer isn't empty), we're done. In particular,
* note that min == 0 is a perfectly well-defined
* request.
*/
if (filter->avail >= min) {
if (filter->avail >= min && filter->avail > 0) {
if (avail != NULL)
*avail = filter->avail;
return (filter->next);

Some files were not shown because too many files have changed in this diff Show More