andykimpe / rpms / 389-ds-base

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