From: tbordaz Date: Tue, 27 Apr 2021 07:29:32 +0000 (+0200) Subject: [PATCH] Issue 4711 - SIGSEV with sync_repl (#4738) X-Git-Tag: archive/raspbian/1.4.4.11-2+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b7f96c2fced4e2950324e856905dce197c1ffb17;p=389-ds-base.git [PATCH] Issue 4711 - SIGSEV with sync_repl (#4738) 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: https://github.com/389ds/389-ds-base/issues/4711 Reviewed by: Pierre Rogier, James Chapman, William Brown (Thanks!) Platforms tested: F33 Gbp-Pq: Name 4711-SIGSEV-with-sync_repl-4738.patch --- diff --git a/ldap/servers/plugins/sync/sync_util.c b/ldap/servers/plugins/sync/sync_util.c index dc7f49f..d84705a 100644 --- a/ldap/servers/plugins/sync/sync_util.c +++ b/ldap/servers/plugins/sync/sync_util.c @@ -165,8 +165,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); @@ -191,6 +191,14 @@ sync_create_state_control(Slapi_Entry *e, LDAPControl **ctrlp, int type, Sync_Co } else { 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)); }