From a1fa031e4f227dcf34600cfabd24745d7608b27c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Fri, 3 Jun 2016 12:23:48 +0200
Subject: [PATCH 03/25] sss_sifp: make it compatible with latest version of the
 infopipe

Current version of infopipe leverage different interfaces and
object paths which were not accessible through the simple ifp
library. This patch changes the API, which is ok since it was
never declared as a public library and beside deprecated
openlmi there are no known users. We will use this in sssctl tool.
---
 src/lib/sifp/sss_sifp.c            |  29 ++++++++++
 src/lib/sifp/sss_sifp.h            |  28 ++++++++-
 src/lib/sifp/sss_sifp_common.c     |  41 +++++++------
 src/lib/sifp/sss_sifp_dbus.c       | 114 +++++++++++++++++++++++++++++++------
 src/lib/sifp/sss_sifp_dbus.h       |  48 ++++++++++++++++
 src/lib/sifp/sss_sifp_private.h    |   5 --
 src/lib/sifp/sss_sifp_utils.c      |  27 ---------
 src/lib/sifp/sss_simpleifp.exports |   8 +++
 src/tests/cmocka/test_sss_sifp.c   |  56 ++++++------------
 9 files changed, 247 insertions(+), 109 deletions(-)

diff --git a/src/lib/sifp/sss_sifp.c b/src/lib/sifp/sss_sifp.c
index 7e8e7c6d67ec16d46ae6bcc4f306347a45104efb..3528fc3bcd6f88ad7b4ecd1f457979fb1f0ec396 100644
--- a/src/lib/sifp/sss_sifp.c
+++ b/src/lib/sifp/sss_sifp.c
@@ -134,6 +134,35 @@ sss_sifp_get_last_io_error_message(sss_sifp_ctx *ctx)
     return ctx->io_error->message;
 }
 
+const char *
+sss_sifp_strerr(sss_sifp_error error)
+{
+    switch (error) {
+    case SSS_SIFP_OK:
+        return "Success";
+    case SSS_SIFP_OUT_OF_MEMORY:
+        return "Out of memory";
+    case SSS_SIFP_INVALID_ARGUMENT:
+        return "Invalid argument";
+    case SSS_SIFP_IO_ERROR:
+        return "Communication error";
+    case SSS_SIFP_INTERNAL_ERROR:
+        return "Internal error";
+    case SSS_SIFP_NOT_SUPPORTED:
+        return "Not supported";
+    case SSS_SIFP_ATTR_MISSING:
+        return "Attribute does not exist";
+    case SSS_SIFP_ATTR_NULL:
+        return "Attribute does not have any value set";
+    case SSS_SIFP_INCORRECT_TYPE:
+        return "Incorrect type";
+    case SSS_SIFP_ERROR_SENTINEL:
+        return "Invalid error code";
+    }
+
+    return "Invalid error code";
+}
+
 sss_sifp_error
 sss_sifp_fetch_attr(sss_sifp_ctx *ctx,
                     const char *object_path,
diff --git a/src/lib/sifp/sss_sifp.h b/src/lib/sifp/sss_sifp.h
index 6b997951be11426c2c7d6af4fcb72a38340b6d12..95a751838f6d71689a6be586a7096b16b43650eb 100644
--- a/src/lib/sifp/sss_sifp.h
+++ b/src/lib/sifp/sss_sifp.h
@@ -42,9 +42,12 @@
  */
 
 /** SSSD InfoPipe bus address */
-#define SSS_SIFP_IFP "org.freedesktop.sssd.infopipe"
+#define SSS_SIFP_ADDRESS "org.freedesktop.sssd.infopipe"
 
-/** SSSD InfoPipe interface */
+/* Backwards-compatible address */
+#define SSS_SIFP_IFP SSS_SIFP_ADDRESS
+
+/* Backwards-compatible interface definitions */
 #define SSS_SIFP_IFACE_IFP SSS_SIFP_IFP
 #define SSS_SIFP_IFACE_COMPONENTS "org.freedesktop.sssd.infopipe.Components"
 #define SSS_SIFP_IFACE_SERVICES "org.freedesktop.sssd.infopipe.Services"
@@ -53,6 +56,18 @@
 #define SSS_SIFP_IFACE_GROUPS "org.freedesktop.sssd.infopipe.Groups"
 
 /**
+ * SSSD InfoPipe object path.
+ * Look at InfoPipe introspection and SSSD documentation for more objects.
+ */
+#define SSS_SIFP_PATH "/org/freedesktop/sssd/infopipe"
+
+/**
+ * SSSD InfoPipe object path.
+ * Look at InfoPipe introspection and SSSD documentation for more interfaces.
+ */
+#define SSS_SIFP_IFACE "org.freedesktop.sssd.infopipe"
+
+/**
  * Opaque libsss_sifp context. One context shall not be used by multiple
  * threads. Each thread needs to create and use its own context.
  *
@@ -164,6 +179,15 @@ const char *
 sss_sifp_get_last_io_error_message(sss_sifp_ctx *ctx);
 
 /**
+ * @brief Translate error code into human readable message.
+ *
+ * @param[in] error sss_sifp error code
+ * @return Error message.
+ */
+const char *
+sss_sifp_strerr(sss_sifp_error error);
+
+/**
  * @brief Fetch selected attributes of given object.
  *
  * @param[in] ctx         sss_sifp context
diff --git a/src/lib/sifp/sss_sifp_common.c b/src/lib/sifp/sss_sifp_common.c
index 2acd6c5a5e46ec92f9516e464f40c78ea8012d7f..bd1dc6a3108329d2c795dc0a259637e71964be9f 100644
--- a/src/lib/sifp/sss_sifp_common.c
+++ b/src/lib/sifp/sss_sifp_common.c
@@ -23,11 +23,15 @@
 #include "lib/sifp/sss_sifp.h"
 #include "lib/sifp/sss_sifp_dbus.h"
 #include "lib/sifp/sss_sifp_private.h"
+#include "responder/ifp/ifp_iface.h"
 
 #define SSS_SIFP_ATTR_NAME "name"
 
 static sss_sifp_error
 sss_sifp_fetch_object_by_attr(sss_sifp_ctx *ctx,
+                              const char *path,
+                              const char *iface_find,
+                              const char *iface_object,
                               const char *method,
                               int attr_type,
                               const void *attr,
@@ -35,26 +39,19 @@ sss_sifp_fetch_object_by_attr(sss_sifp_ctx *ctx,
 {
     sss_sifp_object *object = NULL;
     char *object_path = NULL;
-    const char *interface = NULL;
     sss_sifp_error ret;
 
     if (method == NULL || attr == NULL || attr_type == DBUS_TYPE_INVALID) {
         return SSS_SIFP_INVALID_ARGUMENT;
     }
 
-    ret = sss_sifp_invoke_find(ctx, method, &object_path,
-                               attr_type, attr,
-                               DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_find_ex(ctx, path, iface_find, method, &object_path,
+                                  attr_type, attr, DBUS_TYPE_INVALID);
     if (ret != SSS_SIFP_OK) {
         goto done;
     }
 
-    interface = sss_sifp_get_iface_for_object(object_path);
-    if (interface == NULL) {
-        return SSS_SIFP_INTERNAL_ERROR;
-    }
-
-    ret = sss_sifp_fetch_object(ctx, object_path, interface, &object);
+    ret = sss_sifp_fetch_object(ctx, object_path, iface_object, &object);
     if (ret != SSS_SIFP_OK) {
         goto done;
     }
@@ -71,11 +68,15 @@ done:
 
 static sss_sifp_error
 sss_sifp_fetch_object_by_name(sss_sifp_ctx *ctx,
+                              const char *path,
+                              const char *iface_find,
+                              const char *iface_object,
                               const char *method,
                               const char *name,
                               sss_sifp_object **_object)
 {
-    return sss_sifp_fetch_object_by_attr(ctx, method, DBUS_TYPE_STRING, &name,
+    return sss_sifp_fetch_object_by_attr(ctx, path, iface_find, iface_object,
+                                         method, DBUS_TYPE_STRING, &name,
                                          _object);
 }
 
@@ -95,8 +96,8 @@ sss_sifp_list_domains(sss_sifp_ctx *ctx,
         return SSS_SIFP_INVALID_ARGUMENT;
     }
 
-    ret = sss_sifp_invoke_list(ctx, "Domains", &object_paths,
-                               DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_list_ex(ctx, IFP_PATH, IFACE_IFP, "Domains",
+                                  &object_paths, DBUS_TYPE_INVALID);
     if (ret != SSS_SIFP_OK) {
         goto done;
     }
@@ -112,8 +113,7 @@ sss_sifp_list_domains(sss_sifp_ctx *ctx,
 
     /* fetch domain name */
     for (i = 0; i < size; i++) {
-        ret = sss_sifp_fetch_attr(ctx, object_paths[i],
-                                  SSS_SIFP_IFACE_DOMAINS,
+        ret = sss_sifp_fetch_attr(ctx, object_paths[i], IFACE_IFP_DOMAINS,
                                   SSS_SIFP_ATTR_NAME, &attrs);
         if (ret != SSS_SIFP_OK) {
             goto done;
@@ -155,7 +155,9 @@ sss_sifp_fetch_domain_by_name(sss_sifp_ctx *ctx,
                               const char *name,
                               sss_sifp_object **_domain)
 {
-    return sss_sifp_fetch_object_by_name(ctx, "DomainByName", name, _domain);
+    return sss_sifp_fetch_object_by_name(ctx, IFP_PATH, IFACE_IFP,
+                                         IFACE_IFP_DOMAINS, "DomainByName",
+                                         name, _domain);
 }
 
 sss_sifp_error
@@ -165,7 +167,8 @@ sss_sifp_fetch_user_by_uid(sss_sifp_ctx *ctx,
 {
     uint64_t _uid = uid;
 
-    return sss_sifp_fetch_object_by_attr(ctx, "UserByID",
+    return sss_sifp_fetch_object_by_attr(ctx, IFP_PATH_USERS, IFACE_IFP_USERS,
+                                         IFACE_IFP_USERS_USER, "UserByID",
                                          DBUS_TYPE_UINT64, &_uid, _user);
 }
 
@@ -174,5 +177,7 @@ sss_sifp_fetch_user_by_name(sss_sifp_ctx *ctx,
                             const char *name,
                             sss_sifp_object **_user)
 {
-    return sss_sifp_fetch_object_by_name(ctx, "UserByName", name, _user);
+    return sss_sifp_fetch_object_by_name(ctx, IFP_PATH_USERS, IFACE_IFP_USERS,
+                                         IFACE_IFP_USERS_USER, "UserByName",
+                                         name, _user);
 }
diff --git a/src/lib/sifp/sss_sifp_dbus.c b/src/lib/sifp/sss_sifp_dbus.c
index d9813718b2201b37b0eb8a1e23c4773e4cdd50a4..7c72c52f0d226ccdfaf7b8ffaed7776647a7771c 100644
--- a/src/lib/sifp/sss_sifp_dbus.c
+++ b/src/lib/sifp/sss_sifp_dbus.c
@@ -27,6 +27,8 @@
 #include "lib/sifp/sss_sifp_private.h"
 
 static sss_sifp_error sss_sifp_ifp_call(sss_sifp_ctx *ctx,
+                                        const char *object_path,
+                                        const char *interface,
                                         const char *method,
                                         int first_arg_type,
                                         va_list ap,
@@ -35,7 +37,11 @@ static sss_sifp_error sss_sifp_ifp_call(sss_sifp_ctx *ctx,
    DBusMessage *msg = NULL;
    sss_sifp_error ret;
 
-   msg = sss_sifp_create_message(SSS_SIFP_PATH_IFP, SSS_SIFP_IFACE_IFP, method);
+   if (object_path == NULL || interface == NULL || method == NULL) {
+       return SSS_SIFP_INVALID_ARGUMENT;
+   }
+
+   msg = sss_sifp_create_message(object_path, interface, method);
    if (msg == NULL) {
        ret = SSS_SIFP_OUT_OF_MEMORY;
        goto done;
@@ -60,7 +66,7 @@ sss_sifp_create_message(const char *object_path,
                         const char *interface,
                         const char *method)
 {
-    return dbus_message_new_method_call(SSS_SIFP_IFP, object_path,
+    return dbus_message_new_method_call(SSS_SIFP_ADDRESS, object_path,
                                         interface, method);
 }
 
@@ -109,17 +115,18 @@ done:
     return ret;
 }
 
-sss_sifp_error
-sss_sifp_invoke_list(sss_sifp_ctx *ctx,
-                     const char *method,
-                     char ***_object_paths,
-                     int first_arg_type,
-                     ...)
+static sss_sifp_error
+sss_sifp_invoke_list_va(sss_sifp_ctx *ctx,
+                        const char *object_path,
+                        const char *interface,
+                        const char *method,
+                        char ***_object_paths,
+                        int first_arg_type,
+                        va_list ap)
 {
     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;
@@ -131,9 +138,8 @@ sss_sifp_invoke_list(sss_sifp_ctx *ctx,
         goto done;
     }
 
-    va_start(ap, first_arg_type);
-    ret = sss_sifp_ifp_call(ctx, dbus_method, first_arg_type, ap, &reply);
-    va_end(ap);
+    ret = sss_sifp_ifp_call(ctx, object_path, interface, dbus_method,
+                            first_arg_type, ap, &reply);
     if (ret != SSS_SIFP_OK) {
         goto done;
     }
@@ -151,16 +157,53 @@ done:
 }
 
 sss_sifp_error
-sss_sifp_invoke_find(sss_sifp_ctx *ctx,
+sss_sifp_invoke_list_ex(sss_sifp_ctx *ctx,
+                        const char *object_path,
+                        const char *interface,
+                        const char *method,
+                        char ***_object_paths,
+                        int first_arg_type,
+                        ...)
+{
+    va_list ap;
+    sss_sifp_error ret;
+
+    va_start(ap, first_arg_type);
+    ret = sss_sifp_invoke_list_va(ctx, object_path, interface, method,
+                                  _object_paths, first_arg_type, ap);
+    va_end(ap);
+    return ret;
+}
+
+sss_sifp_error
+sss_sifp_invoke_list(sss_sifp_ctx *ctx,
                      const char *method,
-                     char **_object_path,
+                     char ***_object_paths,
                      int first_arg_type,
                      ...)
 {
+    va_list ap;
+    sss_sifp_error ret;
+
+    va_start(ap, first_arg_type);
+    ret = sss_sifp_invoke_list_ex(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE, method,
+                                  _object_paths, first_arg_type, ap);
+    va_end(ap);
+    return ret;
+}
+
+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;
-   va_list ap;
 
    if (ctx == NULL || method == NULL || _object_path == NULL) {
        return SSS_SIFP_INVALID_ARGUMENT;
@@ -172,9 +215,8 @@ sss_sifp_invoke_find(sss_sifp_ctx *ctx,
        goto done;
    }
 
-   va_start(ap, first_arg_type);
-   ret = sss_sifp_ifp_call(ctx, dbus_method, first_arg_type, ap, &reply);
-   va_end(ap);
+   ret = sss_sifp_ifp_call(ctx, object_path, interface, dbus_method,
+                           first_arg_type, ap, &reply);
    if (ret != SSS_SIFP_OK) {
        goto done;
    }
@@ -190,3 +232,39 @@ done:
 
    return ret;
 }
+
+sss_sifp_error
+sss_sifp_invoke_find_ex(sss_sifp_ctx *ctx,
+                        const char *object_path,
+                        const char *interface,
+                        const char *method,
+                        char **_object_path,
+                        int first_arg_type,
+                        ...)
+{
+   va_list ap;
+   sss_sifp_error ret;
+
+   va_start(ap, first_arg_type);
+   ret = sss_sifp_invoke_find_va(ctx, object_path, interface, method,
+                                 _object_path, first_arg_type, ap);
+   va_end(ap);
+   return ret;
+}
+
+sss_sifp_error
+sss_sifp_invoke_find(sss_sifp_ctx *ctx,
+                     const char *method,
+                     char **_object_path,
+                     int first_arg_type,
+                     ...)
+{
+   va_list ap;
+   sss_sifp_error ret;
+
+   va_start(ap, first_arg_type);
+   ret = sss_sifp_invoke_find_va(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE, method,
+                                 _object_path, first_arg_type, ap);
+   va_end(ap);
+   return ret;
+}
diff --git a/src/lib/sifp/sss_sifp_dbus.h b/src/lib/sifp/sss_sifp_dbus.h
index 57b136528e378432109e5e0d9ece5b2a30c7e41e..875d781be210ba9ea7574e7c79442aefc259c0f8 100644
--- a/src/lib/sifp/sss_sifp_dbus.h
+++ b/src/lib/sifp/sss_sifp_dbus.h
@@ -86,6 +86,30 @@ sss_sifp_send_message_ex(sss_sifp_ctx *ctx,
 
 /**
  * @brief List objects that satisfies given conditions. This routine will
+ * invoke List<method> D-Bus method on given interface and object path. If
+ * no interface or object path is given, /org/freedesktop/sssd/infopipe and
+ * org.freedesktop.sssd.infopipe is used. Arguments to this method are given
+ * as standard variadic D-Bus arguments.
+ *
+ * @param[in] ctx            sss_sifp context
+ * @param[in] object_path    D-Bus object path
+ * @param[in] interface      D-Bus interface
+ * @param[in] method         D-Bus method to call without the 'List' prefix
+ * @param[out] _object_paths List of object paths
+ * @param[in] first_arg_type Type of the first D-Bus argument
+ * @param[in] ...            D-Bus arguments
+ */
+sss_sifp_error
+sss_sifp_invoke_list_ex(sss_sifp_ctx *ctx,
+                        const char *object_path,
+                        const char *interface,
+                        const char *method,
+                        char ***_object_paths,
+                        int first_arg_type,
+                        ...);
+
+/**
+ * @brief List objects that satisfies given conditions. This routine will
  * invoke List<method> D-Bus method on SSSD InfoPipe interface. Arguments
  * to this method are given as standard variadic D-Bus arguments.
  *
@@ -104,6 +128,30 @@ sss_sifp_invoke_list(sss_sifp_ctx *ctx,
 
 /**
  * @brief Find single object that satisfies given conditions. This routine will
+ * invoke Find<method> D-Bus method on given interface and object path. If
+ * no interface or object path is given, /org/freedesktop/sssd/infopipe and
+ * org.freedesktop.sssd.infopipe is used. Arguments to this method are given
+ * as standard variadic D-Bus arguments.
+ *
+ * @param[in] ctx            sss_sifp context
+ * @param[in] object_path    D-Bus object path
+ * @param[in] interface      D-Bus interface
+ * @param[in] method         D-Bus method to call without the 'Find' prefix
+ * @param[out] _object_path  Object path
+ * @param[in] first_arg_type Type of the first D-Bus argument
+ * @param[in] ...            D-Bus arguments
+ */
+sss_sifp_error
+sss_sifp_invoke_find_ex(sss_sifp_ctx *ctx,
+                        const char *object_path,
+                        const char *interface,
+                        const char *method,
+                        char **_object_path,
+                        int first_arg_type,
+                        ...);
+
+/**
+ * @brief Find single object that satisfies given conditions. This routine will
  * invoke Find<method> D-Bus method on SSSD InfoPipe interface. Arguments
  * to this method are given as standard variadic D-Bus arguments.
  *
diff --git a/src/lib/sifp/sss_sifp_private.h b/src/lib/sifp/sss_sifp_private.h
index b42d05146756088aacccb0bb15c65cd1b34df7c9..9af8f7ba9f97113ffed1df44d6cedcca2bad447b 100644
--- a/src/lib/sifp/sss_sifp_private.h
+++ b/src/lib/sifp/sss_sifp_private.h
@@ -21,8 +21,6 @@
 #ifndef SSS_SIFP_PRIVATE_H_
 #define SSS_SIFP_PRIVATE_H_
 
-#define SSS_SIFP_PATH_IFP "/org/freedesktop/sssd/infopipe"
-
 #include <dbus/dbus.h>
 #include "lib/sifp/sss_sifp.h"
 
@@ -81,9 +79,6 @@ void
 sss_sifp_set_io_error(sss_sifp_ctx *ctx,
                       DBusError *error);
 
-const char *
-sss_sifp_get_iface_for_object(const char *object_path);
-
 char *
 sss_sifp_strdup(sss_sifp_ctx *ctx,
                 const char *str);
diff --git a/src/lib/sifp/sss_sifp_utils.c b/src/lib/sifp/sss_sifp_utils.c
index 29cde7ef58a406735337995c083e980c79f52d78..ccd051838fc53867109bfa83d4333903c712caec 100644
--- a/src/lib/sifp/sss_sifp_utils.c
+++ b/src/lib/sifp/sss_sifp_utils.c
@@ -44,33 +44,6 @@ void sss_sifp_set_io_error(sss_sifp_ctx *ctx, DBusError *error)
     dbus_set_error(ctx->io_error, error->name, error->message);
 }
 
-const char *
-sss_sifp_get_iface_for_object(const char *object_path)
-{
-    int i;
-    const char *path;
-    static struct {
-        const char *path;
-        const char *iface;
-    } known_types[] = {
-        {SSS_SIFP_PATH_IFP "/Components/", SSS_SIFP_IFACE_COMPONENTS},
-        {SSS_SIFP_PATH_IFP "/Domains/", SSS_SIFP_IFACE_DOMAINS},
-        {SSS_SIFP_PATH_IFP "/Services/", SSS_SIFP_IFACE_SERVICES},
-        {SSS_SIFP_PATH_IFP "/Users/", SSS_SIFP_IFACE_USERS},
-        {SSS_SIFP_PATH_IFP "/Groups/", SSS_SIFP_IFACE_GROUPS},
-        {NULL, NULL}
-    };
-
-    for (i = 0; known_types[i].path != NULL; i++) {
-        path = known_types[i].path;
-        if (strncmp(path, object_path, strlen(path)) == 0) {
-            return known_types[i].iface;
-        }
-    }
-
-    return NULL;
-}
-
 char * sss_sifp_strdup(sss_sifp_ctx *ctx, const char *str)
 {
     char *result = NULL;
diff --git a/src/lib/sifp/sss_simpleifp.exports b/src/lib/sifp/sss_simpleifp.exports
index 3d598fb2869d8aca4646577e435484f49196699c..f49109202a1b8e73daa2db0aa238f04a6d1272f6 100644
--- a/src/lib/sifp/sss_simpleifp.exports
+++ b/src/lib/sifp/sss_simpleifp.exports
@@ -46,3 +46,11 @@ SSS_SIMPLEIFP_0.0 {
     local:
         *;
 };
+
+SSS_SIMPLEIFP_0.1 {
+    # public functions
+    global:
+        sss_sifp_strerr;
+        sss_sifp_invoke_list_ex;
+        sss_sifp_invoke_find_ex;
+} SSS_SIMPLEIFP_0.0;
diff --git a/src/tests/cmocka/test_sss_sifp.c b/src/tests/cmocka/test_sss_sifp.c
index acf6a6ec87f4dddb0c92186e66da959e1ddd8463..88ff0ff4e94626de71cc71da8c55edf6d769d065 100644
--- a/src/tests/cmocka/test_sss_sifp.c
+++ b/src/tests/cmocka/test_sss_sifp.c
@@ -25,6 +25,7 @@
 #include "lib/sifp/sss_sifp.h"
 #include "lib/sifp/sss_sifp_dbus.h"
 #include "lib/sifp/sss_sifp_private.h"
+#include "responder/ifp/ifp_iface.h"
 
 struct {
     sss_sifp_ctx *dbus_ctx;
@@ -1619,32 +1620,6 @@ void test_sss_sifp_parse_attr_list_empty(void **state)
     assert_null(attrs);
 }
 
-void test_sss_sifp_get_iface_for_object(void **state)
-{
-    int i;
-    const char *iface = NULL;
-    static struct {
-        const char *path;
-        const char *iface;
-    } data[] = {{SSS_SIFP_PATH_IFP "/Components/Monitor",
-                 SSS_SIFP_IFACE_COMPONENTS},
-                {SSS_SIFP_PATH_IFP "/Domains/LDAP",
-                 SSS_SIFP_IFACE_DOMAINS},
-                {SSS_SIFP_PATH_IFP "/Services/NSS",
-                 SSS_SIFP_IFACE_SERVICES},
-                {SSS_SIFP_PATH_IFP "/Users/2154",
-                 SSS_SIFP_IFACE_USERS},
-                {SSS_SIFP_PATH_IFP "/Groups/3441",
-                 SSS_SIFP_IFACE_GROUPS},
-                {NULL, NULL}};
-
-    for (i = 0; data[i].path != NULL; i++) {
-        iface = sss_sifp_get_iface_for_object(data[i].path);
-        assert_non_null(iface);
-        assert_string_equal(data[i].iface, iface);
-    }
-}
-
 void test_sss_sifp_fetch_attr(void **state)
 {
     sss_sifp_ctx *ctx = test_ctx.dbus_ctx;
@@ -1870,7 +1845,8 @@ void test_sss_sifp_invoke_list_zeroargs(void **state)
     will_return(__wrap_dbus_connection_send_with_reply_and_block, reply);
 
     /* test */
-    ret = sss_sifp_invoke_list(ctx, "MyMethod", &path_out, DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_list_ex(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE,
+                                  "MyMethod", &path_out, DBUS_TYPE_INVALID);
     assert_int_equal(ret, SSS_SIFP_OK);
     assert_non_null(path_out);
 
@@ -1906,9 +1882,10 @@ void test_sss_sifp_invoke_list_withargs(void **state)
     will_return(__wrap_dbus_connection_send_with_reply_and_block, reply);
 
     /* test */
-    ret = sss_sifp_invoke_list(ctx, "MyMethod", &path_out,
-                               DBUS_TYPE_STRING, &arg,
-                               DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_list_ex(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE,
+                                  "MyMethod", &path_out,
+                                  DBUS_TYPE_STRING, &arg,
+                                  DBUS_TYPE_INVALID);
     assert_int_equal(ret, SSS_SIFP_OK);
     assert_non_null(path_out);
 
@@ -1938,7 +1915,8 @@ void test_sss_sifp_invoke_find_zeroargs(void **state)
     will_return(__wrap_dbus_connection_send_with_reply_and_block, reply);
 
     /* test */
-    ret = sss_sifp_invoke_find(ctx, "MyMethod", &path_out, DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_find_ex(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE,
+                                  "MyMethod", &path_out, DBUS_TYPE_INVALID);
     assert_int_equal(ret, SSS_SIFP_OK);
     assert_non_null(path_out);
     assert_string_equal(path_in, path_out);
@@ -1964,9 +1942,10 @@ void test_sss_sifp_invoke_find_withargs(void **state)
     will_return(__wrap_dbus_connection_send_with_reply_and_block, reply);
 
     /* test */
-    ret = sss_sifp_invoke_find(ctx, "MyMethod", &path_out,
-                               DBUS_TYPE_STRING, &arg,
-                               DBUS_TYPE_INVALID);
+    ret = sss_sifp_invoke_find_ex(ctx, SSS_SIFP_PATH, SSS_SIFP_IFACE,
+                                  "MyMethod", &path_out,
+                                  DBUS_TYPE_STRING, &arg,
+                                  DBUS_TYPE_INVALID);
     assert_int_equal(ret, SSS_SIFP_OK);
     assert_non_null(path_out);
     assert_string_equal(path_in, path_out);
@@ -1983,8 +1962,8 @@ void test_sss_sifp_list_domains(void **state)
     DBusMessage *msg_ipa = NULL;
     dbus_bool_t bret;
     sss_sifp_error ret;
-    const char *in[] = {SSS_SIFP_PATH_IFP "/Domains/LDAP",
-                        SSS_SIFP_PATH_IFP "/Domains/IPA"};
+    const char *in[] = {SSS_SIFP_PATH "/Domains/LDAP",
+                        SSS_SIFP_PATH "/Domains/IPA"};
     const char **paths = in;
     const char *names[] = {"LDAP", "IPA"};
     char **out = NULL;
@@ -2043,7 +2022,7 @@ void test_sss_sifp_fetch_domain_by_name(void **state)
     DBusMessageIter var_iter;
     dbus_bool_t bret;
     sss_sifp_error ret;
-    const char *in =SSS_SIFP_PATH_IFP "/Domains/LDAP";
+    const char *in =SSS_SIFP_PATH "/Domains/LDAP";
     const char *name = "LDAP";
     const char *prop = NULL;
     sss_sifp_object *out = NULL;
@@ -2118,7 +2097,7 @@ void test_sss_sifp_fetch_domain_by_name(void **state)
 
     assert_string_equal(out->name, name);
     assert_string_equal(out->object_path, in);
-    assert_string_equal(out->interface, SSS_SIFP_IFACE_DOMAINS);
+    assert_string_equal(out->interface, IFACE_IFP_DOMAINS);
 
     for (i = 0; props[i].name != NULL; i++) {
         assert_non_null(out->attrs[i]);
@@ -2228,7 +2207,6 @@ int main(int argc, const char *argv[])
                                         test_setup, test_teardown_parser),
         cmocka_unit_test_setup_teardown(test_sss_sifp_parse_attr_list_empty,
                                         test_setup, test_teardown_parser),
-        cmocka_unit_test(test_sss_sifp_get_iface_for_object),
         cmocka_unit_test_setup_teardown(test_sss_sifp_fetch_attr,
                                         test_setup, test_teardown_api),
         cmocka_unit_test_setup_teardown(test_sss_sifp_fetch_all_attrs,
-- 
2.1.0

