2 * Copyright (c) 1990 Regents of the University of Michigan.
11 static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
16 #include <ac/socket.h>
17 #include <ac/string.h>
25 * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
28 * dn DN of the object to delete
31 * msgid = ldap_delete( ld, dn );
34 ldap_delete( LDAP *ld, char *dn )
39 * A delete request looks like this:
40 * DelRequet ::= DistinguishedName,
43 Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
45 /* create a message to send */
46 if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
50 if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
52 ld->ld_errno = LDAP_ENCODING_ERROR;
57 /* send the message */
58 return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
63 ldap_delete_s( LDAP *ld, char *dn )
68 if ( (msgid = ldap_delete( ld, dn )) == -1 )
69 return( ld->ld_errno );
71 if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
72 return( ld->ld_errno );
74 return( ldap_result2error( ld, res, 1 ) );