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>
24 * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
27 * dn DN of the object to delete
30 * msgid = ldap_delete( ld, dn );
33 ldap_delete( LDAP *ld, char *dn )
38 * A delete request looks like this:
39 * DelRequet ::= DistinguishedName,
42 Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
44 /* create a message to send */
45 if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
49 if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
51 ld->ld_errno = LDAP_ENCODING_ERROR;
56 /* send the message */
57 return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
62 ldap_delete_s( LDAP *ld, char *dn )
67 if ( (msgid = ldap_delete( ld, dn )) == -1 )
68 return( ld->ld_errno );
70 if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
71 return( ld->ld_errno );
73 return( ldap_result2error( ld, res, 1 ) );