Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
e5a37f21
Commit
e5a37f21
authored
Jun 23, 2004
by
Kurt Zeilenga
Browse files
SLAPD_DISCONNECT v -1 cleanup
misc other cleanup
parent
83476f2d
Changes
8
Hide whitespace changes
Inline
Side-by-side
servers/slapd/abandon.c
View file @
e5a37f21
...
...
@@ -57,9 +57,8 @@ do_abandon( Operation *op, SlapReply *rs )
#else
Debug
(
LDAP_DEBUG_ANY
,
"do_abandon: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
return
-
1
;
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
return
SLAPD_DISCONNECT
;
}
if
(
get_ctrls
(
op
,
rs
,
0
)
!=
LDAP_SUCCESS
)
{
...
...
servers/slapd/add.c
View file @
e5a37f21
...
...
@@ -82,7 +82,7 @@ do_add( Operation *op, SlapReply *rs )
Debug
(
LDAP_DEBUG_ANY
,
"do_add: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
return
-
1
;
return
SLAPD_DISCONNECT
;
}
e
=
(
Entry
*
)
ch_calloc
(
1
,
sizeof
(
Entry
)
);
...
...
@@ -130,7 +130,7 @@ do_add( Operation *op, SlapReply *rs )
Debug
(
LDAP_DEBUG_ANY
,
"do_add: decoding error
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
done
;
}
...
...
@@ -168,7 +168,7 @@ do_add( Operation *op, SlapReply *rs )
Debug
(
LDAP_DEBUG_ANY
,
"do_add: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
done
;
}
...
...
servers/slapd/bind.c
View file @
e5a37f21
...
...
@@ -41,8 +41,7 @@
int
do_bind
(
Operation
*
op
,
SlapReply
*
rs
)
SlapReply
*
rs
)
{
BerElement
*
ber
=
op
->
o_ber
;
ber_int_t
version
;
...
...
@@ -117,7 +116,7 @@ do_bind(
Debug
(
LDAP_DEBUG_ANY
,
"bind: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
cleanup
;
}
...
...
servers/slapd/connection.c
View file @
e5a37f21
...
...
@@ -948,7 +948,7 @@ void connection_done( Connection *c )
static
void
*
connection_operation
(
void
*
ctx
,
void
*
arg_v
)
{
int
rc
=
SLAPD_DISCONNECT
;
int
rc
=
LDAP_OTHER
;
Operation
*
op
=
arg_v
;
SlapReply
rs
=
{
REP_RESULT
};
ber_tag_t
tag
=
op
->
o_tag
;
...
...
@@ -966,6 +966,36 @@ connection_operation( void *ctx, void *arg_v )
op
->
o_threadctx
=
ctx
;
switch
(
tag
)
{
case
LDAP_REQ_BIND
:
case
LDAP_REQ_UNBIND
:
case
LDAP_REQ_ADD
:
case
LDAP_REQ_DELETE
:
case
LDAP_REQ_MODRDN
:
case
LDAP_REQ_MODIFY
:
case
LDAP_REQ_COMPARE
:
case
LDAP_REQ_SEARCH
:
case
LDAP_REQ_ABANDON
:
case
LDAP_REQ_EXTENDED
:
break
;
default:
#ifdef NEW_LOGGING
LDAP_LOG
(
CONNECTION
,
INFO
,
"connection_operation: "
"conn %lu unknown LDAP request 0x%lx
\n
"
,
conn
->
c_connid
,
tag
,
0
);
#else
Debug
(
LDAP_DEBUG_ANY
,
"connection_operation: "
"conn %lu unknown LDAP request 0x%lx
\n
"
,
conn
->
c_connid
,
tag
,
0
);
#endif
op
->
o_tag
=
LBER_ERROR
;
rs
.
sr_err
=
LDAP_PROTOCOL_ERROR
;
rs
.
sr_text
=
"unknown LDAP request"
;
send_ldap_disconnect
(
op
,
&
rs
);
rc
=
SLAPD_DISCONNECT
;
goto
operations_error
;
}
if
(
conn
->
c_sasl_bind_in_progress
&&
tag
!=
LDAP_REQ_BIND
)
{
#ifdef NEW_LOGGING
LDAP_LOG
(
CONNECTION
,
ERR
,
...
...
@@ -978,6 +1008,7 @@ connection_operation( void *ctx, void *arg_v )
#endif
send_ldap_error
(
op
,
&
rs
,
LDAP_OPERATIONS_ERROR
,
"SASL bind in progress"
);
rc
=
LDAP_OPERATIONS_ERROR
;
goto
operations_error
;
}
...
...
@@ -1053,29 +1084,15 @@ connection_operation( void *ctx, void *arg_v )
break
;
default:
#ifdef NEW_LOGGING
LDAP_LOG
(
CONNECTION
,
INFO
,
"connection_operation: conn %lu unknown LDAP request 0x%lx
\n
"
,
conn
->
c_connid
,
tag
,
0
);
#else
Debug
(
LDAP_DEBUG_ANY
,
"unknown LDAP request 0x%lx
\n
"
,
tag
,
0
,
0
);
#endif
op
->
o_tag
=
LBER_ERROR
;
rs
.
sr_err
=
LDAP_PROTOCOL_ERROR
;
rs
.
sr_text
=
"unknown LDAP request"
;
send_ldap_disconnect
(
op
,
&
rs
);
rc
=
-
1
;
break
;
/* not reachable */
assert
(
0
);
}
#ifdef SLAPD_MONITOR
oldtag
=
tag
;
#endif
/* SLAPD_MONITOR */
operations_error:
if
(
rc
==
SLAPD_DISCONNECT
)
tag
=
LBER_ERROR
;
operations_error:
ldap_pvt_thread_mutex_lock
(
&
num_ops_mutex
);
num_ops_completed
++
;
#ifdef SLAPD_MONITOR
switch
(
oldtag
)
{
...
...
@@ -1109,6 +1126,9 @@ operations_error:
case
LDAP_REQ_EXTENDED
:
num_ops_completed_
[
SLAP_OP_EXTENDED
]
++
;
break
;
default:
/* not reachable */
assert
(
0
);
}
#endif
/* SLAPD_MONITOR */
ldap_pvt_thread_mutex_unlock
(
&
num_ops_mutex
);
...
...
@@ -1116,7 +1136,6 @@ operations_error:
if
(
op
->
o_cancel
==
SLAP_CANCEL_REQ
)
{
op
->
o_cancel
=
LDAP_TOO_LATE
;
}
while
(
op
->
o_cancel
!=
SLAP_CANCEL_NONE
&&
op
->
o_cancel
!=
SLAP_CANCEL_DONE
)
{
...
...
@@ -1128,14 +1147,17 @@ operations_error:
ber_set_option
(
op
->
o_ber
,
LBER_OPT_BER_MEMCTX
,
&
memctx_null
);
if
(
op
->
o_cancel
!=
SLAP_CANCEL_ACK
&&
(
op
->
o_sync_mode
&
SLAP_SYNC_PERSIST
)
)
{
(
op
->
o_sync_mode
&
SLAP_SYNC_PERSIST
)
)
{
slap_sl_mem_detach
(
ctx
,
memctx
);
}
else
if
((
op
->
o_sync_slog_size
!=
-
1
))
{
slap_sl_mem_detach
(
ctx
,
memctx
);
LDAP_STAILQ_REMOVE
(
&
conn
->
c_ops
,
op
,
slap_op
,
o_next
);
LDAP_STAILQ_NEXT
(
op
,
o_next
)
=
NULL
;
conn
->
c_n_ops_executing
--
;
conn
->
c_n_ops_completed
++
;
}
else
{
LDAP_STAILQ_REMOVE
(
&
conn
->
c_ops
,
op
,
slap_op
,
o_next
);
LDAP_STAILQ_NEXT
(
op
,
o_next
)
=
NULL
;
...
...
@@ -1161,9 +1183,7 @@ operations_error:
}
connection_resched
(
conn
);
ldap_pvt_thread_mutex_unlock
(
&
conn
->
c_mutex
);
return
NULL
;
}
...
...
@@ -1174,11 +1194,12 @@ int connection_client_setup(
ldap_pvt_thread_start_t
*
func
,
void
*
arg
)
{
int
rc
;
Connection
*
c
;
if
(
connection_init
(
s
,
(
Listener
*
)
&
dummy_list
,
""
,
""
,
CONN_IS_CLIENT
,
0
,
NULL
)
<
0
)
{
return
-
1
;
}
rc
=
connection_init
(
s
,
(
Listener
*
)
&
dummy_list
,
""
,
""
,
CONN_IS_CLIENT
,
0
,
NULL
)
;
if
(
rc
<
0
)
return
-
1
;
c
=
connection_get
(
s
);
c
->
c_clientfunc
=
func
;
...
...
@@ -1190,15 +1211,13 @@ int connection_client_setup(
}
void
connection_client_enable
(
ber_socket_t
s
)
ber_socket_t
s
)
{
slapd_set_read
(
s
,
1
);
}
void
connection_client_stop
(
ber_socket_t
s
)
ber_socket_t
s
)
{
Connection
*
c
;
...
...
servers/slapd/dn.c
View file @
e5a37f21
...
...
@@ -918,6 +918,7 @@ int
dnX509peerNormalize
(
void
*
ssl
,
struct
berval
*
dn
)
{
return
ldap_pvt_tls_get_peer_dn
(
ssl
,
dn
,
(
LDAPDN_rewrite_dummy
*
)
LDAPDN_rewrite
,
0
);
return
ldap_pvt_tls_get_peer_dn
(
ssl
,
dn
,
(
LDAPDN_rewrite_dummy
*
)
LDAPDN_rewrite
,
0
);
}
#endif
servers/slapd/extended.c
View file @
e5a37f21
...
...
@@ -163,7 +163,7 @@ do_extended(
op
->
o_protocol
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"requires LDAPv3"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
done
;
}
...
...
@@ -175,7 +175,7 @@ do_extended(
Debug
(
LDAP_DEBUG_ANY
,
"do_extended: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
done
;
}
...
...
@@ -211,7 +211,7 @@ do_extended(
Debug
(
LDAP_DEBUG_ANY
,
"do_extended: ber_scanf failed
\n
"
,
0
,
0
,
0
);
#endif
send_ldap_discon
(
op
,
rs
,
LDAP_PROTOCOL_ERROR
,
"decoding error"
);
rs
->
sr_err
=
-
1
;
rs
->
sr_err
=
SLAPD_DISCONNECT
;
goto
done
;
}
}
...
...
servers/slapd/result.c
View file @
e5a37f21
...
...
@@ -524,7 +524,6 @@ send_ldap_disconnect( Operation *op, SlapReply *rs )
rs
->
sr_err
,
rs
->
sr_text
?
rs
->
sr_text
:
""
,
NULL
);
#endif
if
(
op
->
o_protocol
<
LDAP_VERSION3
)
{
rs
->
sr_rspoid
=
NULL
;
rs
->
sr_tag
=
req2res
(
op
->
o_tag
);
...
...
@@ -614,11 +613,15 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
*/
if
(
op
->
o_pb
!=
NULL
)
{
slapi_int_pblock_set_operation
(
op
->
o_pb
,
op
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_CODE
,
(
void
*
)
rs
->
sr_err
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_TEXT
,
(
void
*
)
rs
->
sr_text
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_MATCHED
,
(
void
*
)
rs
->
sr_matched
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_CODE
,
(
void
*
)
rs
->
sr_err
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_TEXT
,
(
void
*
)
rs
->
sr_text
);
slapi_pblock_set
(
op
->
o_pb
,
SLAPI_RESULT_MATCHED
,
(
void
*
)
rs
->
sr_matched
);
(
void
)
slapi_int_call_plugins
(
op
->
o_bd
,
SLAPI_PLUGIN_PRE_RESULT_FN
,
op
->
o_pb
);
(
void
)
slapi_int_call_plugins
(
op
->
o_bd
,
SLAPI_PLUGIN_PRE_RESULT_FN
,
op
->
o_pb
);
}
#endif
/* LDAP_SLAPI */
...
...
@@ -949,7 +952,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
#endif
if
(
op
->
o_res_ber
==
NULL
)
ber_free_buf
(
ber
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
goto
error_return
;
}
finish
=
1
;
...
...
@@ -992,7 +996,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
#endif
if
(
op
->
o_res_ber
==
NULL
)
ber_free_buf
(
ber
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
goto
error_return
;
}
}
...
...
@@ -1147,7 +1152,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
#endif
if
(
op
->
o_res_ber
==
NULL
)
ber_free_buf
(
ber
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
send_ldap_error
(
op
,
rs
,
LDAP_OTHER
,
"encoding description error"
);
attrs_free
(
aa
);
goto
error_return
;
}
...
...
@@ -1232,9 +1238,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
for
(
anp
=
rs
->
sr_attrs
;
anp
->
an_name
.
bv_val
!=
NULL
;
anp
++
)
{
rc
=
compute_evaluator
(
&
ctx
,
anp
->
an_name
.
bv_val
,
rs
->
sr_entry
,
slapi_int_compute_output_ber
);
if
(
rc
==
1
)
{
break
;
}
if
(
rc
==
1
)
break
;
}
}
else
{
/*
...
...
servers/slapd/search.c
View file @
e5a37f21
...
...
@@ -47,8 +47,8 @@ static void call_search_postop_plugins( Operation *op );
int
do_search
(
Operation
*
op
,
/* info about the op to which we're responding */
SlapReply
*
rs
/* all the response data we'll send */
)
{
SlapReply
*
rs
/* all the response data we'll send */
)
{
struct
berval
base
=
BER_BVNULL
;
ber_len_t
siz
,
off
,
i
;
int
manageDSAit
;
...
...
@@ -164,6 +164,7 @@ do_search(
if
(
rs
->
sr_err
==
SLAPD_DISCONNECT
)
{
rs
->
sr_err
=
LDAP_PROTOCOL_ERROR
;
send_ldap_disconnect
(
op
,
rs
);
rs
->
sr_err
=
SLAPD_DISCONNECT
;
}
else
{
send_ldap_result
(
op
,
rs
);
}
...
...
@@ -427,19 +428,24 @@ do_search(
#endif
/* LDAP_SLAPI */
return_results:
;
if
(
(
op
->
o_sync_mode
&
SLAP_SYNC_PERSIST
)
)
return
rs
->
sr_err
;
if
(
(
op
->
o_sync_slog_size
!=
-
1
)
)
return
rs
->
sr_err
;
if
(
(
op
->
o_sync_mode
&
SLAP_SYNC_PERSIST
)
)
return
rs
->
sr_err
;
if
(
(
op
->
o_sync_slog_size
!=
-
1
)
)
return
rs
->
sr_err
;
if
(
!
BER_BVISNULL
(
&
op
->
o_req_dn
)
)
slap_sl_free
(
op
->
o_req_dn
.
bv_val
,
op
->
o_tmpmemctx
);
if
(
!
BER_BVISNULL
(
&
op
->
o_req_ndn
)
)
slap_sl_free
(
op
->
o_req_ndn
.
bv_val
,
op
->
o_tmpmemctx
);
if
(
!
BER_BVISNULL
(
&
op
->
o_req_dn
)
)
{
slap_sl_free
(
op
->
o_req_dn
.
bv_val
,
op
->
o_tmpmemctx
);
}
if
(
!
BER_BVISNULL
(
&
op
->
o_req_ndn
)
)
{
slap_sl_free
(
op
->
o_req_ndn
.
bv_val
,
op
->
o_tmpmemctx
);
}
if
(
!
BER_BVISNULL
(
&
op
->
ors_filterstr
)
)
op
->
o_tmpfree
(
op
->
ors_filterstr
.
bv_val
,
op
->
o_tmpmemctx
);
if
(
!
BER_BVISNULL
(
&
op
->
ors_filterstr
)
)
{
op
->
o_tmpfree
(
op
->
ors_filterstr
.
bv_val
,
op
->
o_tmpmemctx
);
}
if
(
op
->
ors_filter
!=
NULL
)
filter_free_x
(
op
,
op
->
ors_filter
);
if
(
op
->
ors_attrs
!=
NULL
)
op
->
o_tmpfree
(
op
->
ors_attrs
,
op
->
o_tmpmemctx
);
if
(
op
->
ors_attrs
!=
NULL
)
{
op
->
o_tmpfree
(
op
->
ors_attrs
,
op
->
o_tmpmemctx
);
}
#ifdef LDAP_SLAPI
if
(
attrs
!=
NULL
)
op
->
o_tmpfree
(
attrs
,
op
->
o_tmpmemctx
);
#endif
/* LDAP_SLAPI */
...
...
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