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
8bc7650a
Commit
8bc7650a
authored
Dec 18, 2017
by
Nadezhda Ivanova
Committed by
Ondřej Kuzník
Nov 17, 2020
Browse files
Clean ups and renames to coexist with slapd
parent
c7e3437e
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
servers/lloadd/backend.c
View file @
8bc7650a
...
...
@@ -25,13 +25,13 @@
#include
<event2/dns.h>
#include
"lutil.h"
#include
"
slap
.h"
#include
"
lload
.h"
static
void
upstream_connect_cb
(
evutil_socket_t
s
,
short
what
,
void
*
arg
)
{
PendingConnection
*
conn
=
arg
;
Backend
*
b
=
conn
->
backend
;
Lload
PendingConnection
*
conn
=
arg
;
Lload
Backend
*
b
=
conn
->
backend
;
int
error
=
0
,
rc
=
-
1
;
ldap_pvt_thread_mutex_lock
(
&
b
->
b_mutex
);
...
...
@@ -89,7 +89,7 @@ done:
static
void
upstream_name_cb
(
int
result
,
struct
evutil_addrinfo
*
res
,
void
*
arg
)
{
Backend
*
b
=
arg
;
Lload
Backend
*
b
=
arg
;
ber_socket_t
s
=
AC_SOCKET_INVALID
;
int
rc
;
...
...
@@ -123,7 +123,7 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
}
/* Asynchronous connect */
if
(
rc
)
{
PendingConnection
*
conn
;
Lload
PendingConnection
*
conn
;
if
(
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
{
Debug
(
LDAP_DEBUG_ANY
,
"upstream_name_cb: "
...
...
@@ -133,12 +133,12 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
goto
fail
;
}
conn
=
ch_calloc
(
1
,
sizeof
(
PendingConnection
)
);
conn
=
ch_calloc
(
1
,
sizeof
(
Lload
PendingConnection
)
);
LDAP_LIST_ENTRY_INIT
(
conn
,
next
);
conn
->
backend
=
b
;
conn
->
fd
=
s
;
conn
->
event
=
event_new
(
slap
_get_base
(
s
),
s
,
EV_WRITE
|
EV_PERSIST
,
conn
->
event
=
event_new
(
lload
_get_base
(
s
),
s
,
EV_WRITE
|
EV_PERSIST
,
upstream_connect_cb
,
conn
);
if
(
!
conn
->
event
)
{
Debug
(
LDAP_DEBUG_ANY
,
"upstream_name_cb: "
...
...
@@ -175,10 +175,10 @@ fail:
}
}
Connection
*
backend_select
(
Operation
*
op
)
Lload
Connection
*
backend_select
(
Lload
Operation
*
op
)
{
Backend
*
b
,
*
first
,
*
next
;
Lload
Backend
*
b
,
*
first
,
*
next
;
ldap_pvt_thread_mutex_lock
(
&
backend_mutex
);
first
=
b
=
current_backend
;
...
...
@@ -191,8 +191,8 @@ backend_select( Operation *op )
/* TODO: Two runs, one with trylock, then one actually locked if we don't
* find anything? */
do
{
struct
ConnSt
*
head
;
Connection
*
c
;
lload_c_head
*
head
;
Lload
Connection
*
c
;
ldap_pvt_thread_mutex_lock
(
&
b
->
b_mutex
);
next
=
LDAP_CIRCLEQ_LOOP_NEXT
(
&
backend
,
b
,
b_next
);
...
...
@@ -257,7 +257,7 @@ backend_select( Operation *op )
}
void
backend_retry
(
Backend
*
b
)
backend_retry
(
Lload
Backend
*
b
)
{
int
rc
,
requested
;
...
...
@@ -314,7 +314,7 @@ void
backend_connect
(
evutil_socket_t
s
,
short
what
,
void
*
arg
)
{
struct
evutil_addrinfo
hints
=
{};
Backend
*
b
=
arg
;
Lload
Backend
*
b
=
arg
;
char
*
hostname
;
if
(
slapd_shutdown
)
{
...
...
@@ -357,19 +357,19 @@ backend_connect( evutil_socket_t s, short what, void *arg )
s
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
struct
sockaddr_un
)
);
/* Asynchronous connect */
if
(
rc
)
{
PendingConnection
*
conn
;
Lload
PendingConnection
*
conn
;
if
(
errno
!=
EINPROGRESS
&&
errno
!=
EWOULDBLOCK
)
{
evutil_closesocket
(
s
);
goto
fail
;
}
conn
=
ch_calloc
(
1
,
sizeof
(
PendingConnection
)
);
conn
=
ch_calloc
(
1
,
sizeof
(
Lload
PendingConnection
)
);
LDAP_LIST_ENTRY_INIT
(
conn
,
next
);
conn
->
backend
=
b
;
conn
->
fd
=
s
;
conn
->
event
=
event_new
(
slap
_get_base
(
s
),
s
,
conn
->
event
=
event_new
(
lload
_get_base
(
s
),
s
,
EV_WRITE
|
EV_PERSIST
,
upstream_connect_cb
,
conn
);
if
(
!
conn
->
event
)
{
Debug
(
LDAP_DEBUG_ANY
,
"backend_connect: "
...
...
@@ -423,14 +423,15 @@ void
backends_destroy
(
void
)
{
while
(
!
LDAP_CIRCLEQ_EMPTY
(
&
backend
)
)
{
Backend
*
b
=
LDAP_CIRCLEQ_FIRST
(
&
backend
);
Lload
Backend
*
b
=
LDAP_CIRCLEQ_FIRST
(
&
backend
);
Debug
(
LDAP_DEBUG_CONNS
,
"backends_destroy: "
"destroying backend uri='%s', numconns=%d, numbindconns=%d
\n
"
,
b
->
b_uri
.
bv_val
,
b
->
b_numconns
,
b
->
b_numbindconns
);
while
(
!
LDAP_LIST_EMPTY
(
&
b
->
b_connecting
)
)
{
PendingConnection
*
pending
=
LDAP_LIST_FIRST
(
&
b
->
b_connecting
);
LloadPendingConnection
*
pending
=
LDAP_LIST_FIRST
(
&
b
->
b_connecting
);
Debug
(
LDAP_DEBUG_CONNS
,
"backends_destroy: "
"destroying socket pending connect() fd=%d
\n
"
,
...
...
@@ -442,7 +443,7 @@ backends_destroy( void )
ch_free
(
pending
);
}
while
(
!
LDAP_CIRCLEQ_EMPTY
(
&
b
->
b_preparing
)
)
{
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_preparing
);
Lload
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_preparing
);
CONNECTION_LOCK
(
c
);
Debug
(
LDAP_DEBUG_CONNS
,
"backends_destroy: "
...
...
@@ -453,7 +454,7 @@ backends_destroy( void )
CONNECTION_DESTROY
(
c
);
}
while
(
!
LDAP_CIRCLEQ_EMPTY
(
&
b
->
b_bindconns
)
)
{
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_bindconns
);
Lload
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_bindconns
);
CONNECTION_LOCK
(
c
);
Debug
(
LDAP_DEBUG_CONNS
,
"backends_destroy: "
...
...
@@ -464,7 +465,7 @@ backends_destroy( void )
CONNECTION_DESTROY
(
c
);
}
while
(
!
LDAP_CIRCLEQ_EMPTY
(
&
b
->
b_conns
)
)
{
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_conns
);
Lload
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
b
->
b_conns
);
CONNECTION_LOCK
(
c
);
Debug
(
LDAP_DEBUG_CONNS
,
"backends_destroy: "
...
...
servers/lloadd/bind.c
View file @
8bc7650a
...
...
@@ -22,16 +22,16 @@
#include
<ac/unistd.h>
#include
"lutil.h"
#include
"
slap
.h"
#include
"
lload
.h"
/*
* On entering the function, we've put a reference on both connections and hold
* upstream's c_io_mutex.
*/
static
int
client_bind
(
Operation
*
op
)
client_bind
(
Lload
Operation
*
op
)
{
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
Lload
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
BerElement
*
ber
,
*
copy
=
NULL
;
BerValue
binddn
;
ber_tag_t
tag
;
...
...
@@ -130,9 +130,9 @@ fail:
* upstream's c_io_mutex.
*/
static
int
client_bind_as_vc
(
Operation
*
op
)
client_bind_as_vc
(
Lload
Operation
*
op
)
{
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
Lload
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
BerElement
*
ber
,
*
request
,
*
copy
=
NULL
;
BerValue
binddn
,
auth
,
mech
;
char
*
msg
=
"internal error"
;
...
...
@@ -260,9 +260,9 @@ fail:
#endif
/* LDAP_API_FEATURE_VERIFY_CREDENTIALS */
int
request_bind
(
Connection
*
client
,
Operation
*
op
)
request_bind
(
Lload
Connection
*
client
,
Lload
Operation
*
op
)
{
Connection
*
upstream
;
Lload
Connection
*
upstream
;
int
rc
=
LDAP_SUCCESS
;
/* protect the Bind operation */
...
...
@@ -334,9 +334,9 @@ request_bind( Connection *client, Operation *op )
}
int
handle_bind_response
(
Operation
*
op
,
BerElement
*
ber
)
handle_bind_response
(
Lload
Operation
*
op
,
BerElement
*
ber
)
{
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
Lload
Connection
*
client
=
op
->
o_client
,
*
upstream
=
op
->
o_upstream
;
BerValue
response
;
BerElement
*
copy
;
ber_int_t
result
;
...
...
@@ -413,9 +413,9 @@ done:
#ifdef LDAP_API_FEATURE_VERIFY_CREDENTIALS
int
handle_vc_bind_response
(
Operation
*
op
,
BerElement
*
ber
)
handle_vc_bind_response
(
Lload
Operation
*
op
,
BerElement
*
ber
)
{
Connection
*
c
=
op
->
o_client
;
Lload
Connection
*
c
=
op
->
o_client
;
BerElement
*
output
;
BerValue
matched
,
diagmsg
,
creds
=
BER_BVNULL
,
controls
=
BER_BVNULL
;
ber_int_t
result
;
...
...
@@ -432,11 +432,11 @@ handle_vc_bind_response( Operation *op, BerElement *ber )
tag
=
ber_peek_tag
(
ber
,
&
len
);
if
(
result
==
LDAP_PROTOCOL_ERROR
)
{
Connection
*
upstream
=
op
->
o_upstream
;
Backend
*
b
;
Lload
Connection
*
upstream
=
op
->
o_upstream
;
Lload
Backend
*
b
;
CONNECTION_LOCK
(
upstream
);
b
=
(
Backend
*
)
upstream
->
c_private
;
b
=
(
Lload
Backend
*
)
upstream
->
c_private
;
Debug
(
LDAP_DEBUG_ANY
,
"handle_vc_bind_response: "
"VC extended operation not supported on backend %s
\n
"
,
b
->
b_uri
.
bv_val
);
...
...
servers/lloadd/client.c
View file @
8bc7650a
...
...
@@ -22,16 +22,16 @@
#include
<ac/unistd.h>
#include
"lutil.h"
#include
"
slap
.h"
#include
"
lload
.h"
slap
_c_head
clients
=
LDAP_CIRCLEQ_HEAD_INITIALIZER
(
clients
);
lload
_c_head
clients
=
LDAP_CIRCLEQ_HEAD_INITIALIZER
(
clients
);
ldap_pvt_thread_mutex_t
clients_mutex
;
int
request_abandon
(
Connection
*
c
,
Operation
*
op
)
request_abandon
(
Lload
Connection
*
c
,
Lload
Operation
*
op
)
{
Operation
*
request
,
needle
=
{
.
o_client_connid
=
c
->
c_connid
};
Lload
Operation
*
request
,
needle
=
{
.
o_client_connid
=
c
->
c_connid
};
int
rc
=
LDAP_SUCCESS
;
if
(
ber_decode_int
(
&
op
->
o_request
,
&
needle
.
o_client_msgid
)
)
{
...
...
@@ -61,8 +61,8 @@ request_abandon( Connection *c, Operation *op )
}
Debug
(
LDAP_DEBUG_STATS
,
"request_abandon: "
"connid=%lu msgid=%d abandoning %s msgid=%d
\n
"
,
c
->
c_connid
,
op
->
o_client_msgid
,
slap_msgtype2str
(
request
->
o_tag
),
needle
.
o_client_msgid
);
c
->
c_connid
,
op
->
o_client_msgid
,
lload_msgtype2str
(
request
->
o_tag
),
needle
.
o_client_msgid
);
if
(
c
->
c_state
==
LLOAD_C_BINDING
)
{
/* We have found the request and we are binding, it must be a bind
...
...
@@ -81,10 +81,10 @@ done:
}
int
request_process
(
Connection
*
client
,
Operation
*
op
)
request_process
(
Lload
Connection
*
client
,
Lload
Operation
*
op
)
{
BerElement
*
output
;
Connection
*
upstream
;
Lload
Connection
*
upstream
;
ber_int_t
msgid
;
int
rc
=
LDAP_SUCCESS
;
...
...
@@ -120,7 +120,7 @@ request_process( Connection *client, Operation *op )
Debug
(
LDAP_DEBUG_TRACE
,
"request_process: "
"client connid=%lu added %s msgid=%d to upstream connid=%lu as "
"msgid=%d
\n
"
,
op
->
o_client_connid
,
slap
_msgtype2str
(
op
->
o_tag
),
op
->
o_client_connid
,
lload
_msgtype2str
(
op
->
o_tag
),
op
->
o_client_msgid
,
op
->
o_upstream_connid
,
op
->
o_upstream_msgid
);
assert
(
rc
==
LDAP_SUCCESS
);
...
...
@@ -163,12 +163,12 @@ request_process( Connection *client, Operation *op )
fail:
if
(
upstream
)
{
Backend
*
b
;
Lload
Backend
*
b
;
ldap_pvt_thread_mutex_unlock
(
&
upstream
->
c_io_mutex
);
CONNECTION_LOCK_DECREF
(
upstream
);
upstream
->
c_n_ops_executing
--
;
b
=
(
Backend
*
)
upstream
->
c_private
;
b
=
(
Lload
Backend
*
)
upstream
->
c_private
;
CONNECTION_UNLOCK_OR_DESTROY
(
upstream
);
ldap_pvt_thread_mutex_lock
(
&
b
->
b_mutex
);
...
...
@@ -187,10 +187,10 @@ fail:
}
int
handle_one_request
(
Connection
*
c
)
handle_one_request
(
Lload
Connection
*
c
)
{
BerElement
*
ber
;
Operation
*
op
=
NULL
;
Lload
Operation
*
op
=
NULL
;
RequestHandler
handler
=
NULL
;
ber
=
c
->
c_currentber
;
...
...
@@ -244,7 +244,7 @@ handle_one_request( Connection *c )
void
client_tls_handshake_cb
(
evutil_socket_t
s
,
short
what
,
void
*
arg
)
{
Connection
*
c
=
arg
;
Lload
Connection
*
c
=
arg
;
int
rc
=
0
;
CONNECTION_LOCK_DECREF
(
c
);
...
...
@@ -283,7 +283,7 @@ client_tls_handshake_cb( evutil_socket_t s, short what, void *arg )
}
ldap_pvt_thread_mutex_unlock
(
&
c
->
c_io_mutex
);
rc
=
ldap_pvt_tls_accept
(
c
->
c_sb
,
slap
_tls_ctx
);
rc
=
ldap_pvt_tls_accept
(
c
->
c_sb
,
lload
_tls_ctx
);
if
(
rc
<
0
)
{
goto
fail
;
}
...
...
@@ -332,22 +332,22 @@ fail:
CONNECTION_DESTROY
(
c
);
}
Connection
*
Lload
Connection
*
client_init
(
ber_socket_t
s
,
Listener
*
listener
,
Lload
Listener
*
listener
,
const
char
*
peername
,
struct
event_base
*
base
,
int
flags
)
{
Connection
*
c
;
Lload
Connection
*
c
;
struct
event
*
event
;
event_callback_fn
read_cb
=
connection_read_cb
,
write_cb
=
connection_write_cb
;
assert
(
listener
!=
NULL
);
if
(
(
c
=
connection_init
(
s
,
peername
,
flags
))
==
NULL
)
{
if
(
(
c
=
lload_
connection_init
(
s
,
peername
,
flags
)
)
==
NULL
)
{
return
NULL
;
}
...
...
@@ -363,7 +363,7 @@ client_init(
c
->
c_is_tls
=
LLOAD_LDAPS
;
rc
=
ldap_pvt_tls_accept
(
c
->
c_sb
,
slap
_tls_ctx
);
rc
=
ldap_pvt_tls_accept
(
c
->
c_sb
,
lload
_tls_ctx
);
if
(
rc
<
0
)
{
Debug
(
LDAP_DEBUG_CONNS
,
"client_init: "
"connid=%lu failed initial TLS accept rc=%d
\n
"
,
...
...
@@ -426,7 +426,7 @@ fail:
}
void
client_reset
(
Connection
*
c
)
client_reset
(
Lload
Connection
*
c
)
{
TAvlnode
*
root
;
...
...
@@ -439,7 +439,7 @@ client_reset( Connection *c )
if
(
root
)
{
TAvlnode
*
node
=
tavl_end
(
root
,
TAVL_DIR_LEFT
);
do
{
Operation
*
op
=
node
->
avl_data
;
Lload
Operation
*
op
=
node
->
avl_data
;
/* make sure it's useable after we've unlocked the connection */
op
->
o_client_refcnt
++
;
...
...
@@ -468,7 +468,7 @@ client_reset( Connection *c )
}
void
client_destroy
(
Connection
*
c
)
client_destroy
(
Lload
Connection
*
c
)
{
enum
sc_state
state
;
struct
event
*
read_event
,
*
write_event
;
...
...
@@ -547,7 +547,7 @@ clients_destroy( void )
{
ldap_pvt_thread_mutex_lock
(
&
clients_mutex
);
while
(
!
LDAP_CIRCLEQ_EMPTY
(
&
clients
)
)
{
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
clients
);
Lload
Connection
*
c
=
LDAP_CIRCLEQ_FIRST
(
&
clients
);
ldap_pvt_thread_mutex_unlock
(
&
clients_mutex
);
CONNECTION_LOCK
(
c
);
...
...
servers/lloadd/config.c
View file @
8bc7650a
This diff is collapsed.
Click to expand it.
servers/lloadd/config.h
View file @
8bc7650a
...
...
@@ -128,19 +128,19 @@ typedef struct config_args_s {
#define value_string values.v_string
#define value_bv values.v_bv
int
config_fp_parse_line
(
ConfigArgs
*
c
);
int
lload_
config_fp_parse_line
(
ConfigArgs
*
c
);
int
config_
s
et_vals
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
int
config_add_vals
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
int
lload_
config_
g
et_vals
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
int
lload_
config_add_vals
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
int
config_push_cleanup
(
ConfigArgs
*
c
,
ConfigDriver
*
cleanup
);
void
init_config_argv
(
ConfigArgs
*
c
);
int
read_config_file
(
const
char
*
fname
,
int
depth
,
ConfigArgs
*
cf
,
ConfigTable
*
cft
);
void
lload_
init_config_argv
(
ConfigArgs
*
c
);
int
lload_
read_config_file
(
const
char
*
fname
,
int
depth
,
ConfigArgs
*
cf
,
ConfigTable
*
cft
);
ConfigTable
*
config_find_keyword
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
ConfigTable
*
lload_
config_find_keyword
(
ConfigTable
*
ct
,
ConfigArgs
*
c
);
Listener
*
config_check_my_url
(
const
char
*
url
,
LDAPURLDesc
*
lud
);
Lload
Listener
*
lload_
config_check_my_url
(
const
char
*
url
,
LDAPURLDesc
*
lud
);
LDAP_END_DECL
...
...
servers/lloadd/connection.c
View file @
8bc7650a
...
...
@@ -37,13 +37,13 @@
#include
<ac/unistd.h>
#include
"lutil.h"
#include
"
slap
.h"
#include
"
lload
.h"
static
ldap_pvt_thread_mutex_t
conn_nextid_mutex
;
static
unsigned
long
conn_nextid
=
0
;
static
void
connection_assign_nextid
(
Connection
*
conn
)
lload_
connection_assign_nextid
(
Lload
Connection
*
conn
)
{
ldap_pvt_thread_mutex_lock
(
&
conn_nextid_mutex
);
conn
->
c_connid
=
conn_nextid
++
;
...
...
@@ -55,7 +55,7 @@ connection_assign_nextid( Connection *conn )
* received.
*
* We run c->c_pdu_cb for each pdu, stopping once we hit an error, have to wait
* on reading or after we process
slap
_conn_max_pdus_per_cycle pdus so as to
* on reading or after we process
lload
_conn_max_pdus_per_cycle pdus so as to
* maintain fairness and not hog the worker thread forever.
*
* If we've run out of pdus immediately available from the stream or hit the
...
...
@@ -69,7 +69,7 @@ connection_assign_nextid( Connection *conn )
static
void
*
handle_pdus
(
void
*
ctx
,
void
*
arg
)
{
Connection
*
c
=
arg
;
Lload
Connection
*
c
=
arg
;
int
pdus_handled
=
0
;
CONNECTION_LOCK_DECREF
(
c
);
...
...
@@ -87,7 +87,7 @@ handle_pdus( void *ctx, void *arg )
}
/* Otherwise, handle_one_request leaves the connection locked */
if
(
++
pdus_handled
>=
slap
_conn_max_pdus_per_cycle
)
{
if
(
++
pdus_handled
>=
lload
_conn_max_pdus_per_cycle
)
{
/* Do not read now, re-enable read event instead */
break
;
}
...
...
@@ -146,7 +146,7 @@ handle_pdus( void *ctx, void *arg )
void
connection_read_cb
(
evutil_socket_t
s
,
short
what
,
void
*
arg
)
{
Connection
*
c
=
arg
;
Lload
Connection
*
c
=
arg
;
BerElement
*
ber
;
ber_tag_t
tag
;
ber_len_t
len
;
...
...
@@ -219,7 +219,7 @@ connection_read_cb( evutil_socket_t s, short what, void *arg )
return
;
}
if
(
!
slap
_conn_max_pdus_per_cycle
||
if
(
!
lload
_conn_max_pdus_per_cycle
||
ldap_pvt_thread_pool_submit
(
&
connection_pool
,
handle_pdus
,
c
)
)
{
/* If we're overloaded or configured as such, process one and resume in
* the next cycle.
...
...
@@ -247,7 +247,7 @@ connection_read_cb( evutil_socket_t s, short what, void *arg )
void
connection_write_cb
(
evutil_socket_t
s
,
short
what
,
void
*
arg
)
{
Connection
*
c
=
arg
;
Lload
Connection
*
c
=
arg
;
CONNECTION_LOCK
(
c
);
if
(
!
c
->
c_live
)
{
...
...
@@ -296,7 +296,7 @@ connection_write_cb( evutil_socket_t s, short what, void *arg )
}
void
connection_destroy
(
Connection
*
c
)
connection_destroy
(
Lload
Connection
*
c
)
{
assert
(
c
);
Debug
(
LDAP_DEBUG_CONNS
,
"connection_destroy: "
...
...
@@ -328,15 +328,15 @@ connection_destroy( Connection *c )
listeners_reactivate
();
}
Connection
*
connection_init
(
ber_socket_t
s
,
const
char
*
peername
,
int
flags
)
Lload
Connection
*
lload_
connection_init
(
ber_socket_t
s
,
const
char
*
peername
,
int
flags
)
{
Connection
*
c
;
Lload
Connection
*
c
;
assert
(
peername
!=
NULL
);
if
(
s
==
AC_SOCKET_INVALID
)
{
Debug
(
LDAP_DEBUG_ANY
,
"connection_init: "
Debug
(
LDAP_DEBUG_ANY
,
"
lload_
connection_init: "
"init of socket fd=%ld invalid
\n
"
,
(
long
)
s
);
return
NULL
;
...
...
@@ -344,7 +344,7 @@ connection_init( ber_socket_t s, const char *peername, int flags )
assert
(
s
>=
0
);
c
=
ch_calloc
(
1
,
sizeof
(
Connection
)
);
c
=
ch_calloc
(
1
,
sizeof
(
Lload
Connection
)
);
c
->
c_fd
=
s
;
c
->
c_sb
=
ber_sockbuf_alloc
();
...
...
@@ -383,9 +383,9 @@ connection_init( ber_socket_t s, const char *peername, int flags )
ldap_pvt_thread_mutex_init
(
&
c
->
c_mutex
);
ldap_pvt_thread_mutex_init
(
&
c
->
c_io_mutex
);
connection_assign_nextid
(
c
);
lload_
connection_assign_nextid
(
c
);
Debug
(
LDAP_DEBUG_CONNS
,
"connection_init: "
Debug
(
LDAP_DEBUG_CONNS
,
"
lload_
connection_init: "
"connection connid=%lu allocated for socket fd=%d peername=%s
\n
"
,
c
->
c_connid
,
s
,
peername
);
...
...
servers/lloadd/daemon.c
View file @
8bc7650a
This diff is collapsed.
Click to expand it.
servers/lloadd/extended.c
View file @
8bc7650a
...
...
@@ -18,12 +18,15 @@
#include
<ac/string.h>
#include
"lutil.h"
#include
"
slap
.h"
#include
"
lload
.h"
Avlnode
*
lload_exop_handlers
=
NULL
;
void
*
lload_tls_ctx
;
LDAP
*
lload_tls_ld
,
*
lload_tls_backend_ld
;
int
handle_starttls
(
Connection
*
c
,
Operation
*
op
)
handle_starttls
(
Lload
Connection
*
c
,
Lload
Operation
*
op
)
{
struct
event_base
*
base
=
event_get_base
(
c
->
c_read_event
);
BerElement
*
output
;
...
...
@@ -41,7 +44,7 @@ handle_starttls( Connection *c, Operation *op )
}
else
if
(
c
->
c_ops
)
{
rc
=
LDAP_OPERATIONS_ERROR
;
msg
=
"cannot start TLS when operations are outstanding"
;
}
else
if
(
!
slap
_tls_ctx
)
{
}
else
if
(
!
lload
_tls_ctx
)
{
rc
=
LDAP_UNAVAILABLE
;
msg
=
"Could not initialize TLS"
;
}
...
...
@@ -100,7 +103,7 @@ handle_starttls( Connection *c, Operation *op )
}
int
request_extended
(
Connection
*
c
,
Operation
*
op
)
request_extended
(
Lload
Connection
*
c
,
Lload
Operation
*
op
)
{
ExopHandler
*
handler
,
needle
=
{};
BerElement
*
copy
;
...
...
servers/lloadd/init.c
View file @
8bc7650a
...
...
@@ -32,7 +32,7 @@
#include
<ac/string.h>
#include
<ac/time.h>
#include
"
slap
.h"
#include
"
lload
.h"
#include
"lber_pvt.h"
#include
"ldap_rq.h"
...
...
@@ -61,11 +61,11 @@ int connection_pool_max = SLAP_MAX_WORKER_THREADS;
int
connection_pool_queues
=
1
;
int
slap_tool_thread_max
=
1
;
static
const
char
*
slap
_name
=
NULL
;
static
const
char
*
lload
_name
=
NULL
;
int
slapMode
=
SLAP_UNDEFINED_MODE
;
int
slap
_init
(
int
mode
,
const
char
*
name
)
lload
_init
(
int
mode
,
const
char
*
name
)
{
int
rc
=
LDAP_SUCCESS
;
...
...
@@ -89,7 +89,7 @@ slap_init( int mode, const char *name )
"initiated server.
\n
"
,
name
);
slap
_name
=
name
;
lload
_name
=
name
;
ldap_pvt_thread_pool_init_q
(
&
connection_pool
,
connection_pool_max
,
0
,
connection_pool_queues
);
...
...
@@ -119,13 +119,13 @@ slap_init( int mode, const char *name )
}
int
slap
_destroy
(
void
)
lload
_destroy
(
void
)
{
int
rc
=
LDAP_SUCCESS
;
Debug
(
LDAP_DEBUG_TRACE
,
"%s destroy: "