PERFORCE change 149458 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Tue Sep 9 02:57:05 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=149458
Change 149458 by gonzo at gonzo_jeeves on 2008/09/09 02:56:18
IFC @149457
Affected files ...
.. //depot/projects/mips2/src/bin/setfacl/setfacl.c#3 integrate
.. //depot/projects/mips2/src/contrib/ntp/libparse/clk_rawdcf.c#3 integrate
.. //depot/projects/mips2/src/lib/libarchive/archive_write_disk.c#13 integrate
.. //depot/projects/mips2/src/lib/libarchive/test/Makefile#9 integrate
.. //depot/projects/mips2/src/lib/libarchive/test/test_read_format_gtar_sparse.c#7 integrate
.. //depot/projects/mips2/src/lib/libarchive/test/test_write_disk_secure.c#6 integrate
.. //depot/projects/mips2/src/lib/libc/regex/re_format.7#2 integrate
.. //depot/projects/mips2/src/lib/libc/stdlib/malloc.c#14 integrate
.. //depot/projects/mips2/src/lib/libgeom/geom_util.c#3 integrate
.. //depot/projects/mips2/src/lib/libgeom/libgeom.3#4 integrate
.. //depot/projects/mips2/src/lib/libgeom/libgeom.h#3 integrate
.. //depot/projects/mips2/src/release/Makefile.inc.docports#3 integrate
.. //depot/projects/mips2/src/release/doc/en_US.ISO8859-1/relnotes/article.sgml#20 integrate
.. //depot/projects/mips2/src/sbin/fdisk/fdisk.c#4 integrate
.. //depot/projects/mips2/src/sbin/ipfw/ipfw2.c#10 integrate
.. //depot/projects/mips2/src/sbin/md5/md5.1#2 integrate
.. //depot/projects/mips2/src/sbin/natd/natd.c#4 integrate
.. //depot/projects/mips2/src/share/man/man4/if_bridge.4#5 integrate
.. //depot/projects/mips2/src/share/man/man4/tap.4#3 integrate
.. //depot/projects/mips2/src/share/man/man9/bus_dma.9#4 integrate
.. //depot/projects/mips2/src/share/misc/committers-ports.dot#10 integrate
.. //depot/projects/mips2/src/sys/amd64/amd64/cpu_switch.S#8 integrate
.. //depot/projects/mips2/src/sys/amd64/amd64/genassym.c#9 integrate
.. //depot/projects/mips2/src/sys/amd64/amd64/machdep.c#14 integrate
.. //depot/projects/mips2/src/sys/amd64/amd64/mp_machdep.c#8 integrate
.. //depot/projects/mips2/src/sys/amd64/amd64/trap.c#11 integrate
.. //depot/projects/mips2/src/sys/amd64/include/pcb.h#5 integrate
.. //depot/projects/mips2/src/sys/amd64/include/pcpu.h#6 integrate
.. //depot/projects/mips2/src/sys/amd64/include/segments.h#3 integrate
.. //depot/projects/mips2/src/sys/amd64/linux32/linux32_genassym.c#2 integrate
.. //depot/projects/mips2/src/sys/amd64/linux32/linux32_locore.s#3 integrate
.. //depot/projects/mips2/src/sys/amd64/linux32/linux32_machdep.c#7 integrate
.. //depot/projects/mips2/src/sys/arm/at91/at91.c#6 integrate
.. //depot/projects/mips2/src/sys/arm/at91/at91_mci.c#3 integrate
.. //depot/projects/mips2/src/sys/arm/at91/at91_ssc.c#4 integrate
.. //depot/projects/mips2/src/sys/arm/at91/kb920x_machdep.c#9 integrate
.. //depot/projects/mips2/src/sys/arm/conf/KB920X#9 integrate
.. //depot/projects/mips2/src/sys/arm/conf/NSLU#2 integrate
.. //depot/projects/mips2/src/sys/boot/sparc64/loader/main.c#6 integrate
.. //depot/projects/mips2/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#4 integrate
.. //depot/projects/mips2/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#5 integrate
.. //depot/projects/mips2/src/sys/conf/NOTES#23 integrate
.. //depot/projects/mips2/src/sys/contrib/dev/ath/public/wisoc.hal.o.uu#1 branch
.. //depot/projects/mips2/src/sys/contrib/dev/ath/public/wisoc.inc#1 branch
.. //depot/projects/mips2/src/sys/contrib/dev/ath/public/wisoc.opt_ah.h#1 branch
.. //depot/projects/mips2/src/sys/dev/acpi_support/acpi_fujitsu.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/asmc/asmc.c#5 integrate
.. //depot/projects/mips2/src/sys/dev/asmc/asmcvar.h#4 integrate
.. //depot/projects/mips2/src/sys/dev/bge/if_bge.c#13 integrate
.. //depot/projects/mips2/src/sys/dev/cxgb/cxgb_adapter.h#12 integrate
.. //depot/projects/mips2/src/sys/dev/cxgb/cxgb_main.c#18 integrate
.. //depot/projects/mips2/src/sys/dev/cxgb/cxgb_sge.c#15 integrate
.. //depot/projects/mips2/src/sys/dev/drm/ati_pcigart.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/drm/drm_bufs.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/drm/drm_pci.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/drm/i915_dma.c#7 integrate
.. //depot/projects/mips2/src/sys/dev/drm/mach64_dma.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/esp/esp_sbus.c#5 integrate
.. //depot/projects/mips2/src/sys/dev/esp/ncr53c9x.c#6 integrate
.. //depot/projects/mips2/src/sys/dev/esp/ncr53c9xreg.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/esp/ncr53c9xvar.h#3 integrate
.. //depot/projects/mips2/src/sys/dev/ic/i8251.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/ic/i8255.h#1 branch
.. //depot/projects/mips2/src/sys/dev/iicbus/ds133x.c#2 integrate
.. //depot/projects/mips2/src/sys/dev/iicbus/ds1672.c#2 integrate
.. //depot/projects/mips2/src/sys/dev/le/if_le_ledma.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/re/if_re.c#19 integrate
.. //depot/projects/mips2/src/sys/dev/si/si.c#4 integrate
.. //depot/projects/mips2/src/sys/dev/sound/pci/hda/hdac.c#12 integrate
.. //depot/projects/mips2/src/sys/dev/uart/uart_cpu_pc98.c#4 integrate
.. //depot/projects/mips2/src/sys/dev/usb/ucom.c#7 integrate
.. //depot/projects/mips2/src/sys/dev/usb/ucomvar.h#6 integrate
.. //depot/projects/mips2/src/sys/dev/usb/usbdevs#21 integrate
.. //depot/projects/mips2/src/sys/geom/geom_dev.c#6 integrate
.. //depot/projects/mips2/src/sys/i386/isa/isa.c#4 integrate
.. //depot/projects/mips2/src/sys/i386/linux/linux_genassym.c#2 integrate
.. //depot/projects/mips2/src/sys/i386/linux/linux_locore.s#2 integrate
.. //depot/projects/mips2/src/sys/kern/subr_sleepqueue.c#14 integrate
.. //depot/projects/mips2/src/sys/kern/subr_turnstile.c#8 integrate
.. //depot/projects/mips2/src/sys/kern/tty.c#11 integrate
.. //depot/projects/mips2/src/sys/kern/uipc_sockbuf.c#8 integrate
.. //depot/projects/mips2/src/sys/net/if_bridge.c#13 integrate
.. //depot/projects/mips2/src/sys/net/if_tap.c#6 integrate
.. //depot/projects/mips2/src/sys/net/if_tap.h#3 integrate
.. //depot/projects/mips2/src/sys/net/route.h#5 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211.h#11 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_ddb.c#4 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_freebsd.h#8 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_ht.c#9 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_ht.h#6 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_ioctl.c#9 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_ioctl.h#7 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_node.c#8 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_node.h#6 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_phy.c#3 integrate
.. //depot/projects/mips2/src/sys/net80211/ieee80211_sta.c#2 integrate
.. //depot/projects/mips2/src/sys/netinet/ip_fw.h#8 integrate
.. //depot/projects/mips2/src/sys/netinet/ip_fw2.c#15 integrate
.. //depot/projects/mips2/src/sys/netinet/tcp_debug.c#4 integrate
.. //depot/projects/mips2/src/sys/netinet/tcp_input.c#14 integrate
.. //depot/projects/mips2/src/sys/netinet/tcp_output.c#13 integrate
.. //depot/projects/mips2/src/sys/netinet/tcp_subr.c#15 integrate
.. //depot/projects/mips2/src/sys/netinet/tcp_var.h#13 integrate
.. //depot/projects/mips2/src/sys/pc98/cbus/sio.c#8 integrate
.. //depot/projects/mips2/src/sys/pc98/include/bus.h#3 integrate
.. //depot/projects/mips2/src/sys/pc98/pc98/busiosubr.c#3 integrate
.. //depot/projects/mips2/src/sys/sparc64/include/asi.h#4 integrate
.. //depot/projects/mips2/src/sys/sparc64/include/tlb.h#3 integrate
.. //depot/projects/mips2/src/sys/sparc64/sbus/dma_sbus.c#4 integrate
.. //depot/projects/mips2/src/sys/sparc64/sbus/lsi64854.c#2 integrate
.. //depot/projects/mips2/src/sys/sparc64/sbus/lsi64854var.h#2 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/cheetah.c#6 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/exception.S#6 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/genassym.c#6 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/mp_exception.S#4 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/pmap.c#12 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/support.S#4 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/swtch.S#4 integrate
.. //depot/projects/mips2/src/sys/sparc64/sparc64/tlb.c#4 integrate
.. //depot/projects/mips2/src/sys/sys/disk.h#3 integrate
.. //depot/projects/mips2/src/sys/sys/param.h#20 integrate
.. //depot/projects/mips2/src/sys/sys/termios.h#4 integrate
.. //depot/projects/mips2/src/tools/tools/nanobsd/nanobsd.sh#11 integrate
.. //depot/projects/mips2/src/usr.sbin/boot0cfg/boot0cfg.c#2 integrate
.. //depot/projects/mips2/src/usr.sbin/setfib/setfib.c#3 integrate
Differences ...
==== //depot/projects/mips2/src/bin/setfacl/setfacl.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/setfacl/setfacl.c,v 1.13 2007/02/26 00:42:17 mckusick Exp $");
+__FBSDID("$FreeBSD: src/bin/setfacl/setfacl.c,v 1.14 2008/09/06 13:17:35 trasz Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -245,10 +245,13 @@
continue;
}
- if (acl_type == ACL_TYPE_ACCESS)
+ if (acl_type == ACL_TYPE_ACCESS) {
final_acl = acl[ACCESS_ACL];
- else
+ 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);
@@ -269,8 +272,7 @@
}
}
- acl_free(acl[ACCESS_ACL]);
- acl_free(acl[DEFAULT_ACL]);
+ acl_free(final_acl);
free(acl);
}
==== //depot/projects/mips2/src/contrib/ntp/libparse/clk_rawdcf.c#3 (text+ko) ====
@@ -229,7 +229,7 @@
unsigned char *c = dcfprm->zerobits;
int i;
- parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%s\"\n", buffer));
+ parseprintf(DD_RAWDCF,("parse: convert_rawdcf: \"%.*s\"\n", size, buffer));
if (size < 57)
{
@@ -320,7 +320,7 @@
* bad format - not for us
*/
#ifndef PARSEKERNEL
- msyslog(LOG_ERR, "parse: convert_rawdcf: parity check FAILED for \"%s\"\n", buffer);
+ msyslog(LOG_ERR, "parse: convert_rawdcf: parity check FAILED for \"%.*s\"\n", size, buffer);
#endif
return CVT_FAIL|CVT_BADFMT;
}
==== //depot/projects/mips2/src/lib/libarchive/archive_write_disk.c#13 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.35 2008/09/05 06:13:11 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.36 2008/09/07 05:22:33 kientzle Exp $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -907,14 +907,26 @@
* We know something is in the way, but we don't know what;
* we need to find out before we go any further.
*/
- if (lstat(a->name, &a->st) != 0) {
+ int r = 0;
+ /*
+ * The SECURE_SYMLINK logic has already removed a
+ * symlink to a dir if the client wants that. So
+ * follow the symlink if we're creating a dir.
+ */
+ if (S_ISDIR(a->mode))
+ r = stat(a->name, &a->st);
+ /*
+ * If it's not a dir (or it's a broken symlink),
+ * then don't follow it.
+ */
+ if (r != 0 || !S_ISDIR(a->mode))
+ r = lstat(a->name, &a->st);
+ if (r != 0) {
archive_set_error(&a->archive, errno,
"Can't stat existing object");
return (ARCHIVE_WARN);
}
- /* TODO: if it's a symlink... */
-
/*
* NO_OVERWRITE_NEWER doesn't apply to directories.
*/
==== //depot/projects/mips2/src/lib/libarchive/test/Makefile#9 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.24 2008/08/25 06:08:22 kientzle Exp $
+# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.25 2008/09/08 00:58:12 kientzle Exp $
# Where to find the libarchive sources
LA_SRCDIR=${.CURDIR}/..
@@ -89,7 +89,7 @@
# Uncomment to link against dmalloc
#LDADD+= -L/usr/local/lib -ldmalloc
#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
-#WARNS=6
+WARNS=6
# Build libarchive_test and run it.
check test: libarchive_test
==== //depot/projects/mips2/src/lib/libarchive/test/test_read_format_gtar_sparse.c#7 (text+ko) ====
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.9 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.10 2008/09/08 00:58:12 kientzle Exp $");
struct contents {
@@ -187,6 +187,7 @@
struct contents expect;
/* data, size, offset of block read from archive. */
struct contents actual;
+ const void *p;
struct archive *a;
extract_reference_file(name);
@@ -206,10 +207,10 @@
expect = *cts++;
while (0 == (err = archive_read_data_block(a,
- (const void **)&actual.d,
- &actual.s, &actual.o))) {
+ &p, &actual.s, &actual.o))) {
+ actual.d = p;
while (actual.s > 0) {
- char c = *(const char *)actual.d;
+ char c = *actual.d;
if(actual.o < expect.o) {
/*
* Any byte before the expected
==== //depot/projects/mips2/src/lib/libarchive/test/test_write_disk_secure.c#6 (text+ko) ====
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.5 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_secure.c,v 1.8 2008/09/07 23:59:27 kientzle Exp $");
#define UMASK 022
@@ -105,6 +105,80 @@
archive_entry_free(ae);
assert(0 == archive_write_finish_entry(a));
+ /*
+ * Without security checks, extracting a dir over a link to a
+ * dir should follow the link.
+ */
+ /* Create a symlink to a dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir3");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir3");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was followed. */
+ assertEqualInt(0, lstat("link_to_dir3", &st));
+ assert(S_ISLNK(st.st_mode));
+ archive_entry_free(ae);
+
+ /*
+ * As above, but a broken link, so the link should get replaced.
+ */
+ /* Create a symlink to a dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir4");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "nonexistent_dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir4");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was replaced. */
+ assertEqualInt(0, lstat("link_to_dir4", &st));
+ assert(S_ISDIR(st.st_mode));
+ archive_entry_free(ae);
+
+ /*
+ * As above, but a link to a non-dir, so the link should get replaced.
+ */
+ /* Create a regular file and a symlink to it */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "non_dir");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Create symlink to the file. */
+ archive_entry_copy_pathname(ae, "link_to_dir5");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "non_dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir5");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was replaced. */
+ assertEqualInt(0, lstat("link_to_dir5", &st));
+ assert(S_ISDIR(st.st_mode));
+ archive_entry_free(ae);
+
+
#if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a);
#else
==== //depot/projects/mips2/src/lib/libc/regex/re_format.7#2 (text+ko) ====
@@ -34,7 +34,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
-.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.11 2004/07/02 23:52:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.12 2008/09/05 17:41:20 keramida Exp $
.\"
.Dd March 20, 1994
.Dt RE_FORMAT 7
@@ -288,6 +288,14 @@
A locale may provide others.
A character class may not be used as an endpoint of a range.
.Pp
+A bracketed expression like
+.Ql [[:class:]]
+can be used to match a single character that belongs to a character
+class.
+The reverse, matching any character that does not belong to a specific
+class, the negation operator of bracket expressions may be used:
+.Ql [^[:class:]] .
+.Pp
There are two special cases\(dd of bracket expressions:
the bracket expressions
.Ql [[:<:]]
==== //depot/projects/mips2/src/lib/libc/stdlib/malloc.c#14 (text+ko) ====
@@ -156,7 +156,7 @@
#define MALLOC_DSS
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.177 2008/08/27 02:00:53 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.178 2008/09/06 05:26:31 marcel Exp $");
#include "libc_private.h"
#ifdef MALLOC_DEBUG
@@ -226,7 +226,7 @@
# define CPU_SPINWAIT __asm__ volatile("pause")
#endif
#ifdef __ia64__
-# define PAGESIZE_2POW 12
+# define PAGESIZE_2POW 13
# define QUANTUM_2POW 4
# define SIZEOF_PTR_2POW 3
#endif
==== //depot/projects/mips2/src/lib/libgeom/geom_util.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libgeom/geom_util.c,v 1.2 2008/05/20 11:45:05 pjd Exp $");
+__FBSDID("$FreeBSD: src/lib/libgeom/geom_util.c,v 1.3 2008/09/07 13:54:57 lulf Exp $");
#include <sys/param.h>
#include <sys/disk.h>
@@ -42,29 +42,22 @@
#include <libgeom.h>
+static char *g_device_path_open(const char *, int *, int);
+
/*
* Open the given provider and at least check if this is a block device.
*/
int
g_open(const char *name, int dowrite)
{
- char path[MAXPATHLEN];
+ char *path;
int fd;
- if (name[0] == '/')
- strlcpy(path, name, sizeof(path));
- else
- snprintf(path, sizeof(path), "%s%s", _PATH_DEV, name);
-
- fd = open(path, dowrite ? O_RDWR : O_RDONLY);
+ path = g_device_path_open(name, &fd, dowrite);
+ if (path != NULL)
+ free(path);
if (fd == -1)
return (-1);
- /* Let try to get sectorsize, which will prove it is a GEOM provider. */
- if (g_sectorsize(fd) == -1) {
- close(fd);
- errno = EFTYPE;
- return (-1);
- }
return (fd);
}
@@ -121,6 +114,19 @@
}
/*
+ * Return the correct provider name.
+ */
+char *
+g_providername(int fd)
+{
+ char name[MAXPATHLEN];
+
+ if (g_ioctl_arg(fd, DIOCGPROVIDERNAME, name) == -1)
+ return (NULL);
+ return (strdup(name));
+}
+
+/*
* Call BIO_FLUSH for the given provider.
*/
int
@@ -234,3 +240,77 @@
}
return (fd);
}
+
+/*
+ * Return the device path device given a partial or full path to its node.
+ * A pointer can be provided, which will be set to an opened file descriptor of
+ * not NULL.
+ */
+static char *
+g_device_path_open(const char *devpath, int *fdp, int dowrite)
+{
+ char *path;
+ int fd;
+
+ /* Make sure that we can fail. */
+ if (fdp != NULL)
+ *fdp = -1;
+ /* Use the device node if we're able to open it. */
+ do {
+ fd = open(devpath, dowrite ? O_RDWR : O_RDONLY);
+ if (fd == -1)
+ break;
+ /*
+ * Let try to get sectorsize, which will prove it is a GEOM
+ * provider.
+ */
+ if (g_sectorsize(fd) == -1) {
+ close(fd);
+ errno = EFTYPE;
+ return (NULL);
+ }
+ if ((path = strdup(devpath)) == NULL) {
+ close(fd);
+ return (NULL);
+ }
+ if (fdp != NULL)
+ *fdp = fd;
+ else
+ close(fd);
+ return (path);
+ } while (0);
+
+ /* If we're not given an absolute path, assume /dev/ prefix. */
+ if (*devpath != '/') {
+ asprintf(&path, "%s%s", _PATH_DEV, devpath);
+ if (path == NULL)
+ return (NULL);
+ fd = open(path, dowrite ? O_RDWR : O_RDONLY);
+ if (fd == -1) {
+ free(path);
+ return (NULL);
+ }
+ /*
+ * Let try to get sectorsize, which will prove it is a GEOM
+ * provider.
+ */
+ if (g_sectorsize(fd) == -1) {
+ free(path);
+ close(fd);
+ errno = EFTYPE;
+ return (NULL);
+ }
+ if (fdp != NULL)
+ *fdp = fd;
+ else
+ close(fd);
+ return (path);
+ }
+ return (NULL);
+}
+
+char *
+g_device_path(const char *devpath)
+{
+ return (g_device_path_open(devpath, NULL, 0));
+}
==== //depot/projects/mips2/src/lib/libgeom/libgeom.3#4 (text+ko) ====
@@ -26,9 +26,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libgeom/libgeom.3,v 1.10 2008/06/13 21:49:21 thompsa Exp $
+.\" $FreeBSD: src/lib/libgeom/libgeom.3,v 1.11 2008/09/08 06:27:00 lulf Exp $
.\"
-.Dd May 6, 2007
+.Dd September 8, 2008
.Dt LIBGEOM 3
.Os
.Sh NAME
@@ -52,9 +52,11 @@
.Nm g_sectorsize ,
.Nm g_flush ,
.Nm g_delete ,
+.Nm g_device_path ,
.Nm g_get_ident ,
.Nm g_get_name ,
-.Nm g_open_by_ident
+.Nm g_open_by_ident ,
+.Nm g_providername
.Nd userland API library for kernel GEOM subsystem
.Sh LIBRARY
.Lb libgeom
@@ -103,12 +105,16 @@
.Fn g_flush "int fd"
.Ft int
.Fn g_delete "int fd" "off_t offset" "off_t length"
+.Ft "char *"
+.Fn g_device_path "const char *devpath"
.Ft int
.Fn g_get_ident "int fd" "char *ident" "size_t size"
.Ft int
.Fn g_get_name "const char *ident" "char *name" "size_t size"
.Ft int
.Fn g_open_by_ident "const char *ident" "int dowrite" "char *name" "size_t size"
+.Ft "char *"
+.Fn g_providername "int fd"
.Sh DESCRIPTION
The
.Nm geom
@@ -301,6 +307,13 @@
function tells the provider that the given data range is no longer used.
.Pp
The
+.Fn g_device_path
+function returns the full path to a provider given a partial or full path to the
+device node.
+If the device can not be found or is not a valid geom provider, NULL is
+returned.
+.Pp
+The
.Fn g_get_ident
function returns provider's fixed and unique identifier.
The
@@ -326,7 +339,17 @@
.Dv NULL ,
the function will store provider's name there.
.Pp
-All functions return value greater than or equal to
+The
+.Fn g_providername
+function returns the provider name of an open file descriptor.
+If the file descriptor does not point to a valid geom provider, NULL is
+returned.
+.Pp
+All functions except
+.Fn g_providername
+and
+.Fn g_device_path
+return a value greater than or equal to
.Va 0
on success or
.Va -1
==== //depot/projects/mips2/src/lib/libgeom/libgeom.h#3 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libgeom/libgeom.h,v 1.12 2007/05/06 10:00:27 des Exp $
+ * $FreeBSD: src/lib/libgeom/libgeom.h,v 1.13 2008/09/07 13:54:57 lulf Exp $
*/
#ifndef _LIBGEOM_H_
#define _LIBGEOM_H_
@@ -154,6 +154,8 @@
int g_get_ident(int, char *, size_t);
int g_get_name(const char *, char *, size_t);
int g_open_by_ident(const char *, int, char *, size_t);
+char *g_device_path(const char *);
+char *g_providername(int);
__END_DECLS
==== //depot/projects/mips2/src/release/Makefile.inc.docports#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/release/Makefile.inc.docports,v 1.27 2007/04/11 15:24:58 ru Exp $
+# $FreeBSD: src/release/Makefile.inc.docports,v 1.28 2008/09/06 10:12:52 jhay Exp $
#
# List of (dependent) ports that are minimally required to be
# checked out from CVS in order to get ${DOCPORTS} built and
@@ -38,8 +38,8 @@
ports/graphics/scr2png \
ports/graphics/tiff \
ports/print/freetype2 \
- ports/print/ghostscript-gpl \
- ports/print/ghostscript-gpl-nox11 \
+ ports/print/ghostscript8 \
+ ports/print/ghostscript8-nox11 \
ports/print/gsfonts \
ports/textproc/docbook-410 \
ports/textproc/docbook-xml \
==== //depot/projects/mips2/src/release/doc/en_US.ISO8859-1/relnotes/article.sgml#20 (text+ko) ====
@@ -17,7 +17,7 @@
<corpauthor>The &os; Project</corpauthor>
- <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/article.sgml,v 1.1092 2008/07/29 04:23:18 bmah Exp $</pubdate>
+ <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/article.sgml,v 1.1093 2008/09/08 17:13:18 gshapiro Exp $</pubdate>
<copyright>
<year>2000</year>
@@ -449,7 +449,7 @@
Figwort release to the Hydrangea release.</para>
<para role="merged"><application>sendmail</application> has been updated from
- 8.14.1 to 8.14.2.</para>
+ 8.14.1 to 8.14.3.</para>
<para role="merged">The timezone database has been updated from
the <application>tzdata2007h</application> release to
==== //depot/projects/mips2/src/sbin/fdisk/fdisk.c#4 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fdisk/fdisk.c,v 1.85 2008/07/31 00:55:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/sbin/fdisk/fdisk.c,v 1.86 2008/09/07 13:58:35 lulf Exp $");
#include <sys/disk.h>
#include <sys/disklabel.h>
@@ -245,7 +245,6 @@
int
main(int argc, char *argv[])
{
- struct stat sb;
int c, i;
int partition = -1;
struct dos_partition *partp;
@@ -307,18 +306,9 @@
if (argc == 0) {
disk = get_rootdisk();
} else {
- if (stat(argv[0], &sb) == 0) {
- /* OK, full pathname given */
- disk = argv[0];
- } else if (errno == ENOENT && argv[0][0] != '/') {
- /* Try prepending "/dev" */
- asprintf(&disk, "%s%s", _PATH_DEV, argv[0]);
- if (disk == NULL)
- errx(1, "out of memory");
- } else {
- /* other stat error, let it fail below */
- disk = argv[0];
- }
+ disk = g_device_path(argv[0]);
+ if (disk == NULL)
+ err(1, "unable to get correct path for %s\n", argv[0]);
}
if (open_disk(u_flag) < 0)
err(1, "cannot open disk %s", disk);
@@ -724,21 +714,14 @@
static int
open_disk(int flag)
{
- struct stat st;
int rwmode;
- if (stat(disk, &st) == -1) {
- if (errno == ENOENT)
- return -2;
- warnx("can't get file status of %s", disk);
- return -1;
- }
- if ( !(st.st_mode & S_IFCHR) )
- warnx("device %s is not character special", disk);
- rwmode = a_flag || I_flag || B_flag || flag ? O_RDWR : O_RDONLY;
- fd = open(disk, rwmode);
- if (fd == -1 && errno == EPERM && rwmode == O_RDWR)
- fd = open(disk, O_RDONLY);
+ /* Write mode if one of these flags are set. */
+ rwmode = (a_flag || I_flag || B_flag || flag);
+ fd = g_open(disk, rwmode);
+ /* If the mode fails, try read-only if we didn't. */
+ if (fd == -1 && errno == EPERM && rwmode)
+ fd = g_open(disk, 0);
if (fd == -1 && errno == ENXIO)
return -2;
if (fd == -1) {
@@ -778,29 +761,30 @@
{
int error;
struct gctl_req *grq;
- const char *q;
- char fbuf[BUFSIZ];
+ const char *errmsg;
+ char fbuf[BUFSIZ], *pname;
int i, fdw;
grq = gctl_get_handle();
gctl_ro_param(grq, "verb", -1, "write MBR");
gctl_ro_param(grq, "class", -1, "MBR");
- q = strrchr(disk, '/');
- if (q == NULL)
- q = disk;
- else
- q++;
- gctl_ro_param(grq, "geom", -1, q);
+ pname = g_providername(fd);
+ if (pname == NULL) {
+ warnx("Error getting providername for %s\n", disk);
+ return (-1);
+ }
+ gctl_ro_param(grq, "geom", -1, pname);
gctl_ro_param(grq, "data", secsize, buf);
- q = gctl_issue(grq);
- if (q == NULL) {
+ errmsg = gctl_issue(grq);
+ free(pname);
+ if (errmsg == NULL) {
gctl_free(grq);
return(0);
}
if (!q_flag) /* GEOM errors are benign, not all devices supported */
- warnx("%s", q);
+ warnx("%s", errmsg);
gctl_free(grq);
-
+
error = pwrite(fd, buf, secsize, (sector * 512));
if (error == secsize)
return (0);
@@ -841,21 +825,18 @@
dos_cylsecs = cylsecs = heads * sectors;
disksecs = cyls * heads * sectors;
- error = ioctl(fd, DIOCGSECTORSIZE, &u);
- if (error != 0 || u == 0)
- u = 512;
- else
- secsize = u;
+ u = g_sectorsize(fd);
+ if (u <= 0)
+ return (-1);
- error = ioctl(fd, DIOCGMEDIASIZE, &o);
- if (error == 0) {
- disksecs = o / u;
- cyls = dos_cyls = o / (u * dos_heads * dos_sectors);
- }
+ o = g_mediasize(fd);
+ if (o < 0)
+ return (-1);
+ disksecs = o / u;
+ cyls = dos_cyls = o / (u * dos_heads * dos_sectors);
return (disksecs);
}
-
static int
read_s0()
==== //depot/projects/mips2/src/sbin/ipfw/ipfw2.c#10 (text+ko) ====
@@ -17,7 +17,7 @@
*
* NEW command line interface for IP firewall facility
*
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.120 2008/05/10 15:02:56 julian Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.121 2008/09/06 17:23:37 rik Exp $
*/
#include <sys/param.h>
@@ -2429,7 +2429,7 @@
rulenum = atoi(av[0]);
new_set = atoi(av[2]);
if (!isdigit(*(av[0])) || (cmd == 3 && rulenum > RESVD_SET) ||
- (cmd == 2 && rulenum == 65535) )
+ (cmd == 2 && rulenum == IPFW_DEFAULT_RULE) )
errx(EX_DATAERR, "invalid source number %s\n", av[0]);
if (!isdigit(*(av[2])) || new_set > RESVD_SET)
errx(EX_DATAERR, "invalid dest. set %s\n", av[1]);
@@ -2553,7 +2553,7 @@
* need to scan the list to count them.
*/
for (nstat = 1, r = data, lim = (char *)data + nbytes;
- r->rulenum < 65535 && (char *)r < lim;
+ r->rulenum < IPFW_DEFAULT_RULE && (char *)r < lim;
++nstat, r = NEXT(r) )
; /* nothing */
@@ -5045,7 +5045,8 @@
if (have_tag)
errx(EX_USAGE, "tag and untag cannot be "
"specified more than once");
- GET_UINT_ARG(tag, 1, 65534, i, rule_action_params);
+ GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1, i,
+ rule_action_params);
have_tag = cmd;
fill_cmd(cmd, O_TAG, (i == TOK_TAG) ? 0: F_NOT, tag);
ac--; av++;
@@ -5521,8 +5522,8 @@
if (c->limit_mask == 0)
errx(EX_USAGE, "limit: missing limit mask");
- GET_UINT_ARG(c->conn_limit, 1, 65534, TOK_LIMIT,
- rule_options);
+ GET_UINT_ARG(c->conn_limit, 1, IPFW_DEFAULT_RULE - 1,
+ TOK_LIMIT, rule_options);
ac--; av++;
break;
@@ -5649,8 +5650,8 @@
else {
uint16_t tag;
- GET_UINT_ARG(tag, 1, 65534, TOK_TAGGED,
- rule_options);
+ GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1,
+ TOK_TAGGED, rule_options);
fill_cmd(cmd, O_TAGGED, 0, tag);
}
ac--; av++;
@@ -5978,7 +5979,7 @@
size = 0;
data = NULL;
frule = 0;
- lrule = 65535; /* max ipfw rule number */
+ lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */
ac--; av++;
/* Parse parameters. */
==== //depot/projects/mips2/src/sbin/md5/md5.1#2 (text+ko) ====
@@ -1,5 +1,5 @@
-.\" $FreeBSD: src/sbin/md5/md5.1,v 1.24 2005/03/10 09:56:39 cperciva Exp $
-.Dd June 6, 2004
+.\" $FreeBSD: src/sbin/md5/md5.1,v 1.25 2008/09/07 15:19:34 trhodes Exp $
+.Dd September 7, 2008
.Dt MD5 1
.Os
.Sh NAME
@@ -49,7 +49,7 @@
.Tn RSA .
.Pp
.Tn MD5
-has not yet (2001-09-03) been broken, but sufficient attacks have been
+has not yet (2007-03-05) been broken, but sufficient attacks have been
made that its security is in some doubt.
The attacks on
.Tn MD5
==== //depot/projects/mips2/src/sbin/natd/natd.c#4 (text+ko) ====
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/natd/natd.c,v 1.53 2008/06/22 22:14:02 mav Exp $");
+__FBSDID("$FreeBSD: src/sbin/natd/natd.c,v 1.54 2008/09/06 17:26:52 rik Exp $");
#define SYSLOG_NAMES
@@ -130,6 +130,7 @@
static void SetupSkinnyPort(const char *strValue);
static void NewInstance(const char *name);
static void DoGlobal (int fd);
+static int CheckIpfwRulenum(unsigned int rnum);
/*
* Globals.
@@ -1947,6 +1948,10 @@
if (sscanf(strValue, "%u:%u", &base, &num) != 2)
errx(1, "punch_fw: basenumber:count parameter required");
+ if (CheckIpfwRulenum(base + num - 1) == -1)
+ errx(1, "punch_fw: basenumber:count parameter should fit "
+ "the maximum allowed rule numbers");
+
LibAliasSetFWBase(mla, base, num);
(void)LibAliasSetMode(mla, PKT_ALIAS_PUNCH_FW, PKT_ALIAS_PUNCH_FW);
}
@@ -1991,3 +1996,22 @@
mla = ip->la;
mip = ip;
}
+
+static int
+CheckIpfwRulenum(unsigned int rnum)
+{
+ unsigned int default_rule;
+ size_t len = sizeof(default_rule);
+
+ if (sysctlbyname("net.inet.ip.fw.default_rule", &default_rule, &len,
+ NULL, 0) == -1) {
+ warn("Failed to get the default ipfw rule number, using "
+ "default historical value 65535. The reason was");
+ default_rule = 65535;
+ }
+ if (rnum >= default_rule) {
+ return -1;
+ }
+
+ return 0;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list