From owner-p4-projects@FreeBSD.ORG Sun May 28 04:04:11 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 314DE16B79C; Sun, 28 May 2006 04:03:17 +0000 (UTC) X-Original-To: perforce@freebsd.org 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 4FE9016B873 for ; Sun, 28 May 2006 03:56:53 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D14443D46 for ; Sun, 28 May 2006 03:56:53 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4S3tkBP061157 for ; Sun, 28 May 2006 03:55:46 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4S3tkQp061154 for perforce@freebsd.org; Sun, 28 May 2006 03:55:46 GMT (envelope-from csjp@freebsd.org) Date: Sun, 28 May 2006 03:55:46 GMT Message-Id: <200605280355.k4S3tkQp061154@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 97988 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 May 2006 04:04:38 -0000 http://perforce.freebsd.org/chv.cgi?CH=97988 Change 97988 by csjp@csjp_xor on 2006/05/28 03:55:13 Instead of zeroing out termid, resulting in a bogus origin, use getaudit instead. This will allow remote host information to be propagated through to the subject token. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#23 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#23 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#22 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_wrappers.c#23 $ */ #ifdef __APPLE__ @@ -62,12 +62,12 @@ int reterr, const char *fmt, ...) { char text[MAX_AUDITSTRING_LEN]; - au_tid_t termid; token_t *token; long acond; va_list ap; pid_t pid; int error, afd; + struct auditinfo ai; if (auditon(A_GETCOND, &acond, sizeof(acond)) < 0) { /* @@ -92,11 +92,16 @@ errno = error; return (-1); } - /* XXX what should we do for termid? */ - bzero(&termid, sizeof(termid)); + if (getaudit(&ai) < 0) { + error = errno; + syslog(LOG_AUTH | LOG_ERR, "audit: getaudit failed: %s", + strerror(errno)); + errno = error; + return (-1); + } pid = getpid(); token = au_to_subject32(auid, geteuid(), getegid(), - getuid(), getgid(), pid, pid, &termid); + getuid(), getgid(), pid, pid, &ai.ai_termid); if (token == NULL) { syslog(LOG_AUTH | LOG_ERR, "audit: unable to build subject token");