Audit path argument when changing audit trails.

Call NDFREE(), which while not currently strictly necessary, isn't a
bad idea.

MFC after:	3 days
Obtained from:	TrustedBSD Project
This commit is contained in:
Robert Watson 2006-10-02 06:56:10 +00:00
parent 20d05583d0
commit 5d8ea5963c

View File

@ -555,15 +555,16 @@ auditctl(struct thread *td, struct auditctl_args *uap)
if (uap->path == NULL)
return (EINVAL);
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_USERSPACE,
uap->path, td);
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1,
UIO_USERSPACE, uap->path, td);
flags = AUDIT_OPEN_FLAGS;
error = vn_open(&nd, &flags, 0, -1);
if (error)
return (error);
vfslocked = NDHASGIANT(&nd);
VOP_UNLOCK(nd.ni_vp, 0, td);
vp = nd.ni_vp;
VOP_UNLOCK(vp, 0, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VREG) {
vn_close(vp, AUDIT_CLOSE_FLAGS, td->td_ucred, td);
VFS_UNLOCK_GIANT(vfslocked);