/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* get audit preselection mask values
*/
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <adt_xlate.h> /* adt_write_syslog */
static int
{
if (v == 0) {
} else {
}
(void) strcat(s, ",");
return (0);
}
return (-1);
}
/*
* getauditflagschar() - convert bit flag to character string
*
* input: masks->am_success - audit on success
* masks->am_failure - audit on failure
* verbose - string format. 0 if short name; 1 if long name;
*
* output: auditstring - resultant audit string
*
* returns: 0 - entry read ok
* -1 - error
*/
int
{
unsigned int m; /* for masking with masks */
int l;
/* initialize input buffer */
*auditstring = '\0';
/* no masks, no flags; we're outta here */
return (-1);
/* kludge to get rid of trailing comma */
if (auditstring[l] == ',')
auditstring[l] = '\0';
return (0);
}
/* Get the mask value for the string "all" */
all.am_success = 0;
all.am_failure = 0;
return (-1);
return (0);
}
plus_all = 1;
minus_all = 1;
}
for (m = (unsigned)0x80000000; m != 0; m >>= 1) {
else if (m & masks->am_success)
prefix = "+";
else if (m & masks->am_failure)
prefix = "-";
else
continue;
return (-1);
}
*prefix = '\0';
return (0);
}
/*
* Audit flags:
*
* [+ | - | ^ | ^+ | ^-]<classname>{,[+ | - | ^ | ^+ | ^-]<classname>}*
*
* <classname>, add class mask to success and failure mask.
* +<classname>, add class mask only to success mask.
* -<classname>, add class mask only to failure mask.
* ^<classname>, remove class mask from success and failure mask.
* ^+<classname>, remove class mask from success mask.
* ^-<classname>, remove class mask from failure mask.
*/
/*
* __chkflags - check if the audit flags are valid for this system
*
* Entry flags = audit flags string.
* cont = B_TRUE, continue parsing even if error.
* B_FALSE, return failure on error.
*
* Exit mask = audit mask as defined by flags.
*
* Return B_TRUE if no errors, or continue == B_TRUE.
* B_FALSE and if error != NULL, flags in error.
*/
{
int i;
return (B_FALSE);
}
mask->am_success = 0;
mask->am_failure = 0;
while (*flags != '\0') {
/* skip white space */
flags++;
}
if (flags == '\0') {
break;
}
/* save error pointer */
}
/* get the prefix */
if (*flags == '+') {
flags++;
} else if (*flags == '-') {
flags++;
} else if (*flags == '^') {
flags++;
if (*flags == '+') {
flags++;
} else if (*flags == '-') {
flags++;
}
}
/* get class name */
for (i = 0; (i < sizeof (name) - 1) &&
}
name[i++] = '\0';
if (*flags == ',') {
/* skip comma (',') */
flags++;
}
if (!cont) {
return (B_FALSE);
} else {
"audit flag %s", name);
}
} else {
/* add class mask */
}
}
}
}
return (B_TRUE);
}
/*
* getauditflagsbin() - converts character string to success and
* failure bit masks
*
* input: auditstring - audit string
*
* output: masks->am_success - audit on success
* masks->am_failure - audit on failure
*
* returns: 0 - ok
* -1 - error - string or mask NULL.
*/
int
{
return (0);
}
return (-1);
}