Skip to content

Commit

Permalink
Try to solve Issue #390
Browse files Browse the repository at this point in the history
See the issue for details. Shor story is that there is some kind of
collision between the two generated flag_tabs.h file. No idea what's
causing it, but the file being deleted was only for RHEL 4 so it is
no longer needed. Deleting it should end the collision.
  • Loading branch information
stevegrubb committed Sep 3, 2024
1 parent 2bdb1da commit 6b9b74a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 97 deletions.
20 changes: 3 additions & 17 deletions auparse/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Makefile.am --
# Copyright 2006-08,2011-18 Red Hat Inc.
# Copyright 2006-08,2011-18,2024 Red Hat Inc.
# All Rights Reserved.
#
# This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -56,7 +56,7 @@ message.c:

BUILT_SOURCES = accesstabs.h captabs.h clocktabs.h clone-flagtabs.h \
epoll_ctls.h famtabs.h fcntl-cmdtabs.h fsconfigs.h \
flagtabs.h icmptypetabs.h ipctabs.h ipccmdtabs.h\
icmptypetabs.h ipctabs.h ipccmdtabs.h\
ioctlreqtabs.h ipoptnametabs.h ip6optnametabs.h \
mmaptabs.h mounttabs.h nfprototabs.h open-flagtabs.h \
persontabs.h prctl_opttabs.h pktoptnametabs.h \
Expand All @@ -72,7 +72,7 @@ BUILT_SOURCES = accesstabs.h captabs.h clocktabs.h clone-flagtabs.h \
noinst_PROGRAMS = gen_accesstabs_h gen_captabs_h gen_clock_h \
gen_clone-flagtabs_h \
gen_epoll_ctls_h gen_famtabs_h gen_fcntl-cmdtabs_h \
gen_flagtabs_h gen_fsconfigs_h gen_ioctlreqtabs_h \
gen_fsconfigs_h gen_ioctlreqtabs_h \
gen_icmptypetabs_h gen_ipctabs_h gen_ipccmdtabs_h\
gen_ipoptnametabs_h gen_ip6optnametabs_h gen_nfprototabs_h \
gen_mmaptabs_h gen_mounttabs_h \
Expand Down Expand Up @@ -167,20 +167,6 @@ gen_famtabs_h$(BUILD_EXEEXT): LDFLAGS=$(LDFLAGS_FOR_BUILD)
famtabs.h: gen_famtabs_h Makefile
./gen_famtabs_h --i2s fam > $@

gen_flagtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h flagtab.h
# ../auparse/ is used to avoid using ../lib/flagtab.h
gen_flagtabs_h_CFLAGS = '-DTABLE_H="../auparse/flagtab.h"'
$(gen_flagtabs_h_OBJECTS): CC=$(CC_FOR_BUILD)
$(gen_flagtabs_h_OBJECTS): CFLAGS=$(CFLAGS_FOR_BUILD)
$(gen_flagtabs_h_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
$(gen_flagtabs_h_OBJECTS): LDFLAGS=$(LDFLAGS_FOR_BUILD)
gen_flagtabs_h$(BUILD_EXEEXT): CC=$(CC_FOR_BUILD)
gen_flagtabs_h$(BUILD_EXEEXT): CFLAGS=$(CFLAGS_FOR_BUILD)
gen_flagtabs_h$(BUILD_EXEEXT): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
gen_flagtabs_h$(BUILD_EXEEXT): LDFLAGS=$(LDFLAGS_FOR_BUILD)
flagtabs.h: gen_flagtabs_h Makefile
./gen_flagtabs_h --i2s-transtab flag > $@

gen_fcntl_cmdtabs_h_SOURCES = ../lib/gen_tables.c ../lib/gen_tables.h \
fcntl-cmdtab.h
gen_fcntl_cmdtabs_h_CFLAGS = '-DTABLE_H="fcntl-cmdtab.h"'
Expand Down
33 changes: 0 additions & 33 deletions auparse/flagtab.h

This file was deleted.

47 changes: 1 addition & 46 deletions auparse/interpret.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
#include "epoll_ctls.h"
#include "famtabs.h"
#include "fcntl-cmdtabs.h"
#include "flagtabs.h"
#include "fsconfigs.h"
#include "ipctabs.h"
#include "ipccmdtabs.h"
Expand Down Expand Up @@ -1369,44 +1368,6 @@ static const char *print_sockaddr(const char *val)
return out;
}

/* This is only used in the RHEL4 kernel */
static const char *print_flags(const char *val)
{
int flags, cnt = 0;
size_t i;
char *out, buf[sizeof(flag_strings)+FLAG_NUM_ENTRIES+1];

errno = 0;
flags = strtoul(val, NULL, 16);
if (errno) {
if (asprintf(&out, "conversion error(%s)", val) < 0)
out = NULL;
return out;
}
if (flags == 0) {
if (asprintf(&out, "none") < 0)
out = NULL;
return out;
}
buf[0] = 0;
for (i=0; i<FLAG_NUM_ENTRIES; i++) {
if (flag_table[i].value & flags) {
if (!cnt) {
strcat(buf,
flag_strings + flag_table[i].offset);
cnt++;
} else {
strcat(buf, ",");
strcat(buf,
flag_strings + flag_table[i].offset);
}
}
}
if (buf[0] == 0)
snprintf(buf, sizeof(buf), "0x%s", val);
return strdup(buf);
}

static const char *print_promiscuous(const char *val)
{
int ival;
Expand Down Expand Up @@ -3228,10 +3189,7 @@ int auparse_interp_adjust_type(int rtype, const char *name, const char *val)
type = AUPARSE_TYPE_ESCAPED;
else
type = AUPARSE_TYPE_UNCLASSIFIED;
} else if (rtype == AUDIT_PATH && *name =='f' &&
strcmp(name, "flags") == 0)
type = AUPARSE_TYPE_FLAGS;
else if (rtype == AUDIT_MQ_OPEN && strcmp(name, "mode") == 0)
} else if (rtype == AUDIT_MQ_OPEN && strcmp(name, "mode") == 0)
type = AUPARSE_TYPE_MODE_SHORT;
else if (rtype == AUDIT_CRYPTO_KEY_USER && strcmp(name, "fp") == 0)
type = AUPARSE_TYPE_UNCLASSIFIED;
Expand Down Expand Up @@ -3330,9 +3288,6 @@ char *auparse_do_interpretation(int type, const idata *id,
case AUPARSE_TYPE_SOCKADDR:
out = print_sockaddr(id->val);
break;
case AUPARSE_TYPE_FLAGS:
out = print_flags(id->val);
break;
case AUPARSE_TYPE_PROMISC:
out = print_promiscuous(id->val);
break;
Expand Down
2 changes: 1 addition & 1 deletion auparse/typetab.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _S(AUPARSE_TYPE_PERM, "perm" )
_S(AUPARSE_TYPE_PERM, "perm_mask" )
_S(AUPARSE_TYPE_MODE, "mode" )
_S(AUPARSE_TYPE_SOCKADDR, "saddr" )
//_S(AUPARSE_TYPE_FLAGS, "flags" )
//_S(AUPARSE_TYPE_FLAGS, "flags" ) deprecated - RHEL4
_S(AUPARSE_TYPE_PROMISC, "prom" )
_S(AUPARSE_TYPE_PROMISC, "old_prom" )
_S(AUPARSE_TYPE_CAPABILITY, "capability" )
Expand Down

0 comments on commit 6b9b74a

Please sign in to comment.