|
|
9f2ebf |
From ada45cd38a73b1b196db459849fcc19781bc06fc Mon Sep 17 00:00:00 2001
|
|
|
9f2ebf |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
9f2ebf |
Date: Wed, 6 Dec 2017 16:26:15 +0100
|
|
|
9f2ebf |
Subject: [PATCH 72/83] SDAP: Rename sdap_posix_check to sdap_gc_posix_check
|
|
|
9f2ebf |
MIME-Version: 1.0
|
|
|
9f2ebf |
Content-Type: text/plain; charset=UTF-8
|
|
|
9f2ebf |
Content-Transfer-Encoding: 8bit
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Because searching the LDAP port of Active Directory server with a NULL
|
|
|
9f2ebf |
search base yields an error:
|
|
|
9f2ebf |
https://technet.microsoft.com/en-us/library/cc755809(v=ws.10).aspx
|
|
|
9f2ebf |
we changed the POSIX check request to only run against a GC connection
|
|
|
9f2ebf |
in a previous patch. To make it clearer to the caller that this request
|
|
|
9f2ebf |
should only be used with a GC connection, this patch renames the
|
|
|
9f2ebf |
request.
|
|
|
9f2ebf |
|
|
|
9f2ebf |
There are no functional changes in this patch.
|
|
|
9f2ebf |
|
|
|
9f2ebf |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
9f2ebf |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
9f2ebf |
(cherry picked from commit ba8a92bbd59f189bd1323dd0c4010cdfc694be35)
|
|
|
9f2ebf |
---
|
|
|
9f2ebf |
src/providers/ldap/ldap_id.c | 20 +++++++--------
|
|
|
9f2ebf |
src/providers/ldap/sdap_async.c | 48 ++++++++++++++++++------------------
|
|
|
9f2ebf |
src/providers/ldap/sdap_async.h | 16 ++++++++----
|
|
|
9f2ebf |
src/providers/ldap/sdap_async_enum.c | 10 ++++----
|
|
|
9f2ebf |
4 files changed, 50 insertions(+), 44 deletions(-)
|
|
|
9f2ebf |
|
|
|
9f2ebf |
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
|
|
|
9f2ebf |
index b5ac3a749113a281fe8a5564ac341ced0570eded..3824f8f9aa8d2892664f1182376bedf6fb8627f6 100644
|
|
|
9f2ebf |
--- a/src/providers/ldap/ldap_id.c
|
|
|
9f2ebf |
+++ b/src/providers/ldap/ldap_id.c
|
|
|
9f2ebf |
@@ -415,10 +415,10 @@ static void users_get_connect_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
state->conn,
|
|
|
9f2ebf |
state->use_id_mapping,
|
|
|
9f2ebf |
!state->non_posix)) {
|
|
|
9f2ebf |
- subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
- sdap_id_op_handle(state->op),
|
|
|
9f2ebf |
- dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
- SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
+ subreq = sdap_gc_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
+ sdap_id_op_handle(state->op),
|
|
|
9f2ebf |
+ dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
+ SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
if (subreq == NULL) {
|
|
|
9f2ebf |
tevent_req_error(req, ENOMEM);
|
|
|
9f2ebf |
return;
|
|
|
9f2ebf |
@@ -441,7 +441,7 @@ static void users_get_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
struct users_get_state *state = tevent_req_data(req,
|
|
|
9f2ebf |
struct users_get_state);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
- ret = sdap_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
+ ret = sdap_gc_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
talloc_zfree(subreq);
|
|
|
9f2ebf |
if (ret != EOK) {
|
|
|
9f2ebf |
/* We can only finish the id_op on error as the connection
|
|
|
9f2ebf |
@@ -960,10 +960,10 @@ static void groups_get_connect_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
state->conn,
|
|
|
9f2ebf |
state->use_id_mapping,
|
|
|
9f2ebf |
!state->non_posix)) {
|
|
|
9f2ebf |
- subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
- sdap_id_op_handle(state->op),
|
|
|
9f2ebf |
- dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
- SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
+ subreq = sdap_gc_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
+ sdap_id_op_handle(state->op),
|
|
|
9f2ebf |
+ dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
+ SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
if (subreq == NULL) {
|
|
|
9f2ebf |
tevent_req_error(req, ENOMEM);
|
|
|
9f2ebf |
return;
|
|
|
9f2ebf |
@@ -985,7 +985,7 @@ static void groups_get_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
struct groups_get_state *state = tevent_req_data(req,
|
|
|
9f2ebf |
struct groups_get_state);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
- ret = sdap_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
+ ret = sdap_gc_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
talloc_zfree(subreq);
|
|
|
9f2ebf |
if (ret != EOK) {
|
|
|
9f2ebf |
/* We can only finish the id_op on error as the connection
|
|
|
9f2ebf |
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
|
|
|
9f2ebf |
index 1df0b85f4bda6442d8da66784ad7424306b1f051..a9bea4f80903aeb9d0fdb4d2b8f2acb36d81d6fe 100644
|
|
|
9f2ebf |
--- a/src/providers/ldap/sdap_async.c
|
|
|
9f2ebf |
+++ b/src/providers/ldap/sdap_async.c
|
|
|
9f2ebf |
@@ -2573,12 +2573,12 @@ int sdap_asq_search_recv(struct tevent_req *req,
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
/* ==Posix attribute presence test================================= */
|
|
|
9f2ebf |
-static void sdap_posix_check_done(struct tevent_req *subreq);
|
|
|
9f2ebf |
-static errno_t sdap_posix_check_parse(struct sdap_handle *sh,
|
|
|
9f2ebf |
- struct sdap_msg *msg,
|
|
|
9f2ebf |
- void *pvt);
|
|
|
9f2ebf |
+static void sdap_gc_posix_check_done(struct tevent_req *subreq);
|
|
|
9f2ebf |
+static errno_t sdap_gc_posix_check_parse(struct sdap_handle *sh,
|
|
|
9f2ebf |
+ struct sdap_msg *msg,
|
|
|
9f2ebf |
+ void *pvt);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
-struct sdap_posix_check_state {
|
|
|
9f2ebf |
+struct sdap_gc_posix_check_state {
|
|
|
9f2ebf |
struct tevent_context *ev;
|
|
|
9f2ebf |
struct sdap_options *opts;
|
|
|
9f2ebf |
struct sdap_handle *sh;
|
|
|
9f2ebf |
@@ -2591,16 +2591,16 @@ struct sdap_posix_check_state {
|
|
|
9f2ebf |
};
|
|
|
9f2ebf |
|
|
|
9f2ebf |
struct tevent_req *
|
|
|
9f2ebf |
-sdap_posix_check_send(TALLOC_CTX *memctx, struct tevent_context *ev,
|
|
|
9f2ebf |
- struct sdap_options *opts, struct sdap_handle *sh,
|
|
|
9f2ebf |
- int timeout)
|
|
|
9f2ebf |
+sdap_gc_posix_check_send(TALLOC_CTX *memctx, struct tevent_context *ev,
|
|
|
9f2ebf |
+ struct sdap_options *opts, struct sdap_handle *sh,
|
|
|
9f2ebf |
+ int timeout)
|
|
|
9f2ebf |
{
|
|
|
9f2ebf |
struct tevent_req *req = NULL;
|
|
|
9f2ebf |
struct tevent_req *subreq = NULL;
|
|
|
9f2ebf |
- struct sdap_posix_check_state *state;
|
|
|
9f2ebf |
+ struct sdap_gc_posix_check_state *state;
|
|
|
9f2ebf |
errno_t ret;
|
|
|
9f2ebf |
|
|
|
9f2ebf |
- req = tevent_req_create(memctx, &state, struct sdap_posix_check_state);
|
|
|
9f2ebf |
+ req = tevent_req_create(memctx, &state, struct sdap_gc_posix_check_state);
|
|
|
9f2ebf |
if (req == NULL) {
|
|
|
9f2ebf |
return NULL;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
@@ -2636,13 +2636,13 @@ sdap_posix_check_send(TALLOC_CTX *memctx, struct tevent_context *ev,
|
|
|
9f2ebf |
LDAP_SCOPE_SUBTREE, state->filter,
|
|
|
9f2ebf |
state->attrs,
|
|
|
9f2ebf |
NULL, NULL, 1, state->timeout,
|
|
|
9f2ebf |
- sdap_posix_check_parse, state,
|
|
|
9f2ebf |
+ sdap_gc_posix_check_parse, state,
|
|
|
9f2ebf |
SDAP_SRCH_FLG_SIZELIMIT_SILENT);
|
|
|
9f2ebf |
if (subreq == NULL) {
|
|
|
9f2ebf |
ret = ENOMEM;
|
|
|
9f2ebf |
goto fail;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
- tevent_req_set_callback(subreq, sdap_posix_check_done, req);
|
|
|
9f2ebf |
+ tevent_req_set_callback(subreq, sdap_gc_posix_check_done, req);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
return req;
|
|
|
9f2ebf |
|
|
|
9f2ebf |
@@ -2652,13 +2652,13 @@ fail:
|
|
|
9f2ebf |
return req;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
-static errno_t sdap_posix_check_parse(struct sdap_handle *sh,
|
|
|
9f2ebf |
- struct sdap_msg *msg,
|
|
|
9f2ebf |
- void *pvt)
|
|
|
9f2ebf |
+static errno_t sdap_gc_posix_check_parse(struct sdap_handle *sh,
|
|
|
9f2ebf |
+ struct sdap_msg *msg,
|
|
|
9f2ebf |
+ void *pvt)
|
|
|
9f2ebf |
{
|
|
|
9f2ebf |
struct berval **vals = NULL;
|
|
|
9f2ebf |
- struct sdap_posix_check_state *state =
|
|
|
9f2ebf |
- talloc_get_type(pvt, struct sdap_posix_check_state);
|
|
|
9f2ebf |
+ struct sdap_gc_posix_check_state *state =
|
|
|
9f2ebf |
+ talloc_get_type(pvt, struct sdap_gc_posix_check_state);
|
|
|
9f2ebf |
char *dn;
|
|
|
9f2ebf |
char *endptr;
|
|
|
9f2ebf |
|
|
|
9f2ebf |
@@ -2700,12 +2700,12 @@ done:
|
|
|
9f2ebf |
return EOK;
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
-static void sdap_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
+static void sdap_gc_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
{
|
|
|
9f2ebf |
struct tevent_req *req = tevent_req_callback_data(subreq,
|
|
|
9f2ebf |
struct tevent_req);
|
|
|
9f2ebf |
- struct sdap_posix_check_state *state =
|
|
|
9f2ebf |
- tevent_req_data(req, struct sdap_posix_check_state);
|
|
|
9f2ebf |
+ struct sdap_gc_posix_check_state *state =
|
|
|
9f2ebf |
+ tevent_req_data(req, struct sdap_gc_posix_check_state);
|
|
|
9f2ebf |
errno_t ret;
|
|
|
9f2ebf |
|
|
|
9f2ebf |
ret = sdap_get_generic_ext_recv(subreq, NULL, NULL, NULL);
|
|
|
9f2ebf |
@@ -2730,11 +2730,11 @@ static void sdap_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
tevent_req_done(req);
|
|
|
9f2ebf |
}
|
|
|
9f2ebf |
|
|
|
9f2ebf |
-int sdap_posix_check_recv(struct tevent_req *req,
|
|
|
9f2ebf |
- bool *_has_posix)
|
|
|
9f2ebf |
+int sdap_gc_posix_check_recv(struct tevent_req *req,
|
|
|
9f2ebf |
+ bool *_has_posix)
|
|
|
9f2ebf |
{
|
|
|
9f2ebf |
- struct sdap_posix_check_state *state = tevent_req_data(req,
|
|
|
9f2ebf |
- struct sdap_posix_check_state);
|
|
|
9f2ebf |
+ struct sdap_gc_posix_check_state *state = tevent_req_data(req,
|
|
|
9f2ebf |
+ struct sdap_gc_posix_check_state);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
TEVENT_REQ_RETURN_ON_ERROR(req);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
diff --git a/src/providers/ldap/sdap_async.h b/src/providers/ldap/sdap_async.h
|
|
|
9f2ebf |
index 7216ba032e551196cf5258b4e58fbfc8cfe417ea..26f13e38bf6dff08a8cd0e6b3b5282effda80c9e 100644
|
|
|
9f2ebf |
--- a/src/providers/ldap/sdap_async.h
|
|
|
9f2ebf |
+++ b/src/providers/ldap/sdap_async.h
|
|
|
9f2ebf |
@@ -266,13 +266,19 @@ int sdap_deref_search_recv(struct tevent_req *req,
|
|
|
9f2ebf |
size_t *reply_count,
|
|
|
9f2ebf |
struct sdap_deref_attrs ***reply);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
+/*
|
|
|
9f2ebf |
+ * This request should only be ran against a Global Catalog connection
|
|
|
9f2ebf |
+ * because it uses a NULL search base to search all domains in the forest,
|
|
|
9f2ebf |
+ * which would return an error with an LDAP port:
|
|
|
9f2ebf |
+ * https://technet.microsoft.com/en-us/library/cc755809(v=ws.10).aspx
|
|
|
9f2ebf |
+ */
|
|
|
9f2ebf |
struct tevent_req *
|
|
|
9f2ebf |
-sdap_posix_check_send(TALLOC_CTX *memctx, struct tevent_context *ev,
|
|
|
9f2ebf |
- struct sdap_options *opts, struct sdap_handle *sh,
|
|
|
9f2ebf |
- int timeout);
|
|
|
9f2ebf |
+sdap_gc_posix_check_send(TALLOC_CTX *memctx, struct tevent_context *ev,
|
|
|
9f2ebf |
+ struct sdap_options *opts, struct sdap_handle *sh,
|
|
|
9f2ebf |
+ int timeout);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
-int sdap_posix_check_recv(struct tevent_req *req,
|
|
|
9f2ebf |
- bool *_has_posix);
|
|
|
9f2ebf |
+int sdap_gc_posix_check_recv(struct tevent_req *req,
|
|
|
9f2ebf |
+ bool *_has_posix);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
struct tevent_req *
|
|
|
9f2ebf |
sdap_sd_search_send(TALLOC_CTX *memctx,
|
|
|
9f2ebf |
diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
|
|
|
9f2ebf |
index ec0c679823a8cd9820bb978f77799a3f86621271..ea9d51adc7f94145cd7e689893bf7fd81028c5bb 100644
|
|
|
9f2ebf |
--- a/src/providers/ldap/sdap_async_enum.c
|
|
|
9f2ebf |
+++ b/src/providers/ldap/sdap_async_enum.c
|
|
|
9f2ebf |
@@ -200,10 +200,10 @@ static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq)
|
|
|
9f2ebf |
state->user_conn,
|
|
|
9f2ebf |
use_id_mapping,
|
|
|
9f2ebf |
true)) {
|
|
|
9f2ebf |
- subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
- sdap_id_op_handle(state->user_op),
|
|
|
9f2ebf |
- dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
- SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
+ subreq = sdap_gc_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
9f2ebf |
+ sdap_id_op_handle(state->user_op),
|
|
|
9f2ebf |
+ dp_opt_get_int(state->ctx->opts->basic,
|
|
|
9f2ebf |
+ SDAP_SEARCH_TIMEOUT));
|
|
|
9f2ebf |
if (subreq == NULL) {
|
|
|
9f2ebf |
tevent_req_error(req, ENOMEM);
|
|
|
9f2ebf |
return;
|
|
|
9f2ebf |
@@ -233,7 +233,7 @@ static void sdap_dom_enum_ex_posix_check_done(struct tevent_req *subreq)
|
|
|
9f2ebf |
struct sdap_dom_enum_ex_state *state = tevent_req_data(req,
|
|
|
9f2ebf |
struct sdap_dom_enum_ex_state);
|
|
|
9f2ebf |
|
|
|
9f2ebf |
- ret = sdap_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
+ ret = sdap_gc_posix_check_recv(subreq, &has_posix);
|
|
|
9f2ebf |
talloc_zfree(subreq);
|
|
|
9f2ebf |
if (ret != EOK && ret != ERR_NO_POSIX) {
|
|
|
9f2ebf |
/* We can only finish the id_op on error as the connection
|
|
|
9f2ebf |
--
|
|
|
9f2ebf |
2.14.3
|
|
|
9f2ebf |
|