Browse Source

Bug 676689 - crash while adding a new user to be synced to windows

https://bugzilla.redhat.com/show_bug.cgi?id=676689
Resolves: bug 676689
Bug Description: crash while adding a new user to be synced to windows
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: The OpenLDAP ldap_next_entry() function will assert and
abort if passed a NULL message.  Mozldap ldap_next_entry() will just return
NULL.  Fix the server to not pass NULL to ldap_next_entry().
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 years ago
parent
commit
82b362176a

+ 2 - 1
ldap/servers/plugins/replication/windows_connection.c

@@ -688,7 +688,8 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
 			/* See if there are any more entries : if so then that's an error
 			 * but we still need to get them to avoid gumming up the connection
 			 */
-			while (NULL != ( message = ldap_next_entry(conn->ld,message))) ;
+			/* have to check message first - cannot pass a NULL message */
+			while (message && (NULL != ( message = ldap_next_entry(conn->ld,message)))) ;
 			return_value = CONN_OPERATION_SUCCESS;
 		}
 		else if (IS_DISCONNECT_ERROR(ldap_rc))

+ 5 - 1
ldap/servers/slapd/auth.c

@@ -186,7 +186,11 @@ slapu_next_entry( LDAP* ld, LDAPMessage* msg )
 {
     Slapi_Entry** entry = (Slapi_Entry**)msg;
     if (ld != internal_ld) {
-	return ldap_next_entry (ld, msg);
+	if (msg) {
+	    return ldap_next_entry (ld, msg);
+	} else {
+	    return NULL;
+	}
     }
     if (entry && *entry && *++entry) {
 	return (LDAPMessage*)entry;