]> git.sur5r.net Git - openldap/commitdiff
ITS#4992 fix cldap
authorHoward Chu <hyc@openldap.org>
Fri, 8 Jun 2007 09:40:17 +0000 (09:40 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 8 Jun 2007 09:40:17 +0000 (09:40 +0000)
libraries/libldap/abandon.c
libraries/libldap/request.c
libraries/libldap/search.c

index 43e2f342c8826207f9c0e59405e8a9208d8360c1..d72483ecdaf8614b4d34c032055f5afabfb714b4 100644 (file)
@@ -224,8 +224,9 @@ start_again:;
                        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 6ecdcf6770c1d37872addf1d3da8198377a82b7d..be36b19845cf7f9e4c5169ec89a0acf880cace38 100644 (file)
@@ -255,6 +255,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 a09b8301cab484ef5b618f3795008c456a859f4d..2f27eddd6eff8fce4abd505cc02577e7198f082c 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;