]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/abandon.c
Add strdup.c from -llutil, renamed to ldap_strdup() and always used.
[openldap] / libraries / libldap / abandon.c
index a5e93798c1bc3c4750321fa30bff11835d2bdbf3..ebc6bca5dbc1bd22cb644a9e307a6e4fe782afad 100644 (file)
@@ -16,9 +16,8 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
 
 #include <ac/socket.h>
 #include <ac/string.h>
+#include <ac/time.h>
 
-#include "lber.h"
-#include "ldap.h"
 #include "ldap-int.h"
 
 static int do_abandon LDAP_P(( LDAP *ld, int origid, int msgid ));
@@ -48,9 +47,9 @@ do_abandon( LDAP *ld, int origid, int msgid )
        BerElement      *ber;
        int             i, err, sendabandon;
        Sockbuf         *sb;
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        LDAPRequest     *lr;
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
        /*
         * An abandon request looks like this:
@@ -62,7 +61,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
 
        sendabandon = 1;
 
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        /* find the request that we are abandoning */
        for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
                if ( lr->lr_msgid == msgid ) {  /* this message */
@@ -84,7 +83,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
                        sendabandon = 0;
                }
        }
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
        if ( ldap_msgdelete( ld, msgid ) == 0 ) {
                ld->ld_errno = LDAP_SUCCESS;
@@ -98,33 +97,33 @@ do_abandon( LDAP *ld, int origid, int msgid )
                        err = -1;
                        ld->ld_errno = LDAP_NO_MEMORY;
                } else {
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
                        if ( ld->ld_sb.sb_naddr > 0 ) {
                                err = ber_printf( ber, "{isti}",
                                    ++ld->ld_msgid, ld->ld_cldapdn,
                                    LDAP_REQ_ABANDON, msgid );
                        } else {
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
                                err = ber_printf( ber, "{iti}", ++ld->ld_msgid,
                                    LDAP_REQ_ABANDON, msgid );
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
                        }
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
 
                        if ( err == -1 ) {
                                ld->ld_errno = LDAP_ENCODING_ERROR;
                                ber_free( ber, 1 );
                        } else {
                                /* send the message */
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
                                if ( lr != NULL ) {
                                        sb = lr->lr_conn->lconn_sb;
                                } else {
                                        sb = &ld->ld_sb;
                                }
-#else /* LDAP_REFERRALS */
+#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
                                sb = &ld->ld_sb;
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
                                if ( ber_flush( sb, ber, 1 ) != 0 ) {
                                        ld->ld_errno = LDAP_SERVER_DOWN;
                                        err = -1;
@@ -135,7 +134,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
                }
        }
 
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        if ( lr != NULL ) {
                if ( sendabandon ) {
                        ldap_free_connection( ld, lr->lr_conn, 0, 1 );
@@ -144,7 +143,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
                        ldap_free_request( ld, lr );
                }
        }
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
 
        if ( ld->ld_abandoned == NULL ) {