瀏覽代碼

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 [email protected] (Thank you, Nathan!!)
Noriko Hosoi 11 年之前
父節點
當前提交
488fa1229f
共有 1 個文件被更改,包括 16 次插入1 次删除
  1. 16 1
      ldap/servers/slapd/back-ldbm/idl_common.c

+ 16 - 1
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 );
 	}