Date: Fri, 8 Aug 2003 12:55:10 +0400 (MSD) From: Dmitry Morozovsky <marck@rinet.ru> To: FreeBSD-gnats-submit@FreeBSD.org Cc: grog@FreeBSD.org Subject: bin/55366: [patch] vinum makes /dev/vinum with wrong ownership Message-ID: <200308080855.h788tAwQ087903@woozle.rinet.ru> Resent-Message-ID: <200308080900.h7890YfG094689@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 55366 >Category: bin >Synopsis: [patch] vinum makes /dev/vinum with wrong ownership >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 08 02:00:33 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Dmitry Morozovsky >Release: FreeBSD 4-STABLE i386 >Organization: Cronyx Plus LLC (RiNet ISP) >Environment: System: FreeBSD 4-STABLE >Description: vinum(8) creates /dev/vinum with default ownership. this leads, in particular, to unavailability to dump vinum volumes by user from group 'operator' >How-To-Repeat: create vinum volume su operator dump -0a -f /dev/null /dev/vinum/somevolume >Fix: Index: sys/dev/vinum/vinumvar.h =================================================================== RCS file: /home/ncvs/src/sys/dev/vinum/vinumvar.h,v retrieving revision 1.32.2.4 diff -u -r1.32.2.4 vinumvar.h --- sys/dev/vinum/vinumvar.h 28 May 2001 05:56:27 -0000 1.32.2.4 +++ sys/dev/vinum/vinumvar.h 8 Aug 2003 07:40:20 -0000 @@ -216,6 +216,7 @@ }; #define VINUM_DIR "/dev/vinum" +#define VINUMDEVGRP "operator" /* * These definitions help catch Index: sbin/vinum/v.c =================================================================== RCS file: /home/ncvs/src/sbin/vinum/v.c,v retrieving revision 1.26.2.3 diff -u -r1.26.2.3 v.c --- sbin/vinum/v.c 13 Mar 2001 03:04:06 -0000 1.26.2.3 +++ sbin/vinum/v.c 8 Aug 2003 07:40:20 -0000 @@ -62,6 +62,7 @@ #include <sys/linker.h> #include <sys/module.h> #include <sys/resource.h> +#include <grp.h> FILE *cf; /* config file handle */ FILE *history; /* history file */ @@ -520,6 +521,8 @@ int plexno; int sdno; int driveno; + gid_t opgrp; + struct group *gr; if (access("/dev", W_OK) < 0) { /* can't access /dev to write? */ if (errno == EROFS) /* because it's read-only, */ @@ -535,7 +538,13 @@ if (superdev >= 0) /* super device open */ close(superdev); + opgrp = ((gr = getgrnam(VINUMDEVGRP)) == NULL) ? 0 : gr->gr_gid; system("rm -rf " VINUM_DIR); /* remove the old directories */ + if (mkdir(VINUM_DIR, ACCESSPERMS) != 0 || + chown(VINUM_DIR, 0, opgrp) != 0) { + perror(VINUMMOD ": can't remake " VINUM_DIR); + return; + } system("mkdir -p " VINUM_DIR "/drive " /* and make them again */ VINUM_DIR "/plex " VINUM_DIR "/sd " >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308080855.h788tAwQ087903>