Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10319 closed defect (fixed)

Error with postgresql and Trac 1.0

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

Description (last modified by Ryan J Ollos)

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 12 years 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 12 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 12 years ago by Ryan J Ollos

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 12 years ago by Ryan J Ollos

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 Changed 12 years ago by branson

Resolution: fixed
Status: newclosed

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 12 years ago by Ryan J Ollos

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain branson.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.