Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
b801ca17
Commit
b801ca17
authored
Sep 28, 2017
by
Ondřej Kuzník
Committed by
Ondřej Kuzník
Nov 17, 2020
Browse files
Rename macros and symbols to lloadd
parent
11f47438
Changes
9
Hide whitespace changes
Inline
Side-by-side
servers/lloadd/backend.c
View file @
b801ca17
...
...
@@ -215,7 +215,7 @@ backend_select( Operation *op )
LDAP_CIRCLEQ_FOREACH
(
c
,
head
,
c_next
)
{
ldap_pvt_thread_mutex_lock
(
&
c
->
c_io_mutex
);
CONNECTION_LOCK
(
c
);
if
(
c
->
c_state
==
SLAP
_C_READY
&&
!
c
->
c_pendingber
&&
if
(
c
->
c_state
==
LLOAD
_C_READY
&&
!
c
->
c_pendingber
&&
(
b
->
b_max_conn_pending
==
0
||
c
->
c_n_ops_executing
<
b
->
b_max_conn_pending
)
)
{
Debug
(
LDAP_DEBUG_CONNS
,
"backend_select: "
...
...
servers/lloadd/bind.c
View file @
b801ca17
...
...
@@ -104,7 +104,7 @@ request_bind( Operation *op )
avl_dup_error
)
)
{
assert
(
0
);
}
upstream
->
c_state
=
SLAP
_C_ACTIVE
;
upstream
->
c_state
=
LLOAD
_C_ACTIVE
;
CONNECTION_UNLOCK
(
upstream
);
ldap_pvt_thread_mutex_unlock
(
&
upstream
->
c_io_mutex
);
...
...
@@ -313,8 +313,8 @@ client_bind( Connection *client, Operation *op )
client_reset
(
client
);
client
->
c_state
=
SLAP
_C_BINDING
;
client
->
c_type
=
SLAP
_C_OPEN
;
client
->
c_state
=
LLOAD
_C_BINDING
;
client
->
c_type
=
LLOAD
_C_OPEN
;
rc
=
tavl_insert
(
&
client
->
c_ops
,
op
,
operation_client_cmp
,
avl_dup_error
);
assert
(
rc
==
LDAP_SUCCESS
);
...
...
@@ -358,9 +358,9 @@ client_bind( Connection *client, Operation *op )
if
(
!--
op
->
o_client_refcnt
)
{
operation_destroy_from_client
(
op
);
if
(
client
->
c_state
==
SLAP
_C_BINDING
)
{
client
->
c_state
=
SLAP
_C_READY
;
client
->
c_type
=
SLAP
_C_OPEN
;
if
(
client
->
c_state
==
LLOAD
_C_BINDING
)
{
client
->
c_state
=
LLOAD
_C_READY
;
client
->
c_type
=
LLOAD
_C_OPEN
;
if
(
!
BER_BVISNULL
(
&
client
->
c_auth
)
)
{
ber_memfree
(
client
->
c_auth
.
bv_val
);
BER_BVZERO
(
&
client
->
c_auth
);
...
...
servers/lloadd/client.c
View file @
b801ca17
...
...
@@ -69,7 +69,7 @@ handle_one_request( Connection *c )
handler
=
request_extended
;
break
;
default:
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
return
operation_send_reject_locked
(
op
,
LDAP_PROTOCOL_ERROR
,
"bind in progress"
,
0
);
}
...
...
@@ -104,7 +104,7 @@ client_init(
ber_sockbuf_ctrl
(
c
->
c_sb
,
LBER_SB_OPT_SET_MAX_INCOMING
,
&
max
);
}
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_state
=
LLOAD
_C_READY
;
event
=
event_new
(
base
,
s
,
EV_READ
|
EV_PERSIST
,
read_cb
,
c
);
if
(
!
event
)
{
...
...
@@ -147,7 +147,7 @@ fail:
c
->
c_read_event
=
NULL
;
}
c
->
c_state
=
SLAP
_C_INVALID
;
c
->
c_state
=
LLOAD
_C_INVALID
;
CONNECTION_DESTROY
(
c
);
assert
(
c
==
NULL
);
return
NULL
;
...
...
@@ -163,9 +163,9 @@ client_destroy( Connection *c )
"destroying client connid=%lu
\n
"
,
c
->
c_connid
);
assert
(
c
->
c_state
!=
SLAP
_C_INVALID
);
assert
(
c
->
c_state
!=
LLOAD
_C_INVALID
);
state
=
c
->
c_state
;
c
->
c_state
=
SLAP
_C_INVALID
;
c
->
c_state
=
LLOAD
_C_INVALID
;
read_event
=
c
->
c_read_event
;
write_event
=
c
->
c_write_event
;
...
...
@@ -190,7 +190,7 @@ client_destroy( Connection *c )
event_del
(
write_event
);
}
if
(
state
!=
SLAP
_C_CLOSING
)
{
if
(
state
!=
LLOAD
_C_CLOSING
)
{
ldap_pvt_thread_mutex_lock
(
&
clients_mutex
);
LDAP_CIRCLEQ_REMOVE
(
&
clients
,
c
,
c_next
);
ldap_pvt_thread_mutex_unlock
(
&
clients_mutex
);
...
...
@@ -217,7 +217,7 @@ client_destroy( Connection *c )
*/
assert
(
c
->
c_refcnt
>=
0
);
if
(
c
->
c_refcnt
)
{
c
->
c_state
=
SLAP
_C_CLOSING
;
c
->
c_state
=
LLOAD
_C_CLOSING
;
Debug
(
LDAP_DEBUG_CONNS
,
"client_destroy: "
"connid=%lu aborting with refcnt=%d
\n
"
,
c
->
c_connid
,
c
->
c_refcnt
);
...
...
servers/lloadd/config.c
View file @
b801ca17
...
...
@@ -71,10 +71,10 @@ static char *logfileName;
lload_features_t
lload_features
;
ber_len_t
sockbuf_max_incoming_client
=
SLAP
_SB_MAX_INCOMING_CLIENT
;
ber_len_t
sockbuf_max_incoming_upstream
=
SLAP
_SB_MAX_INCOMING_UPSTREAM
;
ber_len_t
sockbuf_max_incoming_client
=
LLOAD
_SB_MAX_INCOMING_CLIENT
;
ber_len_t
sockbuf_max_incoming_upstream
=
LLOAD
_SB_MAX_INCOMING_UPSTREAM
;
int
slap_conn_max_pdus_per_cycle
=
SLAP
_CONN_MAX_PDUS_PER_CYCLE_DEFAULT
;
int
slap_conn_max_pdus_per_cycle
=
LLOAD
_CONN_MAX_PDUS_PER_CYCLE_DEFAULT
;
int
slap_write_timeout
=
10000
;
...
...
servers/lloadd/connection.c
View file @
b801ca17
...
...
@@ -289,7 +289,7 @@ connection_destroy( Connection *c )
assert
(
c
->
c_live
==
0
);
assert
(
c
->
c_refcnt
==
0
);
assert
(
c
->
c_state
==
SLAP
_C_INVALID
);
assert
(
c
->
c_state
==
LLOAD
_C_INVALID
);
ber_sockbuf_free
(
c
->
c_sb
);
...
...
@@ -394,7 +394,7 @@ connection_init( ber_socket_t s, const char *peername, int flags )
c
->
c_connid
,
s
,
peername
);
CONNECTION_LOCK
(
c
);
c
->
c_state
=
SLAP
_C_ACTIVE
;
c
->
c_state
=
LLOAD
_C_ACTIVE
;
return
c
;
}
servers/lloadd/extended.c
View file @
b801ca17
...
...
@@ -60,7 +60,7 @@ request_extended( Connection *c, Operation *op )
}
ber_free
(
copy
,
0
);
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
return
operation_send_reject_locked
(
op
,
LDAP_PROTOCOL_ERROR
,
"bind in progress"
,
0
);
}
...
...
servers/lloadd/operation.c
View file @
b801ca17
...
...
@@ -165,9 +165,9 @@ operation_destroy_from_client( Operation *op )
* others */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
race_state
=
op
->
o_freeing
;
op
->
o_freeing
|=
SLAP
_OP_FREEING_CLIENT
;
op
->
o_freeing
|=
LLOAD
_OP_FREEING_CLIENT
;
if
(
detach_client
)
{
op
->
o_freeing
|=
SLAP
_OP_DETACHING_CLIENT
;
op
->
o_freeing
|=
LLOAD
_OP_DETACHING_CLIENT
;
}
ldap_pvt_thread_mutex_unlock
(
&
op
->
o_mutex
);
...
...
@@ -192,8 +192,8 @@ operation_destroy_from_client( Operation *op )
"op=%p lost race but client connid=%lu is going down
\n
"
,
op
,
client
->
c_connid
);
CONNECTION_LOCK_DECREF
(
client
);
}
else
if
(
(
race_state
&
SLAP
_OP_FREEING_MASK
)
==
SLAP
_OP_FREEING_UPSTREAM
)
{
}
else
if
(
(
race_state
&
LLOAD
_OP_FREEING_MASK
)
==
LLOAD
_OP_FREEING_UPSTREAM
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"operation_destroy_from_client: "
"op=%p lost race, increased client refcnt connid=%lu "
"to refcnt=%d
\n
"
,
...
...
@@ -212,7 +212,7 @@ operation_destroy_from_client( Operation *op )
/* 5. If we raced the upstream side and won, reclaim the token */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_link_mutex
);
if
(
!
(
race_state
&
SLAP
_OP_DETACHING_UPSTREAM
)
)
{
if
(
!
(
race_state
&
LLOAD
_OP_DETACHING_UPSTREAM
)
)
{
upstream
=
op
->
o_upstream
;
if
(
upstream
)
{
CONNECTION_LOCK
(
upstream
);
...
...
@@ -223,8 +223,8 @@ operation_destroy_from_client( Operation *op )
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
/* We don't actually resolve the race in full until we grab the other's
* c_mutex+op->o_mutex here */
if
(
upstream
&&
(
op
->
o_freeing
&
SLAP
_OP_FREEING_UPSTREAM
)
)
{
if
(
op
->
o_freeing
&
SLAP
_OP_DETACHING_UPSTREAM
)
{
if
(
upstream
&&
(
op
->
o_freeing
&
LLOAD
_OP_FREEING_UPSTREAM
)
)
{
if
(
op
->
o_freeing
&
LLOAD
_OP_DETACHING_UPSTREAM
)
{
CONNECTION_UNLOCK
(
upstream
);
upstream
=
NULL
;
}
else
{
...
...
@@ -251,9 +251,9 @@ operation_destroy_from_client( Operation *op )
/* There must have been no race if op is still alive */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
op
->
o_freeing
&=
~
SLAP
_OP_FREEING_CLIENT
;
op
->
o_freeing
&=
~
LLOAD
_OP_FREEING_CLIENT
;
if
(
detach_client
)
{
op
->
o_freeing
&=
~
SLAP
_OP_DETACHING_CLIENT
;
op
->
o_freeing
&=
~
LLOAD
_OP_DETACHING_CLIENT
;
}
assert
(
op
->
o_freeing
==
0
);
ldap_pvt_thread_mutex_unlock
(
&
op
->
o_mutex
);
...
...
@@ -326,9 +326,9 @@ operation_destroy_from_upstream( Operation *op )
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
race_state
=
op
->
o_freeing
;
op
->
o_freeing
|=
SLAP
_OP_FREEING_UPSTREAM
;
op
->
o_freeing
|=
LLOAD
_OP_FREEING_UPSTREAM
;
if
(
detach_upstream
)
{
op
->
o_freeing
|=
SLAP
_OP_DETACHING_UPSTREAM
;
op
->
o_freeing
|=
LLOAD
_OP_DETACHING_UPSTREAM
;
}
ldap_pvt_thread_mutex_unlock
(
&
op
->
o_mutex
);
...
...
@@ -360,8 +360,8 @@ operation_destroy_from_upstream( Operation *op )
"op=%p lost race but upstream connid=%lu is going down
\n
"
,
op
,
upstream
->
c_connid
);
CONNECTION_LOCK_DECREF
(
upstream
);
}
else
if
(
(
race_state
&
SLAP
_OP_FREEING_MASK
)
==
SLAP
_OP_FREEING_CLIENT
)
{
}
else
if
(
(
race_state
&
LLOAD
_OP_FREEING_MASK
)
==
LLOAD
_OP_FREEING_CLIENT
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"operation_destroy_from_upstream: "
"op=%p lost race, increased upstream refcnt connid=%lu "
"to refcnt=%d
\n
"
,
...
...
@@ -380,7 +380,7 @@ operation_destroy_from_upstream( Operation *op )
/* 5. If we raced the client side and won, reclaim the token */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_link_mutex
);
if
(
!
(
race_state
&
SLAP
_OP_DETACHING_CLIENT
)
)
{
if
(
!
(
race_state
&
LLOAD
_OP_DETACHING_CLIENT
)
)
{
client
=
op
->
o_client
;
if
(
client
)
{
CONNECTION_LOCK
(
client
);
...
...
@@ -391,8 +391,8 @@ operation_destroy_from_upstream( Operation *op )
/* We don't actually resolve the race in full until we grab the other's
* c_mutex+op->o_mutex here */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
if
(
client
&&
(
op
->
o_freeing
&
SLAP
_OP_FREEING_CLIENT
)
)
{
if
(
op
->
o_freeing
&
SLAP
_OP_DETACHING_CLIENT
)
{
if
(
client
&&
(
op
->
o_freeing
&
LLOAD
_OP_FREEING_CLIENT
)
)
{
if
(
op
->
o_freeing
&
LLOAD
_OP_DETACHING_CLIENT
)
{
CONNECTION_UNLOCK
(
client
);
client
=
NULL
;
}
else
{
...
...
@@ -418,9 +418,9 @@ operation_destroy_from_upstream( Operation *op )
op
,
op
->
o_client_refcnt
);
/* There must have been no race if op is still alive */
ldap_pvt_thread_mutex_lock
(
&
op
->
o_mutex
);
op
->
o_freeing
&=
~
SLAP
_OP_FREEING_UPSTREAM
;
op
->
o_freeing
&=
~
LLOAD
_OP_FREEING_UPSTREAM
;
if
(
detach_upstream
)
{
op
->
o_freeing
&=
~
SLAP
_OP_DETACHING_UPSTREAM
;
op
->
o_freeing
&=
~
LLOAD
_OP_DETACHING_UPSTREAM
;
}
assert
(
op
->
o_freeing
==
0
);
ldap_pvt_thread_mutex_unlock
(
&
op
->
o_mutex
);
...
...
@@ -544,8 +544,8 @@ operation_abandon( Operation *op )
/* The operation has already been abandoned or finished */
goto
unlock
;
}
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
c
->
c_state
=
SLAP
_C_READY
;
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
c
->
c_state
=
LLOAD
_C_READY
;
}
c
->
c_n_ops_executing
--
;
b
=
(
Backend
*
)
c
->
c_private
;
...
...
@@ -601,8 +601,8 @@ done:
/* Caller should hold a reference on client */
CONNECTION_LOCK
(
c
);
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
c
->
c_state
=
SLAP
_C_READY
;
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
c
->
c_state
=
LLOAD
_C_READY
;
}
op
->
o_client_refcnt
--
;
operation_destroy_from_client
(
op
);
...
...
@@ -647,11 +647,11 @@ request_abandon( Connection *c, Operation *op )
c
->
c_connid
,
op
->
o_client_msgid
,
slap_msgtype2str
(
request
->
o_tag
),
needle
.
o_client_msgid
);
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
/* We have found the request and we are binding, it must be a bind
* request */
assert
(
request
->
o_tag
==
LDAP_REQ_BIND
);
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_state
=
LLOAD
_C_READY
;
}
CONNECTION_UNLOCK_INCREF
(
c
);
...
...
@@ -826,7 +826,7 @@ request_process( Connection *client, Operation *op )
assert
(
rc
==
LDAP_SUCCESS
);
if
(
(
lload_features
&
LLOAD_FEATURE_PROXYAUTHZ
)
&&
client
->
c_type
!=
SLAP
_C_PRIVILEGED
)
{
client
->
c_type
!=
LLOAD
_C_PRIVILEGED
)
{
CONNECTION_LOCK_DECREF
(
client
);
Debug
(
LDAP_DEBUG_TRACE
,
"request_process: "
"proxying identity %s to upstream
\n
"
,
...
...
servers/lloadd/slap.h
View file @
b801ca17
...
...
@@ -78,16 +78,16 @@ LDAP_BEGIN_DECL
#define SLAP_STRDUP(s) ber_strdup( ( s ) )
#define SLAP_STRNDUP(s, l) ber_strndup( ( s ), ( l ) )
#define SERVICE_NAME OPENLDAP_PACKAGE "-
slap
d"
#define SERVICE_NAME OPENLDAP_PACKAGE "-
lload
d"
#define SLAPD_ANONYMOUS ""
#define SLAP_STRING_UNKNOWN "unknown"
#define SLAP_MAX_WORKER_THREADS ( 16 )
#define
SLAP
_SB_MAX_INCOMING_CLIENT ( ( 1 << 18 ) - 1 )
#define
SLAP
_SB_MAX_INCOMING_UPSTREAM ( ( 1 << 24 ) - 1 )
#define
LLOAD
_SB_MAX_INCOMING_CLIENT ( ( 1 << 18 ) - 1 )
#define
LLOAD
_SB_MAX_INCOMING_UPSTREAM ( ( 1 << 24 ) - 1 )
#define
SLAP
_CONN_MAX_PDUS_PER_CYCLE_DEFAULT 10
#define
LLOAD
_CONN_MAX_PDUS_PER_CYCLE_DEFAULT 10
#define SLAP_TEXT_BUFLEN ( 256 )
...
...
@@ -292,17 +292,17 @@ typedef void (*CONNECTION_DESTROY_CB)( Connection *c );
/* connection state (protected by c_mutex) */
enum
sc_state
{
SLAP
_C_INVALID
=
0
,
/* MUST BE ZERO (0) */
SLAP
_C_READY
,
/* ready */
SLAP
_C_CLOSING
,
/* closing */
SLAP
_C_ACTIVE
,
/* exclusive operation (tls setup, ...) in progress */
SLAP
_C_BINDING
,
/* binding */
LLOAD
_C_INVALID
=
0
,
/* MUST BE ZERO (0) */
LLOAD
_C_READY
,
/* ready */
LLOAD
_C_CLOSING
,
/* closing */
LLOAD
_C_ACTIVE
,
/* exclusive operation (tls setup, ...) in progress */
LLOAD
_C_BINDING
,
/* binding */
};
enum
sc_type
{
SLAP
_C_OPEN
=
0
,
/* regular connection */
SLAP
_C_PREPARING
,
/* upstream connection not assigned yet */
SLAP
_C_BIND
,
/* connection used to handle bind client requests if VC not enabled */
SLAP
_C_PRIVILEGED
,
/* connection can override proxyauthz control */
LLOAD
_C_OPEN
=
0
,
/* regular connection */
LLOAD
_C_PREPARING
,
/* upstream connection not assigned yet */
LLOAD
_C_BIND
,
/* connection used to handle bind client requests if VC not enabled */
LLOAD
_C_PRIVILEGED
,
/* connection can override proxyauthz control */
};
/*
* represents a connection from an ldap client/to ldap server
...
...
@@ -422,16 +422,16 @@ struct Connection {
};
enum
op_state
{
SLAP
_OP_NOT_FREEING
=
0
,
SLAP
_OP_FREEING_UPSTREAM
=
1
<<
0
,
SLAP
_OP_FREEING_CLIENT
=
1
<<
1
,
SLAP
_OP_DETACHING_UPSTREAM
=
1
<<
2
,
SLAP
_OP_DETACHING_CLIENT
=
1
<<
3
,
LLOAD
_OP_NOT_FREEING
=
0
,
LLOAD
_OP_FREEING_UPSTREAM
=
1
<<
0
,
LLOAD
_OP_FREEING_CLIENT
=
1
<<
1
,
LLOAD
_OP_DETACHING_UPSTREAM
=
1
<<
2
,
LLOAD
_OP_DETACHING_CLIENT
=
1
<<
3
,
};
#define
SLAP
_OP_FREEING_MASK \
(
SLAP
_OP_FREEING_UPSTREAM |
SLAP
_OP_FREEING_CLIENT )
#define
SLAP
_OP_DETACHING_MASK \
(
SLAP
_OP_DETACHING_UPSTREAM |
SLAP
_OP_DETACHING_CLIENT )
#define
LLOAD
_OP_FREEING_MASK \
(
LLOAD
_OP_FREEING_UPSTREAM |
LLOAD
_OP_FREEING_CLIENT )
#define
LLOAD
_OP_DETACHING_MASK \
(
LLOAD
_OP_DETACHING_UPSTREAM |
LLOAD
_OP_DETACHING_CLIENT )
struct
Operation
{
Connection
*
o_client
;
...
...
servers/lloadd/upstream.c
View file @
b801ca17
...
...
@@ -118,25 +118,25 @@ handle_bind_response( Operation *op, BerElement *ber )
CONNECTION_LOCK
(
upstream
);
if
(
result
!=
LDAP_SASL_BIND_IN_PROGRESS
)
{
upstream
->
c_state
=
SLAP
_C_READY
;
upstream
->
c_state
=
LLOAD
_C_READY
;
}
CONNECTION_UNLOCK
(
upstream
);
CONNECTION_LOCK
(
client
);
if
(
client
->
c_state
==
SLAP
_C_BINDING
)
{
if
(
client
->
c_state
==
LLOAD
_C_BINDING
)
{
switch
(
result
)
{
case
LDAP_SASL_BIND_IN_PROGRESS
:
break
;
case
LDAP_SUCCESS
:
default:
{
client
->
c_state
=
SLAP
_C_READY
;
client
->
c_type
=
SLAP
_C_OPEN
;
client
->
c_state
=
LLOAD
_C_READY
;
client
->
c_type
=
LLOAD
_C_OPEN
;
if
(
result
!=
LDAP_SUCCESS
)
{
ber_memfree
(
client
->
c_auth
.
bv_val
);
BER_BVZERO
(
&
client
->
c_auth
);
}
else
if
(
!
ber_bvstrcasecmp
(
&
client
->
c_auth
,
&
lloadd_identity
)
)
{
client
->
c_type
=
SLAP
_C_PRIVILEGED
;
client
->
c_type
=
LLOAD
_C_PRIVILEGED
;
}
if
(
!
BER_BVISNULL
(
&
client
->
c_sasl_bind_mech
)
)
{
ber_memfree
(
client
->
c_sasl_bind_mech
.
bv_val
);
...
...
@@ -146,8 +146,8 @@ handle_bind_response( Operation *op, BerElement *ber )
}
}
}
else
{
assert
(
client
->
c_state
==
SLAP
_C_INVALID
||
client
->
c_state
==
SLAP
_C_CLOSING
);
assert
(
client
->
c_state
==
LLOAD
_C_INVALID
||
client
->
c_state
==
LLOAD
_C_CLOSING
);
}
CONNECTION_UNLOCK
(
client
);
...
...
@@ -232,20 +232,20 @@ handle_vc_bind_response( Operation *op, BerElement *ber )
}
}
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
switch
(
result
)
{
case
LDAP_SASL_BIND_IN_PROGRESS
:
break
;
case
LDAP_SUCCESS
:
default:
{
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_type
=
SLAP
_C_OPEN
;
c
->
c_state
=
LLOAD
_C_READY
;
c
->
c_type
=
LLOAD
_C_OPEN
;
if
(
result
!=
LDAP_SUCCESS
)
{
ber_memfree
(
c
->
c_auth
.
bv_val
);
BER_BVZERO
(
&
c
->
c_auth
);
}
else
if
(
!
ber_bvstrcasecmp
(
&
c
->
c_auth
,
&
lloadd_identity
)
)
{
c
->
c_type
=
SLAP
_C_PRIVILEGED
;
c
->
c_type
=
LLOAD
_C_PRIVILEGED
;
}
if
(
!
BER_BVISNULL
(
&
c
->
c_vc_cookie
)
)
{
ber_memfree
(
c
->
c_vc_cookie
.
bv_val
);
...
...
@@ -259,7 +259,8 @@ handle_vc_bind_response( Operation *op, BerElement *ber )
}
}
}
else
{
assert
(
c
->
c_state
==
SLAP_C_INVALID
||
c
->
c_state
==
SLAP_C_CLOSING
);
assert
(
c
->
c_state
==
LLOAD_C_INVALID
||
c
->
c_state
==
LLOAD_C_CLOSING
);
}
CONNECTION_UNLOCK_INCREF
(
c
);
...
...
@@ -296,8 +297,8 @@ done:
static
int
handle_unsolicited
(
Connection
*
c
,
BerElement
*
ber
)
{
if
(
c
->
c_state
==
SLAP
_C_READY
)
{
c
->
c_state
=
SLAP
_C_CLOSING
;
if
(
c
->
c_state
==
LLOAD
_C_READY
)
{
c
->
c_state
=
LLOAD
_C_CLOSING
;
}
Debug
(
LDAP_DEBUG_CONNS
,
"handle_unsolicited: "
...
...
@@ -445,8 +446,8 @@ handle_one_response( Connection *c )
CONNECTION_LOCK_DECREF
(
c
);
op
->
o_upstream_refcnt
--
;
if
(
!
client
||
!
op
->
o_upstream_refcnt
)
{
if
(
c
->
c_state
==
SLAP
_C_BINDING
)
{
c
->
c_state
=
SLAP
_C_READY
;
if
(
c
->
c_state
==
LLOAD
_C_BINDING
)
{
c
->
c_state
=
LLOAD
_C_READY
;
}
operation_destroy_from_upstream
(
op
);
}
...
...
@@ -500,8 +501,8 @@ upstream_bind_cb( Connection *c )
switch
(
result
)
{
case
LDAP_SUCCESS
:
{
c
->
c_pdu_cb
=
handle_one_response
;
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_type
=
SLAP
_C_OPEN
;
c
->
c_state
=
LLOAD
_C_READY
;
c
->
c_type
=
LLOAD
_C_OPEN
;
CONNECTION_UNLOCK_INCREF
(
c
);
ldap_pvt_thread_mutex_lock
(
&
b
->
b_mutex
);
LDAP_CIRCLEQ_REMOVE
(
&
b
->
b_preparing
,
c
,
c_next
);
...
...
@@ -611,16 +612,16 @@ upstream_finish( Connection *c )
if
(
is_bindconn
)
{
LDAP_CIRCLEQ_REMOVE
(
&
b
->
b_preparing
,
c
,
c_next
);
LDAP_CIRCLEQ_INSERT_HEAD
(
&
b
->
b_bindconns
,
c
,
c_next
);
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_type
=
SLAP
_C_BIND
;
c
->
c_state
=
LLOAD
_C_READY
;
c
->
c_type
=
LLOAD
_C_BIND
;
b
->
b_bindavail
++
;
b
->
b_opening
--
;
b
->
b_failed
=
0
;
}
else
if
(
bindconf
.
sb_method
==
LDAP_AUTH_NONE
)
{
LDAP_CIRCLEQ_REMOVE
(
&
b
->
b_preparing
,
c
,
c_next
);
LDAP_CIRCLEQ_INSERT_HEAD
(
&
b
->
b_conns
,
c
,
c_next
);
c
->
c_state
=
SLAP
_C_READY
;
c
->
c_type
=
SLAP
_C_OPEN
;
c
->
c_state
=
LLOAD
_C_READY
;
c
->
c_type
=
LLOAD
_C_OPEN
;
b
->
b_active
++
;
b
->
b_opening
--
;
b
->
b_failed
=
0
;
...
...
@@ -659,7 +660,7 @@ upstream_init( ber_socket_t s, Backend *b )
c
->
c_pdu_cb
=
handle_one_response
;
LDAP_CIRCLEQ_INSERT_HEAD
(
&
b
->
b_preparing
,
c
,
c_next
);
c
->
c_type
=
SLAP
_C_PREPARING
;
c
->
c_type
=
LLOAD
_C_PREPARING
;
{
ber_len_t
max
=
sockbuf_max_incoming_upstream
;
...
...
@@ -712,7 +713,7 @@ fail:
event_free
(
c
->
c_read_event
);
}
c
->
c_state
=
SLAP
_C_INVALID
;
c
->
c_state
=
LLOAD
_C_INVALID
;
CONNECTION_DESTROY
(
c
);
assert
(
c
==
NULL
);
...
...
@@ -732,9 +733,9 @@ upstream_destroy( Connection *c )
"freeing connection connid=%lu
\n
"
,
c
->
c_connid
);
assert
(
c
->
c_state
!=
SLAP
_C_INVALID
);
assert
(
c
->
c_state
!=
LLOAD
_C_INVALID
);
state
=
c
->
c_state
;
c
->
c_state
=
SLAP
_C_INVALID
;
c
->
c_state
=
LLOAD
_C_INVALID
;
root
=
c
->
c_ops
;
c
->
c_ops
=
NULL
;
...
...
@@ -763,13 +764,13 @@ upstream_destroy( Connection *c )
}
/* Remove from the backend on first pass */
if
(
state
!=
SLAP
_C_CLOSING
)
{
if
(
state
!=
LLOAD
_C_CLOSING
)
{
ldap_pvt_thread_mutex_lock
(
&
b
->
b_mutex
);
if
(
c
->
c_type
==
SLAP
_C_PREPARING
)
{
if
(
c
->
c_type
==
LLOAD
_C_PREPARING
)
{
LDAP_CIRCLEQ_REMOVE
(
&
b
->
b_preparing
,
c
,
c_next
);
b
->
b_opening
--
;
b
->
b_failed
++
;
}
else
if
(
c
->
c_type
==
SLAP
_C_BIND
)
{
}
else
if
(
c
->
c_type
==
LLOAD
_C_BIND
)
{
LDAP_CIRCLEQ_REMOVE
(
&
b
->
b_bindconns
,
c
,
c_next
);
b
->
b_bindavail
--
;
}
else
{
...
...
@@ -800,7 +801,7 @@ upstream_destroy( Connection *c )
*/
assert
(
c
->
c_refcnt
>=
0
);
if
(
c
->
c_refcnt
)
{
c
->
c_state
=
SLAP
_C_CLOSING
;
c
->
c_state
=
LLOAD
_C_CLOSING
;
Debug
(
LDAP_DEBUG_CONNS
,
"upstream_destroy: "
"connid=%lu aborting with refcnt=%d
\n
"
,
c
->
c_connid
,
c
->
c_refcnt
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment