diff --git a/parser/parser.h b/parser/parser.h index a31fb8c71..4e50e7912 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -26,7 +26,7 @@ typedef enum pattern_t pattern_t; struct flagval { - int debug; + int hat; int complain; int audit; }; diff --git a/parser/parser_interface.c b/parser/parser_interface.c index 57634ea8a..8a14dd2ee 100644 --- a/parser/parser_interface.c +++ b/parser/parser_interface.c @@ -632,7 +632,7 @@ int sd_serialize_profile(sd_serialize *p, struct codomain *profile, if (!sd_write_struct(p, "flags")) return 0; /* used to be flags.debug, but that's no longer supported */ - if (!sd_write32(p, 0)) + if (!sd_write32(p, profile->flags.hat)) return 0; if (!sd_write32(p, profile->flags.complain)) return 0; diff --git a/parser/parser_yacc.y b/parser/parser_yacc.y index 6d0c6e8f5..1f0ce9a69 100644 --- a/parser/parser_yacc.y +++ b/parser/parser_yacc.y @@ -178,7 +178,6 @@ struct codomain *do_local_profile(struct codomain *cod, char *name, int mode, in %type capability %type set_caps %type change_profile -%type change_hat %type TOK_SET_VAR %type TOK_BOOL_VAR %type TOK_VALUE @@ -593,15 +592,6 @@ rules: rules change_profile add_entry_to_policy($1, $2); $$ = $1; }; -rules: rules change_hat - { - PDEBUG("matched: rules change_hat\n"); - PDEBUG("rules change_hat: (%s)\n", $2->name); - if (!$2) - yyerror(_("Assert: `change_hat' returned NULL.")); - add_entry_to_policy($1, $2); - $$ = $1; - }; rules: rules opt_audit_flag TOK_DENY capability { @@ -895,18 +885,6 @@ rule: TOK_PTRACE TOK_COLON TOK_ID TOK_COLON TOK_ID TOK_END_OF_RULE $$ = entry; }; -change_hat: hat_start TOK_ID TOK_END_OF_RULE - { - /* allow change_hat to external hats */ - struct cod_entry *entry; - PDEBUG("Matched change_hat: tok_id (%s)\n", $2); - entry = new_entry(NULL, $2, AA_CHANGE_HAT, NULL); - if (!entry) - yyerror(_("Memory allocation error.")); - PDEBUG("change_hat.entry: (%s)\n", entry->name); - $$ = entry; - }; - hat: hat_start TOK_ID flags TOK_OPEN rules TOK_CLOSE { struct codomain *cod = $5; @@ -916,6 +894,7 @@ hat: hat_start TOK_ID flags TOK_OPEN rules TOK_CLOSE } cod->name = $2; cod->flags = $3; + cod->flags.hat = 1; if (force_complain) cod->flags = force_complain_flags; PDEBUG("^%s: flags='%s%s'\n",