diff options
author | amw <none@none> | 2007-10-25 16:34:29 -0700 |
---|---|---|
committer | amw <none@none> | 2007-10-25 16:34:29 -0700 |
commit | da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0 (patch) | |
tree | 65be91fb78a6a66183197595333f2e8aafb4640a /usr/src/uts/common/syscall/open.c | |
parent | e845e33dd0d1aea22db7edaa8c7d43955d24609b (diff) | |
download | illumos-joyent-da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0.tar.gz |
PSARC/2007/218 caller_context_t in all VOPs
PSARC/2007/227 VFS Feature Registration and ACL on Create
PSARC/2007/244 ZFS Case-insensitive support
PSARC/2007/315 Extensible Attribute Interfaces
PSARC/2007/394 ls(1) new command line options '-/' and '-%': CIFS system attributes support
PSARC/2007/403 Modified Access Checks for CIFS
PSARC/2007/410 Add system attribute support to chmod(1)
PSARC/2007/432 CIFS system attributes support for cp(1), pack(1), unpack(1), compress(1) and uncompress(1)
PSARC/2007/444 Rescind SETTABLE Attribute
PSARC/2007/459 CIFS system attributes support for cpio(1), pax(1), tar(1)
PSARC/2007/546 Update utilities to match CIFS system attributes changes.
PSARC/2007/560 ZFS sharesmb property
4890717 want append-only files
6417428 Case-insensitive file system name lookup to support CIFS
6417435 DOS attributes and additional timestamps to support for CIFS
6417442 File system quarantined and modified attributes to support an integrated Anti-Virus service
6417453 FS boolean property for rejecting/allowing invalid UTF-8 sequences in file names
6473733 RFE: Need support for open-deny modes
6473755 RFE: Need ability to reconcile oplock and delegation conflicts
6494624 sharemgr needs to support CIFS shares better
6546705 All vnode operations need to pass caller_context_t
6546706 Need VOP_SETATTR/VOP_GETATTR to support new, optional attributes
6546893 Solaris system attribute support
6550962 ZFS ACL inheritance needs to be enhanced to support Automatic Inheritance
6553589 RFE: VFS Feature Registration facility
6553770 RFE: ZFS support for ACL-on-CREATE (PSARC 2007/227)
6565581 ls(1) should support file system attributes proposed in PSARC/2007/315
6566784 NTFS streams are not copied along with the files.
6576205 cp(1), pack(1) and compress(1) should support file system attributes proposed in PSARC/2007/315
6578875 RFE: kernel interfaces for nbmand need improvement
6578883 RFE: VOP_SHRLOCK needs additional access types
6578885 chmod(1) should support file system attributes proposed in PSARC/2007/315
6578886 RFE: disallow nbmand state to change on remount
6583349 ACL parser needs to support audit/alarm ACE types
6590347 tar(1) should support filesystem attributes proposed in PSARC/2007/315
6597357 *tar* xv@ doesn't show the hidden directory even though it is restored
6597360 *tar* should re-init xattr info if openat() fails during extraction of and extended attribute
6597368 *tar* cannot restore hard linked extended attributes
6597374 *tar* doesn't display "x " when hard linked attributes are restored
6597375 *tar* extended attribute header off by one
6614861 *cpio* incorrectly archives extended system attributes with -@
6614896 *pax* incorrectly archives extended system attributes with -@
6615225 *tar* incorrectly archives extended system attributes with -@
6617183 CIFS Service - PSARC 2006/715
Diffstat (limited to 'usr/src/uts/common/syscall/open.c')
-rw-r--r-- | usr/src/uts/common/syscall/open.c | 77 |
1 files changed, 64 insertions, 13 deletions
diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index f5b873bdb7..b45f7bf35b 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -49,6 +49,7 @@ #include <sys/uio.h> #include <sys/debug.h> #include <c2/audit.h> +#include <sys/cmn_err.h> /* * Common code for open()/openat() and creat(). Check permissions, allocate @@ -66,6 +67,8 @@ copen(int startfd, char *fname, int filemode, int createmode) int fd, dupfd; vnode_t *startvp; proc_t *p = curproc; + uio_seg_t seg = UIO_USERSPACE; + char *open_filename = fname; if (startfd == AT_FDCWD) { /* @@ -95,7 +98,31 @@ copen(int startfd, char *fname, int filemode, int createmode) } } - if (filemode & FXATTR) { + /* + * Handle openattrdirat request + */ + if (filemode & FXATTRDIROPEN) { +#ifdef C2_AUDIT + if (audit_active) + audit_setfsat_path(1); +#endif /* C2_AUDIT */ + + if (error = lookupnameat(fname, seg, FOLLOW, + NULLVPP, &vp, startvp)) + return (set_errno(error)); + if (startvp) { + VN_RELE(startvp); + startvp = NULL; + } + + startvp = vp; + } + + /* + * Do we need to go into extended attribute space? + */ + if (filemode & (FXATTR|FXATTRDIROPEN)) { + vattr_t vattr; /* * Make sure we have a valid request. @@ -111,7 +138,7 @@ copen(int startfd, char *fname, int filemode, int createmode) goto out; } - if (startfd == AT_FDCWD) { + if (startfd == AT_FDCWD && !(filemode & FXATTRDIROPEN)) { mutex_enter(&p->p_lock); startvp = PTOU(p)->u_cdir; VN_HOLD(startvp); @@ -119,23 +146,34 @@ copen(int startfd, char *fname, int filemode, int createmode) } /* - * Verify permission to put attributes on file + * In order to access hidden attribute directory the + * user must be able to stat() the file */ - if ((VOP_ACCESS(startvp, VREAD, 0, CRED()) != 0) && - (VOP_ACCESS(startvp, VWRITE, 0, CRED()) != 0) && - (VOP_ACCESS(startvp, VEXEC, 0, CRED()) != 0)) { - error = EACCES; + vattr.va_mask = AT_ALL; + if (error = VOP_GETATTR(startvp, &vattr, 0, CRED(), NULL)) { pn_free(&pn); goto out; } - if ((startvp->v_vfsp->vfs_flag & VFS_XATTR) != 0) { + if ((startvp->v_vfsp->vfs_flag & VFS_XATTR) != 0 || + vfs_has_feature(startvp->v_vfsp, VFSFT_XVATTR)) { error = VOP_LOOKUP(startvp, "", &sdvp, &pn, - LOOKUP_XATTR|CREATE_XATTR_DIR, rootvp, CRED()); + LOOKUP_XATTR|CREATE_XATTR_DIR, rootvp, CRED(), + NULL, NULL, NULL); } else { error = EINVAL; } + + /* + * For openattrdirat use "." as filename to open + * as part of vn_openat() + */ + if (error == 0 && (filemode & FXATTRDIROPEN)) { + open_filename = "."; + seg = UIO_SYSSPACE; + } + pn_free(&pn); if (error != 0) goto out; @@ -144,7 +182,7 @@ copen(int startfd, char *fname, int filemode, int createmode) startvp = sdvp; } - if ((filemode & (FREAD|FWRITE)) != 0) { + if ((filemode & (FREAD|FWRITE|FXATTRDIROPEN)) != 0) { if ((filemode & (FNONBLOCK|FNDELAY)) == (FNONBLOCK|FNDELAY)) filemode &= ~FNDELAY; error = falloc((vnode_t *)NULL, filemode, &fp, &fd); @@ -157,9 +195,11 @@ copen(int startfd, char *fname, int filemode, int createmode) * Last arg is a don't-care term if * !(filemode & FCREAT). */ - error = vn_openat(fname, UIO_USERSPACE, filemode, - (int)(createmode & MODEMASK), &vp, CRCREAT, - PTOU(curproc)->u_cmask, startvp); + + error = vn_openat(open_filename, seg, filemode, + (int)(createmode & MODEMASK), + &vp, CRCREAT, PTOU(curproc)->u_cmask, + startvp, fd); if (startvp != NULL) VN_RELE(startvp); @@ -223,6 +263,7 @@ out: #define OPENMODE32(fmode) ((int)((fmode)-FOPEN)) #define CREATMODE32 (FWRITE|FCREAT|FTRUNC) #define OPENMODE64(fmode) (OPENMODE32(fmode) | FOFFMAX) +#define OPENMODEATTRDIR FXATTRDIROPEN #define CREATMODE64 (CREATMODE32 | FOFFMAX) #ifdef _LP64 #define OPENMODE(fmode) OPENMODE64(fmode) @@ -301,4 +342,14 @@ openat32(int fd, char *path, int fmode, int cmode) { return (copen(fd, path, OPENMODE32(fmode), cmode)); } + #endif /* _SYSCALL32_IMPL */ + +/* + * Special interface to open hidden attribute directory. + */ +int +openattrdirat(int fd, char *fname) +{ + return (copen(fd, fname, OPENMODEATTRDIR, 0)); +} |