mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s4/ldap: Fix nested searches SEGFAULT bug
Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
e3d50e89ab
commit
a4d0ed5a10
@ -278,6 +278,13 @@ static void ildb_callback(struct ldap_request *req)
|
||||
break;
|
||||
|
||||
case LDAP_TAG_SearchRequest:
|
||||
/* check if we are already processing this request */
|
||||
if (req->in_dispatch_replies) {
|
||||
return;
|
||||
}
|
||||
|
||||
req->in_dispatch_replies = true;
|
||||
|
||||
/* loop over all messages */
|
||||
for (i = 0; i < req->num_replies; i++) {
|
||||
|
||||
@ -327,6 +334,7 @@ static void ildb_callback(struct ldap_request *req)
|
||||
if (ret != LDB_SUCCESS) {
|
||||
callback_failed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LDAP_TAG_SearchResultReference:
|
||||
@ -337,6 +345,7 @@ static void ildb_callback(struct ldap_request *req)
|
||||
if (ret != LDB_SUCCESS) {
|
||||
callback_failed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -350,6 +359,8 @@ static void ildb_callback(struct ldap_request *req)
|
||||
}
|
||||
}
|
||||
|
||||
req->in_dispatch_replies = false;
|
||||
|
||||
talloc_free(req->replies);
|
||||
req->replies = NULL;
|
||||
req->num_replies = 0;
|
||||
|
@ -37,6 +37,10 @@ struct ldap_request {
|
||||
int num_replies;
|
||||
struct ldap_message **replies;
|
||||
|
||||
/* mark while we are processing replies
|
||||
* in request of type LDAP_TAG_SearchRequest */
|
||||
bool in_dispatch_replies;
|
||||
|
||||
NTSTATUS status;
|
||||
DATA_BLOB data;
|
||||
struct {
|
||||
|
Loading…
Reference in New Issue
Block a user