return connection;
}
+static int is_setid()
+{
+#ifdef HAVE_GETEUID
+ if ((getuid() != geteuid()) ||
+ (getgid() != getegid())) {
+ return 1;
+ }
+#endif
+ return 0;
+}
static DBusGProxy *dbus_connect (MoonshotError **error)
{
* If/when we move to GDBus this code can become a one-liner.
*/
+ if (is_setid()) {
+ *error = moonshot_error_new (MOONSHOT_ERROR_IPC_ERROR,
+ "Cannot use IPC while setid");
+ return NULL;
+ }
+
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &g_error);
if (g_error_matches(g_error, DBUS_GERROR, DBUS_GERROR_NOT_SUPPORTED)) {