From owner-p4-projects@FreeBSD.ORG Mon Nov 28 21:22:09 2005 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 C12DF16A422; Mon, 28 Nov 2005 21:22:08 +0000 (GMT) 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 68EEB16A420 for ; Mon, 28 Nov 2005 21:22:08 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7246043D4C for ; Mon, 28 Nov 2005 21:22:07 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jASLM7XA022426 for ; Mon, 28 Nov 2005 21:22:07 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jASLM7uK022423 for perforce@freebsd.org; Mon, 28 Nov 2005 21:22:07 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 28 Nov 2005 21:22:07 GMT Message-Id: <200511282122.jASLM7uK022423@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 87382 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: Mon, 28 Nov 2005 21:22:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=87382 Change 87382 by rwatson@rwatson_peppercorn on 2005/11/28 21:21:48 In getauditflagsbin(), return EINVAL if the arguments are invalid or a class in the mask string isn't recognized. In getauditflagschar(), return EINVAL if the arguments are invalid. Annotate that we should also reject the character string if it contains an unrecognized class. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_flags.c#6 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_flags.c#6 (text+ko) ==== @@ -28,6 +28,7 @@ #include +#include #include #include @@ -45,8 +46,10 @@ struct au_class_ent *c; char *last; - if ((auditstr == NULL) || (masks == NULL)) + if ((auditstr == NULL) || (masks == NULL)) { + errno = EINVAL; return (-1); + } masks->am_success = 0; masks->am_failure = 0; @@ -76,8 +79,10 @@ else ADD_TO_MASK(masks, c->ac_class, sel); free_au_class_ent(c); - } else + } else { + errno = EINVAL; return (-1); + } /* Get the next class. */ tok = strtok_r(NULL, delim, &last); @@ -89,6 +94,9 @@ * Convert the au_mask_t fields into a string value. If verbose is non-zero * the long flag names are used else the short (2-character)flag names are * used. + * + * XXXRW: If bits are specified that are not matched by any class, they are + * omitted rather than rejected with EINVAL. */ int getauditflagschar(char *auditstr, au_mask_t *masks, int verbose) @@ -97,8 +105,10 @@ char *strptr = auditstr; u_char sel; - if ((auditstr == NULL) || (masks == NULL)) + if ((auditstr == NULL) || (masks == NULL)) { + return (EINVAL); return (-1); + } /* * Enumerate the class entries, check if each is selected in either