summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-05-26 14:37:46 +0200
committerSimo Sorce <ssorce@redhat.com>2009-05-26 11:30:04 -0400
commit1eca703ca65ad74673fd20ee97bb8d6e538f0085 (patch)
treea0b8897a56296e1ecd3110351a6d27178e6581f7
parentee2f522ebd4ded82f5ce46ff27a66a14cfce8274 (diff)
downloadsssd-1eca703ca65ad74673fd20ee97bb8d6e538f0085.tar.gz
sssd-1eca703ca65ad74673fd20ee97bb8d6e538f0085.tar.xz
sssd-1eca703ca65ad74673fd20ee97bb8d6e538f0085.zip
Do not fire up backend search when the data provider is local
-rw-r--r--server/infopipe/infopipe_users.c6
-rw-r--r--server/responder/common/responder.h4
-rw-r--r--server/responder/nss/nsssrv_cmd.c28
3 files changed, 21 insertions, 17 deletions
diff --git a/server/infopipe/infopipe_users.c b/server/infopipe/infopipe_users.c
index ee5137121..8973c18f6 100644
--- a/server/infopipe/infopipe_users.c
+++ b/server/infopipe/infopipe_users.c
@@ -28,6 +28,7 @@
#include "infopipe/infopipe_private.h"
#include "infopipe/sysbus.h"
#include "db/sysdb.h"
+#include "responder/common/responder.h"
static int attr_comparator(const void *key1, const void *key2);
static int username_comparator(const void *key1, const void *key2);
@@ -1213,9 +1214,8 @@ int infp_users_get_attr(DBusMessage *message, struct sbus_conn_ctx *sconn)
infp_getattr_req->infp_req->domain =
infp_get_domain_obj(infp_getattr_req->infp_req->infp, domain);
- if (infp_getattr_req->infp_req->domain->provider) {
- infp_getattr_req->check_provider = true;
- }
+ infp_getattr_req->check_provider =
+ NEED_CHECK_PROVIDER(infp_getattr_req->infp_req->domain->provider);
/* Copy the username list */
infp_getattr_req->usernames = talloc_array(infp_getattr_req, char *, username_count);
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 */