summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-11-19 13:25:21 +0000
committerRichard Hughes <richard@hughsie.com>2014-11-19 13:45:55 +0000
commit53110ed19c393c619c9ecad67274d09d13a2a221 (patch)
tree455b242098010529bf1991b48b78de1b2c07f525
parentdd4697d75f68c9f6cea394b798bd4c17cfb32774 (diff)
downloadcolord-53110ed19c393c619c9ecad67274d09d13a2a221.tar.gz
Don't assume getuid() is available on all platforms
-rw-r--r--configure.ac3
-rw-r--r--src/cd-common.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 831686c..dcb38bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,10 +139,11 @@ AX_CHECK_LINK_FLAG([-Wl,-z,relro,-z,now],
AC_SUBST([RELRO_LDFLAGS])
dnl ---------------------------------------------------------------------------
-dnl - Check headers that may not exist on all platforms
+dnl - Check headers and functions that may not exist on all platforms
dnl ---------------------------------------------------------------------------
AC_CHECK_HEADER(pwd.h)
AC_CHECK_HEADER(syslog.h)
+AC_CHECK_FUNC(getuid, AC_DEFINE([HAVE_GETUID], [], [getuid() is available]))
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
diff --git a/src/cd-common.c b/src/cd-common.c
index ed63e76..c806e92 100644
--- a/src/cd-common.c
+++ b/src/cd-common.c
@@ -159,12 +159,14 @@ cd_main_sender_authenticated (GDBusConnection *connection,
return TRUE;
}
+#ifdef HAVE_GETUID
/* a client running as the daemon user may also do all actions */
if (uid == getuid ()) {
g_debug ("CdCommon: not checking %s for %s as running as daemon user",
action_id, sender);
return TRUE;
}
+#endif
#ifdef USE_POLKIT
/* get authority */