aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVsevolod Buzinov <ext-vsevolod.buzinov@nokia.com>2010-08-31 16:43:40 +0300
committerVsevolod Buzinov <ext-vsevolod.buzinov@nokia.com>2010-08-31 16:43:40 +0300
commit6f6362a25527edd2f783962bfdbb7ea52a7b1925 (patch)
tree3a9d509b226ac5a88c7763d84805f1ed059fc984
parent89ef91dfc9df7db546821dd8d4f56dacaa7f8461 (diff)
With this change libresource builds successfully without aegis also
-rw-r--r--configure.ac10
-rw-r--r--src/Makefile.am4
-rw-r--r--src/dbus-proto.c16
-rw-r--r--src/resource.h2
-rw-r--r--tests/Makefile.am6
5 files changed, 23 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 9483498..d618b22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,15 @@ esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
+# check for aegis
+aegis_enabled="no"
+AC_CHECK_LIB(creds, creds_find, [AEGIS_CFLAGS="-DLIBRESOURCE_AEGIS";
+ AEGIS_LIBS="-lcreds";
+ aegis_enabled="yes"],
+ [AC_MSG_WARN([Building without aegis support])])
+AC_SUBST(AEGIS_CFLAGS)
+AC_SUBST(AEGIS_LIBS)
+
AC_OUTPUT([
libresource0.pc
libresource0-glib.pc
@@ -74,4 +83,5 @@ echo "
Debug enabled: ${debug}
With example: ${have_dbus_glib}
+ Aegis enabled: ${aegis_enabled}
"
diff --git a/src/Makefile.am b/src/Makefile.am
index 1577265..98c9774 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,11 +4,11 @@ lib_LTLIBRARIES = libresource.la libresource-glib.la
libresource_la_SOURCES = res-msg.c res-conn.c res-proto.c res-set.c \
dbus-proto.c dbus-msg.c \
internal-proto.c internal-msg.c
-libresource_la_CFLAGS = @DBUS_CFLAGS@ -I$(top_srcdir) -fvisibility=hidden
+libresource_la_CFLAGS = @DBUS_CFLAGS@ @AEGIS_CFLAGS@ -I$(top_srcdir) -fvisibility=hidden
if DEBUG
libresource_la_CFLAGS += -D__DEBUG__
endif
-libresource_la_LDFLAGS = /usr/lib -version-info $(subst .,:,$(VERSION)) -lcreds
+libresource_la_LDFLAGS = /usr/lib -version-info $(subst .,:,$(VERSION)) @AEGIS_LIBS@
libresource_la_LIBADD = @DBUS_LIBS@
libresource_glib_la_SOURCES = resource.c resource-glib-glue.c
diff --git a/src/dbus-proto.c b/src/dbus-proto.c
index 511b8df..42283b8 100644
--- a/src/dbus-proto.c
+++ b/src/dbus-proto.c
@@ -8,8 +8,9 @@
#include "dbus-proto.h"
#include "dbus-msg.h"
+#ifdef LIBRESOURCE_AEGIS
#include <sys/creds.h>
-
+#endif
/*
* local function prototypes
@@ -581,16 +582,17 @@ static DBusHandlerResult manager_method(DBusConnection *dcon,
resset_t *rset;
char *method;
- char creds_buf[200];
int has_creds = 1;
+ resmsg_t reply;
+ int success;
+#ifdef LIBRESOURCE_AEGIS
+ char creds_buf[200];
int pid;
creds_t creds;
int res;
const char *security_token = "Cellular";
const char *name;
- resmsg_t reply;
- int success;
-
+#endif
if (!strcmp(interface, RESPROTO_DBUS_MANAGER_INTERFACE) &&
type == DBUS_MESSAGE_TYPE_METHOD_CALL &&
@@ -626,7 +628,7 @@ static DBusHandlerResult manager_method(DBusConnection *dcon,
resmsg.record.rset.share,
resmsg.record.rset.mask);
-
+#ifdef LIBRESOURCE_AEGIS
printf("resmsg.record.klass: %s\n", resmsg.record.klass);
if (!strcmp(resmsg.record.klass, "call")) {
@@ -676,7 +678,7 @@ static DBusHandlerResult manager_method(DBusConnection *dcon,
creds_free(creds);
}
-
+#endif
if (rset != NULL && watch_client(&rcon->dbus, sender, TRUE)) {
diff --git a/src/resource.h b/src/resource.h
index c177023..4c1395f 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -22,8 +22,6 @@ typedef void (*error_callback_function_t)(resource_set_t *resource_set,
const char *errmsg,
void *userdata);
-int resource_set_use_dbus(DBusConnection *conn);
-
resource_set_t *resource_set_create(const char *klass,
uint32_t mandatory,
uint32_t optional,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fbf68fd..bee6914 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,14 +9,12 @@ resource_test_LDADD = -lcheck \
memory_leak_test_SOURCES = memory-leak-test.c
security_test_SOURCES = security-test.c
-security_test_CFLAGS = -I../src/ @DBUS_CFLAGS@
+security_test_CFLAGS = -I../src/ @DBUS_CFLAGS@ @AEGIS_CFLAGS@
security_test_LDADD = -L../src/.libs/ -lresource -lresource-glib
-noinst_PROGRAMS = resource_test security_test
-
memory_leak_test_CFLAGS = -I$(top_srcdir)/src @DBUS_CFLAGS@
memory_leak_test_LDADD = $(top_builddir)/src/libresource-glib.la \
$(top_builddir)/src/libresource.la \
@DBUS_LIBS@
-noinst_PROGRAMS = resource_test memory_leak_test
+noinst_PROGRAMS = resource_test security_test memory_leak_test