Blame SOURCES/0085-ldap-implement-autofs-get-map.patch

5cd47f
From fcb6f55c09d1d6f6487d771ac829e02565393c56 Mon Sep 17 00:00:00 2001
5cd47f
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
5cd47f
Date: Thu, 15 Aug 2019 12:42:05 +0200
5cd47f
Subject: [PATCH 85/90] ldap: implement autofs get map
5cd47f
MIME-Version: 1.0
5cd47f
Content-Type: text/plain; charset=UTF-8
5cd47f
Content-Transfer-Encoding: 8bit
5cd47f
5cd47f
This will obtain only the map object.
5cd47f
5cd47f
Resolves:
5cd47f
https://pagure.io/SSSD/sssd/issue/2607
5cd47f
5cd47f
Reviewed-by: Tomáš Halman <thalman@redhat.com>
5cd47f
---
5cd47f
 src/providers/ipa/ipa_autofs.c                |   4 +
5cd47f
 src/providers/ldap/ldap_common.h              |  11 +
5cd47f
 src/providers/ldap/sdap_async_autofs.c        | 207 ++++++++++++++++++
5cd47f
 src/providers/ldap/sdap_autofs.c              | 123 +++++++++--
5cd47f
 src/providers/ldap/sdap_autofs.h              |   7 +
5cd47f
 .../plugins/cache_req_autofs_map_by_name.c    |   2 +-
5cd47f
 6 files changed, 340 insertions(+), 14 deletions(-)
5cd47f
5cd47f
diff --git a/src/providers/ipa/ipa_autofs.c b/src/providers/ipa/ipa_autofs.c
5cd47f
index 50e30f39f..19d74071f 100644
5cd47f
--- a/src/providers/ipa/ipa_autofs.c
5cd47f
+++ b/src/providers/ipa/ipa_autofs.c
5cd47f
@@ -51,5 +51,9 @@ errno_t ipa_autofs_init(TALLOC_CTX *mem_ctx,
5cd47f
                   sdap_autofs_enumerate_handler_send, sdap_autofs_enumerate_handler_recv, id_ctx,
5cd47f
                   struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
5cd47f
 
5cd47f
+    dp_set_method(dp_methods, DPM_AUTOFS_GET_MAP,
5cd47f
+                  sdap_autofs_get_map_handler_send, sdap_autofs_get_map_handler_recv, id_ctx,
5cd47f
+                  struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
5cd47f
+
5cd47f
     return ret;
5cd47f
 }
5cd47f
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
5cd47f
index 85dc6949c..36623aca8 100644
5cd47f
--- a/src/providers/ldap/ldap_common.h
5cd47f
+++ b/src/providers/ldap/ldap_common.h
5cd47f
@@ -166,6 +166,17 @@ sdap_autofs_enumerate_handler_recv(TALLOC_CTX *mem_ctx,
5cd47f
                                    struct tevent_req *req,
5cd47f
                                    struct dp_reply_std *data);
5cd47f
 
5cd47f
+struct tevent_req *
5cd47f
+sdap_autofs_get_map_handler_send(TALLOC_CTX *mem_ctx,
5cd47f
+                                 struct sdap_id_ctx *id_ctx,
5cd47f
+                                 struct dp_autofs_data *data,
5cd47f
+                                 struct dp_req_params *params);
5cd47f
+
5cd47f
+errno_t
5cd47f
+sdap_autofs_get_map_handler_recv(TALLOC_CTX *mem_ctx,
5cd47f
+                                 struct tevent_req *req,
5cd47f
+                                 struct dp_reply_std *data);
5cd47f
+
5cd47f
 int sdap_service_init(TALLOC_CTX *memctx, struct be_ctx *ctx,
5cd47f
                       const char *service_name, const char *dns_service_name,
5cd47f
                       const char *urls, const char *backup_urls,
5cd47f
diff --git a/src/providers/ldap/sdap_async_autofs.c b/src/providers/ldap/sdap_async_autofs.c
5cd47f
index 7548d4a67..52ceb84ac 100644
5cd47f
--- a/src/providers/ldap/sdap_async_autofs.c
5cd47f
+++ b/src/providers/ldap/sdap_async_autofs.c
5cd47f
@@ -28,6 +28,7 @@
5cd47f
 #include "db/sysdb_autofs.h"
5cd47f
 #include "providers/ldap/ldap_common.h"
5cd47f
 #include "providers/ldap/sdap_autofs.h"
5cd47f
+#include "providers/ldap/sdap_ops.h"
5cd47f
 
5cd47f
 enum autofs_map_op {
5cd47f
     AUTOFS_MAP_OP_ADD,
5cd47f
@@ -970,3 +971,209 @@ sdap_autofs_setautomntent_recv(struct tevent_req *req)
5cd47f
     return EOK;
5cd47f
 }
5cd47f
 
5cd47f
+struct sdap_autofs_get_map_state {
5cd47f
+    struct sdap_id_ctx *id_ctx;
5cd47f
+    struct sdap_options *opts;
5cd47f
+    struct sdap_id_op *sdap_op;
5cd47f
+    const char *mapname;
5cd47f
+    int dp_error;
5cd47f
+};
5cd47f
+
5cd47f
+static errno_t sdap_autofs_get_map_retry(struct tevent_req *req);
5cd47f
+static void sdap_autofs_get_map_connect_done(struct tevent_req *subreq);
5cd47f
+static void sdap_autofs_get_map_done(struct tevent_req *subreq);
5cd47f
+
5cd47f
+struct tevent_req *sdap_autofs_get_map_send(TALLOC_CTX *mem_ctx,
5cd47f
+                                            struct sdap_id_ctx *id_ctx,
5cd47f
+                                            const char *mapname)
5cd47f
+{
5cd47f
+    struct tevent_req *req;
5cd47f
+    struct sdap_autofs_get_map_state *state;
5cd47f
+    int ret;
5cd47f
+
5cd47f
+    req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_get_map_state);
5cd47f
+    if (!req) {
5cd47f
+        return NULL;
5cd47f
+    }
5cd47f
+
5cd47f
+    state->id_ctx = id_ctx;
5cd47f
+    state->opts = id_ctx->opts;
5cd47f
+    state->mapname = mapname;
5cd47f
+    state->dp_error = DP_ERR_FATAL;
5cd47f
+
5cd47f
+    state->sdap_op = sdap_id_op_create(state, id_ctx->conn->conn_cache);
5cd47f
+    if (!state->sdap_op) {
5cd47f
+        DEBUG(SSSDBG_OP_FAILURE, "sdap_id_op_create() failed\n");
5cd47f
+        ret = ENOMEM;
5cd47f
+        goto done;
5cd47f
+    }
5cd47f
+
5cd47f
+    ret = sdap_autofs_get_map_retry(req);
5cd47f
+    if (ret == EAGAIN) {
5cd47f
+        /* asynchronous processing */
5cd47f
+        return req;
5cd47f
+    }
5cd47f
+
5cd47f
+done:
5cd47f
+    if (ret == EOK) {
5cd47f
+        tevent_req_done(req);
5cd47f
+    } else {
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+    }
5cd47f
+    tevent_req_post(req, id_ctx->be->ev);
5cd47f
+
5cd47f
+    return req;
5cd47f
+}
5cd47f
+
5cd47f
+static errno_t sdap_autofs_get_map_retry(struct tevent_req *req)
5cd47f
+{
5cd47f
+    struct sdap_autofs_get_map_state *state;
5cd47f
+    struct tevent_req *subreq;
5cd47f
+    int ret;
5cd47f
+
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_state);
5cd47f
+
5cd47f
+    subreq = sdap_id_op_connect_send(state->sdap_op, state, &ret;;
5cd47f
+    if (subreq == NULL) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "sdap_id_op_connect_send() failed: "
5cd47f
+                                   "%d(%s)\n", ret, strerror(ret));
5cd47f
+        return ret;
5cd47f
+    }
5cd47f
+
5cd47f
+    tevent_req_set_callback(subreq, sdap_autofs_get_map_connect_done, req);
5cd47f
+
5cd47f
+    return EAGAIN;
5cd47f
+}
5cd47f
+
5cd47f
+static void sdap_autofs_get_map_connect_done(struct tevent_req *subreq)
5cd47f
+{
5cd47f
+    struct tevent_req *req;
5cd47f
+    struct sdap_autofs_get_map_state *state;
5cd47f
+    char *filter;
5cd47f
+    char *safe_mapname;
5cd47f
+    const char **attrs;
5cd47f
+    int dp_error;
5cd47f
+    int ret;
5cd47f
+
5cd47f
+    req = tevent_req_callback_data(subreq, struct tevent_req);
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_state);
5cd47f
+
5cd47f
+    ret = sdap_id_op_connect_recv(subreq, &dp_error);
5cd47f
+    talloc_zfree(subreq);
5cd47f
+
5cd47f
+    if (ret != EOK) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "LDAP connection failed "
5cd47f
+                                   "[%d]: %s\n", ret, strerror(ret));
5cd47f
+        state->dp_error = dp_error;
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    DEBUG(SSSDBG_TRACE_FUNC, "LDAP connection successful\n");
5cd47f
+
5cd47f
+    ret = sss_filter_sanitize(state, state->mapname, &safe_mapname);
5cd47f
+    if (ret != EOK) {
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    filter = talloc_asprintf(state, "(&(%s=%s)(objectclass=%s))",
5cd47f
+                 state->opts->autofs_mobject_map[SDAP_AT_AUTOFS_MAP_NAME].name,
5cd47f
+                 safe_mapname,
5cd47f
+                 state->opts->autofs_mobject_map[SDAP_OC_AUTOFS_MAP].name);
5cd47f
+    if (filter == NULL) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "Failed to build filter\n");
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    ret = build_attrs_from_map(state, state->opts->autofs_mobject_map,
5cd47f
+                               SDAP_OPTS_AUTOFS_MAP, NULL, &attrs, NULL);
5cd47f
+    if (ret != EOK) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "Failed to build attributes from map\n");
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    subreq = sdap_search_bases_return_first_send(state, state->id_ctx->be->ev,
5cd47f
+                    state->opts, sdap_id_op_handle(state->sdap_op),
5cd47f
+                    state->opts->sdom->autofs_search_bases,
5cd47f
+                    state->opts->autofs_mobject_map, false,
5cd47f
+                    dp_opt_get_int(state->opts->basic, SDAP_SEARCH_TIMEOUT),
5cd47f
+                    filter, attrs);
5cd47f
+    if (subreq == NULL) {
5cd47f
+        state->dp_error = DP_ERR_FATAL;
5cd47f
+        tevent_req_error(req, ENOMEM);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    tevent_req_set_callback(subreq, sdap_autofs_get_map_done, req);
5cd47f
+}
5cd47f
+
5cd47f
+static void sdap_autofs_get_map_done(struct tevent_req *subreq)
5cd47f
+{
5cd47f
+    struct tevent_req *req;
5cd47f
+    struct sdap_autofs_get_map_state *state;
5cd47f
+    struct sysdb_attrs **reply;
5cd47f
+    size_t reply_count;
5cd47f
+    errno_t ret;
5cd47f
+
5cd47f
+    req = tevent_req_callback_data(subreq, struct tevent_req);
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_state);
5cd47f
+
5cd47f
+    ret = sdap_search_bases_return_first_recv(subreq, state, &reply_count,
5cd47f
+                                              &reply);
5cd47f
+    talloc_zfree(subreq);
5cd47f
+
5cd47f
+    ret = sdap_id_op_done(state->sdap_op, ret, &state->dp_error);
5cd47f
+    if (state->dp_error == DP_ERR_OK && ret != EOK) {
5cd47f
+        /* retry */
5cd47f
+        ret = sdap_autofs_get_map_retry(req);
5cd47f
+        if (ret != EOK) {
5cd47f
+            tevent_req_error(req, ret);
5cd47f
+        }
5cd47f
+        return;
5cd47f
+    } else if (ret != EOK) {
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    if (reply_count == 0) {
5cd47f
+        ret = sysdb_delete_autofsmap(state->id_ctx->be->domain, state->mapname);
5cd47f
+        if (ret != EOK && ret != ENOENT) {
5cd47f
+            DEBUG(SSSDBG_OP_FAILURE,
5cd47f
+                "Cannot delete autofs map %s [%d]: %s\n",
5cd47f
+                 state->mapname, ret, strerror(ret));
5cd47f
+            tevent_req_error(req, ret);
5cd47f
+            return;
5cd47f
+        }
5cd47f
+
5cd47f
+        tevent_req_done(req);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    ret = save_autofs_map(state->id_ctx->be->domain, state->opts, reply[0], false);
5cd47f
+    if (ret != EOK) {
5cd47f
+        DEBUG(SSSDBG_OP_FAILURE,
5cd47f
+             "Cannot save autofs map %s [%d]: %s\n",
5cd47f
+              state->mapname, ret, strerror(ret));
5cd47f
+        tevent_req_error(req, ret);
5cd47f
+        return;
5cd47f
+    }
5cd47f
+
5cd47f
+    tevent_req_done(req);
5cd47f
+}
5cd47f
+
5cd47f
+errno_t sdap_autofs_get_map_recv(struct tevent_req *req,
5cd47f
+                                 int *dp_error)
5cd47f
+{
5cd47f
+    struct sdap_autofs_get_map_state *state;
5cd47f
+
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_state);
5cd47f
+
5cd47f
+    TEVENT_REQ_RETURN_ON_ERROR(req);
5cd47f
+
5cd47f
+    *dp_error = state->dp_error;
5cd47f
+
5cd47f
+    return EOK;
5cd47f
+}
5cd47f
diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c
5cd47f
index 5b9146199..9a5ed11e8 100644
5cd47f
--- a/src/providers/ldap/sdap_autofs.c
5cd47f
+++ b/src/providers/ldap/sdap_autofs.c
5cd47f
@@ -34,6 +34,27 @@
5cd47f
 #include "db/sysdb_autofs.h"
5cd47f
 #include "util/util.h"
5cd47f
 
5cd47f
+static void
5cd47f
+sdap_autofs_invalidate_maps(struct sdap_id_ctx *id_ctx,
5cd47f
+                            const char *mapname)
5cd47f
+{
5cd47f
+    const char *master_map;
5cd47f
+    errno_t ret;
5cd47f
+
5cd47f
+    master_map = dp_opt_get_string(id_ctx->opts->basic,
5cd47f
+                                   SDAP_AUTOFS_MAP_MASTER_NAME);
5cd47f
+    if (strcmp(master_map, mapname) == 0) {
5cd47f
+        DEBUG(SSSDBG_FUNC_DATA, "Refresh of automount master map triggered: "
5cd47f
+              "%s\n", mapname);
5cd47f
+
5cd47f
+        ret = sysdb_invalidate_autofs_maps(id_ctx->be->domain);
5cd47f
+        if (ret != EOK) {
5cd47f
+            DEBUG(SSSDBG_MINOR_FAILURE, "Could not invalidate autofs maps, "
5cd47f
+                  "backend might return stale entries\n");
5cd47f
+        }
5cd47f
+    }
5cd47f
+}
5cd47f
+
5cd47f
 struct sdap_autofs_enumerate_state {
5cd47f
     struct tevent_context *ev;
5cd47f
     struct sdap_id_ctx *ctx;
5cd47f
@@ -216,7 +237,6 @@ sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
5cd47f
     struct sdap_autofs_enumerate_handler_state *state;
5cd47f
     struct tevent_req *subreq;
5cd47f
     struct tevent_req *req;
5cd47f
-    const char *master_map;
5cd47f
     errno_t ret;
5cd47f
 
5cd47f
     req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_enumerate_handler_state);
5cd47f
@@ -227,18 +247,7 @@ sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
5cd47f
 
5cd47f
     DEBUG(SSSDBG_FUNC_DATA, "Requested refresh for: %s\n", data->mapname);
5cd47f
 
5cd47f
-    master_map = dp_opt_get_string(id_ctx->opts->basic,
5cd47f
-                                   SDAP_AUTOFS_MAP_MASTER_NAME);
5cd47f
-    if (strcmp(master_map, data->mapname) == 0) {
5cd47f
-        DEBUG(SSSDBG_FUNC_DATA, "Refresh of automount master map triggered: "
5cd47f
-              "%s\n", data->mapname);
5cd47f
-
5cd47f
-        ret = sysdb_invalidate_autofs_maps(id_ctx->be->domain);
5cd47f
-        if (ret != EOK) {
5cd47f
-            DEBUG(SSSDBG_MINOR_FAILURE, "Could not invalidate autofs maps, "
5cd47f
-                  "backend might return stale entries\n");
5cd47f
-        }
5cd47f
-    }
5cd47f
+    sdap_autofs_invalidate_maps(id_ctx, data->mapname);
5cd47f
 
5cd47f
     subreq = sdap_autofs_enumerate_send(mem_ctx, params->ev,
5cd47f
                                         id_ctx, data->mapname);
5cd47f
@@ -298,6 +307,90 @@ sdap_autofs_enumerate_handler_recv(TALLOC_CTX *mem_ctx,
5cd47f
     return EOK;
5cd47f
 }
5cd47f
 
5cd47f
+struct sdap_autofs_get_map_handler_state {
5cd47f
+    struct dp_reply_std reply;
5cd47f
+};
5cd47f
+
5cd47f
+static void sdap_autofs_get_map_handler_done(struct tevent_req *subreq);
5cd47f
+
5cd47f
+struct tevent_req *
5cd47f
+sdap_autofs_get_map_handler_send(TALLOC_CTX *mem_ctx,
5cd47f
+                                 struct sdap_id_ctx *id_ctx,
5cd47f
+                                 struct dp_autofs_data *data,
5cd47f
+                                 struct dp_req_params *params)
5cd47f
+{
5cd47f
+    struct sdap_autofs_get_map_handler_state *state;
5cd47f
+    struct tevent_req *subreq;
5cd47f
+    struct tevent_req *req;
5cd47f
+    errno_t ret;
5cd47f
+
5cd47f
+    req = tevent_req_create(mem_ctx, &state,
5cd47f
+                            struct sdap_autofs_get_map_handler_state);
5cd47f
+    if (req == NULL) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n");
5cd47f
+        return NULL;
5cd47f
+    }
5cd47f
+
5cd47f
+    DEBUG(SSSDBG_FUNC_DATA, "Requested refresh for: %s\n", data->mapname);
5cd47f
+
5cd47f
+    sdap_autofs_invalidate_maps(id_ctx, data->mapname);
5cd47f
+
5cd47f
+    subreq = sdap_autofs_get_map_send(mem_ctx, id_ctx, data->mapname);
5cd47f
+    if (subreq == NULL) {
5cd47f
+        DEBUG(SSSDBG_CRIT_FAILURE, "Unable to send request for %s.\n",
5cd47f
+              data->mapname);
5cd47f
+        ret = ENOMEM;
5cd47f
+        goto immediately;
5cd47f
+    }
5cd47f
+
5cd47f
+    tevent_req_set_callback(subreq, sdap_autofs_get_map_handler_done, req);
5cd47f
+
5cd47f
+    return req;
5cd47f
+
5cd47f
+immediately:
5cd47f
+    dp_reply_std_set(&state->reply, DP_ERR_DECIDE, ret, NULL);
5cd47f
+
5cd47f
+    /* TODO For backward compatibility we always return EOK to DP now. */
5cd47f
+    tevent_req_done(req);
5cd47f
+    tevent_req_post(req, params->ev);
5cd47f
+
5cd47f
+    return req;
5cd47f
+}
5cd47f
+
5cd47f
+static void sdap_autofs_get_map_handler_done(struct tevent_req *subreq)
5cd47f
+{
5cd47f
+    struct sdap_autofs_get_map_handler_state *state;
5cd47f
+    struct tevent_req *req;
5cd47f
+    int dp_error;
5cd47f
+    errno_t ret;
5cd47f
+
5cd47f
+    req = tevent_req_callback_data(subreq, struct tevent_req);
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_handler_state);
5cd47f
+
5cd47f
+    ret = sdap_autofs_get_map_recv(subreq, &dp_error);
5cd47f
+    talloc_zfree(subreq);
5cd47f
+
5cd47f
+    /* TODO For backward compatibility we always return EOK to DP now. */
5cd47f
+    dp_reply_std_set(&state->reply, dp_error, ret, NULL);
5cd47f
+    tevent_req_done(req);
5cd47f
+}
5cd47f
+
5cd47f
+errno_t
5cd47f
+sdap_autofs_get_map_handler_recv(TALLOC_CTX *mem_ctx,
5cd47f
+                                 struct tevent_req *req,
5cd47f
+                                 struct dp_reply_std *data)
5cd47f
+{
5cd47f
+    struct sdap_autofs_get_map_handler_state *state = NULL;
5cd47f
+
5cd47f
+    state = tevent_req_data(req, struct sdap_autofs_get_map_handler_state);
5cd47f
+
5cd47f
+    TEVENT_REQ_RETURN_ON_ERROR(req);
5cd47f
+
5cd47f
+    *data = state->reply;
5cd47f
+
5cd47f
+    return EOK;
5cd47f
+}
5cd47f
+
5cd47f
 errno_t sdap_autofs_init(TALLOC_CTX *mem_ctx,
5cd47f
                          struct be_ctx *be_ctx,
5cd47f
                          struct sdap_id_ctx *id_ctx,
5cd47f
@@ -317,5 +410,9 @@ errno_t sdap_autofs_init(TALLOC_CTX *mem_ctx,
5cd47f
                   sdap_autofs_enumerate_handler_send, sdap_autofs_enumerate_handler_recv, id_ctx,
5cd47f
                   struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
5cd47f
 
5cd47f
+    dp_set_method(dp_methods, DPM_AUTOFS_GET_MAP,
5cd47f
+                  sdap_autofs_get_map_handler_send, sdap_autofs_get_map_handler_recv, id_ctx,
5cd47f
+                  struct sdap_id_ctx, struct dp_autofs_data, struct dp_reply_std);
5cd47f
+
5cd47f
     return EOK;
5cd47f
 }
5cd47f
diff --git a/src/providers/ldap/sdap_autofs.h b/src/providers/ldap/sdap_autofs.h
5cd47f
index 593d8c94f..34b9ca953 100644
5cd47f
--- a/src/providers/ldap/sdap_autofs.h
5cd47f
+++ b/src/providers/ldap/sdap_autofs.h
5cd47f
@@ -43,5 +43,12 @@ sdap_autofs_setautomntent_send(TALLOC_CTX *memctx,
5cd47f
 errno_t
5cd47f
 sdap_autofs_setautomntent_recv(struct tevent_req *req);
5cd47f
 
5cd47f
+struct tevent_req *sdap_autofs_get_map_send(TALLOC_CTX *mem_ctx,
5cd47f
+                                            struct sdap_id_ctx *id_ctx,
5cd47f
+                                            const char *mapname);
5cd47f
+
5cd47f
+errno_t sdap_autofs_get_map_recv(struct tevent_req *req,
5cd47f
+                                 int *dp_error);
5cd47f
+
5cd47f
 #endif /* _SDAP_AUTOFS_H_ */
5cd47f
 
5cd47f
diff --git a/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c b/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c
5cd47f
index 268711678..4c1685728 100644
5cd47f
--- a/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c
5cd47f
+++ b/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c
5cd47f
@@ -69,7 +69,7 @@ cache_req_autofs_map_by_name_dp_send(TALLOC_CTX *mem_ctx,
5cd47f
                                      struct ldb_result *result)
5cd47f
 {
5cd47f
     return sss_dp_get_autofs_send(mem_ctx, cr->rctx, domain, true,
5cd47f
-                                  SSS_DP_AUTOFS_ENUMERATE,
5cd47f
+                                  SSS_DP_AUTOFS_GET_MAP,
5cd47f
                                   data->name.name, NULL);
5cd47f
 }
5cd47f
 
5cd47f
-- 
5cd47f
2.20.1
5cd47f