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 extern int ldap_compat;
34 #define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE)
36 #define DELTAG LDAP_RES_DELETE
40 * do_delete - Initiate an X.500 remove entry operation. Returns 1 if
41 * the operation was initiated successfully, and thus a response will be
42 * coming back from the DSA. Returns 0 if there was trouble and thus no
43 * DSA response is expected.
55 struct ds_removeentry_arg ra;
56 static CommonArgs common = default_common_args;
57 extern DN ldap_str2dn();
59 Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
62 * Parse the delete request. It looks like this:
63 * DelRequest := DistinguishedName
66 #if ISODEPACKAGE == IC
68 DAS_RemoveEntryArgument_INIT( &ra );
72 if ( ber_scanf( ber, "a", &dn ) == LBER_ERROR ) {
73 Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
74 send_ldap_msgresult( clientsb, DELTAG, m,
75 LDAP_PROTOCOL_ERROR, NULL, "" );
79 Debug( LDAP_DEBUG_ARGS, "do_delete: dn (%s)\n", dn, 0, 0 );
81 ra.rma_object = ldap_str2dn( dn );
83 if ( ra.rma_object == NULLDN ) {
84 Debug( LDAP_DEBUG_ANY, "ldap_str2dn failed\n", 0, 0, 0 );
85 send_ldap_msgresult( clientsb, DELTAG, m,
86 LDAP_INVALID_DN_SYNTAX, NULL, "" );
90 ra.rma_common = common; /* struct copy */
92 rc = initiate_dap_operation( OP_REMOVEENTRY, m, &ra );
94 dn_free( ra.rma_object );
97 send_ldap_msgresult( clientsb, DELTAG, m, rc, NULL, "" );
110 send_ldap_msgresult( sb, DELTAG, m, LDAP_SUCCESS, NULL, "" );