au_class_ent_t * getauclassnam(char *name) { static au_class_ent_t e; static char cname[AU_CLASS_NAME_MAX]; static char cdesc[AU_CLASS_DESC_MAX]; e.ac_name = cname; e.ac_desc = cdesc; return (getauclassnam_r(&e, name)); }
/* * Convert the character representation of audit values into the au_mask_t * field. */ int getauditflagsbin(char *auditstr, au_mask_t *masks) { char class_ent_name[AU_CLASS_NAME_MAX]; char class_ent_desc[AU_CLASS_DESC_MAX]; struct au_class_ent c; char *tok; char sel, sub; char *last; bzero(&c, sizeof(c)); bzero(class_ent_name, sizeof(class_ent_name)); bzero(class_ent_desc, sizeof(class_ent_desc)); c.ac_name = class_ent_name; c.ac_desc = class_ent_desc; masks->am_success = 0; masks->am_failure = 0; tok = strtok_r(auditstr, flagdelim, &last); while (tok != NULL) { /* Check for the events that should not be audited. */ if (tok[0] == '^') { sub = 1; tok++; } else sub = 0; /* Check for the events to be audited for success. */ if (tok[0] == '+') { sel = AU_PRS_SUCCESS; tok++; } else if (tok[0] == '-') { sel = AU_PRS_FAILURE; tok++; } else sel = AU_PRS_BOTH; if ((getauclassnam_r(&c, tok)) != NULL) { if (sub) SUB_FROM_MASK(masks, c.ac_class, sel); else ADD_TO_MASK(masks, c.ac_class, sel); } else { errno = EINVAL; return (-1); } /* Get the next class. */ tok = strtok_r(NULL, flagdelim, &last); } return (0); }
struct au_class_ent * getauclassnam(const char *name) { static char class_ent_name[AU_CLASS_NAME_MAX]; static char class_ent_desc[AU_CLASS_DESC_MAX]; static struct au_class_ent c; bzero(&c, sizeof(c)); bzero(class_ent_name, sizeof(class_ent_name)); bzero(class_ent_desc, sizeof(class_ent_desc)); c.ac_name = class_ent_name; c.ac_desc = class_ent_desc; return (getauclassnam_r(&c, name)); }