Date: Tue, 2 Feb 2010 23:10:27 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r203410 - head/sys/kern Message-ID: <201002022310.o12NARVd004609@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002022310.o12NARVd004609>