summaryrefslogtreecommitdiff
path: root/server/responder/nss
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-04-13 17:10:04 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-13 18:26:21 -0400
commit7ac324e0b94f1b27b6e66ae4bfd58df202c00e48 (patch)
tree96cdce563716593e601bea48bb603bd939a50526 /server/responder/nss
parentacd073a5e86a6c277c2058d28e506f37a5934736 (diff)
downloadsssd-7ac324e0b94f1b27b6e66ae4bfd58df202c00e48.tar.gz
sssd-7ac324e0b94f1b27b6e66ae4bfd58df202c00e48.tar.bz2
sssd-7ac324e0b94f1b27b6e66ae4bfd58df202c00e48.zip
Fix a couple of segfaults and timeout checks
Diffstat (limited to 'server/responder/nss')
-rw-r--r--server/responder/nss/nsssrv_cmd.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c
index f5555ed9..ba444ccf 100644
--- a/server/responder/nss/nsssrv_cmd.c
+++ b/server/responder/nss/nsssrv_cmd.c
@@ -347,7 +347,7 @@ static void nss_cmd_getpwnam_callback(void *ptr, int status,
cmdctx->name));
ret = ENOENT;
}
- if (dctx->domain == NULL) {
+ if (dom == NULL) {
DEBUG(2, ("No matching domain found for [%s], fail!\n",
cmdctx->name));
ret = ENOENT;
@@ -696,31 +696,22 @@ static void nss_cmd_getpwuid_callback(void *ptr, int status,
ret = EOK;
- for (dom = dctx->domain->next; dom; dom = dom->next) {
-
- ncret = nss_ncache_check_uid(nctx->ncache, nctx->neg_timeout,
+ dom = dctx->domain->next;
+ ncret = nss_ncache_check_uid(nctx->ncache, nctx->neg_timeout,
cmdctx->id);
- if (ncret == ENOENT) break;
-
- neghit = true;
- }
- /* reset neghit if we still have a domain to check */
- if (dom) neghit = false;
-
- dctx->domain = dom;
-
- if (neghit) {
+ if (ncret == EEXIST) {
DEBUG(3, ("Uid [%lu] does not exist! (negative cache)\n",
(unsigned long)cmdctx->id));
ret = ENOENT;
}
- if (dctx->domain == NULL) {
+ if (dom == NULL) {
DEBUG(0, ("No matching domain found for [%lu], fail!\n",
(unsigned long)cmdctx->id));
ret = ENOENT;
}
if (ret == EOK) {
+ dctx->domain = dom;
dctx->check_provider = (dctx->domain->provider != NULL);
if (dctx->res) talloc_free(res);
dctx->res = NULL;
@@ -1723,7 +1714,7 @@ static void nss_cmd_getgrnam_callback(void *ptr, int status,
cmdctx->name));
ret = ENOENT;
}
- if (dctx->domain == NULL) {
+ if (dom == NULL) {
DEBUG(2, ("No matching domain found for [%s], fail!\n",
cmdctx->name));
ret = ENOENT;
@@ -2057,31 +2048,23 @@ static void nss_cmd_getgrgid_callback(void *ptr, int status,
ret = EOK;
- for (dom = dctx->domain->next; dom; dom = dom->next) {
-
- ncret = nss_ncache_check_gid(nctx->ncache, nctx->neg_timeout,
- cmdctx->id);
- if (ncret == ENOENT) break;
+ dom = dctx->domain->next;
- neghit = true;
- }
- /* reset neghit if we still have a domain to check */
- if (dom) neghit = false;
-
- dctx->domain = dom;
-
- if (neghit) {
+ ncret = nss_ncache_check_gid(nctx->ncache, nctx->neg_timeout,
+ cmdctx->id);
+ if (ncret == EEXIST) {
DEBUG(3, ("Gid [%lu] does not exist! (negative cache)\n",
(unsigned long)cmdctx->id));
ret = ENOENT;
}
- if (dctx->domain == NULL) {
+ if (dom == NULL) {
DEBUG(0, ("No matching domain found for [%lu], fail!\n",
(unsigned long)cmdctx->id));
ret = ENOENT;
}
if (ret == EOK) {
+ dctx->domain = dom;
dctx->check_provider = (dctx->domain->provider != NULL);
if (dctx->res) talloc_free(res);
dctx->res = NULL;