From f778b38f8d8a04e0afcb8b704dc864bfe0ac2f3a Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 5 Nov 2010 21:38:45 +0100 Subject: Use a more efficient host search filter --- src/providers/ipa/ipa_access.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c index 47e98cf9..816b652f 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; -- cgit