/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
LDAPControl **sctrls,
LDAPControl **cctrls )
{
+ int rc;
Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
+ /* check client controls */
+ rc = ldap_int_client_controls( ld, cctrls );
+ if( rc != LDAP_SUCCESS ) return rc;
+
return do_abandon( ld, msgid, msgid, sctrls, cctrls );
}
ldap_abandon( LDAP *ld, int msgid )
{
Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
- return do_abandon( ld, msgid, msgid, NULL, NULL ) == LDAP_SUCCESS
+ return ldap_abandon_ext( ld, msgid, NULL, NULL ) == LDAP_SUCCESS
? 0 : -1;
}
err = 0;
if ( sendabandon ) {
- /* create a message to send */
- if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ if( ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, NULL ) == -1 ) {
+ /* not connected */
+ err = -1;
+ ld->ld_errno = LDAP_SERVER_DOWN;
+
+ } else if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
+ /* BER element alocation failed */
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
} else {
#ifdef LDAP_CONNECTIONLESS
- if ( ld->ld_cldapnaddr > 0 ) {
- err = ber_printf( ber, "{isti", /* '}' */
- ++ld->ld_msgid, ld->ld_cldapdn,
- LDAP_REQ_ABANDON, msgid );
+ if ( LDAP_IS_UDP(ld) ) {
+ err = ber_write( ber, ld->ld_options.ldo_peer,
+ sizeof(struct sockaddr), 0);
+ }
+ if ( LDAP_IS_UDP(ld) && ld->ld_options.ldo_version ==
+ LDAP_VERSION2) {
+ char *dn = ld->ld_options.ldo_cldapdn;
+ if (!dn) dn = "";
+ err = ber_printf( ber, "{isti", /* '}' */
+ ++ld->ld_msgid, dn,
+ LDAP_REQ_ABANDON, msgid );
} else
-#endif /* LDAP_CONNECTIONLESS */
+#endif
{
- err = ber_printf( ber, "{iti", /* '}' */
- ++ld->ld_msgid,
- LDAP_REQ_ABANDON, msgid );
+ /* create a message to send */
+ err = ber_printf( ber, "{iti", /* '}' */
+ ++ld->ld_msgid,
+ LDAP_REQ_ABANDON, msgid );
}
if( err == -1 ) {
} else {
/* close '{' */
- err = ber_printf( ber, /*{*/ "}" );
+ err = ber_printf( ber, /*{*/ "N}" );
if( err == -1 ) {
/* encoding error */
if ( lr != NULL ) {
sb = lr->lr_conn->lconn_sb;
} else {
- sb = &ld->ld_sb;
+ sb = ld->ld_sb;
}
if ( ber_flush( sb, ber, 1 ) != 0 ) {