Blob Blame History Raw
From bd15a135c1b73996208557f36718410a7a6b20b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Thu, 15 Aug 2019 11:56:55 +0200
Subject: [PATCH 84/90] ldap: rename sdap_autofs_get_map to
 sdap_autofs_enumerate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

get_map name will be later used to obtain only the map object.

Resolves:
https://pagure.io/SSSD/sssd/issue/2607

Reviewed-by: Tomáš Halman <thalman@redhat.com>
---
 src/providers/ldap/sdap_autofs.c | 60 ++++++++++++++++----------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c
index f65028d4e..5b9146199 100644
--- a/src/providers/ldap/sdap_autofs.c
+++ b/src/providers/ldap/sdap_autofs.c
@@ -34,7 +34,7 @@
 #include "db/sysdb_autofs.h"
 #include "util/util.h"
 
-struct autofs_get_map_state {
+struct sdap_autofs_enumerate_state {
     struct tevent_context *ev;
     struct sdap_id_ctx *ctx;
     struct sdap_id_op *op;
@@ -44,23 +44,23 @@ struct autofs_get_map_state {
 };
 
 static errno_t
-sdap_autofs_get_map_retry(struct tevent_req *req);
+sdap_autofs_enumerate_retry(struct tevent_req *req);
 static void
-sdap_autofs_get_map_connect_done(struct tevent_req *subreq);
+sdap_autofs_enumerate_connect_done(struct tevent_req *subreq);
 static void
-sdap_autofs_get_map_done(struct tevent_req *req);
+sdap_autofs_enumerate_done(struct tevent_req *req);
 
 static struct tevent_req *
-sdap_autofs_get_map_send(TALLOC_CTX *mem_ctx,
-                         struct tevent_context *ev,
-                         struct sdap_id_ctx *ctx,
-                         const char *map_name)
+sdap_autofs_enumerate_send(TALLOC_CTX *mem_ctx,
+                           struct tevent_context *ev,
+                           struct sdap_id_ctx *ctx,
+                           const char *map_name)
 {
     struct tevent_req *req;
-    struct autofs_get_map_state *state;
+    struct sdap_autofs_enumerate_state *state;
     int ret;
 
-    req = tevent_req_create(mem_ctx, &state, struct autofs_get_map_state);
+    req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_enumerate_state);
     if (!req) return NULL;
 
     state->ev = ev;
@@ -75,7 +75,7 @@ sdap_autofs_get_map_send(TALLOC_CTX *mem_ctx,
         goto fail;
     }
 
-    ret = sdap_autofs_get_map_retry(req);
+    ret = sdap_autofs_enumerate_retry(req);
     if (ret != EOK) {
         goto fail;
     }
@@ -89,10 +89,10 @@ fail:
 }
 
 static errno_t
-sdap_autofs_get_map_retry(struct tevent_req *req)
+sdap_autofs_enumerate_retry(struct tevent_req *req)
 {
-    struct autofs_get_map_state *state =
-                tevent_req_data(req, struct autofs_get_map_state);
+    struct sdap_autofs_enumerate_state *state =
+                tevent_req_data(req, struct sdap_autofs_enumerate_state);
     struct tevent_req *subreq;
     int ret = EOK;
 
@@ -101,17 +101,17 @@ sdap_autofs_get_map_retry(struct tevent_req *req)
         return ret;
     }
 
-    tevent_req_set_callback(subreq, sdap_autofs_get_map_connect_done, req);
+    tevent_req_set_callback(subreq, sdap_autofs_enumerate_connect_done, req);
     return EOK;
 }
 
 static void
-sdap_autofs_get_map_connect_done(struct tevent_req *subreq)
+sdap_autofs_enumerate_connect_done(struct tevent_req *subreq)
 {
     struct tevent_req *req = tevent_req_callback_data(subreq,
                                                       struct tevent_req);
-    struct autofs_get_map_state *state =
-                tevent_req_data(req, struct autofs_get_map_state);
+    struct sdap_autofs_enumerate_state *state =
+                tevent_req_data(req, struct sdap_autofs_enumerate_state);
     int dp_error = DP_ERR_FATAL;
     int ret;
 
@@ -137,17 +137,17 @@ sdap_autofs_get_map_connect_done(struct tevent_req *subreq)
         tevent_req_error(req, ENOMEM);
         return;
     }
-    tevent_req_set_callback(subreq, sdap_autofs_get_map_done, req);
+    tevent_req_set_callback(subreq, sdap_autofs_enumerate_done, req);
 
 }
 
 static void
-sdap_autofs_get_map_done(struct tevent_req *subreq)
+sdap_autofs_enumerate_done(struct tevent_req *subreq)
 {
     struct tevent_req *req = tevent_req_callback_data(subreq,
                                                       struct tevent_req);
-    struct autofs_get_map_state *state =
-        tevent_req_data(req, struct autofs_get_map_state);
+    struct sdap_autofs_enumerate_state *state =
+        tevent_req_data(req, struct sdap_autofs_enumerate_state);
     int dp_error = DP_ERR_FATAL;
     int ret;
 
@@ -157,7 +157,7 @@ sdap_autofs_get_map_done(struct tevent_req *subreq)
     ret = sdap_id_op_done(state->op, ret, &dp_error);
     if (dp_error == DP_ERR_OK && ret != EOK) {
         /* retry */
-        ret = sdap_autofs_get_map_retry(req);
+        ret = sdap_autofs_enumerate_retry(req);
         if (ret != EOK) {
             tevent_req_error(req, ret);
             return;
@@ -187,10 +187,10 @@ sdap_autofs_get_map_done(struct tevent_req *subreq)
 }
 
 static errno_t
-sdap_autofs_get_map_recv(struct tevent_req *req, int *dp_error_out)
+sdap_autofs_enumerate_recv(struct tevent_req *req, int *dp_error_out)
 {
-    struct autofs_get_map_state *state =
-        tevent_req_data(req, struct autofs_get_map_state);
+    struct sdap_autofs_enumerate_state *state =
+        tevent_req_data(req, struct sdap_autofs_enumerate_state);
 
     if (dp_error_out) {
         *dp_error_out = state->dp_error;
@@ -217,7 +217,6 @@ sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
     struct tevent_req *subreq;
     struct tevent_req *req;
     const char *master_map;
-
     errno_t ret;
 
     req = tevent_req_create(mem_ctx, &state, struct sdap_autofs_enumerate_handler_state);
@@ -241,8 +240,8 @@ sdap_autofs_enumerate_handler_send(TALLOC_CTX *mem_ctx,
         }
     }
 
-    subreq = sdap_autofs_get_map_send(mem_ctx, params->ev,
-                                      id_ctx, data->mapname);
+    subreq = sdap_autofs_enumerate_send(mem_ctx, params->ev,
+                                        id_ctx, data->mapname);
     if (subreq == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE, "Unable to send request for %s.\n",
               data->mapname);
@@ -262,6 +261,7 @@ immediately:
     tevent_req_post(req, params->ev);
 
     return req;
+
 }
 
 static void sdap_autofs_enumerate_handler_done(struct tevent_req *subreq)
@@ -274,7 +274,7 @@ static void sdap_autofs_enumerate_handler_done(struct tevent_req *subreq)
     req = tevent_req_callback_data(subreq, struct tevent_req);
     state = tevent_req_data(req, struct sdap_autofs_enumerate_handler_state);
 
-    ret = sdap_autofs_get_map_recv(subreq, &dp_error);
+    ret = sdap_autofs_enumerate_recv(subreq, &dp_error);
     talloc_zfree(subreq);
 
     /* TODO For backward compatibility we always return EOK to DP now. */
-- 
2.20.1