The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

[FreeBSD] mount_msdos patch - раздельнве маски для файлов и каталогов (patch fs bsd)


<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>
Ключевые слова: patch, fs, bsd,  (найти похожие документы)
Date: Wed, 22 May 2002 23:04:33 +0400 From: Eugene Grosbein <Eugene.Grosbein@f1.n5006.z2.fidonet.org> Newsgroups: fido7.ru.unix.bsd Subject: [FreeBSD] mount_msdos patch - раздельнве маски для файлов и каталогов AD> а никто не делал патч на msdos fs дабы оно при noexec таки делало файлы AD> неисполняемыми? ну или чтоб можно было маски для файлов и каталогов AD> раздельно указывать, один хрен. Index: sbin/mount_msdos/mount_msdos.8
RCS file: /home/ncvs/src/sbin/mount_msdos/Attic/mount_msdos.8,v retrieving revision 1.19.2.1 diff -u -r1.19.2.1 mount_msdos.8 - --- sbin/mount_msdos/mount_msdos.8 8 Dec 2000 14:03:59 -0000 1.19.2.1 +++ sbin/mount_msdos/mount_msdos.8 19 Jan 2002 05:55:22 -0000 @@ -42,6 +42,7 @@ .Op Fl u Ar uid .Op Fl g Ar gid .Op Fl m Ar mask +.Op Fl M Ar mask .Op Fl s .Op Fl l .Op Fl 9 @@ -105,11 +106,22 @@ for more information about octal file modes.) Only the nine low-order bits of .Ar mask -are used. +are used. The value of +.Ar -M +is used if it is supplied and +.Ar -m +is omitted. The default .Ar mask is taken from the directory on which the file system is being mounted. +.It Fl M Ar mask +Specify the maximum file permissions for directories +in the file system. The value of +.Ar -m +is used if it is supplied and +.Ar -M +is omitted. See description of previous option for details. .It Fl s Force behaviour to ignore and not generate Win'95 long filenames. Index: sbin/mount_msdos/mount_msdos.c
RCS file: /home/ncvs/src/sbin/mount_msdos/Attic/mount_msdos.c,v retrieving revision 1.19.2.1 diff -u -r1.19.2.1 mount_msdos.c - --- sbin/mount_msdos/mount_msdos.c 20 Jul 2000 10:35:13 -0000 1.19.2.1 +++ sbin/mount_msdos/mount_msdos.c 19 Jan 2002 04:30:27 -0000 @@ -88,15 +88,15 @@ { struct msdosfs_args args; struct stat sb; - int c, error, mntflags, set_gid, set_uid, set_mask; + int c, error, mntflags, set_gid, set_uid, set_mask, set_dirmask; char *dev, *dir, mntpath[MAXPATHLEN]; struct vfsconf vfc; - mntflags = set_gid = set_uid = set_mask = 0; + mntflags = set_gid = set_uid = set_mask = set_dirmask = 0; (void)memset(&args, '\0', sizeof(args)); args.magic = MSDOSFS_ARGSMAGIC; - while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) { + while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:W:")) != -1) { switch (c) { #ifdef MSDOSFSMNT_GEMDOSFS case 'G': @@ -124,6 +124,10 @@ args.mask = a_mask(optarg); set_mask = 1; break; + case 'M': + args.dirmask = a_mask(optarg); + set_dirmask = 1; + break; case 'L': load_ultable(&args, optarg); args.flags |= MSDOSFSMNT_ULTABLE; @@ -144,7 +148,16 @@ if (optind + 2 != argc) usage(); - + + if (set_mask && !set_dirmask) { + args.dirmask = args.mask; + set_dirmask = 1; + } + else if (set_dirmask && !set_mask) { + args.mask = args.dirmask; + set_mask = 1; + } + dev = argv[optind]; dir = argv[optind + 1]; @@ -170,7 +183,8 @@ if (!set_gid) args.gid = sb.st_gid; if (!set_mask) - args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + args.mask = args.dirmask = + sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } error = getvfsbyname("msdos", &vfc); Index: sys/msdosfs/msdosfs_vfsops.c
RCS file: /home/ncvs/src/sys/msdosfs/Attic/msdosfs_vfsops.c,v retrieving revision 1.60.2.5 diff -u -r1.60.2.5 msdosfs_vfsops.c - --- sys/msdosfs/msdosfs_vfsops.c 4 Nov 2001 18:57:51 -0000 1.60.2.5 +++ sys/msdosfs/msdosfs_vfsops.c 19 Jan 2002 04:47:43 -0000 @@ -113,6 +113,7 @@ pmp->pm_gid = argp->gid; pmp->pm_uid = argp->uid; pmp->pm_mask = argp->mask & ALLPERMS; + pmp->pm_dirmask = argp->dirmask & ALLPERMS; pmp->pm_flags |= argp->flags & MSDOSFSMNT_MNTOPT; if (pmp->pm_flags & MSDOSFSMNT_U2WTABLE) { bcopy(argp->u2w, pmp->pm_u2w, sizeof(pmp->pm_u2w)); @@ -184,7 +185,7 @@ args.flags = 0; args.uid = 0; args.gid = 0; - args.mask = 0777; + args.mask = args.dirmask = 0777; if ((error = mountmsdosfs(rootvp, mp, p, &args)) != 0) { free(mp, M_MOUNT); Index: sys/msdosfs/msdosfs_vnops.c
RCS file: /home/ncvs/src/sys/msdosfs/Attic/msdosfs_vnops.c,v retrieving revision 1.95.2.1 diff -u -r1.95.2.1 msdosfs_vnops.c - --- sys/msdosfs/msdosfs_vnops.c 18 Jul 2000 13:19:13 -0000 1.95.2.1 +++ sys/msdosfs/msdosfs_vnops.c 19 Jan 2002 05:36:00 -0000 @@ -259,7 +259,7 @@ file_mode = (S_IXUSR|S_IXGRP|S_IXOTH) | (S_IRUSR|S_IRGRP|S_IROTH) | ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH)); - file_mode &= pmp->pm_mask; + file_mode &= (vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); /* * Disallow write attempts on read-only file systems; @@ -358,7 +358,8 @@ mode = S_IRWXU|S_IRWXG|S_IRWXO; else mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; - vap->va_mode = mode & pmp->pm_mask; + vap->va_mode = mode & + (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); vap->va_uid = pmp->pm_uid; vap->va_gid = pmp->pm_gid; vap->va_nlink = 1; Index: sys/msdosfs/msdosfsmount.h
RCS file: /home/ncvs/src/sys/msdosfs/Attic/msdosfsmount.h,v retrieving revision 1.20.2.2 diff -u -r1.20.2.2 msdosfsmount.h - --- sys/msdosfs/msdosfsmount.h 27 Oct 2000 09:45:07 -0000 1.20.2.2 +++ sys/msdosfs/msdosfsmount.h 19 Jan 2002 04:42:41 -0000 @@ -65,7 +65,10 @@ dev_t pm_dev; /* block special device mounted */ uid_t pm_uid; /* uid to set as owner of the files */ gid_t pm_gid; /* gid to set as owner of the files */ - mode_t pm_mask; /* mask to and with file protection bits */ + mode_t pm_mask; /* mask to and with file protection bits + for files */ + mode_t pm_dirmask; /* mask to and with file protection bits + for directories */ struct vnode *pm_devvp; /* vnode for block device mntd */ struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */ u_long pm_BlkPerSec; /* How many DEV_BSIZE blocks fit inside a physical sector */ @@ -211,7 +214,8 @@ struct export_args export; /* network export information */ uid_t uid; /* uid that owns msdosfs files */ gid_t gid; /* gid that owns msdosfs files */ - mode_t mask; /* mask to be applied for msdosfs perms */ + mode_t mask; /* file mask to be applied for msdosfs perms */ + mode_t dirmask; /* dir mask to be applied for msdosfs perms */ int flags; /* see below */ int magic; /* version number */ u_int16_t u2w[128]; /* Local->Unicode table */ Eugene

<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>

 Добавить комментарий
Имя:
E-Mail:
Заголовок:
Текст:




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру