]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#4992 cldap fix from HEAD
authorHoward Chu <hyc@openldap.org>
Fri, 8 Jun 2007 09:43:26 +0000 (09:43 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 8 Jun 2007 09:43:26 +0000 (09:43 +0000)
libraries/libldap/abandon.c
libraries/libldap/request.c
libraries/libldap/search.c

index a6117d859b27672342ec16156f18b25005503ff6..0ff1871c26d2ac5c8dddf7aff46cac6113d4fabd 100644 (file)
@@ -191,8 +191,9 @@ do_abandon(
                        i = ++(ld)->ld_msgid;
 #ifdef LDAP_CONNECTIONLESS
                        if ( LDAP_IS_UDP(ld) ) {
-                           err = ber_write( ber, ld->ld_options.ldo_peer,
-                               sizeof(struct sockaddr), 0);
+                               struct sockaddr sa = {0};
+                               /* dummy, filled with ldo_peer in request.c */
+                               err = ber_write( ber, &sa, sizeof( sa ), 0 );
                        }
                        if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version ==
                                LDAP_VERSION2) {
index 07f10ae50167f0d4828bfcce30b07cf0b8b1f18c..c147c2529acb20fea9422a7d350604da84050f0f 100644 (file)
@@ -222,6 +222,19 @@ ldap_send_server_request(
 
        use_connection( ld, lc );
 
+#ifdef LDAP_CONNECTIONLESS
+       if ( LDAP_IS_UDP( ld )) {
+               BerElement tmpber = *ber;
+               ber_rewind( &tmpber );
+               rc = ber_write( &tmpber, ld->ld_options.ldo_peer,
+                       sizeof( struct sockaddr ), 0 );
+               if ( rc == -1 ) {
+                       ld->ld_errno = LDAP_ENCODING_ERROR;
+                       return rc;
+               }
+       }
+#endif
+
        /* If we still have an incomplete write, try to finish it before
         * dealing with the new request. If we don't finish here, return
         * LDAP_BUSY and let the caller retry later. We only allow a single
index ce9cdbae9fba7a23f74fd19464c7bf9b160c9cdd..2fc0f4b8b54bcca803e2ae6ad4b5c3708f702f88 100644 (file)
@@ -259,8 +259,9 @@ ldap_build_search_req(
        LDAP_NEXT_MSGID( ld, *idp );
 #ifdef LDAP_CONNECTIONLESS
        if ( LDAP_IS_UDP(ld) ) {
-           err = ber_write( ber, ld->ld_options.ldo_peer,
-                   sizeof(struct sockaddr), 0);
+               struct sockaddr sa = {0};
+               /* dummy, filled with ldo_peer in request.c */
+               err = ber_write( ber, &sa, sizeof( sa ), 0 );
        }
        if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version == LDAP_VERSION2) {
            char *dn = ld->ld_options.ldo_cldapdn;