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.
16 /* ac/socket.h must precede ISODE #includes or p_type must be #undeffed
17 * after it is included. (Because ISODE uses p_type as a field name, and
18 * SunOS 5.5:sys/vtype.h defines it (and ac/socket.h indirectly includes it) */
19 #include <ac/socket.h>
21 #include <quipu/commonarg.h>
22 #include <quipu/attrvalue.h>
23 #include <quipu/ds_error.h>
24 #include <quipu/remove.h>
25 #include <quipu/dap2.h>
26 #include <quipu/dua.h>
33 #define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE)
35 #define DELTAG LDAP_RES_DELETE
39 * do_delete - Initiate an X.500 remove entry operation. Returns 1 if
40 * the operation was initiated successfully, and thus a response will be
41 * coming back from the DSA. Returns 0 if there was trouble and thus no
42 * DSA response is expected.
54 struct ds_removeentry_arg ra;
55 static CommonArgs common = default_common_args;
57 Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
60 * Parse the delete request. It looks like this:
61 * DelRequest := DistinguishedName
64 #if ISODEPACKAGE == IC
66 DAS_RemoveEntryArgument_INIT( &ra );
70 if ( ber_scanf( ber, "a", &dn ) == LBER_ERROR ) {
71 Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
72 send_ldap_msgresult( clientsb, DELTAG, m,
73 LDAP_PROTOCOL_ERROR, NULL, "" );
77 Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", dn, 0, 0 );
79 ra.rma_object = ldap_str2dn( dn );
81 if ( ra.rma_object == NULLDN ) {
82 Debug( LDAP_DEBUG_ANY, "ldap_str2dn failed\n", 0, 0, 0 );
83 send_ldap_msgresult( clientsb, DELTAG, m,
84 LDAP_INVALID_DN_SYNTAX, NULL, "" );
88 ra.rma_common = common; /* struct copy */
90 rc = initiate_dap_operation( OP_REMOVEENTRY, m, &ra );
92 dn_free( ra.rma_object );
95 send_ldap_msgresult( clientsb, DELTAG, m, rc, NULL, "" );
108 send_ldap_msgresult( sb, DELTAG, m, LDAP_SUCCESS, NULL, "" );