67 lines
2.8 KiB
Diff
67 lines
2.8 KiB
Diff
From 7971fa6c5b1b2c12b3e42aad158429665189a300 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
Date: Thu, 14 Jan 2016 13:12:14 +0100
|
|
Subject: [PATCH 37/49] SUDO: simplify usn filter
|
|
|
|
usn >= current && usn != currect is equivalent to usn >= current + 1
|
|
|
|
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
(cherry picked from commit 1476d5348fcf387e7481d833becbd993d91f8019)
|
|
---
|
|
src/providers/ipa/ipa_sudo_refresh.c | 10 +++-------
|
|
src/providers/ldap/sdap_sudo_refresh.c | 6 ++----
|
|
2 files changed, 5 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/src/providers/ipa/ipa_sudo_refresh.c b/src/providers/ipa/ipa_sudo_refresh.c
|
|
index 42137679c4bd2209b98d1d5223fd3ac71dc16b16..7871802ef7462ce98f6ff43bc33da57ff123ff6f 100644
|
|
--- a/src/providers/ipa/ipa_sudo_refresh.c
|
|
+++ b/src/providers/ipa/ipa_sudo_refresh.c
|
|
@@ -168,21 +168,17 @@ ipa_sudo_smart_refresh_send(TALLOC_CTX *mem_ctx,
|
|
DEBUG(SSSDBG_TRACE_FUNC, "USN value is unknown, assuming zero.\n");
|
|
usn = 0;
|
|
} else {
|
|
- usn = srv_opts->max_sudo_value;
|
|
+ usn = srv_opts->max_sudo_value + 1;
|
|
}
|
|
|
|
- cmdgroups_filter = talloc_asprintf(state,
|
|
- "(&(%s>=%lu)(!(%s=%lu)))",
|
|
- sudo_ctx->sudocmdgroup_map[IPA_AT_SUDOCMDGROUP_ENTRYUSN].name, usn,
|
|
+ cmdgroups_filter = talloc_asprintf(state, "(%s>=%lu)",
|
|
sudo_ctx->sudocmdgroup_map[IPA_AT_SUDOCMDGROUP_ENTRYUSN].name, usn);
|
|
if (cmdgroups_filter == NULL) {
|
|
ret = ENOMEM;
|
|
goto immediately;
|
|
}
|
|
|
|
- search_filter = talloc_asprintf(state,
|
|
- "(&(%s>=%lu)(!(%s=%lu)))",
|
|
- sudo_ctx->sudorule_map[IPA_AT_SUDORULE_ENTRYUSN].name, usn,
|
|
+ search_filter = talloc_asprintf(state, "(%s>=%lu)",
|
|
sudo_ctx->sudorule_map[IPA_AT_SUDORULE_ENTRYUSN].name, usn);
|
|
if (search_filter == NULL) {
|
|
ret = ENOMEM;
|
|
diff --git a/src/providers/ldap/sdap_sudo_refresh.c b/src/providers/ldap/sdap_sudo_refresh.c
|
|
index ff00fd037430f9a7ce62624184faa53288e581e4..5ba858019e0bda91a9e0919ed2b0345d9faf085e 100644
|
|
--- a/src/providers/ldap/sdap_sudo_refresh.c
|
|
+++ b/src/providers/ldap/sdap_sudo_refresh.c
|
|
@@ -184,13 +184,11 @@ struct tevent_req *sdap_sudo_smart_refresh_send(TALLOC_CTX *mem_ctx,
|
|
DEBUG(SSSDBG_TRACE_FUNC, "USN value is unknown, assuming zero.\n");
|
|
usn = 0;
|
|
} else {
|
|
- usn = srv_opts->max_sudo_value;
|
|
+ usn = srv_opts->max_sudo_value + 1;
|
|
}
|
|
|
|
- search_filter = talloc_asprintf(state,
|
|
- "(&(objectclass=%s)(%s>=%lu)(!(%s=%lu)))",
|
|
+ search_filter = talloc_asprintf(state, "(&(objectclass=%s)(%s>=%lu))",
|
|
map[SDAP_OC_SUDORULE].name,
|
|
- map[SDAP_AT_SUDO_USN].name, usn,
|
|
map[SDAP_AT_SUDO_USN].name, usn);
|
|
if (search_filter == NULL) {
|
|
ret = ENOMEM;
|
|
--
|
|
2.5.0
|
|
|