From 1eca703ca65ad74673fd20ee97bb8d6e538f0085 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 26 May 2009 14:37:46 +0200 Subject: Do not fire up backend search when the data provider is local --- server/responder/common/responder.h | 4 ++++ server/responder/nss/nsssrv_cmd.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'server/responder') diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h index 946418c86..13ebf073f 100644 --- a/server/responder/common/responder.h +++ b/server/responder/common/responder.h @@ -33,6 +33,10 @@ #include "../sss_client/sss_cli.h" #include "util/btreemap.h" +/* if there is a provider other than the special local */ +#define NEED_CHECK_PROVIDER(provider) \ + (provider != NULL && strcmp(provider, "local") != 0) + /* needed until nsssrv.h is updated */ struct cli_request { diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c index a8a3c6864..2eb1dce04 100644 --- a/server/responder/nss/nsssrv_cmd.c +++ b/server/responder/nss/nsssrv_cmd.c @@ -355,7 +355,7 @@ static void nss_cmd_getpwnam_callback(void *ptr, int status, if (ret == EOK) { dctx->domain = dom; - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (dctx->res) talloc_free(res); dctx->res = NULL; @@ -563,7 +563,7 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx) goto done; } - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (!domname) { /* this is a multidomain search */ @@ -712,7 +712,7 @@ static void nss_cmd_getpwuid_callback(void *ptr, int status, if (ret == EOK) { dctx->domain = dom; - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (dctx->res) talloc_free(res); dctx->res = NULL; @@ -882,7 +882,7 @@ static int nss_cmd_getpwuid(struct cli_ctx *cctx) } dctx->domain = dom; - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); DEBUG(4, ("Requesting info for [%lu@%s]\n", cmdctx->id, dctx->domain->name)); @@ -997,7 +997,7 @@ static void nss_cmd_setpwent_callback(void *ptr, int status, if (cmdctx->enum_cached) { dctx->check_provider = false; } else { - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); } if (dctx->check_provider) { @@ -1130,7 +1130,7 @@ static int nss_cmd_setpwent_ext(struct cli_ctx *cctx, bool immediate) if (cmdctx->enum_cached) { dctx->check_provider = false; } else { - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); } if (dctx->check_provider) { @@ -1727,7 +1727,7 @@ static void nss_cmd_getgrnam_callback(void *ptr, int status, if (ret == EOK) { dctx->domain = dom; - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (dctx->res) talloc_free(res); dctx->res = NULL; @@ -1930,7 +1930,7 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx) goto done; } - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (!domname) { /* this is a multidomain search */ @@ -2070,7 +2070,7 @@ static void nss_cmd_getgrgid_callback(void *ptr, int status, if (ret == EOK) { dctx->domain = dom; - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (dctx->res) talloc_free(res); dctx->res = NULL; @@ -2234,7 +2234,7 @@ static int nss_cmd_getgrgid(struct cli_ctx *cctx) } dctx->domain = dom; - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); DEBUG(4, ("Requesting info for [%lu@%s]\n", cmdctx->id, dctx->domain->name)); @@ -2345,7 +2345,7 @@ static void nss_cmd_setgrent_callback(void *ptr, int status, if (cmdctx->enum_cached) { dctx->check_provider = false; } else { - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); } if (dctx->check_provider) { @@ -2478,7 +2478,7 @@ static int nss_cmd_setgrent_ext(struct cli_ctx *cctx, bool immediate) if (cmdctx->enum_cached) { dctx->check_provider = false; } else { - dctx->check_provider = (dom->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); } if (dctx->check_provider) { @@ -2894,7 +2894,7 @@ static void nss_cmd_getinit_callback(void *ptr, int status, if (ret == EOK) { dctx->domain = dom; - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (dctx->res) talloc_free(res); dctx->res = NULL; @@ -3063,7 +3063,7 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx) goto done; } - dctx->check_provider = (dctx->domain->provider != NULL); + dctx->check_provider = NEED_CHECK_PROVIDER(dctx->domain->provider); if (!domname) { /* this is a multidomain search */ -- cgit