Hi,

this patch should fix trac ticket #659.

bye,
Sumit
From 8998459802a142b8b55de8b91393c5ff010a44ce Mon Sep 17 00:00:00 2001
From: Sumit Bose <sb...@redhat.com>
Date: Fri, 5 Nov 2010 21:38:45 +0100
Subject: [PATCH] Use a more efficient host search filter

---
 src/providers/ipa/ipa_access.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index 47e98cf..816b652 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -757,7 +757,7 @@ static struct tevent_req 
*hbac_get_host_info_send(TALLOC_CTX *memctx,
     state->current_item = 0;
     state->hbac_host_info = NULL;
 
-    state->host_filter = talloc_asprintf(state, "(|");
+    state->host_filter = talloc_asprintf(state, "(&(objectclass=ipaHost)(|");
     if (state->host_filter == NULL) {
         DEBUG(1, ("Failed to create filter.\n"));
         ret = ENOMEM;
@@ -770,16 +770,17 @@ static struct tevent_req 
*hbac_get_host_info_send(TALLOC_CTX *memctx,
         }
 
         state->host_filter = talloc_asprintf_append(state->host_filter,
-                                             "(&(objectclass=ipaHost)"
-                                             
"(|(fqdn=%s)(serverhostname=%s)))",
-                                             host, host);
+                                         "(%s=%s)(%s=%s)",
+                                         IPA_HOST_FQDN, host,
+                                         IPA_HOST_SERVERHOSTNAME, host);
+
         if (state->host_filter == NULL) {
             ret = ENOMEM;
             goto fail;
         }
         talloc_zfree(host);
     }
-    state->host_filter = talloc_asprintf_append(state->host_filter, ")");
+    state->host_filter = talloc_asprintf_append(state->host_filter, "))");
     if (state->host_filter == NULL) {
         ret = ENOMEM;
         goto fail;
-- 
1.7.3.2

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to