|
|
ced1f5 |
From 880552cc45e55c7ef9f81423aff8fe867451d752 Mon Sep 17 00:00:00 2001
|
|
|
ced1f5 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
ced1f5 |
Date: Thu, 30 Nov 2017 11:47:30 +0100
|
|
|
ced1f5 |
Subject: [PATCH 69/83] LDAP: Extract the check whether to run a POSIX check to
|
|
|
ced1f5 |
a function
|
|
|
ced1f5 |
MIME-Version: 1.0
|
|
|
ced1f5 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ced1f5 |
Content-Transfer-Encoding: 8bit
|
|
|
ced1f5 |
|
|
|
ced1f5 |
This will reduce the code duplication in the following patches and will
|
|
|
ced1f5 |
allow to keep all the logic on one place so that when/if we change the
|
|
|
ced1f5 |
code in the future, we only have to change the single place.
|
|
|
ced1f5 |
|
|
|
ced1f5 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
ced1f5 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
ced1f5 |
(cherry picked from commit 8e93ebb2a6f7644c389c1d1f4e92a21c4d0b2b45)
|
|
|
ced1f5 |
---
|
|
|
ced1f5 |
src/providers/ldap/ldap_common.c | 15 +++++++++++++++
|
|
|
ced1f5 |
src/providers/ldap/ldap_common.h | 4 ++++
|
|
|
ced1f5 |
src/providers/ldap/ldap_id.c | 15 ++++++---------
|
|
|
ced1f5 |
src/providers/ldap/sdap_async_enum.c | 7 +++----
|
|
|
ced1f5 |
4 files changed, 28 insertions(+), 13 deletions(-)
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
|
|
|
ced1f5 |
index 0597e91f7fade47aeb34565597c730ac406e0cfc..3eff3515d95043d4b59cb0d9953cf050355a0ca5 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/ldap_common.c
|
|
|
ced1f5 |
+++ b/src/providers/ldap/ldap_common.c
|
|
|
ced1f5 |
@@ -971,3 +971,18 @@ sdap_id_ctx_new(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
|
|
|
ced1f5 |
|
|
|
ced1f5 |
return sdap_ctx;
|
|
|
ced1f5 |
}
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+bool should_run_posix_check(struct sdap_id_ctx *ctx,
|
|
|
ced1f5 |
+ bool use_id_mapping,
|
|
|
ced1f5 |
+ bool posix_request)
|
|
|
ced1f5 |
+{
|
|
|
ced1f5 |
+ if (use_id_mapping == false &&
|
|
|
ced1f5 |
+ posix_request == true &&
|
|
|
ced1f5 |
+ ctx->opts->schema_type == SDAP_SCHEMA_AD &&
|
|
|
ced1f5 |
+ ctx->srv_opts &&
|
|
|
ced1f5 |
+ ctx->srv_opts->posix_checked == false) {
|
|
|
ced1f5 |
+ return true;
|
|
|
ced1f5 |
+ }
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
+ return false;
|
|
|
ced1f5 |
+}
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
|
|
|
ced1f5 |
index 0510b7d5ab5121bd96f699e8e59520a2a18a604f..fa7cda4df9d7334f6f0f5baccae0cba0478bfbea 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/ldap_common.h
|
|
|
ced1f5 |
+++ b/src/providers/ldap/ldap_common.h
|
|
|
ced1f5 |
@@ -304,6 +304,10 @@ char *get_enterprise_principal_string_filter(TALLOC_CTX *mem_ctx,
|
|
|
ced1f5 |
const char *princ,
|
|
|
ced1f5 |
struct dp_option *sdap_basic_opts);
|
|
|
ced1f5 |
|
|
|
ced1f5 |
+bool should_run_posix_check(struct sdap_id_ctx *ctx,
|
|
|
ced1f5 |
+ bool id_mapping,
|
|
|
ced1f5 |
+ bool posix_request);
|
|
|
ced1f5 |
+
|
|
|
ced1f5 |
char *sdap_get_access_filter(TALLOC_CTX *mem_ctx,
|
|
|
ced1f5 |
const char *base_filter);
|
|
|
ced1f5 |
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
|
|
|
ced1f5 |
index e89fc6133316f684810afe4c1a0731b8a04f2931..6ab9e0aa1db3eed32deb75211ded30a4cb48ca30 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/ldap_id.c
|
|
|
ced1f5 |
+++ b/src/providers/ldap/ldap_id.c
|
|
|
ced1f5 |
@@ -411,11 +411,9 @@ static void users_get_connect_done(struct tevent_req *subreq)
|
|
|
ced1f5 |
/* If POSIX attributes have been requested with an AD server and we
|
|
|
ced1f5 |
* have no idea about POSIX attributes support, run a one-time check
|
|
|
ced1f5 |
*/
|
|
|
ced1f5 |
- if (state->use_id_mapping == false &&
|
|
|
ced1f5 |
- state->non_posix == false &&
|
|
|
ced1f5 |
- state->ctx->opts->schema_type == SDAP_SCHEMA_AD &&
|
|
|
ced1f5 |
- state->ctx->srv_opts &&
|
|
|
ced1f5 |
- state->ctx->srv_opts->posix_checked == false) {
|
|
|
ced1f5 |
+ if (should_run_posix_check(state->ctx,
|
|
|
ced1f5 |
+ state->use_id_mapping,
|
|
|
ced1f5 |
+ !state->non_posix)) {
|
|
|
ced1f5 |
subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
ced1f5 |
sdap_id_op_handle(state->op),
|
|
|
ced1f5 |
state->sdom->user_search_bases,
|
|
|
ced1f5 |
@@ -958,10 +956,9 @@ static void groups_get_connect_done(struct tevent_req *subreq)
|
|
|
ced1f5 |
/* If POSIX attributes have been requested with an AD server and we
|
|
|
ced1f5 |
* have no idea about POSIX attributes support, run a one-time check
|
|
|
ced1f5 |
*/
|
|
|
ced1f5 |
- if (state->use_id_mapping == false &&
|
|
|
ced1f5 |
- state->ctx->opts->schema_type == SDAP_SCHEMA_AD &&
|
|
|
ced1f5 |
- state->ctx->srv_opts &&
|
|
|
ced1f5 |
- state->ctx->srv_opts->posix_checked == false) {
|
|
|
ced1f5 |
+ if (should_run_posix_check(state->ctx,
|
|
|
ced1f5 |
+ state->use_id_mapping,
|
|
|
ced1f5 |
+ !state->non_posix)) {
|
|
|
ced1f5 |
subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
ced1f5 |
sdap_id_op_handle(state->op),
|
|
|
ced1f5 |
state->sdom->user_search_bases,
|
|
|
ced1f5 |
diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
|
|
|
ced1f5 |
index 91e481c4e694126900c729e86d187fba355de0b8..2cef4eb886f982ba388a34955bdd38468fe68200 100644
|
|
|
ced1f5 |
--- a/src/providers/ldap/sdap_async_enum.c
|
|
|
ced1f5 |
+++ b/src/providers/ldap/sdap_async_enum.c
|
|
|
ced1f5 |
@@ -196,10 +196,9 @@ static void sdap_dom_enum_ex_get_users(struct tevent_req *subreq)
|
|
|
ced1f5 |
/* If POSIX attributes have been requested with an AD server and we
|
|
|
ced1f5 |
* have no idea about POSIX attributes support, run a one-time check
|
|
|
ced1f5 |
*/
|
|
|
ced1f5 |
- if (use_id_mapping == false &&
|
|
|
ced1f5 |
- state->ctx->opts->schema_type == SDAP_SCHEMA_AD &&
|
|
|
ced1f5 |
- state->ctx->srv_opts &&
|
|
|
ced1f5 |
- state->ctx->srv_opts->posix_checked == false) {
|
|
|
ced1f5 |
+ if (should_run_posix_check(state->ctx,
|
|
|
ced1f5 |
+ use_id_mapping,
|
|
|
ced1f5 |
+ true)) {
|
|
|
ced1f5 |
subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
|
|
|
ced1f5 |
sdap_id_op_handle(state->user_op),
|
|
|
ced1f5 |
state->sdom->user_search_bases,
|
|
|
ced1f5 |
--
|
|
|
ced1f5 |
2.14.3
|
|
|
ced1f5 |
|