PERFORCE change 87382 for review
Robert Watson
rwatson at FreeBSD.org
Mon Nov 28 21:22:07 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=87382
Change 87382 by rwatson at 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 <bsm/libbsm.h>
+#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -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
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list