svn commit: r203410 - head/sys/kern
Robert Watson
rwatson at FreeBSD.org
Tue Feb 2 23:10:27 UTC 2010
Author: rwatson
Date: Tue Feb 2 23:10:27 2010
New Revision: 203410
URL: http://svn.freebsd.org/changeset/base/203410
Log:
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.
MFC after: 3 days
Modified:
head/sys/kern/vfs_lookup.c
Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c Tue Feb 2 23:05:53 2010 (r203409)
+++ head/sys/kern/vfs_lookup.c Tue Feb 2 23:10:27 2010 (r203410)
@@ -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.
More information about the svn-src-head
mailing list