]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/delete.c
fix for select_backend suggested G. Gombas (ITS 1090)
[openldap] / servers / slapd / back-ldap / delete.c
index f2554ba30e2c6d70a7c2878bbf5dfd0e8699866e..4b92412be12769c6c2fe1f4f399ff8705e6569aa 100644 (file)
@@ -1,6 +1,10 @@
 /* delete.c - ldap backend delete function */
 /* $OpenLDAP$ */
-
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/* This is an altered version */
 /*
  * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
  * 
  *    ever read sources, credits should appear in the documentation.
  * 
  * 4. This notice may not be removed or altered.
+ *
+ *
+ *
+ * Copyright 2000, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
+ * 
+ * This software is being modified by Pierangelo Masarati.
+ * The previously reported conditions apply to the modified code as well.
+ * Changes in the original code are highlighted where required.
+ * Credits for the original code go to the author, Howard Chu.
  */
 
 #include "portable.h"
@@ -44,16 +57,22 @@ ldap_back_delete(
        struct ldapinfo *li = (struct ldapinfo *) be->be_private;
        struct ldapconn *lc;
 
+       char *mdn;
+
        lc = ldap_back_getconn( li, conn, op );
-       if (!lc)
+       
+       if ( !lc || !ldap_back_dobind( lc, op ) ) {
                return( -1 );
+       }
 
-       if (!lc->bound) {
-               ldap_back_dobind(lc, op);
-               if (!lc->bound)
-                       return( -1 );
+       mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 );
+       if ( mdn == NULL ) {
+               return( -1 );
        }
+       
+       ldap_delete_s( lc->ld, mdn );
 
-       ldap_delete_s( lc->ld, dn );
+       free( mdn );
+       
        return( ldap_back_op_result( lc, op ) );
 }