FreeBSD Bugzilla – Attachment 10977 Details for
Bug 21807
[msdosfs] [patch] Make System attribute correspond to SF_IMMUTABLE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.60 KB, created by
mbendiks
on 2000-10-07 05:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mbendiks
Created:
2000-10-07 05:40:01 UTC
Size:
2.60 KB
patch
obsolete
>--- ./msdosfs_vnops.c.orig Sun Sep 24 14:12:47 2000 >+++ ./msdosfs_vnops.c Sun Sep 24 14:18:58 2000 >@@ -171,10 +171,12 @@ > error = uniqdosname(pdep, cnp, ndirent.de_Name); > if (error) > goto bad; > >- ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ? >- ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY; >+ ndirent.de_Attributes = ((ap->a_vap->va_mode & VWRITE) ? >+ ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY) | >+ ((ap->a_vap->va_flags & SF_IMMUTABLE) ? >+ ATTR_SYSTEM : 0); > ndirent.de_LowerCase = 0; > ndirent.de_StartCluster = 0; > ndirent.de_FileSize = 0; > ndirent.de_dev = pdep->de_dev; >@@ -275,8 +277,12 @@ > break; > } > } > >+ /* System (SF_IMMUTABLE) files cannot be written by anyone. */ >+ if ((mode & VEXEC) && (dep->de_Attributes & ATTR_SYSTEM)) >+ return EPERM; >+ > return (vaccess(vp->v_type, file_mode, pmp->pm_uid, pmp->pm_gid, > ap->a_mode, ap->a_cred, NULL)); > } > >@@ -333,9 +339,9 @@ > } else { > vap->va_atime = vap->va_mtime; > vap->va_ctime = vap->va_mtime; > } >- vap->va_flags = 0; >+ vap->va_flags = (dep->de_Attributes & ATTR_SYSTEM) ? SF_IMMUTABLE : 0; > if ((dep->de_Attributes & ATTR_ARCHIVE) == 0) > vap->va_flags |= SF_ARCHIVED; > vap->va_gen = 0; > vap->va_blocksize = pmp->pm_bpcluster; >@@ -384,8 +390,12 @@ > vap->va_uid, vap->va_gid); > #endif > return (EINVAL); > } >+ /* Check for immutability and securelevel */ >+ if ((dep->de_Attributes & ATTR_SYSTEM) && (securelevel > 0)) >+ return EPERM; >+ /* Set appropriate flags */ > if (vap->va_flags != VNOVAL) { > if (vp->v_mount->mnt_flag & MNT_RDONLY) > return (EROFS); > if (cred->cr_uid != pmp->pm_uid && >@@ -401,12 +411,19 @@ > * users to attempt to set SF_SETTABLE bits or anyone to > * set unsupported bits. However, we ignore attempts to > * set ATTR_ARCHIVE for directories `cp -pr' from a more > * sensible file system attempts it a lot. >+ * >+ * An exception with regards to the SF_SETTABLE bits, is >+ * SF_IMMUTABLE, which we map to ATTR_SYSTEM. > */ > if (cred->cr_uid != 0) { >- if (vap->va_flags & SF_SETTABLE) >+ if (vap->va_flags & (SF_SETTABLE^SF_IMMUTABLE)) > return EPERM; >+ if (vap->va_flags & SF_IMMUTABLE) >+ dep->de_Attributes |= ATTR_SYSTEM; >+ else >+ dep->de_Attributes &= ~ATTR_SYSTEM; > } > if (vap->va_flags & ~SF_ARCHIVED) > return EOPNOTSUPP; > if (vap->va_flags & SF_ARCHIVED) >@@ -414,8 +431,10 @@ > else if (!(dep->de_Attributes & ATTR_DIRECTORY)) > dep->de_Attributes |= ATTR_ARCHIVE; > dep->de_flag |= DE_MODIFIED; > } >+ if (dep->de_Attributes & ATTR_SYSTEM) >+ return EPERM; > > if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { > uid_t uid; > gid_t gid;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21807
: 10977