Skip to content

Commit

Permalink
Issue 5704 - crash in sync_refresh_initial_content (#5720)
Browse files Browse the repository at this point in the history
Bug description:
	If the last record of the changelog is not accessible
	then the session record is NULL. It crashes the server
	when it is dereferenced.
	I failed to reproduce it, including disabling/removing
	'cn=changelog' backend/mapping tree. So I guess it
	happens during rare dynamic.

Fix description:
	Return a failure when the session cookie is not
	initialized

relates: #5704

Reviewed by: Mark Reynolds (Thanks)
  • Loading branch information
tbordaz committed May 9, 2023
1 parent 92e456c commit 55640d8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ldap/servers/plugins/sync/sync_refresh.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,22 @@ sync_srch_refresh_pre_search(Slapi_PBlock *pb)
* consumer.
*/
session_cookie = sync_cookie_create(pb, client_cookie);
PR_ASSERT(session_cookie);
if (session_cookie == NULL) {
/* In some rare case access to the retroCL fails.
* It can happen when retroCL is just created and
* does not contain any record.
* As we are not able to retrieve the last changenumber
* just return a failure.
* Another option would be to set cookie_change_info=0
* if we can not retrieve any record in retroCL
* (in sync_cookie_create)
*/
slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
"sync_srch_refresh_pre_search - fails to create a session cookie\n");
rc = LDAP_OPERATIONS_ERROR;
sync_result_err(pb, rc, "Unable to create a session cookie: last changelog record unreachable");
goto error_return;
}
/*
* if mode is persist we need to setup the persit handler
* to catch the mods while the refresh is done
Expand Down

0 comments on commit 55640d8

Please sign in to comment.