Message ID | 1479252622-20935-1-git-send-email-william.c.roberts@intel.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
<snip> > memset(&avdatum, 0, sizeof avdatum); > + /* > + * AUDITDENY and DONTAUDIT are &= assigned, versus |= for > + * others. Initialize the data accordingly. > + */ > + avdatum.data = (key->specified & > + (AVRULE_AUDITDENY | AVRULE_DONTAUDIT)) ? ~0 : 0; Nak this, surprising this is working and producing correct output, but we would want to check against the AVTAB defines... This patch, while simple, for some reason is getting the best of me :-P > /* this is used to get the node - insertion is actually unique */ > node = avtab_insert_nonunique(avtab, key, &avdatum); > if (!node) { <snip>
On Nov 15, 2016 4:33 PM, "William Roberts" <bill.c.roberts@gmail.com> wrote: > > <snip> > > > memset(&avdatum, 0, sizeof avdatum); > > + /* > > + * AUDITDENY and DONTAUDIT are &= assigned, versus |= for > > + * others. Initialize the data accordingly. > > + */ > > + avdatum.data = (key->specified & > > + (AVRULE_AUDITDENY | AVRULE_DONTAUDIT)) ? ~0 : 0; > > Nak this, surprising this is working and producing correct output, but Correct when checking the sesearch output, which makes sense since we're expecting both classes to be all dontaudit statements. > we would want to check > against the AVTAB defines... > > This patch, while simple, for some reason is getting the best of me :-P > > > /* this is used to get the node - insertion is actually unique */ > > node = avtab_insert_nonunique(avtab, key, &avdatum); > > if (!node) { > <snip>
diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c index 004a029..17d2a2a 100644 --- a/libsepol/src/expand.c +++ b/libsepol/src/expand.c @@ -1640,6 +1640,12 @@ static avtab_ptr_t find_avtab_node(sepol_handle_t * handle, if (!node) { memset(&avdatum, 0, sizeof avdatum); + /* + * AUDITDENY and DONTAUDIT are &= assigned, versus |= for + * others. Initialize the data accordingly. + */ + avdatum.data = (key->specified & + (AVRULE_AUDITDENY | AVRULE_DONTAUDIT)) ? ~0 : 0; /* this is used to get the node - insertion is actually unique */ node = avtab_insert_nonunique(avtab, key, &avdatum); if (!node) { @@ -1850,10 +1856,7 @@ static int expand_avrule_helper(sepol_handle_t * handle, */ avdatump->data &= cur->data; } else if (specified & AVRULE_DONTAUDIT) { - if (avdatump->data) - avdatump->data &= ~cur->data; - else - avdatump->data = ~cur->data; + avdatump->data &= ~cur->data; } else if (specified & AVRULE_XPERMS) { xperms = avdatump->xperms; if (!xperms) {