I am using the LDAP integration module for authentication with no native drupal accounts and with ldap_groups enabled. I've been able to log in as myself and two other sample users without any difficulty.

However when one particular user logged in for the first time, it generated the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'T relations'' at line 1 query: SELECT * FROM role WHERE name = 'Comm & intergov'T relations' in /www/home01/docs/includes/database.mysql.inc on line 120.

I would guess this is because of the apostrophe in the role name "Comm & intergov't relations"

On subsequent log ins it repeats that error and also generates:

Duplicate entry 'Comm & intergov'T relations' for key 2 query: INSERT INTO role (name) VALUES ('Comm & intergov\'T relations') in /www/home01/docs/includes/database.mysql.inc on line 120.

When I disable ldap_groups the problems goes away since it stops trying to make that insert.

I don't control the LDAP entries, so while I will be asking to have this role cleaned up anyway, I also imagine it should be possible to include apostrophes and that this is a bug.

Comments

pablobm’s picture

It is a bug, indeed. I just commited some changes that add proper escaping. Sorry about this.

eliza411’s picture

Awesome. This means I should update from CVS or from the 4.7 release?

pablobm’s picture

Assigned: Unassigned » pablobm
Status: Active » Fixed

A "cvs update" will work straightaway. If you prefer to use the standard link to download the .tar.gz bundle, you should wait up to 24 hours for it to get updated automatically.

Anonymous’s picture

Status: Fixed » Closed (fixed)