]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8747 Keep an explicit backend pointer
authorOndřej Kuzník <okuznik@symas.com>
Mon, 10 Aug 2020 12:41:40 +0000 (14:41 +0200)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 10 May 2021 18:49:13 +0000 (18:49 +0000)
servers/lloadd/bind.c
servers/lloadd/client.c
servers/lloadd/daemon.c
servers/lloadd/lload.h
servers/lloadd/operation.c
servers/lloadd/upstream.c

index 12db80415ed20cf03c13deb824de4ebccafa3223..e20f2e497d92767032caa4a83cffdb22347acb02 100644 (file)
@@ -390,7 +390,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
     if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
         checked_unlock( &upstream->c_io_mutex );
         if ( !pin ) {
-            LloadBackend *b = upstream->c_private;
+            LloadBackend *b = upstream->c_backend;
 
             upstream->c_n_ops_executing--;
             CONNECTION_UNLOCK(upstream);
@@ -440,7 +440,7 @@ request_bind( LloadConnection *client, LloadOperation *op )
     /* Was it unlinked in the meantime? No need to send a response since the
      * client is dead */
     if ( !IS_ALIVE( op, o_refcnt ) ) {
-        LloadBackend *b = upstream->c_private;
+        LloadBackend *b = upstream->c_backend;
 
         upstream->c_n_ops_executing--;
         checked_unlock( &upstream->c_io_mutex );
@@ -786,7 +786,7 @@ handle_whoami_response(
         LloadBackend *b;
 
         CONNECTION_LOCK(upstream);
-        b = (LloadBackend *)upstream->c_private;
+        b = upstream->c_backend;
         Debug( LDAP_DEBUG_ANY, "handle_whoami_response: "
                 "Who Am I? extended operation not supported on backend %s, "
                 "proxyauthz with clients that do SASL binds will not work "
@@ -883,7 +883,7 @@ handle_vc_bind_response(
             LloadBackend *b;
 
             CONNECTION_LOCK(upstream);
-            b = (LloadBackend *)upstream->c_private;
+            b = upstream->c_backend;
             Debug( LDAP_DEBUG_ANY, "handle_vc_bind_response: "
                     "VC extended operation not supported on backend %s\n",
                     b->b_uri.bv_val );
index e4e1682bb1581894d094274e2c985ca403668fa9..c9c60aa4735c03343b89cce675dfd9a82ba8aa7a 100644 (file)
@@ -111,7 +111,7 @@ request_process( LloadConnection *client, LloadOperation *op )
     /* Was it unlinked in the meantime? No need to send a response since the
      * client is dead */
     if ( !IS_ALIVE( op, o_refcnt ) ) {
-        LloadBackend *b = upstream->c_private;
+        LloadBackend *b = upstream->c_backend;
 
         upstream->c_n_ops_executing--;
         checked_unlock( &upstream->c_io_mutex );
@@ -132,7 +132,7 @@ request_process( LloadConnection *client, LloadOperation *op )
 
     output = upstream->c_pendingber;
     if ( output == NULL && (output = ber_alloc()) == NULL ) {
-        LloadBackend *b = upstream->c_private;
+        LloadBackend *b = upstream->c_backend;
 
         upstream->c_n_ops_executing--;
         CONNECTION_UNLOCK(upstream);
index b88571a13a6bce5f4cd4035326a68550adf61879..2338f8365d6792c409e0e31538fc34e22fae755e 100644 (file)
@@ -1403,7 +1403,7 @@ backend_conn_cb( ldap_pvt_thread_start_t *start, void *startarg, void *arg )
     LloadConnection *c = startarg;
     LloadBackend *b = arg;
 
-    if ( b == NULL || c->c_private == b ) {
+    if ( b == NULL || c->c_backend == b ) {
         CONNECTION_LOCK_DESTROY(c);
         return 1;
     }
index 8cced20854b7bb59cb93d1398293489e0f83d9c9..be54d070b9db15fd270a5f9bbba19666d43d9904 100644 (file)
@@ -402,6 +402,8 @@ struct LloadConnection {
     long c_n_ops_completed;      /* num of ops completed */
     lload_counters_t c_counters; /* per connection operation counters */
 
+    LloadBackend *c_backend;
+
     /*
      * Protected by the CIRCLEQ mutex:
      * - Client: clients_mutex
index 617ec6a5dc9adae2a6a2f3cf3176dc4bbeeb02a2..7d127e8d54f7ad656bfdd8e25e60aa05f07d56b2 100644 (file)
@@ -328,7 +328,7 @@ operation_unlink_upstream( LloadOperation *op, LloadConnection *upstream )
             }
         }
         operation_update_conn_counters( op, upstream );
-        b = (LloadBackend *)upstream->c_private;
+        b = upstream->c_backend;
     }
     if ( upstream->c_state == LLOAD_C_CLOSING && !upstream->c_ops ) {
         CONNECTION_DESTROY(upstream);
@@ -520,7 +520,7 @@ connection_timeout( LloadConnection *upstream, void *arg )
 {
     LloadOperation *op;
     TAvlnode *ops = NULL, *node, *next;
-    LloadBackend *b = upstream->c_private;
+    LloadBackend *b = upstream->c_backend;
     time_t threshold = *(time_t *)arg;
     int rc, nops = 0;
 
index 1f0ee18eebe03be7d51e3ea65ed9e45dd848ef2e..79a59e44eed38f3b02360fc1a82f91d61779f15c 100644 (file)
@@ -273,7 +273,7 @@ fail:
 static int
 sasl_bind_step( LloadConnection *c, BerValue *scred, BerValue *ccred )
 {
-    LloadBackend *b = c->c_private;
+    LloadBackend *b = c->c_backend;
     sasl_conn_t *ctx = c->c_sasl_authctx;
     sasl_interact_t *prompts = NULL;
     unsigned credlen;
@@ -405,7 +405,7 @@ int
 upstream_bind_cb( LloadConnection *c )
 {
     BerElement *ber = c->c_currentber;
-    LloadBackend *b = c->c_private;
+    LloadBackend *b = c->c_backend;
     BerValue matcheddn, message;
     ber_tag_t tag;
     ber_int_t msgid, result;
@@ -611,7 +611,7 @@ fail:
 static int
 upstream_finish( LloadConnection *c )
 {
-    LloadBackend *b = c->c_private;
+    LloadBackend *b = c->c_backend;
     int is_bindconn = 0;
 
     assert_locked( &b->b_mutex );
@@ -706,7 +706,7 @@ upstream_tls_handshake_cb( evutil_socket_t s, short what, void *arg )
                 c->c_connid );
         goto fail;
     }
-    b = c->c_private;
+    b = c->c_backend;
 
     rc = ldap_pvt_tls_connect( lload_tls_backend_ld, c->c_sb, b->b_host );
     if ( rc < 0 ) {
@@ -815,7 +815,7 @@ upstream_starttls( LloadConnection *c )
     }
 
     if ( result != LDAP_SUCCESS ) {
-        LloadBackend *b = c->c_private;
+        LloadBackend *b = c->c_backend;
         int rc;
 
         Debug( LDAP_DEBUG_STATS, "upstream_starttls: "
@@ -896,7 +896,7 @@ upstream_init( ber_socket_t s, LloadBackend *b )
     }
 
     CONNECTION_LOCK(c);
-    c->c_private = b;
+    c->c_backend = b;
 #ifdef HAVE_TLS
     c->c_is_tls = b->b_tls;
 #endif
@@ -993,7 +993,7 @@ fail:
 static void
 upstream_unlink( LloadConnection *c )
 {
-    LloadBackend *b = c->c_private;
+    LloadBackend *b = c->c_backend;
     struct event *read_event, *write_event;
     TAvlnode *root;
     long freed, executing;