Modify

Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#10319 closed defect (fixed)

Error with postgresql and Trac 1.0

Reported by: mcdevil@… Owned by: sandinak
Priority: normal Component: DirectoryAuthPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description (last modified by rjollos)

I tried to upgraded from version 0.2.2 and have some problems

Installation:

  • since v0.3 a database upgrade is needed
  • this does only work if tracext.adauth.db.activedirectoryauthpluginsetup = enabled (this hint qould be good in the documentation)
  • the upgrade fails on postgresql with unknown type varcahar(32) -> typo: varchar(32)
  • the upgrade fails on postgresql with unknown type binary -> i tried: text

After this the installation and upgrade succeeds

But i've still an error:

  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 139, in check_password
    dn = self._get_user_dn(user)
  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 271, in _get_user_dn
    if self.has_user(user):
  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 129, in has_user
    users = self.get_users()
  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 73, in get_users
    userinfo = self.expand_group_users(self.auth_group)
  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 97, in expand_group_users
    g = self._ad_search(self.base_dn, ldap.SCOPE_SUBTREE, groupfilter, ['member'])
  File "/usr/local/lib/python2.6/dist-packages/TracActiveDirectoryAuth-0.3.2-py2.6.egg/tracext/adauth/auth.py", line 439, in _ad_search
    cur.execute("SELECT lut,data FROM ad_cache WHERE id='%s'" % key)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/db/util.py", line 66, in execute
    return self.cursor.execute(sql)
InternalError: FEHLER:  aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert

Any idea what's wrong?

Attachments (0)

Change History (6)

comment:1 Changed 23 months ago by anonymous

There is also a problem with the query definition:

_ad_search:

cur.execute('SELECT lut,data FROM ad_cache WHERE id="%s"' % key)

postgresql does not like double quotes. I changed it to

cur.execute("SELECT lut,data FROM ad_cache WHERE id='%s'" % key)

for now. I don't know if it's the correct way.

comment:2 Changed 23 months ago by rjollos

  • Description modified (diff)

comment:3 Changed 23 months ago by rjollos

I believe the correct database-agnostic fix for the issue in comment:1 is to utilize the db.quote(param) function. See t:TracDev/DatabaseApi#GuidelinesforSQLStatements and:

comment:4 Changed 23 months ago by rjollos

As a follow-up to comment:3, I should add that my suggestion was speculative, and I've not had occasion to use the db.quote function. I've been studying the Trac db API lately though, and it seems like the function is intended for this circumstance. I'll be interested to see what you find while implementing the fix.

comment:5 follow-up: Changed 23 months ago by sandinak

  • Resolution set to fixed
  • Status changed from new to closed

Fixed the queries to match t:TracDev/DatabaseApi#GuidelinesforSQLStatements .. wish I had known that was there before .. ;-)

This fix will be in DirectoryAuthPlugin 0.5

comment:6 in reply to: ↑ 5 Changed 23 months ago by rjollos

Replying to sandinak:

Fixed the queries to match t:TracDev/DatabaseApi#GuidelinesforSQLStatements .. wish I had known that was there before .. ;-)

You are not alone. Failing to follow those guidelines is probably the most widespread problem with plugins.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from sandinak. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.