Module Name: src Committed By: christos Date: Thu Dec 23 17:46:55 UTC 2010
Modified Files: src/external/gpl2/lvm2: lvm2tools.mk src/external/gpl2/lvm2/dist/daemons/cmirrord: functions.c src/external/gpl2/lvm2/dist/libdm/ioctl: libdm-iface.c libdm-nbsd-iface.c src/external/gpl2/lvm2/lib/libdevmapper: Makefile src/external/gpl2/lvm2/sbin/dmsetup: Makefile Log Message: PR/44267: Michael van Elst: LVM devices have wrong permissions - Centralize CPPFLAGS for DM_DEVICE_{UID,GID,MODE} - Make DM_DEVICE_GID operator DM_DEVICE_MODE 0640 to be more NetBSD like - make all the code use DM_DEVICE_MODE instead of hard-coding. - make sure that all mknod calls are followed by a chown call. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/gpl2/lvm2/lvm2tools.mk cvs rdiff -u -r1.1.1.1 -r1.2 \ src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c cvs rdiff -u -r1.1.1.3 -r1.2 \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c cvs rdiff -u -r1.7 -r1.8 \ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c cvs rdiff -u -r1.4 -r1.5 src/external/gpl2/lvm2/lib/libdevmapper/Makefile cvs rdiff -u -r1.4 -r1.5 src/external/gpl2/lvm2/sbin/dmsetup/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl2/lvm2/lvm2tools.mk diff -u src/external/gpl2/lvm2/lvm2tools.mk:1.1 src/external/gpl2/lvm2/lvm2tools.mk:1.2 --- src/external/gpl2/lvm2/lvm2tools.mk:1.1 Sun Dec 21 19:57:58 2008 +++ src/external/gpl2/lvm2/lvm2tools.mk Thu Dec 23 12:46:54 2010 @@ -1,4 +1,4 @@ -# $NetBSD: lvm2tools.mk,v 1.1 2008/12/22 00:57:58 haad Exp $ +# $NetBSD: lvm2tools.mk,v 1.2 2010/12/23 17:46:54 christos Exp $ .include <bsd.own.mk> @@ -9,6 +9,9 @@ LIBDM_DISTDIR= ${NETBSDSRCDIR}/external/gpl2/lvm2/dist/libdm LIBDM_INCLUDE= ${NETBSDSRCDIR}/external/gpl2/lvm2/dist/include +# root:operator [cb]rw-r----- +CPPFLAGS+=-DDM_DEVICE_UID=0 -DDM_DEVICE_GID=5 -DDM_DEVICE_MODE=0640 + # #LIBDM_OBJDIR.libdevmapper=${LIBDM_SRCDIR}/lib/libdevmapper/ # Index: src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c diff -u src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c:1.1.1.1 src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c:1.2 --- src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c:1.1.1.1 Tue Dec 1 19:27:10 2009 +++ src/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c Thu Dec 23 12:46:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: functions.c,v 1.1.1.1 2009/12/02 00:27:10 haad Exp $ */ +/* $NetBSD: functions.c,v 1.2 2010/12/23 17:46:54 christos Exp $ */ /* * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. @@ -350,7 +350,10 @@ LOG_DBG("Path not found for %d/%d", major, minor); LOG_DBG("Creating /dev/mapper/%d-%d", major, minor); sprintf(path_rtn, "/dev/mapper/%d-%d", major, minor); - r = mknod(path_rtn, S_IFBLK | S_IRUSR | S_IWUSR, MKDEV(major, minor)); + r = mknod(path_rtn, S_IFBLK | DM_DEVICE_MODE, MKDEV(major, minor)); + + if (r != -1) + r = chown(path_rtn, DM_DEVICE_UID, DM_DEVICE_GID); /* * If we have to make the path, we unlink it after we open it Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c:1.1.1.3 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c:1.2 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c:1.1.1.3 Tue Dec 1 19:26:11 2009 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c Thu Dec 23 12:46:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm-iface.c,v 1.1.1.3 2009/12/02 00:26:11 haad Exp $ */ +/* $NetBSD: libdm-iface.c,v 1.2 2010/12/23 17:46:54 christos Exp $ */ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. @@ -245,11 +245,15 @@ log_verbose("Creating device %s (%u, %u)", control, major, minor); - if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR, + if (mknod(control, S_IFCHR | DM_DEVICE_MODE, MKDEV(major, minor)) < 0) { log_sys_error("mknod", control); return 0; } + if (chown(control, DM_DEVICE_UID, DM_DEVICE_GID) == -1) { + log_sys_error("cbown", control); + return 0; + } #ifdef HAVE_SELINUX if (!dm_set_selinux_context(control, S_IFCHR)) { Index: src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c diff -u src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.7 src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.8 --- src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c:1.7 Fri Mar 12 11:24:40 2010 +++ src/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Thu Dec 23 12:46:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: libdm-nbsd-iface.c,v 1.7 2010/03/12 16:24:40 haad Exp $ */ +/* $NetBSD: libdm-nbsd-iface.c,v 1.8 2010/12/23 17:46:54 christos Exp $ */ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. @@ -162,11 +162,15 @@ log_verbose("Creating device %s (%u, %u)", control, major, minor); - if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR, + if (mknod(control, S_IFCHR | DM_DEVICE_MODE, MKDEV(major, minor)) < 0) { log_sys_error("mknod", control); return 0; } + if (chown(control, DM_DEVICE_UID, DM_DEVICE_GID) == -1) { + log_sys_error("chown", control); + return 0; + } return 1; Index: src/external/gpl2/lvm2/lib/libdevmapper/Makefile diff -u src/external/gpl2/lvm2/lib/libdevmapper/Makefile:1.4 src/external/gpl2/lvm2/lib/libdevmapper/Makefile:1.5 --- src/external/gpl2/lvm2/lib/libdevmapper/Makefile:1.4 Tue Dec 8 19:17:23 2009 +++ src/external/gpl2/lvm2/lib/libdevmapper/Makefile Thu Dec 23 12:46:55 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2009/12/09 00:17:23 haad Exp $ +# $NetBSD: Makefile,v 1.5 2010/12/23 17:46:55 christos Exp $ USE_SHLIBDIR= yes USE_FORT?= no @@ -13,8 +13,7 @@ -I${LVM2_DISTDIR}/include -I${LIBDM_SRCDIR} -D__NetBSD__ -CPPFLAGS+= -D__LIB_DEVMAPPER__ -DDM_DEVICE_UID=0 \ - -DDM_DEVICE_GID=0 -DDM_DEVICE_MODE=0600 +CPPFLAGS+= -D__LIB_DEVMAPPER__ LDADD+= -lprop Index: src/external/gpl2/lvm2/sbin/dmsetup/Makefile diff -u src/external/gpl2/lvm2/sbin/dmsetup/Makefile:1.4 src/external/gpl2/lvm2/sbin/dmsetup/Makefile:1.5 --- src/external/gpl2/lvm2/sbin/dmsetup/Makefile:1.4 Mon Dec 22 13:13:30 2008 +++ src/external/gpl2/lvm2/sbin/dmsetup/Makefile Thu Dec 23 12:46:55 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2008/12/22 18:13:30 agc Exp $ +# $NetBSD: Makefile,v 1.5 2010/12/23 17:46:55 christos Exp $ USE_FORT?= no NOLINT= #defined @@ -16,8 +16,7 @@ CPPFLAGS+= -I${LIBDM_DISTDIR}/ -I${LIBDM_DISTDIR}/misc \ -I. -I${LIBDM_DISTDIR}/ioctl -I${LVM2_DISTDIR}/include -CPPFLAGS+= -D__LIB_DEVMAPPER__ -DDM_DEVICE_UID=0 \ - -DDM_DEVICE_GID=0 -DDM_DEVICE_MODE=0600 +CPPFLAGS+= -D__LIB_DEVMAPPER__ LIBDM_OBJDIR!= cd ${LIBDM_SRCDIR} && ${PRINTOBJDIR} LDADD+= -L${LIBDM_OBJDIR} -ldevmapper