switch (_dbus_auth_do_work (transport->auth))
{
case DBUS_AUTH_STATE_AUTHENTICATED:
- case DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES:
/* leave as maybe_authenticated */
break;
default:
}
/**
+ * Get the UNIX file descriptor, if any.
+ *
+ * @param transport the transport
+ * @param fd_p pointer to fill in with the descriptor
+ * @returns #TRUE if a descriptor was available
+ */
+dbus_bool_t
+_dbus_transport_get_unix_fd (DBusTransport *transport,
+ int *fd_p)
+{
+ dbus_bool_t retval;
+
+ if (transport->vtable->get_unix_fd == NULL)
+ return FALSE;
+
+ if (transport->disconnected)
+ return FALSE;
+
+ _dbus_transport_ref (transport);
+
+ retval = (* transport->vtable->get_unix_fd) (transport,
+ fd_p);
+
+ _dbus_transport_unref (transport);
+
+ return retval;
+}
+
+/**
* Performs a single poll()/select() on the transport's file
* descriptors and then reads/writes data as appropriate,
* queueing incoming messages and sending outgoing messages.
static dbus_bool_t
recover_unused_bytes (DBusTransport *transport)
{
- if (_dbus_auth_do_work (transport->auth) != DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES)
- return TRUE;
-
if (_dbus_auth_needs_decoding (transport->auth))
{
DBusString plaintext;
}
/**
+ * See dbus_connection_get_unix_process_id().
+ *
+ * @param transport the transport
+ * @param pid return location for the process ID
+ * @returns #TRUE if uid is filled in with a valid process ID
+ */
+dbus_bool_t
+_dbus_transport_get_unix_process_id (DBusTransport *transport,
+ unsigned long *pid)
+{
+ DBusCredentials auth_identity;
+
+ *pid = DBUS_PID_UNSET; /* Caller should never use this value on purpose,
+ * but we set it to a safe number, INT_MAX,
+ * just to root out possible bugs in bad callers.
+ */
+
+ if (!transport->authenticated)
+ return FALSE;
+
+ _dbus_auth_get_identity (transport->auth, &auth_identity);
+
+ if (auth_identity.pid != DBUS_PID_UNSET)
+ {
+ *pid = auth_identity.pid;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+/**
* See dbus_connection_set_unix_user_function().
*
* @param transport the transport