]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/request.c
Cast char* argument to hh_to_c() to Byte*
[openldap] / libraries / libldap / request.c
index 6dfa9d1718cc9a7c70e168675e4ce0e097aa2e57..5b8ecc8c5e45a0d4028f7b2f7a8288a95f348e85 100644 (file)
@@ -21,6 +21,7 @@
 #include <ac/unistd.h>
 
 #include "ldap-int.h"
+#include "lber.h"
 
 #if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
 static LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPServer *srv, int any ));
@@ -80,7 +81,7 @@ ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
 
        Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
 
-       if ( ld->ld_sb.sb_sd == -1 ) {
+       if ( ! lber_pvt_sb_in_use(&ld->ld_sb ) ) {
                /* not connected yet */
 
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
@@ -296,8 +297,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
         * XXX open connection synchronously for now
         */
        if (( lc = (LDAPConn *)calloc( 1, sizeof( LDAPConn ))) == NULL ||
-           ( !use_ldsb && ( sb = (Sockbuf *)calloc( 1, sizeof( Sockbuf )))
-           == NULL )) {
+           ( !use_ldsb && ( (sb = lber_pvt_sb_alloc()) == NULL ))) {
                if ( lc != NULL ) {
                        free( (char *)lc );
                }
@@ -321,7 +321,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
 
                if ( srv == NULL ) {
                    if ( !use_ldsb ) {
-                       free( (char *)lc->lconn_sb );
+                       lber_pvt_sb_free( lc->lconn_sb );
                    }
                    free( (char *)lc );
                    ld->ld_errno = LDAP_SERVER_DOWN;
@@ -351,7 +351,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
 
                freepasswd = err = 0;
 
-               if ( ld->ld_rebindproc == NULL ) {
+               if ( ld->ld_rebindproc == 0 ) {
                        binddn = passwd = "";
                        authmethod = LDAP_AUTH_SIMPLE;
                } else {
@@ -444,9 +444,8 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
                                ldap_send_unbind( ld, lc->lconn_sb );
                        }
                        ldap_close_connection( lc->lconn_sb );
-                       if ( lc->lconn_sb->sb_ber.ber_buf != NULL ) {
-                               free( lc->lconn_sb->sb_ber.ber_buf );
-                       }
+                       lber_pvt_sb_destroy( lc->lconn_sb );
+                       ber_clear( &lc->lconn_ber, 1 );
                }
                prevlc = NULL;
                for ( tmplc = ld->ld_conns; tmplc != NULL;
@@ -466,7 +465,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
                        free( lc->lconn_krbinstance );
                }
                if ( lc->lconn_sb != &ld->ld_sb ) {
-                       free( (char *)lc->lconn_sb );
+                       lber_pvt_sb_free( lc->lconn_sb );
                }
                free( lc );
                Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",