From 099520cfa6c9b34febb7b644cf6fdccc1e242319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Fri, 15 Jul 2016 14:20:32 +0200
Subject: [PATCH 2/4] PROXY: Do not abuse data provider interface

We want to use custom interface for proxy provider so we do not
abuse the data provider one. This way we gain more control over
it and we can remove the old interface entirely.
---
 Makefile.am                                 |   6 +-
 src/providers/dp_auth_util.c                |  64 ---------------
 src/providers/proxy/proxy.h                 |   2 +
 src/providers/proxy/proxy_auth.c            |   8 +-
 src/providers/proxy/proxy_child.c           | 119 +++++++++++++++-------------
 src/providers/proxy/proxy_client.c          | 108 +++++++++++--------------
 src/providers/proxy/proxy_iface.xml         |  17 ++++
 src/providers/proxy/proxy_iface_generated.c |  80 +++++++++++++++++++
 src/providers/proxy/proxy_iface_generated.h |  71 +++++++++++++++++
 9 files changed, 288 insertions(+), 187 deletions(-)
 create mode 100644 src/providers/proxy/proxy_iface.xml
 create mode 100644 src/providers/proxy/proxy_iface_generated.c
 create mode 100644 src/providers/proxy/proxy_iface_generated.h

diff --git a/Makefile.am b/Makefile.am
index 720ba8287b19847f5dd06c9718bbaae8195d0d5f..75824c250468308ef52cc028004299f52e99b701 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -714,6 +714,7 @@ dist_noinst_HEADERS = \
     src/providers/ad/ad_domain_info.h \
     src/providers/ad/ad_subdomains.h \
     src/providers/proxy/proxy.h \
+    src/providers/proxy/proxy_iface_generated.h \
     src/tools/tools_util.h \
     src/tools/sss_sync_ops.h \
     src/resolv/async_resolv.h \
@@ -1196,6 +1197,7 @@ CODEGEN_XML = \
     $(srcdir)/src/monitor/monitor_iface.xml \
     $(srcdir)/src/providers/data_provider_iface.xml \
     $(srcdir)/src/providers/data_provider/dp_iface.xml \
+    $(srcdir)/src/providers/proxy/proxy_iface.xml \
     $(srcdir)/src/responder/ifp/ifp_iface.xml
 
 SBUS_CODEGEN = src/sbus/sbus_codegen
@@ -3320,7 +3322,7 @@ libsss_proxy_la_SOURCES = \
     src/providers/proxy/proxy_netgroup.c \
     src/providers/proxy/proxy_services.c \
     src/providers/proxy/proxy_auth.c \
-    src/providers/data_provider_iface_generated.c \
+    src/providers/proxy/proxy_iface_generated.c \
     $(NULL)
 libsss_proxy_la_CFLAGS = \
     $(AM_CFLAGS)
@@ -3589,7 +3591,7 @@ gpo_child_LDADD = \
 
 proxy_child_SOURCES = \
     src/providers/proxy/proxy_child.c \
-    src/providers/data_provider_iface_generated.c \
+    src/providers/proxy/proxy_iface_generated.c \
     $(NULL)
 proxy_child_CFLAGS = \
     $(AM_CFLAGS) \
diff --git a/src/providers/dp_auth_util.c b/src/providers/dp_auth_util.c
index 8c09299b12c703ed703a025d1e8cfe5df2088eb2..35d22ab5f24ba2300889256f477a9ed856b69cb9 100644
--- a/src/providers/dp_auth_util.c
+++ b/src/providers/dp_auth_util.c
@@ -321,67 +321,3 @@ bool dp_unpack_pam_response(DBusMessage *msg, struct pam_data *pd, DBusError *db
 
     return true;
 }
-
-void dp_id_callback(DBusPendingCall *pending, void *ptr)
-{
-    DBusMessage *reply;
-    DBusError dbus_error;
-    dbus_bool_t ret;
-    dbus_uint16_t dp_ver;
-    int type;
-
-    dbus_error_init(&dbus_error);
-
-    reply = dbus_pending_call_steal_reply(pending);
-    if (!reply) {
-        /* reply should never be null. This function shouldn't be called
-         * until reply is valid or timeout has occurred. If reply is NULL
-         * here, something is seriously wrong and we should bail out.
-         */
-        DEBUG(SSSDBG_FATAL_FAILURE,
-              "Severe error. A reply callback was called but no"
-                  " reply was received and no timeout occurred\n");
-
-        /* FIXME: Destroy this connection ? */
-        goto done;
-    }
-
-    type = dbus_message_get_type(reply);
-    switch (type) {
-    case DBUS_MESSAGE_TYPE_METHOD_RETURN:
-        ret = dbus_message_get_args(reply, &dbus_error,
-                                    DBUS_TYPE_UINT16, &dp_ver,
-                                    DBUS_TYPE_INVALID);
-        if (!ret) {
-            DEBUG(SSSDBG_CRIT_FAILURE, "Failed to parse message\n");
-            if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
-            /* FIXME: Destroy this connection ? */
-            goto done;
-        }
-
-        DEBUG(SSSDBG_CONF_SETTINGS,
-              "Got id ack and version (%d) from DP\n", dp_ver);
-
-        break;
-
-    case DBUS_MESSAGE_TYPE_ERROR:
-        DEBUG(SSSDBG_FATAL_FAILURE,"The Monitor returned an error [%s]\n",
-                 dbus_message_get_error_name(reply));
-        /* Falling through to default intentionally*/
-    default:
-        /*
-         * Timeout or other error occurred or something
-         * unexpected happened.
-         * It doesn't matter which, because either way we
-         * know that this connection isn't trustworthy.
-         * We'll destroy it now.
-         */
-
-        /* FIXME: Destroy this connection ? */
-        break;
-    }
-
-done:
-    dbus_pending_call_unref(pending);
-    dbus_message_unref(reply);
-}
diff --git a/src/providers/proxy/proxy.h b/src/providers/proxy/proxy.h
index 3aa090dc8e761e6988a21c9f9fd58e4d539d5f49..3b0475d080402bf40d53843c82a6cbc412d091c8 100644
--- a/src/providers/proxy/proxy.h
+++ b/src/providers/proxy/proxy.h
@@ -42,6 +42,8 @@
 #include "sss_client/nss_compat.h"
 #include <dhash.h>
 
+#define PROXY_CHILD_PATH "/org/freedesktop/sssd/proxychild"
+
 struct proxy_nss_ops {
     enum nss_status (*getpwnam_r)(const char *name, struct passwd *result,
                                   char *buffer, size_t buflen, int *errnop);
diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c
index 6e7139aaa5d45631fa08f265c54b66ab97555a64..2b3510c38b1cb265e3042425c373f39e524a71eb 100644
--- a/src/providers/proxy/proxy_auth.c
+++ b/src/providers/proxy/proxy_auth.c
@@ -23,6 +23,7 @@
 */
 
 #include "providers/proxy/proxy.h"
+#include "providers/proxy/proxy_iface_generated.h"
 
 struct pc_init_ctx;
 
@@ -531,9 +532,9 @@ static struct tevent_req *proxy_pam_conv_send(TALLOC_CTX *mem_ctx,
     state->pid = pid;
 
     msg = dbus_message_new_method_call(NULL,
-                                       DP_PATH,
-                                       DATA_PROVIDER_IFACE,
-                                       DATA_PROVIDER_IFACE_PAMHANDLER);
+                                       PROXY_CHILD_PATH,
+                                       IFACE_PROXY_AUTH,
+                                       IFACE_PROXY_AUTH_PAM);
     if (msg == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "dbus_message_new_method_call failed.\n");
         talloc_zfree(req);
@@ -847,4 +848,3 @@ proxy_pam_handler_recv(TALLOC_CTX *mem_ctx,
 
     return EOK;
 }
-
diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index efd304d5aafd5e53792ef96b75d8aa0c908bbe13..b492adcb3b5efefc08e6eb9e069035aeff8d34df 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -44,22 +44,10 @@
 #include "confdb/confdb.h"
 #include "sbus/sssd_dbus.h"
 #include "providers/proxy/proxy.h"
+#include "providers/proxy/proxy_iface_generated.h"
 
 #include "providers/backend.h"
 
-static int pc_pam_handler(struct sbus_request *dbus_req, void *user_data);
-
-struct data_provider_iface pc_methods = {
-    { &data_provider_iface_meta, 0 },
-    .RegisterService = NULL,
-    .pamHandler = pc_pam_handler,
-    .sudoHandler = NULL,
-    .autofsHandler = NULL,
-    .hostHandler = NULL,
-    .getDomains = NULL,
-    .getAccountInfo = NULL,
-};
-
 struct pc_ctx {
     struct tevent_context *ev;
     struct confdb_ctx *cdb;
@@ -382,17 +370,71 @@ done:
     exit(ret);
 }
 
-int proxy_child_send_id(struct sbus_connection *conn,
-                        uint16_t version,
-                        uint32_t id);
+static void proxy_child_id_callback(DBusPendingCall *pending, void *ptr)
+{
+    DBusMessage *reply;
+    errno_t ret;
+
+    reply = dbus_pending_call_steal_reply(pending);
+    if (reply == NULL) {
+        /* reply should never be null. This function shouldn't be called
+         * until reply is valid or timeout has occurred. If reply is NULL
+         * here, something is seriously wrong and we should bail out.
+         */
+        DEBUG(SSSDBG_FATAL_FAILURE, "Severe error. A reply callback was "
+              "called but no reply was received and no timeout occurred\n");
+        goto done;
+    }
+
+    ret = sbus_parse_reply(reply);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Unable to get ID ack [%d]: %s\n",
+              ret, sss_strerror(ret));
+    }
+
+    DEBUG(SSSDBG_TRACE_FUNC, "Got id ack from proxy child\n");
+
+done:
+    dbus_pending_call_unref(pending);
+    dbus_message_unref(reply);
+}
+
+static errno_t proxy_child_send_id(struct sbus_connection *conn, uint32_t id)
+{
+    DBusMessage *msg;
+    errno_t ret;
+
+    msg = sbus_create_message(NULL, NULL, PROXY_CHILD_PATH, IFACE_PROXY_CLIENT,
+                              IFACE_PROXY_CLIENT_REGISTER,
+                              DBUS_TYPE_UINT32, &id);
+    if (msg == NULL) {
+        DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n");
+        return ENOMEM;
+    }
+
+    DEBUG(SSSDBG_TRACE_FUNC, "Sending ID to Proxy Backend: (%"PRIu32")\n", id);
+
+    ret = sbus_conn_send(conn, msg, 30000, proxy_child_id_callback, NULL, NULL);
+
+    dbus_message_unref(msg);
+
+    return ret;
+}
+
 static int proxy_cli_init(struct pc_ctx *ctx)
 {
     char *sbus_address;
     int ret;
 
+    static struct iface_proxy_auth iface_proxy_auth = {
+        { &iface_proxy_auth_meta, 0 },
+
+        .PAM = pc_pam_handler,
+    };
+
     sbus_address = talloc_asprintf(ctx, "unix:path=%s/%s_%s",
-                                      PIPE_PATH, PROXY_CHILD_PIPE,
-                                      ctx->domain->name);
+                                   PIPE_PATH, PROXY_CHILD_PIPE,
+                                   ctx->domain->name);
     if (sbus_address == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
         return ENOMEM;
@@ -404,13 +446,14 @@ static int proxy_cli_init(struct pc_ctx *ctx)
         return ret;
     }
 
-    ret = sbus_conn_register_iface(ctx->conn, &pc_methods.vtable, DP_PATH, ctx);
+    ret = sbus_conn_register_iface(ctx->conn, &iface_proxy_auth.vtable,
+                                   PROXY_CHILD_PATH, ctx);
     if (ret != EOK) {
         DEBUG(SSSDBG_FATAL_FAILURE, "Failed to export proxy.\n");
         return ret;
     }
 
-    ret = proxy_child_send_id(ctx->conn, DATA_PROVIDER_VERSION, ctx->id);
+    ret = proxy_child_send_id(ctx->conn, ctx->id);
     if (ret != EOK) {
         DEBUG(SSSDBG_FATAL_FAILURE, "dp_common_send_id failed.\n");
         return ret;
@@ -419,42 +462,6 @@ static int proxy_cli_init(struct pc_ctx *ctx)
     return EOK;
 }
 
-int proxy_child_send_id(struct sbus_connection *conn,
-                        uint16_t version,
-                        uint32_t id)
-{
-    DBusMessage *msg;
-    dbus_bool_t ret;
-    int retval;
-
-    /* create the message */
-    msg = dbus_message_new_method_call(NULL,
-                                       DP_PATH,
-                                       DATA_PROVIDER_IFACE,
-                                       DATA_PROVIDER_IFACE_REGISTERSERVICE);
-    if (msg == NULL) {
-        DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory?!\n");
-        return ENOMEM;
-    }
-
-    DEBUG(SSSDBG_FUNC_DATA, "Sending ID to Proxy Backend: (%d,%"PRIu32")\n",
-                             version, id);
-
-    ret = dbus_message_append_args(msg,
-                                   DBUS_TYPE_UINT16, &version,
-                                   DBUS_TYPE_UINT32, &id,
-                                   DBUS_TYPE_INVALID);
-    if (!ret) {
-        DEBUG(SSSDBG_CRIT_FAILURE, "Failed to build message\n");
-        return EIO;
-    }
-
-    retval = sbus_conn_send(conn, msg, 30000, dp_id_callback, NULL, NULL);
-
-    dbus_message_unref(msg);
-    return retval;
-}
-
 int proxy_child_process_init(TALLOC_CTX *mem_ctx, const char *domain,
                              struct tevent_context *ev, struct confdb_ctx *cdb,
                              const char *pam_target, uint32_t id)
diff --git a/src/providers/proxy/proxy_client.c b/src/providers/proxy/proxy_client.c
index fc1735f2a101528a1edeaf3cf9c1118e4a21e937..74957caeec5bf50b5cb959d6f5b8ec1ca9ecba37 100644
--- a/src/providers/proxy/proxy_client.c
+++ b/src/providers/proxy/proxy_client.c
@@ -22,24 +22,10 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "config.h"
-
-#include "util/sss_format.h"
+#include "util/util.h"
+#include "providers/proxy/proxy_iface_generated.h"
 #include "providers/proxy/proxy.h"
 
-static int client_registration(struct sbus_request *dbus_req, void *data);
-
-static struct data_provider_iface proxy_methods = {
-    { &data_provider_iface_meta, 0 },
-    .RegisterService = client_registration,
-    .pamHandler = NULL,
-    .sudoHandler = NULL,
-    .autofsHandler = NULL,
-    .hostHandler = NULL,
-    .getDomains = NULL,
-    .getAccountInfo = NULL,
-};
-
 struct proxy_client {
     struct proxy_auth_ctx *proxy_auth_ctx;
     struct sbus_connection *conn;
@@ -47,24 +33,22 @@ struct proxy_client {
     bool initialized;
 };
 
-static int client_registration(struct sbus_request *dbus_req, void *data)
+static int proxy_client_register(struct sbus_request *sbus_req,
+                                 void *data,
+                                 uint32_t cli_id)
 {
-    dbus_uint16_t version = DATA_PROVIDER_VERSION;
     struct sbus_connection *conn;
     struct proxy_client *proxy_cli;
-    dbus_uint16_t cli_ver;
-    uint32_t cli_id;
     int hret;
     hash_key_t key;
     hash_value_t value;
     struct tevent_req *req;
     struct proxy_child_ctx *child_ctx;
     struct pc_init_ctx *init_ctx;
-    int ret;
 
-    conn = dbus_req->conn;
+    conn = sbus_req->conn;
     proxy_cli = talloc_get_type(data, struct proxy_client);
-    if (!proxy_cli) {
+    if (proxy_cli == NULL) {
         DEBUG(SSSDBG_FATAL_FAILURE, "Connection holds no valid init data\n");
         return EINVAL;
     }
@@ -74,14 +58,6 @@ static int client_registration(struct sbus_request *dbus_req, void *data)
           "Cancel proxy client ID timeout [%p]\n", proxy_cli->timeout);
     talloc_zfree(proxy_cli->timeout);
 
-    if (!sbus_request_parse_or_finish(dbus_req,
-                                      DBUS_TYPE_UINT16, &cli_ver,
-                                      DBUS_TYPE_UINT32, &cli_id,
-                                      DBUS_TYPE_INVALID)) {
-        sbus_disconnect(conn);
-        return EOK; /* handled */
-    }
-
     DEBUG(SSSDBG_FUNC_DATA, "Proxy client [%"PRIu32"] connected\n", cli_id);
 
     /* Check the hash table */
@@ -94,20 +70,14 @@ static int client_registration(struct sbus_request *dbus_req, void *data)
         return EIO;
     }
 
-    /* reply that all is ok */
-    ret = sbus_request_return_and_finish(dbus_req,
-                                         DBUS_TYPE_UINT16, &version,
-                                         DBUS_TYPE_INVALID);
-    if (ret != EOK) {
-        sbus_disconnect(conn);
-        return ret;
-    }
+    iface_proxy_client_Register_finish(sbus_req);
 
     hret = hash_lookup(proxy_cli->proxy_auth_ctx->request_table, &key, &value);
     if (hret != HASH_SUCCESS) {
         DEBUG(SSSDBG_CRIT_FAILURE,
-              "Hash error [%d][%s]\n", hret, hash_error_string(hret));
+              "Hash error [%d]: %s\n", hret, hash_error_string(hret));
         sbus_disconnect(conn);
+        return EIO;
     }
 
     /* Signal that the child is up and ready to receive the request */
@@ -121,7 +91,7 @@ static int client_registration(struct sbus_request *dbus_req, void *data)
          * break.
          */
         DEBUG(SSSDBG_CRIT_FAILURE, "Client connection from a request "
-                  "that's not marked as running\n");
+              "that's not marked as running\n");
         return EIO;
     }
 
@@ -133,9 +103,10 @@ static int client_registration(struct sbus_request *dbus_req, void *data)
     return EOK;
 }
 
-static void init_timeout(struct tevent_context *ev,
-                         struct tevent_timer *te,
-                         struct timeval t, void *ptr)
+static void proxy_client_timeout(struct tevent_context *ev,
+                                 struct tevent_timer *te,
+                                 struct timeval t,
+                                 void *ptr)
 {
     struct proxy_client *proxy_cli;
 
@@ -155,38 +126,53 @@ static void init_timeout(struct tevent_context *ev,
 
 int proxy_client_init(struct sbus_connection *conn, void *data)
 {
-    struct proxy_auth_ctx *proxy_auth_ctx;
+    struct proxy_auth_ctx *auth_ctx;
     struct proxy_client *proxy_cli;
     struct timeval tv;
+    errno_t ret;
 
-    proxy_auth_ctx = talloc_get_type(data, struct proxy_auth_ctx);
+    static struct iface_proxy_client iface_proxy_client = {
+        { &iface_proxy_client_meta, 0 },
 
-    /* hang off this memory to the connection so that when the connection
-     * is freed we can potentially call a destructor */
+        .Register = proxy_client_register,
+    };
 
+    auth_ctx = talloc_get_type(data, struct proxy_auth_ctx);
+
+    /* When connection is lost we also free the client. */
     proxy_cli = talloc_zero(conn, struct proxy_client);
-    if (!proxy_cli) {
-        DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n");
-        talloc_zfree(conn);
+    if (proxy_cli == NULL) {
+        DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory, killing connection.\n");
+        talloc_free(conn);
         return ENOMEM;
     }
-    proxy_cli->proxy_auth_ctx = proxy_auth_ctx;
+
+    proxy_cli->proxy_auth_ctx = auth_ctx;
     proxy_cli->conn = conn;
     proxy_cli->initialized = false;
 
-    /* 5 seconds should be plenty */
+    /* Setup timeout in case client fails to register himself in time. */
     tv = tevent_timeval_current_ofs(5, 0);
-
-    proxy_cli->timeout = tevent_add_timer(proxy_auth_ctx->be->ev, proxy_cli,
-                                          tv, init_timeout, proxy_cli);
-    if (!proxy_cli->timeout) {
-        DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n");
-        talloc_zfree(conn);
+    proxy_cli->timeout = tevent_add_timer(auth_ctx->be->ev, proxy_cli, tv,
+                                          proxy_client_timeout, proxy_cli);
+    if (proxy_cli->timeout == NULL) {
+        /* Connection is closed in the caller. */
+        DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory, killing connection\n");
         return ENOMEM;
     }
+
     DEBUG(SSSDBG_CONF_SETTINGS,
           "Set-up proxy client ID timeout [%p]\n", proxy_cli->timeout);
 
-    return sbus_conn_register_iface(conn, &proxy_methods.vtable,
-                                    DP_PATH, proxy_cli);
+    /* Setup D-Bus interfaces and methods. */
+    ret = sbus_conn_register_iface(conn, &iface_proxy_client.vtable,
+                                   PROXY_CHILD_PATH, proxy_cli);
+    if (ret != EOK) {
+        /* Connection is closed in the caller. */
+        DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register D-Bus interface, "
+              "killing connection [%d]: %s\n", ret, sss_strerror(ret));
+        return ret;
+    }
+
+    return ret;
 }
diff --git a/src/providers/proxy/proxy_iface.xml b/src/providers/proxy/proxy_iface.xml
new file mode 100644
index 0000000000000000000000000000000000000000..39b0b03928661a1851fd739598b0194547441c2c
--- /dev/null
+++ b/src/providers/proxy/proxy_iface.xml
@@ -0,0 +1,17 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+    <interface name="org.freedesktop.sssd.ProxyChild.Client">
+        <annotation value="iface_proxy_client" name="org.freedesktop.DBus.GLib.CSymbol"/>
+        <method name="Register">
+            <arg name="ID" type="u" direction="in" />
+        </method>
+    </interface>
+
+    <interface name="org.freedesktop.sssd.ProxyChild.Auth">
+        <annotation value="iface_proxy_auth" name="org.freedesktop.DBus.GLib.CSymbol"/>
+        <method name="PAM">
+            <annotation name="org.freedesktop.sssd.RawHandler" value="true"/>
+        </method>
+    </interface>
+</node>
diff --git a/src/providers/proxy/proxy_iface_generated.c b/src/providers/proxy/proxy_iface_generated.c
new file mode 100644
index 0000000000000000000000000000000000000000..425727d1496b537eb25b002815d14e1f57b8f00d
--- /dev/null
+++ b/src/providers/proxy/proxy_iface_generated.c
@@ -0,0 +1,80 @@
+/* The following definitions are auto-generated from proxy_iface.xml */
+
+#include "util/util.h"
+#include "sbus/sssd_dbus.h"
+#include "sbus/sssd_dbus_meta.h"
+#include "sbus/sssd_dbus_invokers.h"
+#include "proxy_iface_generated.h"
+
+/* invokes a handler with a 'u' DBus signature */
+static int invoke_u_method(struct sbus_request *dbus_req, void *function_ptr);
+
+/* arguments for org.freedesktop.sssd.ProxyChild.Client.Register */
+const struct sbus_arg_meta iface_proxy_client_Register__in[] = {
+    { "ID", "u" },
+    { NULL, }
+};
+
+int iface_proxy_client_Register_finish(struct sbus_request *req)
+{
+   return sbus_request_return_and_finish(req,
+                                         DBUS_TYPE_INVALID);
+}
+
+/* methods for org.freedesktop.sssd.ProxyChild.Client */
+const struct sbus_method_meta iface_proxy_client__methods[] = {
+    {
+        "Register", /* name */
+        iface_proxy_client_Register__in,
+        NULL, /* no out_args */
+        offsetof(struct iface_proxy_client, Register),
+        invoke_u_method,
+    },
+    { NULL, }
+};
+
+/* interface info for org.freedesktop.sssd.ProxyChild.Client */
+const struct sbus_interface_meta iface_proxy_client_meta = {
+    "org.freedesktop.sssd.ProxyChild.Client", /* name */
+    iface_proxy_client__methods,
+    NULL, /* no signals */
+    NULL, /* no properties */
+    sbus_invoke_get_all, /* GetAll invoker */
+};
+
+/* methods for org.freedesktop.sssd.ProxyChild.Auth */
+const struct sbus_method_meta iface_proxy_auth__methods[] = {
+    {
+        "PAM", /* name */
+        NULL, /* no in_args */
+        NULL, /* no out_args */
+        offsetof(struct iface_proxy_auth, PAM),
+        NULL, /* no invoker */
+    },
+    { NULL, }
+};
+
+/* interface info for org.freedesktop.sssd.ProxyChild.Auth */
+const struct sbus_interface_meta iface_proxy_auth_meta = {
+    "org.freedesktop.sssd.ProxyChild.Auth", /* name */
+    iface_proxy_auth__methods,
+    NULL, /* no signals */
+    NULL, /* no properties */
+    sbus_invoke_get_all, /* GetAll invoker */
+};
+
+/* invokes a handler with a 'u' DBus signature */
+static int invoke_u_method(struct sbus_request *dbus_req, void *function_ptr)
+{
+    uint32_t arg_0;
+    int (*handler)(struct sbus_request *, void *, uint32_t) = function_ptr;
+
+    if (!sbus_request_parse_or_finish(dbus_req,
+                               DBUS_TYPE_UINT32, &arg_0,
+                               DBUS_TYPE_INVALID)) {
+         return EOK; /* request handled */
+    }
+
+    return (handler)(dbus_req, dbus_req->intf->handler_data,
+                     arg_0);
+}
diff --git a/src/providers/proxy/proxy_iface_generated.h b/src/providers/proxy/proxy_iface_generated.h
new file mode 100644
index 0000000000000000000000000000000000000000..7af074fa3d839263318ceac7ea34f62dcde64563
--- /dev/null
+++ b/src/providers/proxy/proxy_iface_generated.h
@@ -0,0 +1,71 @@
+/* The following declarations are auto-generated from proxy_iface.xml */
+
+#ifndef __PROXY_IFACE_XML__
+#define __PROXY_IFACE_XML__
+
+#include "sbus/sssd_dbus.h"
+
+/* ------------------------------------------------------------------------
+ * DBus Constants
+ *
+ * Various constants of interface and method names mostly for use by clients
+ */
+
+/* constants for org.freedesktop.sssd.ProxyChild.Client */
+#define IFACE_PROXY_CLIENT "org.freedesktop.sssd.ProxyChild.Client"
+#define IFACE_PROXY_CLIENT_REGISTER "Register"
+
+/* constants for org.freedesktop.sssd.ProxyChild.Auth */
+#define IFACE_PROXY_AUTH "org.freedesktop.sssd.ProxyChild.Auth"
+#define IFACE_PROXY_AUTH_PAM "PAM"
+
+/* ------------------------------------------------------------------------
+ * DBus handlers
+ *
+ * These structures are filled in by implementors of the different
+ * dbus interfaces to handle method calls.
+ *
+ * Handler functions of type sbus_msg_handler_fn accept raw messages,
+ * other handlers are typed appropriately. If a handler that is
+ * set to NULL is invoked it will result in a
+ * org.freedesktop.DBus.Error.NotSupported error for the caller.
+ *
+ * Handlers have a matching xxx_finish() function (unless the method has
+ * accepts raw messages). These finish functions the
+ * sbus_request_return_and_finish() with the appropriate arguments to
+ * construct a valid reply. Once a finish function has been called, the
+ * @dbus_req it was called with is freed and no longer valid.
+ */
+
+/* vtable for org.freedesktop.sssd.ProxyChild.Client */
+struct iface_proxy_client {
+    struct sbus_vtable vtable; /* derive from sbus_vtable */
+    int (*Register)(struct sbus_request *req, void *data, uint32_t arg_ID);
+};
+
+/* finish function for Register */
+int iface_proxy_client_Register_finish(struct sbus_request *req);
+
+/* vtable for org.freedesktop.sssd.ProxyChild.Auth */
+struct iface_proxy_auth {
+    struct sbus_vtable vtable; /* derive from sbus_vtable */
+    sbus_msg_handler_fn PAM;
+};
+
+/* ------------------------------------------------------------------------
+ * DBus Interface Metadata
+ *
+ * These structure definitions are filled in with the information about
+ * the interfaces, methods, properties and so on.
+ *
+ * The actual definitions are found in the accompanying C file next
+ * to this header.
+ */
+
+/* interface info for org.freedesktop.sssd.ProxyChild.Client */
+extern const struct sbus_interface_meta iface_proxy_client_meta;
+
+/* interface info for org.freedesktop.sssd.ProxyChild.Auth */
+extern const struct sbus_interface_meta iface_proxy_auth_meta;
+
+#endif /* __PROXY_IFACE_XML__ */
-- 
2.1.0

