From owner-freebsd-bugs@FreeBSD.ORG Tue Jun 7 12:01:29 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 57BC816A4C4 for ; Tue, 7 Jun 2005 12:01:29 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 43AD043D53 for ; Tue, 7 Jun 2005 12:00:58 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j57C0wkJ090276 for ; Tue, 7 Jun 2005 12:00:58 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j57C0wxE090273; Tue, 7 Jun 2005 12:00:58 GMT (envelope-from gnats) Resent-Date: Tue, 7 Jun 2005 12:00:58 GMT Resent-Message-Id: <200506071200.j57C0wxE090273@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, "Loren M. Lang" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8BD216A41C for ; Tue, 7 Jun 2005 11:50:44 +0000 (GMT) (envelope-from sttng359@alzatex.com) Received: from hosea.tallye.com (joel.tallye.com [216.99.199.78]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C3CD43D4C for ; Tue, 7 Jun 2005 11:50:44 +0000 (GMT) (envelope-from sttng359@alzatex.com) Received: from fbsd.ddns.alzatex.cc (fbsd.ddns.alzatex.cc [192.168.1.37]) by hosea.tallye.com (8.12.8/8.12.10) with ESMTP id j57BohDV014139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 7 Jun 2005 04:50:43 -0700 Received: from fbsd.ddns.alzatex.cc (localhost [127.0.0.1]) by fbsd.ddns.alzatex.cc (8.13.3/8.13.3) with ESMTP id j57Bsc60001527 for ; Tue, 7 Jun 2005 04:54:38 -0700 (PDT) (envelope-from sttng359@fbsd.ddns.alzatex.cc) Received: (from sttng359@localhost) by fbsd.ddns.alzatex.cc (8.13.3/8.13.3/Submit) id j57BscEW001526; Tue, 7 Jun 2005 04:54:38 -0700 (PDT) (envelope-from sttng359) Message-Id: <200506071154.j57BscEW001526@fbsd.ddns.alzatex.cc> Date: Tue, 7 Jun 2005 04:54:38 -0700 (PDT) From: "Loren M. Lang" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/81989: [PATCH] mount_msdosfs When a mask, but no dirmask specified, add X bits to dirmask. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Loren M. Lang" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2005 12:01:29 -0000 >Number: 81989 >Category: bin >Synopsis: [PATCH] mount_msdosfs When a mask, but no dirmask specified, add X bits to dirmask. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jun 07 12:00:57 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Loren M. Lang >Release: FreeBSD 5.4-RELEASE-p1 i386 >Organization: Alzatex, Inc. >Environment: System: FreeBSD fbsd.ddns.alzatex.cc 5.4-RELEASE-p1 FreeBSD 5.4-RELEASE-p1 #6: Tue Jun 7 04:04:28 PDT 2005 root@:/usr/obj/usr/src/sys/IPSEC-NG i386 >Description: Currently, when a file mask is set, but no directory mask, it sets the directory mask to the file mask. Or when no mask it set at all, it uses the permissions on the mount point for both the directory and file mask. This patch causes mount_msdosfs to enable the access(X) bit for the directory mask everywhere either a read or write permission is set. This allows me to set a file mask with -m 644 or by changing the permissions on the mount point to 644 and have directories work correctly with the corresponding 755 permissions. This behavior mimics how mount_smbfs currently responds for smb network mounts. >How-To-Repeat: The following two commands would get a permission error: mount_msdosfs -m 644 /dev/fd0 /mnt/floppy ls /mnt/floppy >Fix: --- mount_msdosfs.patch begins here --- --- sbin/mount_msdosfs/mount_msdosfs.c.orig Sat Jun 4 02:49:28 2005 +++ sbin/mount_msdosfs/mount_msdosfs.c Tue Jun 7 03:48:53 2005 @@ -81,6 +81,7 @@ static mode_t a_mask(char *); static void usage(void) __dead2; static int set_charset(struct msdosfs_args *); +static mode_t set_dirxbit(mode_t); int main(int argc, char **argv) @@ -186,7 +187,7 @@ usage(); if (set_mask && !set_dirmask) { - args.dirmask = args.mask; + args.dirmask = set_dirxbit(args.mask); set_dirmask = 1; } else if (set_dirmask && !set_mask) { @@ -231,15 +232,30 @@ args.uid = sb.st_uid; if (!set_gid) args.gid = sb.st_gid; - if (!set_mask) - args.mask = args.dirmask = - sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + if (!set_mask) { + args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + args.dirmask = set_dirxbit(args.mask); + } } if (mount("msdosfs", mntpath, mntflags, &args) < 0) err(EX_OSERR, "%s", dev); exit (0); +} + +static mode_t +set_dirxbit(m) + mode_t m; +{ + if(m & (S_IRUSR|S_IWUSR)) + m |= S_IXUSR; + if(m & (S_IRGRP|S_IWGRP)) + m |= S_IXGRP; + if(m & (S_IROTH|S_IWOTH)) + m |= S_IXOTH; + + return m; } gid_t --- mount_msdosfs.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: