summaryrefslogtreecommitdiffstats
path: root/src/providers/fail_over.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-09-12 19:23:48 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-03 13:44:13 +0200
commit052684f1ab1c8a4fcfb2c9057c33273acbaf660e (patch)
tree9cbb6c5004e16f90188b5495204b2ce0773453ab /src/providers/fail_over.c
parentb196e1e91ec04ca5af93bfd2dcfc5225f4858a54 (diff)
downloadsssd-052684f1ab1c8a4fcfb2c9057c33273acbaf660e.tar.gz
sssd-052684f1ab1c8a4fcfb2c9057c33273acbaf660e.tar.xz
sssd-052684f1ab1c8a4fcfb2c9057c33273acbaf660e.zip
FO: Check server validity before setting statussssd-1_8_5
The list of resolved servers is allocated on the back end context and kept in the fo_service structure. However, a single request often resolves a server and keeps a pointer until the end of a request and only then gives feedback about the server based on the request result. This presents a big race condition in case the SRV resolution is used. When there are requests coming in in parallel, it is possible that an incoming request will invalidate a server until another request that holds a pointer to the original server is able to give a feedback. This patch simply checks if a server is in the list of servers maintained by a service before reading its status. https://fedorahosted.org/sssd/ticket/1364
Diffstat (limited to 'src/providers/fail_over.c')
-rw-r--r--src/providers/fail_over.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index deb7d394c..8925e3586 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -1476,10 +1476,13 @@ void fo_reset_services(struct fo_ctx *fo_ctx)
}
}
-struct fo_service *
-fo_get_server_service(struct fo_server *server)
+bool fo_svc_has_server(struct fo_service *service, struct fo_server *server)
{
- if (!server) return NULL;
- return server->service;
-}
+ struct fo_server *srv;
+
+ DLIST_FOR_EACH(srv, service->server_list) {
+ if (srv == server) return true;
+ }
+ return false;
+}