From 488fa1229f0f0b80cbe43f2e52c2e2b3aaefe188 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Aug 21 2014 23:03:14 +0000 Subject: Bug 1129660 - Adding users to user group throws Internal server error. Description: 389-ds-base-1.2.11 branch did not have the commit a71633d56951dd6c4d0368c790b85628f1598968 (Ticket #47313 - Indexed search with filter containing '&' and "!" with attribute subtypes gives wrong result). This patch backporting just the NULL idl checking in idl_common.c from the commit to the 389-ds-base-1.2.11 branch. https://bugzilla.redhat.com/show_bug.cgi?id=1129660 Reviewed by nkinder@redhat.com (Thank you, Nathan!!) --- diff --git a/ldap/servers/slapd/back-ldbm/idl_common.c b/ldap/servers/slapd/back-ldbm/idl_common.c index 216bfb0..efac186 100644 --- a/ldap/servers/slapd/back-ldbm/idl_common.c +++ b/ldap/servers/slapd/back-ldbm/idl_common.c @@ -46,16 +46,25 @@ size_t idl_sizeof(IDList *idl) { + if (NULL == idl) { + return 0; + } return (2 + idl->b_nmax) * sizeof(ID); } NIDS idl_length(IDList *idl) { + if (NULL == idl) { + return 0; + } return (idl->b_nmax == ALLIDSBLOCK) ? UINT_MAX : idl->b_nids; } int idl_is_allids(IDList *idl) { + if (NULL == idl) { + return 0; + } return (idl->b_nmax == ALLIDSBLOCK); } @@ -110,6 +119,9 @@ idl_free( IDList **idl ) int idl_append( IDList *idl, ID id) { + if (NULL == idl) { + return 2; + } if ( ALLIDS( idl ) || ( (idl->b_nids) && (idl->b_ids[idl->b_nids - 1] == id)) ) { return( 1 ); /* already there */ } @@ -321,7 +333,7 @@ idl_notin( backend *be, IDList *a, IDList *b, - IDList **new_result + IDList **new_result ) { NIDS ni, ai, bi; @@ -435,6 +447,9 @@ idl_nextid( IDList *idl, ID id ) { NIDS i; + if (NULL == idl) { + return NOID; + } if ( ALLIDS( idl ) ) { return( ++id < idl->b_nids ? id : NOID ); }