#define SESSION_BUS_CONF_FILE_PRIMARY "/usr/lib/dbus-tests/configs/libdbuspolicy-tests/session.conf"
#endif
+#define POLICY_CONN_INFO_ALL (__u64)(KDBUS_ATTACH_CREDS | KDBUS_ATTACH_NAMES | KDBUS_ATTACH_SECLABEL)
+#define POLICY_CONN_INFO_NAME (__u64)(KDBUS_ATTACH_NAMES)
+
/** A process ID */
typedef unsigned long dbus_pid_t;
/** A user ID */
union kdbus_cmd_union cmd;
};
-int kdbus_get_conn_info(bool bus_type, const char *destination, int message_type, struct kdbus_cmd_param *info)
+int kdbus_get_conn_info(bool bus_type, const char *destination, struct kdbus_cmd_param *info, __u64 flags)
{
char const *label = NULL;
const char** k_names = info->k_names;
uintptr_t items_end;
cmd->cmd_info.flags = 0;
- cmd->cmd_info.attach_flags = (__u64)(KDBUS_ATTACH_CREDS | KDBUS_ATTACH_NAMES | (DBUSPOLICY_MESSAGE_TYPE_SIGNAL != message_type ? KDBUS_ATTACH_SECLABEL : 0));
+ cmd->cmd_info.attach_flags = flags;
if (kdbus_is_unique_id(destination)) {
cmd->cmd_info.size = sizeof(cmd->cmd_info);
/* check can send */
/* if broadcasting, then pass - null destination */
if (destination && *destination) {
- r = kdbus_get_conn_info(bus_type, destination, message_type, &info);
+ r = kdbus_get_conn_info(bus_type, destination, &info, POLICY_CONN_INFO_ALL);
if (r < 0)
goto end;
}
/* check can recv */
/* get sender information from kdbus */
- r = kdbus_get_conn_info(bus_type, sender, message_type, &info);
+ r = kdbus_get_conn_info(bus_type, sender, &info, POLICY_CONN_INFO_NAME);
if (r < 0) {
fprintf(stderr, "failed to kdbus conn info:%d\n", r);
goto end;
__internal_enter();
if (destination && *destination) {
- r = kdbus_get_conn_info(bus_type, destination, message_type, &info);
+ r = kdbus_get_conn_info(bus_type, destination, &info, POLICY_CONN_INFO_NAME);
if (r < 0)
goto end;
}