Blame SOURCES/0073-DP-Create-a-new-handler-function-getAccountDomain.patch

9f2ebf
From 1bed72e4faa2734b0eef6a107b2dc24bf052e576 Mon Sep 17 00:00:00 2001
9f2ebf
From: Jakub Hrozek <jhrozek@redhat.com>
9f2ebf
Date: Mon, 30 Oct 2017 20:50:41 +0100
9f2ebf
Subject: [PATCH 73/83] DP: Create a new handler function getAccountDomain()
9f2ebf
MIME-Version: 1.0
9f2ebf
Content-Type: text/plain; charset=UTF-8
9f2ebf
Content-Transfer-Encoding: 8bit
9f2ebf
9f2ebf
Adds a new method getAccountDomain() which is a bit similar to
9f2ebf
getAccountInfo, except it doesn't fetch, parse and store the entry, but
9f2ebf
just returns the domain or a subdomain the entry was found in.
9f2ebf
9f2ebf
At the moment, the method only supports requests by ID.
9f2ebf
9f2ebf
A default handler is provided (and in this patch used by all the
9f2ebf
domains) which returns ERR_GET_ACCT_DOM_NOT_SUPPORTED. This return
9f2ebf
code should be evaluated by the responder so that this DP method is
9f2ebf
not called again, because it's not supported by the back end type.
9f2ebf
9f2ebf
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
9f2ebf
Reviewed-by: Sumit Bose <sbose@redhat.com>
9f2ebf
(cherry picked from commit c0f9f5a0f6d71a1596ee3cef549b4b02295313c3)
9f2ebf
---
9f2ebf
 src/providers/ad/ad_init.c                       |   4 +
9f2ebf
 src/providers/data_provider/dp.h                 |  20 ++++
9f2ebf
 src/providers/data_provider/dp_custom_data.h     |   6 ++
9f2ebf
 src/providers/data_provider/dp_iface.c           |   3 +-
9f2ebf
 src/providers/data_provider/dp_iface.h           |  17 ++++
9f2ebf
 src/providers/data_provider/dp_iface.xml         |   7 ++
9f2ebf
 src/providers/data_provider/dp_iface_generated.c |  31 +++++++
9f2ebf
 src/providers/data_provider/dp_iface_generated.h |   5 +
9f2ebf
 src/providers/data_provider/dp_target_id.c       | 113 +++++++++++++++++++++++
9f2ebf
 src/providers/files/files_init.c                 |   6 ++
9f2ebf
 src/providers/ipa/ipa_init.c                     |   4 +
9f2ebf
 src/providers/ldap/ldap_init.c                   |   4 +
9f2ebf
 src/providers/proxy/proxy_init.c                 |   4 +
9f2ebf
 src/util/util_errors.c                           |   1 +
9f2ebf
 src/util/util_errors.h                           |   1 +
9f2ebf
 15 files changed, 225 insertions(+), 1 deletion(-)
9f2ebf
9f2ebf
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
9f2ebf
index e62025d4acd24844a5c7082d00c597516f35de16..7efb6aa71cbd2551422c87e0b0c5c1fe91390375 100644
9f2ebf
--- a/src/providers/ad/ad_init.c
9f2ebf
+++ b/src/providers/ad/ad_init.c
9f2ebf
@@ -510,6 +510,10 @@ errno_t sssm_ad_id_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   sdap_online_check_handler_send, sdap_online_check_handler_recv, id_ctx->sdap_id_ctx,
9f2ebf
                   struct sdap_id_ctx, void, struct dp_reply_std);
9f2ebf
 
9f2ebf
+    dp_set_method(dp_methods, DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
+                  default_account_domain_send, default_account_domain_recv, NULL,
9f2ebf
+                  void, struct dp_get_acct_domain_data, struct dp_reply_std);
9f2ebf
+
9f2ebf
     return EOK;
9f2ebf
 }
9f2ebf
 
9f2ebf
diff --git a/src/providers/data_provider/dp.h b/src/providers/data_provider/dp.h
9f2ebf
index aa5b781158c54545b26034602bb25db46b189e87..ceb49da53b88142924e1792c6f64a22ec369677b 100644
9f2ebf
--- a/src/providers/data_provider/dp.h
9f2ebf
+++ b/src/providers/data_provider/dp.h
9f2ebf
@@ -82,6 +82,7 @@ enum dp_methods {
9f2ebf
     DPM_HOSTID_HANDLER,
9f2ebf
     DPM_DOMAINS_HANDLER,
9f2ebf
     DPM_SESSION_HANDLER,
9f2ebf
+    DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
 
9f2ebf
     DPM_REFRESH_ACCESS_RULES,
9f2ebf
 
9f2ebf
@@ -179,4 +180,23 @@ void dp_sbus_reset_users_memcache(struct data_provider *provider);
9f2ebf
 void dp_sbus_reset_groups_memcache(struct data_provider *provider);
9f2ebf
 void dp_sbus_reset_initgr_memcache(struct data_provider *provider);
9f2ebf
 
9f2ebf
+/*
9f2ebf
+ * A dummy handler for DPM_ACCT_DOMAIN_HANDLER.
9f2ebf
+ *
9f2ebf
+ * Its purpose is to always return ERR_GET_ACCT_DOM_NOT_SUPPORTED
9f2ebf
+ * which the responder should evaluate as "this back end does not
9f2ebf
+ * support locating entries' domain" and never call
9f2ebf
+ * DPM_ACCT_DOMAIN_HANDLER again
9f2ebf
+ *
9f2ebf
+ * This request cannot fail, except for critical errors like OOM.
9f2ebf
+ */
9f2ebf
+struct tevent_req *
9f2ebf
+default_account_domain_send(TALLOC_CTX *mem_ctx,
9f2ebf
+                            void *unused_ctx,
9f2ebf
+                            struct dp_get_acct_domain_data *data,
9f2ebf
+                            struct dp_req_params *params);
9f2ebf
+errno_t default_account_domain_recv(TALLOC_CTX *mem_ctx,
9f2ebf
+                                    struct tevent_req *req,
9f2ebf
+                                    struct dp_reply_std *data);
9f2ebf
+
9f2ebf
 #endif /* _DP_H_ */
9f2ebf
diff --git a/src/providers/data_provider/dp_custom_data.h b/src/providers/data_provider/dp_custom_data.h
9f2ebf
index d9de288b62f4f6763ceb205dc596876cfc58bf6c..7c64bde4513961e79200e852c7277f77e064d5a3 100644
9f2ebf
--- a/src/providers/data_provider/dp_custom_data.h
9f2ebf
+++ b/src/providers/data_provider/dp_custom_data.h
9f2ebf
@@ -43,6 +43,12 @@ struct dp_subdomains_data {
9f2ebf
     const char *domain_hint;
9f2ebf
 };
9f2ebf
 
9f2ebf
+struct dp_get_acct_domain_data {
9f2ebf
+    uint32_t entry_type;
9f2ebf
+    uint32_t filter_type;
9f2ebf
+    const char *filter_value;
9f2ebf
+};
9f2ebf
+
9f2ebf
 struct dp_id_data {
9f2ebf
     uint32_t entry_type;
9f2ebf
     uint32_t filter_type;
9f2ebf
diff --git a/src/providers/data_provider/dp_iface.c b/src/providers/data_provider/dp_iface.c
9f2ebf
index 28d70e686f63a3572ac595f493aa1d59436c563f..124be0048f38a93d06561ff7b0d1916838587103 100644
9f2ebf
--- a/src/providers/data_provider/dp_iface.c
9f2ebf
+++ b/src/providers/data_provider/dp_iface.c
9f2ebf
@@ -33,7 +33,8 @@ struct iface_dp iface_dp = {
9f2ebf
     .autofsHandler = dp_autofs_handler,
9f2ebf
     .hostHandler = dp_host_handler,
9f2ebf
     .getDomains = dp_subdomains_handler,
9f2ebf
-    .getAccountInfo = dp_get_account_info_handler
9f2ebf
+    .getAccountInfo = dp_get_account_info_handler,
9f2ebf
+    .getAccountDomain = dp_get_account_domain_handler,
9f2ebf
 };
9f2ebf
 
9f2ebf
 struct iface_dp_backend iface_dp_backend = {
9f2ebf
diff --git a/src/providers/data_provider/dp_iface.h b/src/providers/data_provider/dp_iface.h
9f2ebf
index 759b9e6c9eb7f53836ae0b641b34e6c31e65779f..0a2f81eb5c108aa7596c974157b0dfafb041869f 100644
9f2ebf
--- a/src/providers/data_provider/dp_iface.h
9f2ebf
+++ b/src/providers/data_provider/dp_iface.h
9f2ebf
@@ -58,6 +58,23 @@ errno_t dp_subdomains_handler(struct sbus_request *sbus_req,
9f2ebf
                               void *dp_cli,
9f2ebf
                               const char *domain_hint);
9f2ebf
 
9f2ebf
+/*
9f2ebf
+ * Return a domain the account belongs to.
9f2ebf
+ *
9f2ebf
+ * The request uses the dp_reply_std structure for reply, with the following
9f2ebf
+ * semantics:
9f2ebf
+ *  - DP_ERR_OK - it is expected that the string message contains the domain name
9f2ebf
+ *                the entry was found in. A 'negative' reply where the
9f2ebf
+ *                request returns DP_ERR_OK, but no domain should be treated
9f2ebf
+ *                as authoritative, as if the entry does not exist.
9f2ebf
+ *  - DP_ERR_*  - the string message contains error string that corresponds
9f2ebf
+ *                to the errno field in dp_reply_std().
9f2ebf
+ */
9f2ebf
+errno_t dp_get_account_domain_handler(struct sbus_request *sbus_req,
9f2ebf
+                                      void *dp_cli,
9f2ebf
+                                      uint32_t entry_type,
9f2ebf
+                                      const char *filter);
9f2ebf
+
9f2ebf
 /* org.freedesktop.sssd.DataProvider.Backend */
9f2ebf
 errno_t dp_backend_is_online(struct sbus_request *sbus_req,
9f2ebf
                              void *dp_cli,
9f2ebf
diff --git a/src/providers/data_provider/dp_iface.xml b/src/providers/data_provider/dp_iface.xml
9f2ebf
index 2bfa9dfa7e9d02d2d12c3358967f6969438a97a2..c2431850bca4baa529fb18e0480e781308b12dd6 100644
9f2ebf
--- a/src/providers/data_provider/dp_iface.xml
9f2ebf
+++ b/src/providers/data_provider/dp_iface.xml
9f2ebf
@@ -79,5 +79,12 @@
9f2ebf
             <arg name="error" type="u" direction="out" />
9f2ebf
             <arg name="error_message" type="s" direction="out" />
9f2ebf
         </method>
9f2ebf
+        <method name="getAccountDomain">
9f2ebf
+            <arg name="entry_type" type="u" direction="in" />
9f2ebf
+            <arg name="filter" type="s" direction="in" />
9f2ebf
+            <arg name="dp_error" type="q" direction="out" />
9f2ebf
+            <arg name="error" type="u" direction="out" />
9f2ebf
+            <arg name="domain_name" type="s" direction="out" />
9f2ebf
+        </method>
9f2ebf
     </interface>
9f2ebf
 </node>
9f2ebf
diff --git a/src/providers/data_provider/dp_iface_generated.c b/src/providers/data_provider/dp_iface_generated.c
9f2ebf
index 11ee2e24a69cc8d4d19fdbeed613e76081aef15d..4d093444536b15d8a17f7e507b93948e1df6ffee 100644
9f2ebf
--- a/src/providers/data_provider/dp_iface_generated.c
9f2ebf
+++ b/src/providers/data_provider/dp_iface_generated.c
9f2ebf
@@ -313,6 +313,30 @@ int iface_dp_getAccountInfo_finish(struct sbus_request *req, uint16_t arg_dp_err
9f2ebf
                                          DBUS_TYPE_INVALID);
9f2ebf
 }
9f2ebf
 
9f2ebf
+/* arguments for org.freedesktop.sssd.dataprovider.getAccountDomain */
9f2ebf
+const struct sbus_arg_meta iface_dp_getAccountDomain__in[] = {
9f2ebf
+    { "entry_type", "u" },
9f2ebf
+    { "filter", "s" },
9f2ebf
+    { NULL, }
9f2ebf
+};
9f2ebf
+
9f2ebf
+/* arguments for org.freedesktop.sssd.dataprovider.getAccountDomain */
9f2ebf
+const struct sbus_arg_meta iface_dp_getAccountDomain__out[] = {
9f2ebf
+    { "dp_error", "q" },
9f2ebf
+    { "error", "u" },
9f2ebf
+    { "domain_name", "s" },
9f2ebf
+    { NULL, }
9f2ebf
+};
9f2ebf
+
9f2ebf
+int iface_dp_getAccountDomain_finish(struct sbus_request *req, uint16_t arg_dp_error, uint32_t arg_error, const char *arg_domain_name)
9f2ebf
+{
9f2ebf
+   return sbus_request_return_and_finish(req,
9f2ebf
+                                         DBUS_TYPE_UINT16, &arg_dp_error,
9f2ebf
+                                         DBUS_TYPE_UINT32, &arg_error,
9f2ebf
+                                         DBUS_TYPE_STRING, &arg_domain_name,
9f2ebf
+                                         DBUS_TYPE_INVALID);
9f2ebf
+}
9f2ebf
+
9f2ebf
 /* methods for org.freedesktop.sssd.dataprovider */
9f2ebf
 const struct sbus_method_meta iface_dp__methods[] = {
9f2ebf
     {
9f2ebf
@@ -357,6 +381,13 @@ const struct sbus_method_meta iface_dp__methods[] = {
9f2ebf
         offsetof(struct iface_dp, getAccountInfo),
9f2ebf
         invoke_uusss_method,
9f2ebf
     },
9f2ebf
+    {
9f2ebf
+        "getAccountDomain", /* name */
9f2ebf
+        iface_dp_getAccountDomain__in,
9f2ebf
+        iface_dp_getAccountDomain__out,
9f2ebf
+        offsetof(struct iface_dp, getAccountDomain),
9f2ebf
+        invoke_us_method,
9f2ebf
+    },
9f2ebf
     { NULL, }
9f2ebf
 };
9f2ebf
 
9f2ebf
diff --git a/src/providers/data_provider/dp_iface_generated.h b/src/providers/data_provider/dp_iface_generated.h
9f2ebf
index 541a90b0b5a5bc0a346cbd04974d33c8bb0983c5..b629ec77487328a41615f3ca7e812088730f40c4 100644
9f2ebf
--- a/src/providers/data_provider/dp_iface_generated.h
9f2ebf
+++ b/src/providers/data_provider/dp_iface_generated.h
9f2ebf
@@ -38,6 +38,7 @@
9f2ebf
 #define IFACE_DP_HOSTHANDLER "hostHandler"
9f2ebf
 #define IFACE_DP_GETDOMAINS "getDomains"
9f2ebf
 #define IFACE_DP_GETACCOUNTINFO "getAccountInfo"
9f2ebf
+#define IFACE_DP_GETACCOUNTDOMAIN "getAccountDomain"
9f2ebf
 
9f2ebf
 /* ------------------------------------------------------------------------
9f2ebf
  * DBus handlers
9f2ebf
@@ -110,6 +111,7 @@ struct iface_dp {
9f2ebf
     int (*hostHandler)(struct sbus_request *req, void *data, uint32_t arg_dp_flags, const char *arg_name, const char *arg_alias);
9f2ebf
     int (*getDomains)(struct sbus_request *req, void *data, const char *arg_domain_hint);
9f2ebf
     int (*getAccountInfo)(struct sbus_request *req, void *data, uint32_t arg_dp_flags, uint32_t arg_entry_type, const char *arg_filter, const char *arg_domain, const char *arg_extra);
9f2ebf
+    int (*getAccountDomain)(struct sbus_request *req, void *data, uint32_t arg_entry_type, const char *arg_filter);
9f2ebf
 };
9f2ebf
 
9f2ebf
 /* finish function for autofsHandler */
9f2ebf
@@ -124,6 +126,9 @@ int iface_dp_getDomains_finish(struct sbus_request *req, uint16_t arg_dp_error,
9f2ebf
 /* finish function for getAccountInfo */
9f2ebf
 int iface_dp_getAccountInfo_finish(struct sbus_request *req, uint16_t arg_dp_error, uint32_t arg_error, const char *arg_error_message);
9f2ebf
 
9f2ebf
+/* finish function for getAccountDomain */
9f2ebf
+int iface_dp_getAccountDomain_finish(struct sbus_request *req, uint16_t arg_dp_error, uint32_t arg_error, const char *arg_domain_name);
9f2ebf
+
9f2ebf
 /* ------------------------------------------------------------------------
9f2ebf
  * DBus Interface Metadata
9f2ebf
  *
9f2ebf
diff --git a/src/providers/data_provider/dp_target_id.c b/src/providers/data_provider/dp_target_id.c
9f2ebf
index 820a6574cb3a224cce4b7d8286af306f234454a3..11a36e9ce9b1aefcabb04dfe51395b6f4e4bc899 100644
9f2ebf
--- a/src/providers/data_provider/dp_target_id.c
9f2ebf
+++ b/src/providers/data_provider/dp_target_id.c
9f2ebf
@@ -490,3 +490,116 @@ done:
9f2ebf
 
9f2ebf
     return ret;
9f2ebf
 }
9f2ebf
+
9f2ebf
+static bool
9f2ebf
+check_and_parse_acct_domain_filter(struct dp_get_acct_domain_data *data,
9f2ebf
+                                   const char *filter)
9f2ebf
+{
9f2ebf
+    /* We will use sizeof() to determine the length of a string so we don't
9f2ebf
+     * call strlen over and over again with each request. Not a bottleneck,
9f2ebf
+     * but unnecessary and simple to avoid. */
9f2ebf
+    static struct {
9f2ebf
+        const char *name;
9f2ebf
+        size_t lenght;
9f2ebf
+        uint32_t type;
9f2ebf
+    } types[] = {FILTER_TYPE("idnumber", BE_FILTER_IDNUM),
9f2ebf
+                 {0, 0, 0}};
9f2ebf
+    int i;
9f2ebf
+
9f2ebf
+    if (SBUS_IS_STRING_EMPTY(filter)) {
9f2ebf
+        return false;
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    for (i = 0; types[i].name != NULL; i++) {
9f2ebf
+        if (strncmp(filter, types[i].name, types[i].lenght) == 0) {
9f2ebf
+            data->filter_type = types[i].type;
9f2ebf
+            data->filter_value = SBUS_SET_STRING(&filter[types[i].lenght]);
9f2ebf
+            return true;
9f2ebf
+        }
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    if (strcmp(filter, ENUM_INDICATOR) == 0) {
9f2ebf
+        data->filter_type = BE_FILTER_ENUM;
9f2ebf
+        data->filter_value = NULL;
9f2ebf
+        return true;
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    return false;
9f2ebf
+}
9f2ebf
+
9f2ebf
+errno_t dp_get_account_domain_handler(struct sbus_request *sbus_req,
9f2ebf
+                                      void *dp_cli,
9f2ebf
+                                      uint32_t entry_type,
9f2ebf
+                                      const char *filter)
9f2ebf
+{
9f2ebf
+    struct dp_get_acct_domain_data *data;
9f2ebf
+    const char *key = NULL;
9f2ebf
+    errno_t ret;
9f2ebf
+
9f2ebf
+    data = talloc_zero(sbus_req, struct dp_get_acct_domain_data);
9f2ebf
+    if (data == NULL) {
9f2ebf
+        return ENOMEM;
9f2ebf
+    }
9f2ebf
+    data->entry_type = entry_type;
9f2ebf
+
9f2ebf
+    if (!check_and_parse_acct_domain_filter(data, filter)) {
9f2ebf
+        ret = EINVAL;
9f2ebf
+        goto done;
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    dp_req_with_reply(dp_cli, NULL, "AccountDomain", key, sbus_req,
9f2ebf
+                      DPT_ID, DPM_ACCT_DOMAIN_HANDLER, 0, data,
9f2ebf
+                      dp_req_reply_std, struct dp_reply_std);
9f2ebf
+
9f2ebf
+    ret = EOK;
9f2ebf
+
9f2ebf
+done:
9f2ebf
+    if (ret != EOK) {
9f2ebf
+        talloc_free(data);
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    return ret;
9f2ebf
+}
9f2ebf
+
9f2ebf
+struct default_account_domain_state {
9f2ebf
+    struct dp_reply_std reply;
9f2ebf
+};
9f2ebf
+
9f2ebf
+struct tevent_req *
9f2ebf
+default_account_domain_send(TALLOC_CTX *mem_ctx,
9f2ebf
+                            void *unused_ctx,
9f2ebf
+                            struct dp_get_acct_domain_data *data,
9f2ebf
+                            struct dp_req_params *params)
9f2ebf
+{
9f2ebf
+    struct default_account_domain_state *state;
9f2ebf
+    struct tevent_req *req;
9f2ebf
+
9f2ebf
+    req = tevent_req_create(mem_ctx, &state,
9f2ebf
+                            struct default_account_domain_state);
9f2ebf
+    if (req == NULL) {
9f2ebf
+        DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
9f2ebf
+        return NULL;
9f2ebf
+    }
9f2ebf
+
9f2ebf
+    dp_reply_std_set(&state->reply,
9f2ebf
+                     DP_ERR_DECIDE, ERR_GET_ACCT_DOM_NOT_SUPPORTED,
9f2ebf
+                     NULL);
9f2ebf
+    tevent_req_done(req);
9f2ebf
+    tevent_req_post(req, params->ev);
9f2ebf
+    return req;
9f2ebf
+}
9f2ebf
+
9f2ebf
+errno_t default_account_domain_recv(TALLOC_CTX *mem_ctx,
9f2ebf
+                                    struct tevent_req *req,
9f2ebf
+                                    struct dp_reply_std *data)
9f2ebf
+{
9f2ebf
+    struct default_account_domain_state *state = NULL;
9f2ebf
+
9f2ebf
+    state = tevent_req_data(req, struct default_account_domain_state);
9f2ebf
+
9f2ebf
+    TEVENT_REQ_RETURN_ON_ERROR(req);
9f2ebf
+
9f2ebf
+    *data = state->reply;
9f2ebf
+
9f2ebf
+    return EOK;
9f2ebf
+}
9f2ebf
diff --git a/src/providers/files/files_init.c b/src/providers/files/files_init.c
9f2ebf
index b91dfbac9bf9d4b678ebdfa6b1cb0971b4477dd9..8e5cd4cf913b79653616120d6ed6540e62ade932 100644
9f2ebf
--- a/src/providers/files/files_init.c
9f2ebf
+++ b/src/providers/files/files_init.c
9f2ebf
@@ -88,5 +88,11 @@ int sssm_files_id_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   ctx, struct files_id_ctx,
9f2ebf
                   struct dp_id_data, struct dp_reply_std);
9f2ebf
 
9f2ebf
+    dp_set_method(dp_methods, DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
+                  default_account_domain_send,
9f2ebf
+                  default_account_domain_recv,
9f2ebf
+                  NULL, void,
9f2ebf
+                  struct dp_get_acct_domain_data, struct dp_reply_std);
9f2ebf
+
9f2ebf
     return EOK;
9f2ebf
 }
9f2ebf
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
9f2ebf
index f335d51fd65959d256c54a5d92c594a24e895b7c..754e5315c3a7f84ac2901986ecdda73e4dad26bc 100644
9f2ebf
--- a/src/providers/ipa/ipa_init.c
9f2ebf
+++ b/src/providers/ipa/ipa_init.c
9f2ebf
@@ -754,6 +754,10 @@ errno_t sssm_ipa_id_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   sdap_online_check_handler_send, sdap_online_check_handler_recv, id_ctx->sdap_id_ctx,
9f2ebf
                   struct sdap_id_ctx, void, struct dp_reply_std);
9f2ebf
 
9f2ebf
+    dp_set_method(dp_methods, DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
+                  default_account_domain_send, default_account_domain_recv, NULL,
9f2ebf
+                  void, struct dp_get_acct_domain_data, struct dp_reply_std);
9f2ebf
+
9f2ebf
     return EOK;
9f2ebf
 }
9f2ebf
 
9f2ebf
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
9f2ebf
index 43d905893081c31ed659fd1ef8343f965bdc5af0..c0ede8941ee8480c2ec4765f89d12e903edcf012 100644
9f2ebf
--- a/src/providers/ldap/ldap_init.c
9f2ebf
+++ b/src/providers/ldap/ldap_init.c
9f2ebf
@@ -531,6 +531,10 @@ errno_t sssm_ldap_id_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   sdap_online_check_handler_send, sdap_online_check_handler_recv, id_ctx,
9f2ebf
                   struct sdap_id_ctx, void, struct dp_reply_std);
9f2ebf
 
9f2ebf
+    dp_set_method(dp_methods, DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
+                  default_account_domain_send, default_account_domain_recv, NULL,
9f2ebf
+                  void, struct dp_get_acct_domain_data, struct dp_reply_std);
9f2ebf
+
9f2ebf
     return EOK;
9f2ebf
 }
9f2ebf
 
9f2ebf
diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c
9f2ebf
index 7c9d3dafbdf1f9448cc8f8b473aea15cf4206afc..7d997cb16ee62f10f4b86c9c3ab373a48676fe75 100644
9f2ebf
--- a/src/providers/proxy/proxy_init.c
9f2ebf
+++ b/src/providers/proxy/proxy_init.c
9f2ebf
@@ -351,6 +351,10 @@ errno_t sssm_proxy_id_init(TALLOC_CTX *mem_ctx,
9f2ebf
                   proxy_account_info_handler_send, proxy_account_info_handler_recv, ctx,
9f2ebf
                   struct proxy_id_ctx, struct dp_id_data, struct dp_reply_std);
9f2ebf
 
9f2ebf
+    dp_set_method(dp_methods, DPM_ACCT_DOMAIN_HANDLER,
9f2ebf
+                  default_account_domain_send, default_account_domain_recv, NULL,
9f2ebf
+                  void, struct dp_get_acct_domain_data, struct dp_reply_std);
9f2ebf
+
9f2ebf
     ret = EOK;
9f2ebf
 
9f2ebf
 done:
9f2ebf
diff --git a/src/util/util_errors.c b/src/util/util_errors.c
9f2ebf
index 5a92a2dcf6e65f93bc9732cebf562756357123b6..9a9ba3f3063cab4afb538c3a58527a2d2ed3fffd 100644
9f2ebf
--- a/src/util/util_errors.c
9f2ebf
+++ b/src/util/util_errors.c
9f2ebf
@@ -115,6 +115,7 @@ struct err_string error_to_str[] = {
9f2ebf
     { "Unable to initialize SSL" }, /* ERR_SSL_FAILURE */
9f2ebf
     { "Unable to verify peer" }, /* ERR_UNABLE_TO_VERIFY_PEER */
9f2ebf
     { "Unable to resolve host" }, /* ERR_UNABLE_TO_RESOLVE_HOST */
9f2ebf
+    { "GetAccountDomain() not supported" }, /* ERR_GET_ACCT_DOM_NOT_SUPPORTED */
9f2ebf
     { "ERR_LAST" } /* ERR_LAST */
9f2ebf
 };
9f2ebf
 
9f2ebf
diff --git a/src/util/util_errors.h b/src/util/util_errors.h
9f2ebf
index 509ccb805fb97e59f9da0ea2f991ece2f2030ca4..5ee9862c3f2f60c078693b1b85a40f15436e818c 100644
9f2ebf
--- a/src/util/util_errors.h
9f2ebf
+++ b/src/util/util_errors.h
9f2ebf
@@ -137,6 +137,7 @@ enum sssd_errors {
9f2ebf
     ERR_SSL_FAILURE,
9f2ebf
     ERR_UNABLE_TO_VERIFY_PEER,
9f2ebf
     ERR_UNABLE_TO_RESOLVE_HOST,
9f2ebf
+    ERR_GET_ACCT_DOM_NOT_SUPPORTED,
9f2ebf
     ERR_LAST            /* ALWAYS LAST */
9f2ebf
 };
9f2ebf
 
9f2ebf
-- 
9f2ebf
2.14.3
9f2ebf