2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 * Copyright (c) 1990 Regents of the University of Michigan.
16 #include <ac/socket.h>
17 #include <ac/string.h>
23 * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
26 * dn DN of the object to delete
29 * msgid = ldap_delete( ld, dn );
32 ldap_delete( LDAP *ld, char *dn )
37 * A delete request looks like this:
38 * DelRequet ::= DistinguishedName,
41 Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
43 /* create a message to send */
44 if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
48 if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
50 ld->ld_errno = LDAP_ENCODING_ERROR;
55 /* send the message */
56 return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
61 ldap_delete_s( LDAP *ld, char *dn )
66 if ( (msgid = ldap_delete( ld, dn )) == -1 )
67 return( ld->ld_errno );
69 if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
70 return( ld->ld_errno );
72 return( ldap_result2error( ld, res, 1 ) );