I did try it. But the pid returned is -1. I want in the daemon side, the client's pid. There are certain services I want to allow for a limited set of clients serviced by this daemon. unix_user allows returning 0 (since I have the intialized variable passed in).<br> <br> Here is the daemon code snippet<br> <br> install_err security_service_allow_install (<br> SecurityObject *obj,<br> gchar *deb_path,<br> gerror **error)<br> {<br> <br> unsigned long pid;<br> DBusConnection *conn;<br> <br> conn = dbus_g_connection_get_connection(obj->connection);<br> rv = dbus_connection_get_unix_process_id(conn, &pid);<br> <br> if (client_allowed_to_install(pid)) {<br> install();<br> }<br> <br> Thanks<br> John.<br><br> <br><b><i>Havoc Pennington
<hp@redhat.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Hi,<br><br>masala north wrote:<br>> We are developing a security frame work sitting on top of dbus. Is it <br>> possible to get the pid of the calling/client process?<br>> <br><br>If you are talking to another program directly (no bus daemon) you would <br>use dbus_connection_get_unix_process_id / dbus_connection_get_unix_user<br><br>If you are using the bus daemon, you need to ask the bus daemon to call <br>those functions for you.<br><br>To see the methods on the bus daemon type this command:<br> dbus-send --print-reply --dest=org.freedesktop.DBus <br>org.freedesktop.DBus.Introspectable.Introspect<br><br>In this case you want GetConnectionUnixUser and GetConnectionUnixProcessID.<br><br>There is a convenience function dbus_bus_get_unix_user() that calls <br>GetConnectionUnixUser, but the convenience function makes
a blocking <br>call. There's no convenience function for the process ID one.<br><br>To get the name of the client use dbus_message_get_sender()<br><br>Havoc<br><br><br></blockquote><br><p> __________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com