Skip to content

Commit

Permalink
Issue 4711 - SIGSEV with sync_repl (#4738)
Browse files Browse the repository at this point in the history
Bug description:
	sync_repl sends back entries identified with a unique
	identifier that is 'nsuniqueid'. If 'nsuniqueid' is
	missing, then it may crash

Fix description:
	Check a nsuniqueid is available else returns OP_ERR

relates: #4711

Reviewed by: Pierre Rogier, James Chapman, William Brown (Thanks!)

Platforms tested:  F33
  • Loading branch information
tbordaz authored and mreynolds389 committed May 14, 2021
1 parent 39891cd commit 0bdc258
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ldap/servers/plugins/sync/sync_util.c
Expand Up @@ -126,8 +126,8 @@ sync_create_state_control(Slapi_Entry *e, LDAPControl **ctrlp, int type, Sync_Co
BerElement *ber;
struct berval *bvp;
char *uuid;
Slapi_Attr *attr;
Slapi_Value *val;
Slapi_Attr *attr = NULL;
Slapi_Value *val = NULL;

if (type == LDAP_SYNC_NONE || ctrlp == NULL || (ber = der_alloc()) == NULL) {
return (LDAP_OPERATIONS_ERROR);
Expand All @@ -137,6 +137,14 @@ sync_create_state_control(Slapi_Entry *e, LDAPControl **ctrlp, int type, Sync_Co

slapi_entry_attr_find(e, SLAPI_ATTR_UNIQUEID, &attr);
slapi_attr_first_value(attr, &val);
if ((attr == NULL) || (val == NULL)) {
/* It may happen with entries in special backends
* such like cn=config, cn=shema, cn=monitor...
*/
slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
"sync_create_state_control - Entries are missing nsuniqueid. Unable to proceed.\n");
return (LDAP_OPERATIONS_ERROR);
}
uuid = sync_nsuniqueid2uuid(slapi_value_get_string(val));
if ((rc = ber_printf(ber, "{eo", type, uuid, 16)) != -1) {
if (cookie) {
Expand Down

0 comments on commit 0bdc258

Please sign in to comment.