2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 18:17:09 +00:00

Fix many compile-time warnings.

Start replacing RPM with lsb-release.
Drop old references to CVE.
Remove unused code.
This commit is contained in:
Kees Cook 2010-07-26 09:22:45 -07:00
parent a92f9e67b3
commit 624aee531a
8 changed files with 21 additions and 60 deletions

View File

@ -48,7 +48,7 @@ BUILDDIR=$(shell if [ -d "${TESTBUILDDIR}" ] ; then \
echo "/tmp/${NAME}" ; \ echo "/tmp/${NAME}" ; \
fi ;) fi ;)
endif endif
RPMHOSTVENDOR=$(shell rpm --eval "%{_host_vendor}") RPMHOSTVENDOR=$(shell which rpm && rpm --eval "%{_host_vendor}")
ifndef DISTRO ifndef DISTRO
DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \ DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \
echo slackware ; \ echo slackware ; \
@ -92,30 +92,16 @@ endif
ifndef SPECFILE ifndef SPECFILE
SPECFILE = $(NAME).spec SPECFILE = $(NAME).spec
endif endif
RELEASE = $(shell rpm -q --specfile --define "_sourcedir ." ${RPMARG} --qf "%{RELEASE}" ${SPECFILE}) RELEASE = $(shell lsb_release -is) $(shell lsb_release -rs)
RELEASE_DIR = $(NAME)-$(VERSION) RELEASE_DIR = $(NAME)-$(VERSION)
TARBALL = $(NAME)-$(VERSION)-${REPO_VERSION}.tar.gz TARBALL = $(NAME)-$(VERSION)-${REPO_VERSION}.tar.gz
TAR = /bin/tar czvp -h --exclude .svn --exclude CVS --exclude .cvsignore --exclude ${TARBALL} --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude") TAR = /bin/tar czvp -h --exclude .svn --exclude .bzr --exclude .bzrignore --exclude ${TARBALL} --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude")
LDCONFIG = /sbin/ldconfig LDCONFIG = /sbin/ldconfig
CVSPKG_VERSION=$(shell rpm -q --specfile --define "_sourcedir ." ${RPMARG} ${SPECFILE} | head -1 | tr "." "_")
RPMSUBDIRS=SOURCES SPECS BUILD BUILDROOT SRPMS RPMS/i386 RPMS/i586 \ RPMSUBDIRS=SOURCES SPECS BUILD BUILDROOT SRPMS RPMS/i386 RPMS/i586 \
RPMS/i686 RPMS/athlon RPMS/noarch RPMS/x86_64 RPMS/i686 RPMS/athlon RPMS/noarch RPMS/x86_64
BUILDRPMSUBDIRS=$(foreach subdir, $(RPMSUBDIRS), $(BUILDDIR:/=)/$(subdir)) BUILDRPMSUBDIRS=$(foreach subdir, $(RPMSUBDIRS), $(BUILDDIR:/=)/$(subdir))
.PHONY: cvs_tag
cvs_tag:
cvs tag IMMUNIX-${CVSPKG_VERSION}
.PHONY: checkin
checkin:
if cvs -q up -d | grep -q "^\?" ; then echo "Hey! You have" \
"files in the directory you have not added into cvs."; exit 1; \
fi
cvs ci
make cvs_tag
ifdef EXTERNAL_PACKAGE ifdef EXTERNAL_PACKAGE
.PHONY: rpm .PHONY: rpm
rpm: clean $(BUILDRPMSUBDIRS) rpm: clean $(BUILDRPMSUBDIRS)

View File

@ -31,6 +31,8 @@
#include <assert.h> #include <assert.h>
#define YY_NO_INPUT
unsigned int string_buf_alloc = 0; unsigned int string_buf_alloc = 0;
unsigned int string_buf_len = 0; unsigned int string_buf_len = 0;
char *string_buf = NULL; char *string_buf = NULL;

View File

@ -816,7 +816,7 @@ int sd_serialize_top_profile(sd_serialize *p, struct codomain *profile)
int cache_fd = -1; int cache_fd = -1;
int sd_serialize_codomain(int option, struct codomain *cod) int sd_serialize_codomain(int option, struct codomain *cod)
{ {
int fd; int fd = -1;
int error = -ENOMEM, size, wsize; int error = -ENOMEM, size, wsize;
sd_serialize *work_area; sd_serialize *work_area;
char *filename = NULL; char *filename = NULL;
@ -984,7 +984,7 @@ static char *next_profile_buffer(char *buffer, int size)
int sd_load_buffer(int option, char *buffer, int size) int sd_load_buffer(int option, char *buffer, int size)
{ {
int fd; int fd = -1;
int error = -ENOMEM, wsize, bsize; int error = -ENOMEM, wsize, bsize;
char *filename = NULL; char *filename = NULL;
char *b; char *b;

View File

@ -51,6 +51,8 @@
#define DUMP_PREPROCESS do { if (preprocess_only) ECHO; } while (0) #define DUMP_PREPROCESS do { if (preprocess_only) ECHO; } while (0)
#define YY_NO_INPUT
int current_lineno = 1; int current_lineno = 1;
char *current_filename = NULL; char *current_filename = NULL;

View File

@ -38,6 +38,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "parser.h" #include "parser.h"
#include "parser_version.h" #include "parser_version.h"

View File

@ -35,8 +35,10 @@
/* #define DEBUG */ /* #define DEBUG */
#ifdef DEBUG #ifdef DEBUG
#undef PDEBUG
#define PDEBUG(fmt, args...) printf("Lexer: " fmt, ## args) #define PDEBUG(fmt, args...) printf("Lexer: " fmt, ## args)
#else #else
#undef PDEBUG
#define PDEBUG(fmt, args...) /* Do nothing */ #define PDEBUG(fmt, args...) /* Do nothing */
#endif #endif
#define NPDEBUG(fmt, args...) /* Do nothing */ #define NPDEBUG(fmt, args...) /* Do nothing */
@ -102,7 +104,7 @@ static struct keyword_table rlimit_table[] = {
}; };
/* for alpha matches, check for keywords */ /* for alpha matches, check for keywords */
static int get_table_token(const char *name, struct keyword_table *table, static int get_table_token(const char *name __unused, struct keyword_table *table,
const char *keyword) const char *keyword)
{ {
int i; int i;
@ -142,42 +144,6 @@ int get_rlimit(const char *name)
return get_table_token("rlimit", rlimit_table, name); return get_table_token("rlimit", rlimit_table, name);
} }
static struct keyword_table address_family[] = {
/* {"unix", AF_UNIX},
{"local", AF_LOCAL}, */
{"inet", AF_INET},
/* {"ax25", AF_AX25},
{"ipx", AF_IPX},
{"appletalk", AF_APPLETALK},
{"netrom", AF_NETROM},
{"bridge", AF_BRIDGE},
{"atmpvc", AF_ATMPVC},
{"x25", AF_X25}, */
{"inet6", AF_INET6},
/* {"rose", AF_ROSE},
{"decnet", AF_DECnet},
{"netbeui", AF_NETBEUI},
{"security", AF_SECURITY},
{"key", AF_KEY},
{"netlink", AF_NETLINK},
{"route", AF_ROUTE},
{"packet", AF_PACKET},
{"ash", AF_ASH},
{"econet", AF_ECONET},
{"atmsvc", AF_ATMSVC},
{"sna", AF_SNA},
{"irda", AF_IRDA},
{"pppox", AF_PPPOX},
{"wanpipe", AF_WANPIPE},
{"llc", AF_LLC},
{"tipc", AF_TIPC},
{"bluetooth", AF_BLUETOOTH},
{"iucv", AF_IUCV},
{"rxrpc", AF_RXRPC}, */
/* terminate */
{NULL, 0}
};
struct network_tuple { struct network_tuple {
char *family_name; char *family_name;
unsigned int family; unsigned int family;
@ -462,7 +428,7 @@ static void warn_uppercase(void)
} }
} }
static int parse_sub_mode(const char *str_mode, const char *mode_desc) static int parse_sub_mode(const char *str_mode, const char *mode_desc __unused)
{ {
#define IS_DIFF_QUAL(mode, q) (((mode) & AA_MAY_EXEC) && (((mode) & AA_EXEC_TYPE) != ((q) & AA_EXEC_TYPE))) #define IS_DIFF_QUAL(mode, q) (((mode) & AA_MAY_EXEC) && (((mode) & AA_EXEC_TYPE) != ((q) & AA_EXEC_TYPE)))

View File

@ -425,10 +425,13 @@ static int __expand_variable(struct symtab *symbol)
for (ref_item = ref->expanded; ref_item; ref_item = ref_item->next) { for (ref_item = ref->expanded; ref_item; ref_item = ref_item->next) {
char *expanded_string; char *expanded_string;
asprintf(&expanded_string, "%s%s%s", if (!asprintf(&expanded_string, "%s%s%s",
split->prefix ? split->prefix : "", split->prefix ? split->prefix : "",
ref_item->val, ref_item->val,
split->suffix ? split->suffix : ""); split->suffix ? split->suffix : "")) {
PERROR("Out of memory\n");
exit(1);
}
add_to_set(&work_list, expanded_string); add_to_set(&work_list, expanded_string);
free(expanded_string); free(expanded_string);
} }

View File

@ -412,7 +412,7 @@ flagvals: flagval
flagval: TOK_FLAG_ID flagval: TOK_FLAG_ID
{ {
struct flagval fv = {0, 0, 0}; struct flagval fv = { 0, 0, 0, 0 };
if (strcmp($1, "debug") == 0) { if (strcmp($1, "debug") == 0) {
yyerror(_("Profile flag 'debug' is no longer valid.")); yyerror(_("Profile flag 'debug' is no longer valid."));
} else if (strcmp($1, "complain") == 0) { } else if (strcmp($1, "complain") == 0) {