Require CAP_CREATE on directory descriptor for linkat(2).

Sponsored by:	FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
pjd 2012-09-25 20:58:15 +00:00
parent 76c124139f
commit 5ca6c6bd61

View File

@ -1622,8 +1622,8 @@ kern_linkat(struct thread *td, int fd1, int fd2, char *path1, char *path2,
VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE2,
segflg, path2, fd2, td);
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE |
AUDITVNODE2, segflg, path2, fd2, CAP_CREATE, td);
if ((error = namei(&nd)) == 0) {
lvfslocked = NDHASGIANT(&nd);
if (nd.ni_vp != NULL) {