示例#1
0
文件: sss_sifp_dbus.c 项目: SSSD/sssd
static sss_sifp_error
sss_sifp_invoke_find_va(sss_sifp_ctx *ctx,
                        const char *object_path,
                        const char *interface,
                        const char *method,
                        char **_object_path,
                        int first_arg_type,
                        va_list ap)
{
   DBusMessage *reply = NULL;
   char *dbus_method = NULL;
   sss_sifp_error ret;

   if (ctx == NULL || method == NULL || _object_path == NULL) {
       return SSS_SIFP_INVALID_ARGUMENT;
   }

   dbus_method = sss_sifp_strcat(ctx, "Find", method);
   if (dbus_method == NULL) {
       ret = SSS_SIFP_OUT_OF_MEMORY;
       goto done;
   }

   ret = sss_sifp_ifp_call(ctx, object_path, interface, dbus_method,
                           first_arg_type, ap, &reply);
   if (ret != SSS_SIFP_OK) {
       goto done;
   }

   ret = sss_sifp_parse_object_path(ctx, reply, _object_path);

done:
    sss_sifp_free_string(ctx, &dbus_method);

   if (reply != NULL) {
       dbus_message_unref(reply);
   }

   return ret;
}
示例#2
0
文件: sss_sifp_dbus.c 项目: 3van/sssd
sss_sifp_error
sss_sifp_invoke_list(sss_sifp_ctx *ctx,
                     const char *method,
                     char ***_object_paths,
                     int first_arg_type,
                     ...)
{
    DBusMessage *reply = NULL;
    char *dbus_method = NULL;
    sss_sifp_error ret;
    va_list ap;

    if (ctx == NULL || method == NULL || _object_paths == NULL) {
        return SSS_SIFP_INVALID_ARGUMENT;
    }

    dbus_method = sss_sifp_strcat(ctx, "List", method);
    if (dbus_method == NULL) {
        ret = SSS_SIFP_OUT_OF_MEMORY;
        goto done;
    }

    va_start(ap, first_arg_type);
    ret = sss_sifp_ifp_call(ctx, dbus_method, first_arg_type, ap, &reply);
    va_end(ap);
    if (ret != SSS_SIFP_OK) {
        goto done;
    }

    ret = sss_sifp_parse_object_path_list(ctx, reply, _object_paths);

done:
    sss_sifp_free_string(ctx, &dbus_method);

    if (reply != NULL) {
        dbus_message_unref(reply);
    }

    return ret;
}