Merge r203410 from head to stable/8:

Only audit pathnames in namei(9) if copying the directory string completes
 successfully.  Continue to do this before the empty path check so that the
 ENOENT returned in that case gets an empty string token in the BSM record.

Approved by:	re (kib)
This commit is contained in:
Robert Watson 2010-05-31 21:57:31 +00:00
parent b269c05e01
commit 1732ca8fb3

View File

@ -162,11 +162,16 @@ namei(struct nameidata *ndp)
error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf,
MAXPATHLEN, (size_t *)&ndp->ni_pathlen);
/* If we are auditing the kernel pathname, save the user pathname. */
if (cnp->cn_flags & AUDITVNODE1)
AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf);
if (cnp->cn_flags & AUDITVNODE2)
AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf);
if (error == 0) {
/*
* If we are auditing the kernel pathname, save the user
* pathname.
*/
if (cnp->cn_flags & AUDITVNODE1)
AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf);
if (cnp->cn_flags & AUDITVNODE2)
AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf);
}
/*
* Don't allow empty pathnames.