From owner-p4-projects@FreeBSD.ORG Wed Aug 11 00:39:22 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8640216A4D1; Wed, 11 Aug 2004 00:39:22 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AE8416A4CE for ; Wed, 11 Aug 2004 00:39:22 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27F6543D4C for ; Wed, 11 Aug 2004 00:39:22 +0000 (GMT) (envelope-from wsalamon@computer.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i7B0dMHY041677 for ; Wed, 11 Aug 2004 00:39:22 GMT (envelope-from wsalamon@computer.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i7B0dLbT041674 for perforce@freebsd.org; Wed, 11 Aug 2004 00:39:21 GMT (envelope-from wsalamon@computer.org) Date: Wed, 11 Aug 2004 00:39:21 GMT Message-Id: <200408110039.i7B0dLbT041674@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to wsalamon@computer.org using -f From: Wayne Salamon To: Perforce Change Reviews Subject: PERFORCE change 59360 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2004 00:39:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=59360 Change 59360 by wsalamon@wsalamon_epi on 2004/08/11 00:38:27 Fix the usage of vn_getpath(). Test that the path is written to the audit log by auditing the fchdir() system call. Add a needed include to audit_kernel.h. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/bsm/audit_kernel.h#5 edit .. //depot/projects/trustedbsd/audit3/sys/kern/vfs_syscalls.c#2 edit .. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#7 edit .. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_klib.c#5 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/bsm/audit_kernel.h#5 (text+ko) ==== @@ -28,6 +28,7 @@ #include +#include #include #include ==== //depot/projects/trustedbsd/audit3/sys/kern/vfs_syscalls.c#2 (text+ko) ==== @@ -40,6 +40,9 @@ #include "opt_compat.h" #include "opt_mac.h" +#include +#include + #include #include #include @@ -679,6 +682,9 @@ VREF(vp); fdrop(fp, td); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + + AUDIT_ARG(vnpath, vp, ARG_VNODE1); + if (vp->v_type != VDIR) error = ENOTDIR; #ifdef MAC ==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#7 (text+ko) ==== @@ -62,7 +62,7 @@ * volume, it should be left off unless you want your system * to churn a lot whenever the audit record flow gets high. */ -/* #define AUDIT_EXCESSIVELY_VERBOSE */ +#define AUDIT_EXCESSIVELY_VERBOSE #ifdef AUDIT_EXCESSIVELY_VERBOSE #define AUDIT_PRINTF(x) printf x #else @@ -2027,7 +2027,7 @@ struct kaudit_record *ar; struct vattr vattr; int error; - char **pathp, **retbuf, **freebuf; + char **pathp, *retbuf, *freebuf; struct vnode_au_info *vnp; struct thread *td; @@ -2069,10 +2069,9 @@ * it fails, we just have a zero-length string. Perhaps instead * we should not include a path token...? */ - retbuf = freebuf = NULL; - if (vn_fullpath(td, vp, retbuf, freebuf) == 0) { + if (vn_fullpath(td, vp, &retbuf, &freebuf) == 0) { /* Copy and free buffer allocated by vn_fullpath() */ - bcopy(*retbuf, *pathp, MAXPATHLEN); + bcopy(retbuf, *pathp, MAXPATHLEN); free(freebuf, M_TEMP); } else { (*pathp)[0] = '\0'; ==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_klib.c#5 (text+ko) ==== @@ -814,7 +814,7 @@ void canon_path(struct thread *td, char *path, char *cpath) { char *bufp; - char **retbuf, **freebuf; + char *retbuf, *freebuf; int len; struct vnode *vnp; struct filedesc *fdp; @@ -855,11 +855,10 @@ * string bounding here seems a bit questionable and * will also require attention. */ - retbuf = freebuf = NULL; vn_lock(vnp, LK_EXCLUSIVE | LK_RETRY, td); - if (vn_fullpath(td, vnp, retbuf, freebuf) == 0) { + if (vn_fullpath(td, vnp, &retbuf, &freebuf) == 0) { /* Copy and free buffer allocated by vn_fullpath() */ - bcopy(*retbuf, cpath, MAXPATHLEN); + bcopy(retbuf, cpath, MAXPATHLEN); free(freebuf, M_TEMP); } else {