Opened 11 years ago

Last modified 11 years ago

#10713 closed defect

DirectoryAuthPlugin: can't set dir_scope parameter in trac.ini — at Version 2

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

Description (last modified by Ryan J Ollos)

For my setup of the plugin, I had to change the scope to 2 (Subtree) in order for the authentication to work. I did this in the source code and verified that it worked. However, when I tried to set the dir_scope parameter in trac.ini, I get the following error:

 Trac detected an internal error:

TypeError: an integer is required

Python Traceback
Most recent call last:

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/wiki/web_ui.py", line 125, in process_request
    req.perm(page.resource).require('WIKI_VIEW')
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/perm.py", line 578, in require
    if not self._has_permission(action, resource):
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/perm.py", line 570, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/perm.py", line 462, in check_permission
    perm)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/perm.py", line 296, in check_permission
    get_user_permissions(username)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0-py2.6.egg/trac/perm.py", line 398, in get_user_permissions
    for perm in self.store.get_user_permissions(username) or []:
  File "/usr/local/lib/python2.6/dist-packages/TracDirectoryAuth-0.5-py2.6.egg/tracext/adauth/api.py", line 43, in get_user_permissions
    subjects.update(provider.get_permission_groups(username))
  File "/usr/local/lib/python2.6/dist-packages/TracDirectoryAuth-0.5-py2.6.egg/tracext/adauth/auth.py", line 215, in get_permission_groups
    dn = self._get_user_dn(username)
  File "/usr/local/lib/python2.6/dist-packages/TracDirectoryAuth-0.5-py2.6.egg/tracext/adauth/auth.py", line 299, in _get_user_dn
    [self.user_attr], cache)
  File "/usr/local/lib/python2.6/dist-packages/TracDirectoryAuth-0.5-py2.6.egg/tracext/adauth/auth.py", line 503, in _dir_search
    res = dir.search_s(basedn.encode(self.dir_charset), scope, filter, attrs)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 516, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 828, in search_ext_s
    return self._apply_method_s(SimpleLDAPObject.search_ext_s,*args,**kwargs)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 780, in _apply_method_s
    return func(self,*args,**kwargs)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 509, in search_ext_s
    msgid = self.search_ext(base,scope,filterstr,attrlist,attrsonly,serverctrls,clientctrls,timeout,sizelimit)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 505, in search_ext
    timeout,sizelimit,
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)
TypeError: an integer is required

System:
|Trac 	|1.0 |
|Genshi 	|0.6 (without speedups) |
|pysqlite 	|2.5.5|
|Python 	|2.6.5 (r265:79063, Oct 1 2012, 22:04:36) [GCC 4.4.3]|
|setuptools 	|0.6 |
|SQLite 	|3.6.22 |
|Subversion 	|1.6.6 (r40053) |
|DirectoryAuthPlugin|0.5|
|AccountMangerPlugin|0.4|

Maybe the parameter is not ready for use yet, in that case this isn't really a bug then.

Change History (2)

comment:1 Changed 11 years ago by anonymous

Here's the patch I'm using:

Index: auth.py
===================================================================
--- auth.py     (revision 12445)
+++ auth.py     (working copy)
@@ -33,7 +33,8 @@

     dir_uri = Option('account-manager', 'dir_uri', 'ldap://localhost', 'URI of the LDAP or Active Directory Server')
     dir_charset = Option('account-manager', 'dir_charset', 'utf-8', 'Text encoding used by the LDAP or Active Directory Server')
-    dir_scope = Option('account-manager', 'dir_scope', 1, '0=Base, 1=OneLevel, 2=Subtree')
+    #-- Setting dir_scope to 2 in order for authentication to work (SIBA)
+    dir_scope = Option('account-manager', 'dir_scope', 2, '0=Base, 1=OneLevel, 2=Subtree')
     dir_binddn = Option('account-manager', 'dir_binddn', '', 'DN used to bind to AD, leave blank for anonymous bind')
     dir_bindpw = Option('account-manager', 'dir_bindpw', '', 'Password used when binding to AD, leave blank for anonymous bind')
     dir_timeout = Option('account-manager', 'dir_timeout', 5, 'ldap response timeout in seconds')

comment:2 Changed 11 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.