Anonymous auth method is broken

Peter Würtz wuertz at
Sun Feb 1 01:55:12 PST 2009

Ok, thanks for the explanation! For some reason I never stumbled over
the information that dbus-daemon doesn't work with ANONYMOUS. I just
found alot of posts from people trying to setup remote tcp connections
to dbus-daemon and failed so far.

So you're saying that for this non-intended usage of dbus one would have
to build a own kind dbus-server using the dbus API. Unfortunately there
is no tutorial how to do this and the higher level bindings such as
python-dbus only feature dbus-client functionality.

How about some really minimalistic anonymous-dbus-server example for
people to work with? I don't really know much about this dbus low-level
stuff.. but is this going to work like this (code appended)? Where is
the "dbus_server_run(DbusServer* server)" method I'm missing?

#include <stdio.h>
#include <stdlib.h>
#include <dbus/dbus.h>

static void new_conn_callback(
		DBusServer *server, DBusConnection *new_connection, void *data)
	  dbus_connection_set_allow_anonymous(new_connection, true);

int main() {
	DBusServer *server;
	DBusError error;

	// server listening on tcp port
	server = dbus_server_listen("tcp:host=localhost,port=54321", &error);
	if (!server) {
		printf("error: %s\n", error.message);
	printf("server address: %s\n", dbus_server_get_address(server));

	// add anonymous auth method
	const char* auth_methods[] = {"ANONYMOUS",NULL};
	dbus_server_set_auth_mechanisms(server, auth_methods);

	// set allow_anonymous for new connections
	dbus_server_set_new_connection_function(server, new_conn_callback, NULL, NULL);

	/* now I need something like
	 * dbus_server_run(server);
	 * how is this done using the dbus api?

	return 0;

More information about the dbus mailing list