[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4067) libldap should tell the caller if the server is down



Full_Name: Mike Patnode
Version: 2.2.26
OS: RedHat
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (63.199.144.29)


If we can't open the connection, return LDAP_SERVER_DOWN, rather than continuing
on...

--- openldap-2.2.26/libraries/libldap/abandon.c.old	Wed Oct 05 17:56:14 2005
+++ openldap-2.2.26/libraries/libldap/abandon.c	Wed Oct 05 16:46:37 2005
@@ -195,7 +195,16 @@
 #ifdef LDAP_CONNECTIONLESS
 			if ( LDAP_IS_UDP(ld) ) {
                             if (ld->ld_options.ldo_peer == NULL)
-                                ldap_open_defconn(ld);
+                            {
+                                err = ldap_open_defconn(ld);
+                                if (err == -1)
+                                {
+                                    ber_free( ber, 1 );
+                                    ld->ld_errno = LDAP_SERVER_DOWN;
+                                    return LDAP_SERVER_DOWN;
+                                }
+                            }
+                            
 			    err = ber_write( ber, ld->ld_options.ldo_peer,
 				sizeof(struct sockaddr), 0);
 			}
--- openldap-2.2.26/libraries/libldap/search.c.old	Wed Oct 05 17:56:15 2005
+++ openldap-2.2.26/libraries/libldap/search.c	Wed Oct 05 16:07:37 2005
@@ -262,7 +262,14 @@
 #ifdef LDAP_CONNECTIONLESS
 	if ( LDAP_IS_UDP(ld) ) {
             if (ld->ld_options.ldo_peer == NULL)
-                ldap_open_defconn( ld );
+            {
+                err = ldap_open_defconn( ld );
+                if (err == -1)
+                {
+                    ber_free( ber, 1 );
+                    return( NULL );
+                }
+            }
 	    err = ber_write( ber, ld->ld_options.ldo_peer,
 		    sizeof(struct sockaddr), 0);
 	}