2 * Copyright (c) 1990 Regents of the University of Michigan.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
14 #include <quipu/commonarg.h>
15 #include <quipu/attrvalue.h>
16 #include <quipu/ds_error.h>
17 #include <quipu/remove.h>
18 #include <quipu/dap2.h>
19 #include <quipu/dua.h>
20 #include <sys/types.h>
21 #include <sys/socket.h>
27 extern int ldap_compat;
28 #define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE)
30 #define DELTAG LDAP_RES_DELETE
34 * do_delete - Initiate an X.500 remove entry operation. Returns 1 if
35 * the operation was initiated successfully, and thus a response will be
36 * coming back from the DSA. Returns 0 if there was trouble and thus no
37 * DSA response is expected.
49 struct ds_removeentry_arg ra;
50 static CommonArgs common = default_common_args;
51 extern DN ldap_str2dn();
53 Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
56 * Parse the delete request. It looks like this:
57 * DelRequest := DistinguishedName
60 #if ISODEPACKAGE == IC
62 DAS_RemoveEntryArgument_INIT( &ra );
66 if ( ber_scanf( ber, "a", &dn ) == LBER_ERROR ) {
67 Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
68 send_ldap_msgresult( clientsb, DELTAG, m,
69 LDAP_PROTOCOL_ERROR, NULL, "" );
73 Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", dn, 0, 0 );
75 ra.rma_object = ldap_str2dn( dn );
77 if ( ra.rma_object == NULLDN ) {
78 Debug( LDAP_DEBUG_ANY, "ldap_str2dn failed\n", 0, 0, 0 );
79 send_ldap_msgresult( clientsb, DELTAG, m,
80 LDAP_INVALID_DN_SYNTAX, NULL, "" );
84 ra.rma_common = common; /* struct copy */
86 rc = initiate_dap_operation( OP_REMOVEENTRY, m, &ra );
88 dn_free( ra.rma_object );
91 send_ldap_msgresult( clientsb, DELTAG, m, rc, NULL, "" );
104 send_ldap_msgresult( sb, DELTAG, m, LDAP_SUCCESS, NULL, "" );