Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl2/lvm2 PR/44267: Michael van Elst: LVM devices h...
details: https://anonhg.NetBSD.org/src/rev/271daf9da832
branches: trunk
changeset: 760004:271daf9da832
user: christos <christos%NetBSD.org@localhost>
date: Thu Dec 23 17:46:54 2010 +0000
description:
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.
diffstat:
external/gpl2/lvm2/dist/daemons/cmirrord/functions.c | 7 +++++--
external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c | 8 ++++++--
external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c | 8 ++++++--
external/gpl2/lvm2/lib/libdevmapper/Makefile | 5 ++---
external/gpl2/lvm2/lvm2tools.mk | 5 ++++-
external/gpl2/lvm2/sbin/dmsetup/Makefile | 5 ++---
6 files changed, 25 insertions(+), 13 deletions(-)
diffs (130 lines):
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/dist/daemons/cmirrord/functions.c
--- a/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/dist/daemons/cmirrord/functions.c Thu Dec 23 17:46:54 2010 +0000
@@ -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
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c
--- a/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/dist/libdm/ioctl/libdm-iface.c Thu Dec 23 17:46:54 2010 +0000
@@ -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)) {
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c
--- a/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/dist/libdm/ioctl/libdm-nbsd-iface.c Thu Dec 23 17:46:54 2010 +0000
@@ -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;
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/lib/libdevmapper/Makefile
--- a/external/gpl2/lvm2/lib/libdevmapper/Makefile Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/lib/libdevmapper/Makefile Thu Dec 23 17:46:54 2010 +0000
@@ -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
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/lvm2tools.mk
--- a/external/gpl2/lvm2/lvm2tools.mk Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/lvm2tools.mk Thu Dec 23 17:46:54 2010 +0000
@@ -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/
#
diff -r 42fc6b9d4e65 -r 271daf9da832 external/gpl2/lvm2/sbin/dmsetup/Makefile
--- a/external/gpl2/lvm2/sbin/dmsetup/Makefile Thu Dec 23 17:44:33 2010 +0000
+++ b/external/gpl2/lvm2/sbin/dmsetup/Makefile Thu Dec 23 17:46:54 2010 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index