diff --git a/CHANGES b/CHANGES
index b2b433e64354e347413b2c8589dd59445aac3941..09f3306beab2aeb96013a2383b9c41e934f9c46a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 OpenLDAP 2.4 Change Log
 
 OpenLDAP 2.4.23 Engineering
+	Fixed libldap to return server's error code (ITS#6569)
 	Fixed libldap memleaks (ITS#6568)
 	Fixed liblutil off-by-one with delta (ITS#6541)
 	Fixed slapd syncrepl rid logging (ITS#6533)
diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c
index e98ea7dd75110d95b4e75fc686fa47f567c82cde..05580b793cfa8215566cb412215f35021927bf8b 100644
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -994,6 +994,7 @@ nextresp2:
 
 			/* need to return -1, because otherwise
 			 * a valid result is expected */
+			ld->ld_errno = lderr;
 			return -1;
 		}
 	}