From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 8 02:00:35 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49BB637B401 for ; Fri, 8 Aug 2003 02:00:35 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 40FA043FCB for ; Fri, 8 Aug 2003 02:00:34 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h7890YUp094690 for ; Fri, 8 Aug 2003 02:00:34 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h7890YfG094689; Fri, 8 Aug 2003 02:00:34 -0700 (PDT) Resent-Date: Fri, 8 Aug 2003 02:00:34 -0700 (PDT) Resent-Message-Id: <200308080900.h7890YfG094689@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Morozovsky Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 067FC37B401; Fri, 8 Aug 2003 01:55:13 -0700 (PDT) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id D755243F85; Fri, 8 Aug 2003 01:55:11 -0700 (PDT) (envelope-from marck@woozle.rinet.ru) Received: from woozle.rinet.ru (localhost [127.0.0.1]) by woozle.rinet.ru (8.12.9/8.12.9) with ESMTP id h788tA4C087904; Fri, 8 Aug 2003 12:55:10 +0400 (MSD) (envelope-from marck@woozle.rinet.ru) Received: (from marck@localhost) by woozle.rinet.ru (8.12.9/8.12.9/Submit) id h788tAwQ087903; Fri, 8 Aug 2003 12:55:10 +0400 (MSD) Message-Id: <200308080855.h788tAwQ087903@woozle.rinet.ru> Date: Fri, 8 Aug 2003 12:55:10 +0400 (MSD) From: Dmitry Morozovsky To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: grog@FreeBSD.org Subject: bin/55366: [patch] vinum makes /dev/vinum with wrong ownership X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Dmitry Morozovsky List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2003 09:00:35 -0000 >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 #include #include +#include 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: