AppArmor: do not mix dbus_bool_t with int

libdbus uses dbus_bool_t for booleans; that type is unsigned 32-bit.
However, libapparmor uses int, which is signed, leading to
-Wpointer-sign warnings when we pass a dbus_bool_t * where an int *
was expected.

This file is Linux-specific, and all Linux platforms have 32-bit int
and an in-memory representation of the integers 0 and 1 that is
independent of signedness, so the previous code was harmless
in practice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
This commit is contained in:
Simon McVittie 2016-02-10 13:15:56 +00:00 committed by Ralf Habacker
parent 5d67d56f5f
commit 881d7cb064

View file

@ -606,7 +606,9 @@ bus_apparmor_allows_acquire_service (DBusConnection *connection,
BusAppArmorConfinement *con = NULL;
DBusString qstr, auxdata;
dbus_bool_t free_auxdata = FALSE;
dbus_bool_t allow = FALSE, audit = TRUE;
/* the AppArmor API uses pointers to int for pointers to boolean, and
* int is not strictly guaranteed to be the same as dbus_bool_t */
int allow = FALSE, audit = TRUE;
unsigned long pid;
int res, serrno = 0;
@ -742,8 +744,8 @@ bus_apparmor_allows_send (DBusConnection *sender,
#ifdef HAVE_APPARMOR
BusAppArmorConfinement *src_con = NULL, *dst_con = NULL;
DBusString qstr, auxdata;
dbus_bool_t src_allow = FALSE, dst_allow = FALSE;
dbus_bool_t src_audit = TRUE, dst_audit = TRUE;
int src_allow = FALSE, dst_allow = FALSE;
int src_audit = TRUE, dst_audit = TRUE;
dbus_bool_t free_auxdata = FALSE;
unsigned long pid;
int len, res, src_errno = 0, dst_errno = 0;
@ -1006,7 +1008,7 @@ bus_apparmor_allows_eavesdropping (DBusConnection *connection,
#ifdef HAVE_APPARMOR
BusAppArmorConfinement *con = NULL;
DBusString qstr, auxdata;
dbus_bool_t allow = FALSE, audit = TRUE;
int allow = FALSE, audit = TRUE;
dbus_bool_t free_auxdata = FALSE;
unsigned long pid;
int res, serrno = 0;