2 * Copyright (c) 1990 Regents of the University of Michigan.
9 static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
19 #if defined( DOS ) || defined( _WIN32 )
23 #if !defined( MACOS ) && !defined( DOS )
24 #include <sys/types.h>
25 #include <sys/socket.h>
33 * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
36 * dn DN of the object to delete
39 * msgid = ldap_delete( ld, dn );
42 ldap_delete( LDAP *ld, char *dn )
47 * A delete request looks like this:
48 * DelRequet ::= DistinguishedName,
51 Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
53 /* create a message to send */
54 if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
58 if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
60 ld->ld_errno = LDAP_ENCODING_ERROR;
65 /* send the message */
66 return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
71 ldap_delete_s( LDAP *ld, char *dn )
76 if ( (msgid = ldap_delete( ld, dn )) == -1 )
77 return( ld->ld_errno );
79 if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
80 return( ld->ld_errno );
82 return( ldap_result2error( ld, res, 1 ) );