[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4061) [PATCH] back-sql - SQL syntax errors when removing



Full_Name: Marcio Scheibler
Version: 2.3.7
OS: Debian Linux
URL: 
Submission from: (NULL) (200.18.33.34)


Back-SQL generates a bad SQL command when removing an entry.

   backsql_modify_delete_all_values(): arg2=domain; executing "DELETE FROM
ldap_entry_objclasses WHERE entry_id=(SELECT id FROM ldap_entries WHERE
oc_map_id=7AND keyval=?) AND oc_name=?"
   backsql_modify_delete_all_values(): delete_proc execution failed

There is a missing blank between "ocmap_id=?" and "AND".  I'm using 2.2.26,
but 2.3.7 code seems to have same problem. So I generated a "1-line" patch
against 2.3.7. But I'd so happy if you fix it in upcoming 2.2.X too...

Following small patch fixes it (Sorry, I was unable to upload - "no space
left")
Thanks in advance...

============ CUT HERE
============================================================
--- servers/slapd/back-sql/schema-map.c.orig    2005-10-03 17:44:44.146888872
+0000
+++ servers/slapd/back-sql/schema-map.c 2005-10-03 17:34:56.296255752 +0000
@@ -231,7 +231,7 @@
                snprintf( tmp, sizeof(tmp),
                        "DELETE FROM ldap_entry_objclasses "
                        "WHERE entry_id=(SELECT id FROM ldap_entries "
-                       "WHERE oc_map_id=%lu"
+                       "WHERE oc_map_id=%lu "
                        "AND keyval=?) AND oc_name=?",
                        oc_map->bom_id );
                at_map->bam_delete_proc = ch_strdup( tmp );
============ CUT HERE
==============================================================