You can subscribe to this list here.
2000 |
Jan
|
Feb
(34) |
Mar
(9) |
Apr
|
May
(2) |
Jun
(14) |
Jul
(67) |
Aug
(34) |
Sep
(5) |
Oct
(20) |
Nov
(22) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(15) |
Feb
(16) |
Mar
(20) |
Apr
(13) |
May
(72) |
Jun
(42) |
Jul
(41) |
Aug
(11) |
Sep
(19) |
Oct
(67) |
Nov
(59) |
Dec
(57) |
2002 |
Jan
(74) |
Feb
(69) |
Mar
(34) |
Apr
(55) |
May
(47) |
Jun
(74) |
Jul
(116) |
Aug
(68) |
Sep
(25) |
Oct
(42) |
Nov
(28) |
Dec
(52) |
2003 |
Jan
(19) |
Feb
(18) |
Mar
(35) |
Apr
(49) |
May
(73) |
Jun
(39) |
Jul
(26) |
Aug
(59) |
Sep
(33) |
Oct
(56) |
Nov
(69) |
Dec
(137) |
2004 |
Jan
(276) |
Feb
(15) |
Mar
(18) |
Apr
(27) |
May
(25) |
Jun
(7) |
Jul
(13) |
Aug
(2) |
Sep
(2) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
2005 |
Jan
(22) |
Feb
(25) |
Mar
(41) |
Apr
(17) |
May
(36) |
Jun
(13) |
Jul
(22) |
Aug
(12) |
Sep
(23) |
Oct
(6) |
Nov
(4) |
Dec
|
2006 |
Jan
(11) |
Feb
(3) |
Mar
(5) |
Apr
(22) |
May
(1) |
Jun
(10) |
Jul
(19) |
Aug
(7) |
Sep
(25) |
Oct
(23) |
Nov
(5) |
Dec
(27) |
2007 |
Jan
(25) |
Feb
(17) |
Mar
(44) |
Apr
(8) |
May
(33) |
Jun
(31) |
Jul
(42) |
Aug
(16) |
Sep
(12) |
Oct
(16) |
Nov
(23) |
Dec
(73) |
2008 |
Jan
(26) |
Feb
(6) |
Mar
(46) |
Apr
(17) |
May
(1) |
Jun
(44) |
Jul
(9) |
Aug
(34) |
Sep
(20) |
Oct
(2) |
Nov
(4) |
Dec
(16) |
2009 |
Jan
(14) |
Feb
(3) |
Mar
(45) |
Apr
(52) |
May
(34) |
Jun
(32) |
Jul
(24) |
Aug
(52) |
Sep
(22) |
Oct
(23) |
Nov
(19) |
Dec
(10) |
2010 |
Jan
(10) |
Feb
(13) |
Mar
(22) |
Apr
(9) |
May
(1) |
Jun
(1) |
Jul
(8) |
Aug
(9) |
Sep
(10) |
Oct
(1) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
|
Feb
(18) |
Mar
(39) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michele P. - U. s. <mic...@un...> - 2008-06-07 07:54:39
|
Bjørn Ove Grøtan wrote: > You misunderstood somehow. The DN is not a part of the ldif when > using the API. Hi, I forgot to say that it's the also the first time that I try to use ldap ;) Now it's working! > See below sample. I also suggest using the modlist-module for > automating the list-generating for add and modify operations. > In my code, I use also that (following the simple but pratical examples found at http://www.grotan.com/ldap/python-ldap-samples.html) , but for the mail I remove some annoying code. However thanks! Michele |
From: Michele P. - U. s. <mic...@un...> - 2008-06-07 07:08:49
|
Hi list, I'm trying, for the first time, to use python-ldap and I find some problems on add. I have a code that are, more or less: LDAP_BASE_DN = "dc=unipex,dc=it" ldif = [('dn', 'cn=A name,ou=People,dc=unipex,dc=it'), ('cn', 'A name'), ('objectclass', ['top', 'person', 'inetOrgPerson', 'organizationalPerson', 'mozillaOrgPerson']), ('sn', 'A name'), ('mail', 'a_...@ma...'), ('givenName', 'Michele')] l.add_s(LDAP_BASE_DN, ldif) And I receive: ldap.UNDEFINED_TYPE: {'info': 'dn: attribute type undefined', 'desc': 'Undefined attribute type'} d But if I save the same data into a ldif file and add it with: ldapadd -xv -D "cn=admin,dc=unipex,dc=it" -f test_entry.ldif -W it works! What can I try or where look for solve it? Thanks, Michele P.s. I trying to add an ldif data into ldap with mozilla scheme |
From: Ron T. <Ro...@US...> - 2008-06-06 15:24:46
|
Hi David, I had this happen before because I tried to do this: Import aModuleName.py I don't see that mistake in your code though, but maybe something you are calling is doing that. You need to leave off the .py when doing import. Hope that helps, Ron _____ From: pyt...@li... [mailto:pyt...@li...] On Behalf Of David Hlácik Sent: Thursday, June 05, 2008 9:55 AM To: pyt...@li... Subject: Re: module ldap : no module named .py As you can see : Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py comes from nnrpd_auth.py : try: if self.__newsauth(str(attributes['user']),str(attributes['pass'])): syslog('notice', 'authentication by username succeeded') return ( self.authcodes['ALLOWED'], 'No error', 'default_user') else: syslog('notice', 'authentication by username failed') return ( self.authcodes['DENIED'], 'Access Denied!') except Exception, e: syslog('notice', "Error: %s" % e) On Thu, Jun 5, 2008 at 3:53 PM, David Hláčik <da...@hl...> wrote: FYI, this is the result of test.py : -- syslog level: notice message: nnrpd authentication class instance created ** set_auth_hook for <nnrpd_auth.AUTH instance at 0xb7f1f5ec> -- syslog level: notice message: authentication module successfully hooked into nnrpd -- syslog level: notice message: nnrpd authentication class instance created -- syslog level: notice message: n_a authenticate() invoked: hostname None, ipaddress None, interface None, user boss -- syslog level: notice message: authentication by username succeeded (281, 'No error', 'default_user') And this is the result (from news.notice) when used as auth hook in INN : (inn will load nnrpd_auth.py and instantiate as in nnrpd_auth.py on the end written and call method authenticate(attributes) ) : Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu (10.10.10.199) connect Jun 5 13:33:12 dev01 nnrpd[9550]: python interpreter initialized OK Jun 5 13:33:12 dev01 nnrpd[9550]: python: nnrpd authentication class instance created Jun 5 13:33:12 dev01 nnrpd[9550]: python: authentication module successfully hooked into nnrpd Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python: n_a authenticate() invoked: hostname david-nb.net.hlacik.eu, ipaddress 10.10.10.199, interface 10.10.10.183, user boss Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py Jun 5 13:33:12 dev01 nnrpd[9550]: python authenticate method returned wrong result Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu times user 0.016 system 0.016 idle 0.000 elapsed 0.073 |
From: Michael S. <mi...@st...> - 2008-06-05 14:04:50
|
David Hláčik wrote: > As you can see : > Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py > comes from nnrpd_auth.py : Frankly I don't see anything I can understand or for what I have a clue how to help you. > Alltought when i pass it to INN, when INN calls nnrpd_auth.py and comes to > line when ldap module is used first time it will return error > "no module named.py" python-ldap itself does not have a module called named.py at all. So this is probably off-topic here. Being in your situation I'd try to log a full Python traceback to examine where the exception is raised in your or INN's code. Ciao, Michael. |
From: D. H. <da...@hl...> - 2008-06-05 13:54:45
|
As you can see : Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py comes from nnrpd_auth.py : try: if self.__newsauth(str(attributes['user']),str(attributes['pass'])): syslog('notice', 'authentication by username succeeded') return ( self.authcodes['ALLOWED'], 'No error', 'default_user') else: syslog('notice', 'authentication by username failed') return ( self.authcodes['DENIED'], 'Access Denied!') except Exception, e: syslog('notice', "Error: %s" % e) On Thu, Jun 5, 2008 at 3:53 PM, David Hláčik <da...@hl...> wrote: > FYI, > > this is the result of test.py : > -- syslog level: notice message: nnrpd authentication class instance > created > ** set_auth_hook for <nnrpd_auth.AUTH instance at 0xb7f1f5ec> > -- syslog level: notice message: authentication module successfully hooked > into nnrpd > -- syslog level: notice message: nnrpd authentication class instance > created > -- syslog level: notice message: n_a authenticate() invoked: hostname None, > ipaddress None, interface None, user boss > -- syslog level: notice message: authentication by username succeeded > (281, 'No error', 'default_user') > > And this is the result (from news.notice) when used as auth hook in INN : > (inn will load nnrpd_auth.py and instantiate as in nnrpd_auth.py on the end > written and call method authenticate(attributes) ) : > > Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu (10.10.10.199) > connect > Jun 5 13:33:12 dev01 nnrpd[9550]: python interpreter initialized OK > Jun 5 13:33:12 dev01 nnrpd[9550]: python: nnrpd authentication class > instance created > Jun 5 13:33:12 dev01 nnrpd[9550]: python: authentication module > successfully hooked into nnrpd > Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_init not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_close not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_init not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_close not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_init not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_close not found > Jun 5 13:33:12 dev01 nnrpd[9550]: python: n_a authenticate() invoked: > hostname david-nb.net.hlacik.eu, ipaddress 10.10.10.199, interface > 10.10.10.183, user boss > Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py > Jun 5 13:33:12 dev01 nnrpd[9550]: python authenticate method returned > wrong result > Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu times user 0.016 > system 0.016 idle 0.000 elapsed 0.073 > > |
From: D. H. <da...@hl...> - 2008-06-05 13:53:43
|
FYI, this is the result of test.py : -- syslog level: notice message: nnrpd authentication class instance created ** set_auth_hook for <nnrpd_auth.AUTH instance at 0xb7f1f5ec> -- syslog level: notice message: authentication module successfully hooked into nnrpd -- syslog level: notice message: nnrpd authentication class instance created -- syslog level: notice message: n_a authenticate() invoked: hostname None, ipaddress None, interface None, user boss -- syslog level: notice message: authentication by username succeeded (281, 'No error', 'default_user') And this is the result (from news.notice) when used as auth hook in INN : (inn will load nnrpd_auth.py and instantiate as in nnrpd_auth.py on the end written and call method authenticate(attributes) ) : Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu (10.10.10.199) connect Jun 5 13:33:12 dev01 nnrpd[9550]: python interpreter initialized OK Jun 5 13:33:12 dev01 nnrpd[9550]: python: nnrpd authentication class instance created Jun 5 13:33:12 dev01 nnrpd[9550]: python: authentication module successfully hooked into nnrpd Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python: n_a authenticate() invoked: hostname david-nb.net.hlacik.eu, ipaddress 10.10.10.199, interface 10.10.10.183, user boss Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py Jun 5 13:33:12 dev01 nnrpd[9550]: python authenticate method returned wrong result Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu times user 0.016 system 0.016 idle 0.000 elapsed 0.073 |
From: D. H. <da...@hl...> - 2008-06-05 13:53:02
|
FYI, this is the result of test.py : -- syslog level: notice message: nnrpd authentication class instance created ** set_auth_hook for <nnrpd_auth.AUTH instance at 0xb7f1f5ec> -- syslog level: notice message: authentication module successfully hooked into nnrpd -- syslog level: notice message: nnrpd authentication class instance created -- syslog level: notice message: n_a authenticate() invoked: hostname None, ipaddress None, interface None, user boss -- syslog level: notice message: authentication by username succeeded (281, 'No error', 'default_user') And this is the result (from news.notice) when used as auth hook in INN : (inn will load nnrpd_auth.py and instantiate as in nnrpd_auth.py on the end written and call method authenticate(attributes) ) : Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu (10.10.10.199) connect Jun 5 13:33:12 dev01 nnrpd[9550]: python interpreter initialized OK Jun 5 13:33:12 dev01 nnrpd[9550]: python: nnrpd authentication class instance created Jun 5 13:33:12 dev01 nnrpd[9550]: python: authentication module successfully hooked into nnrpd Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method authen_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method access_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_init not found Jun 5 13:33:12 dev01 nnrpd[9550]: python method dynamic_close not found Jun 5 13:33:12 dev01 nnrpd[9550]: python: n_a authenticate() invoked: hostname david-nb.net.hlacik.eu, ipaddress 10.10.10.199, interface 10.10.10.183, user boss Jun 5 13:33:12 dev01 nnrpd[9550]: python: Error: No module named py Jun 5 13:33:12 dev01 nnrpd[9550]: python authenticate method returned wrong result Jun 5 13:33:12 dev01 nnrpd[9550]: david-nb.net.hlacik.eu times user 0.016 system 0.016 idle 0.000 elapsed 0.073 On Thu, Jun 5, 2008 at 3:50 PM, David Hláčik <da...@hl...> wrote: > Hello, i am trying to write python authentification hook for > InternetNewsService (INN) using *python-ldap module* > > I have created nnrpd_auth.py ,which is working for me, when i am calling it > > from my test.py script. > > Alltought when i pass it to INN, when INN calls nnrpd_auth.py and comes to > line *when ldap module is used first time* it will return error > "no module named.py" > > I will post you my test.py and nnrpd_auth.py. > test.py i am using to debug my > nnrpd_auth.py. Trought test.py as i mentioned nnrpd_auth.py is working > (ldap module will load fine and post results) > Is there some bug, or am i blind and forgetting about somethin? > I am using it on CentOs5.1 with python-2.4.3-19.el5 and > python-ldap-2.2.0-2.1 > > > ----------------nnrpd_auth.py---------------------- > class AUTH: > """Provide authentication and authorization callbacks to nnrpd.""" > def __init__(self): > """This is a good place to initialize variables or open a > database connection. > """ > # Create a list of NNTP codes to respond on connect > self.connectcodes = { 'READPOST':200, > 'READ':201, > 'AUTHNEEDED':480, > 'PERMDENIED':502 > } > > # Create a list of NNTP codes to respond on authentication > self.authcodes = { 'ALLOWED':281, > 'DENIED':502 > > } > > #LDAP search definitions > self.server = 'ldap://dev01.net.hlacik.eu' > self.user_dn = 'cn=pdg,ou=Operators,o=Polarion' > self.user_pw = 'Pdg1' > self.base_dn_users = 'ou=Users,o=Polarion' > self.base_dn_groups = 'ou=Groups,o=Polarion' > > syslog('notice', 'nnrpd authentication class instance created') > > def __newsauth(self,match_username,match_password): > filter = "(uid=" + match_username + ")" > attrs = ['userPassword'] > > try : > l = ldap.initialize(self.server) > l.bind_s(self.user_dn, self.user_pw) > search = l.search_s( self.base_dn_users, > ldap.SCOPE_SUBTREE, filter, attrs > )[0][1] > l.unbind() > except ldap.SERVER_DOWN: > syslog('notice', 'Error, server down') > return 2 > except ldap.INVALID_CREDENTIALS: > syslog('Notice','Error, invalid credentials"') > return 2 > except ldap.LDAPError, e: > syslog('Notice', "Error, %s" % e) > for password in search["userPassword"]: > if password == match_password: return 1 > return 0 > > def newsaccess(self,match_username,match_password): > filter = "(uid=" + match_username + ")" > attrs = ['cn'] > > try : > l = ldap.initialize(self.server) > l.bind_s(self.user_dn, self.user_pw) > cn = l.search_s( self.base_dn_users, ldap.SCOPE_SUBTREE, > filter, attrs )[0] > [0] > raw_res = l.search_s( self.base_dn_groups, > ldap.SCOPE_SUBTREE, "(member=" + > cn + ")",attrs) > l.unbind() > except ldap.SERVER_DOWN: > syslog('notice', 'Error, LDAP server down') > return 2 > except ldap.INVALID_CREDENTIALS: > syslog('Notice','Error, invalid LDAP credentials"') > return 2 > except ldap.LDAPError, e: > syslog('Notice', "LDAP error, %s" % e) > > return raw_res > def authenticate(self, attributes): > """Called when python_auth is encountered in readers.conf""" > > # just for debugging purposes > syslog('notice', 'n_a authenticate() invoked: hostname %s, > ipaddress %s, interface > %s, user %s' % (\ > attributes['hostname'], \ > attributes['ipaddress'], \ > attributes['interface'], \ > attributes['user'])) > # username & password auth using LDAP > try: > if > self.__newsauth(str(attributes['user']),str(attributes['pass'])): > syslog('notice', 'authentication by username > succeeded') > return ( self.authcodes['ALLOWED'], 'No error', > 'default_user') > else: > syslog('notice', 'authentication by username > failed') > return ( self.authcodes['DENIED'], 'Access > Denied!') > except Exception, e: > syslog('notice', "Error: %s" % e) > > def access(self, attributes): > """Called when python_access is encountered in readers.conf""" > > # just for debugging purposes > syslog('notice', 'n_a access() invoked: hostname %s, ipaddress %s, > interface %s, us > er %s' % (\ > attributes['hostname'], \ > attributes['ipaddress'], \ > attributes['interface'], \ > attributes['user'])) > > # allow newsreading from specific host only > if '127.0.0.1' == str(attributes['ipaddress']): > syslog('notice', 'authentication by IP address succeeded') > return {'read':'*','post':'*'} > else: > syslog('notice', 'authentication by IP address failed') > return {'read':'!*','post':'!*'} > > def dynamic(self, attributes): > """Called when python_dynamic was reached in the processing of > readers.conf and a reader requests either read or post > permission for particular newsgroup. > """ > # just for debugging purposes > syslog('notice', 'n_a dyanmic() invoked against type %s, hostname > %s, ipaddress %s, > interface %s, user %s' % (\ > attributes['type'], \ > attributes['hostname'], \ > attributes['ipaddress'], \ > attributes['interface'], \ > attributes['user'])) > > # Allow reading of any newsgroup but not posting > if 'post' == str(attributes['type']): > syslog('notice', 'authorization for post access denied') > return "no posting for you" > elif 'read' == str(attributes['type']): > syslog('notice', 'authorization for read access granted') > return None > else: > syslog('notice', 'authorization type is not known: %s' % > attributes['type']) > return "Internal error"; > > > # > # The rest is used to hook up the auth module on nnrpd. It is unlikely > # you will ever need to modify this. > # > > # Import functions exposed by nnrpd. This import must succeed, or nothing > # will work! > from nnrpd import * > #from ldap import * > import ldap > > # Create a class instance > myauth = AUTH() > > # ...and try to hook up on nnrpd. This would make auth object methods > visible > # to nnrpd. > try: > set_auth_hook(myauth) > syslog('notice', "authentication module successfully hooked into > nnrpd") > except Exception, errmsg: > syslog('error', "Cannot obtain nnrpd hook for authentication method: > %s" % errmsg[0]) > > ----test.py---------- > from nnrpd_auth import * > > myauth = AUTH() > > #print dir(myauth) > print > myauth.authenticate({'user':'boss','pass':'xxx','interface':None,'ipaddress': > None,'hostname':None}) > #print myauth.newsauth('boss','22') > #print myauth.newsaccess('boss','xxx') > > |
From: D. H. <da...@hl...> - 2008-06-05 13:50:05
|
Hello, i am trying to write python authentification hook for InternetNewsService (INN) using *python-ldap module* I have created nnrpd_auth.py ,which is working for me, when i am calling it from my test.py script. Alltought when i pass it to INN, when INN calls nnrpd_auth.py and comes to line *when ldap module is used first time* it will return error "no module named.py" I will post you my test.py and nnrpd_auth.py. test.py i am using to debug my nnrpd_auth.py. Trought test.py as i mentioned nnrpd_auth.py is working (ldap module will load fine and post results) Is there some bug, or am i blind and forgetting about somethin? I am using it on CentOs5.1 with python-2.4.3-19.el5 and python-ldap-2.2.0-2.1 ----------------nnrpd_auth.py---------------------- class AUTH: """Provide authentication and authorization callbacks to nnrpd.""" def __init__(self): """This is a good place to initialize variables or open a database connection. """ # Create a list of NNTP codes to respond on connect self.connectcodes = { 'READPOST':200, 'READ':201, 'AUTHNEEDED':480, 'PERMDENIED':502 } # Create a list of NNTP codes to respond on authentication self.authcodes = { 'ALLOWED':281, 'DENIED':502 } #LDAP search definitions self.server = 'ldap://dev01.net.hlacik.eu' self.user_dn = 'cn=pdg,ou=Operators,o=Polarion' self.user_pw = 'Pdg1' self.base_dn_users = 'ou=Users,o=Polarion' self.base_dn_groups = 'ou=Groups,o=Polarion' syslog('notice', 'nnrpd authentication class instance created') def __newsauth(self,match_username,match_password): filter = "(uid=" + match_username + ")" attrs = ['userPassword'] try : l = ldap.initialize(self.server) l.bind_s(self.user_dn, self.user_pw) search = l.search_s( self.base_dn_users, ldap.SCOPE_SUBTREE, filter, attrs )[0][1] l.unbind() except ldap.SERVER_DOWN: syslog('notice', 'Error, server down') return 2 except ldap.INVALID_CREDENTIALS: syslog('Notice','Error, invalid credentials"') return 2 except ldap.LDAPError, e: syslog('Notice', "Error, %s" % e) for password in search["userPassword"]: if password == match_password: return 1 return 0 def newsaccess(self,match_username,match_password): filter = "(uid=" + match_username + ")" attrs = ['cn'] try : l = ldap.initialize(self.server) l.bind_s(self.user_dn, self.user_pw) cn = l.search_s( self.base_dn_users, ldap.SCOPE_SUBTREE, filter, attrs )[0] [0] raw_res = l.search_s( self.base_dn_groups, ldap.SCOPE_SUBTREE, "(member=" + cn + ")",attrs) l.unbind() except ldap.SERVER_DOWN: syslog('notice', 'Error, LDAP server down') return 2 except ldap.INVALID_CREDENTIALS: syslog('Notice','Error, invalid LDAP credentials"') return 2 except ldap.LDAPError, e: syslog('Notice', "LDAP error, %s" % e) return raw_res def authenticate(self, attributes): """Called when python_auth is encountered in readers.conf""" # just for debugging purposes syslog('notice', 'n_a authenticate() invoked: hostname %s, ipaddress %s, interface %s, user %s' % (\ attributes['hostname'], \ attributes['ipaddress'], \ attributes['interface'], \ attributes['user'])) # username & password auth using LDAP try: if self.__newsauth(str(attributes['user']),str(attributes['pass'])): syslog('notice', 'authentication by username succeeded') return ( self.authcodes['ALLOWED'], 'No error', 'default_user') else: syslog('notice', 'authentication by username failed') return ( self.authcodes['DENIED'], 'Access Denied!') except Exception, e: syslog('notice', "Error: %s" % e) def access(self, attributes): """Called when python_access is encountered in readers.conf""" # just for debugging purposes syslog('notice', 'n_a access() invoked: hostname %s, ipaddress %s, interface %s, us er %s' % (\ attributes['hostname'], \ attributes['ipaddress'], \ attributes['interface'], \ attributes['user'])) # allow newsreading from specific host only if '127.0.0.1' == str(attributes['ipaddress']): syslog('notice', 'authentication by IP address succeeded') return {'read':'*','post':'*'} else: syslog('notice', 'authentication by IP address failed') return {'read':'!*','post':'!*'} def dynamic(self, attributes): """Called when python_dynamic was reached in the processing of readers.conf and a reader requests either read or post permission for particular newsgroup. """ # just for debugging purposes syslog('notice', 'n_a dyanmic() invoked against type %s, hostname %s, ipaddress %s, interface %s, user %s' % (\ attributes['type'], \ attributes['hostname'], \ attributes['ipaddress'], \ attributes['interface'], \ attributes['user'])) # Allow reading of any newsgroup but not posting if 'post' == str(attributes['type']): syslog('notice', 'authorization for post access denied') return "no posting for you" elif 'read' == str(attributes['type']): syslog('notice', 'authorization for read access granted') return None else: syslog('notice', 'authorization type is not known: %s' % attributes['type']) return "Internal error"; # # The rest is used to hook up the auth module on nnrpd. It is unlikely # you will ever need to modify this. # # Import functions exposed by nnrpd. This import must succeed, or nothing # will work! from nnrpd import * #from ldap import * import ldap # Create a class instance myauth = AUTH() # ...and try to hook up on nnrpd. This would make auth object methods visible # to nnrpd. try: set_auth_hook(myauth) syslog('notice', "authentication module successfully hooked into nnrpd") except Exception, errmsg: syslog('error', "Cannot obtain nnrpd hook for authentication method: %s" % errmsg[0]) ----test.py---------- from nnrpd_auth import * myauth = AUTH() #print dir(myauth) print myauth.authenticate({'user':'boss','pass':'xxx','interface':None,'ipaddress': None,'hostname':None}) #print myauth.newsauth('boss','22') #print myauth.newsaccess('boss','xxx') |
From: Michael S. <mi...@st...> - 2008-05-07 16:54:23
|
HI! OpenLDAP will be presented by a team of volunteers (or simply me ;-) at OpenExpo 2008 in Karlsruhe, Germany from Sunday, 2008-05-25 until Monday, 2008-05-26 (or maybe longer) http://openexpo.de Several deployment scenarios based on OpenLDAP will be demonstrated with various LDAP clients. I will also present web2ldap and answer questions about python-ldap too. I'd be glad to meet members of the community personally there. Ciao, Michael. -- Michael Ströder E-Mail: mi...@st... http://www.stroeder.com |
From: Michael S. <mi...@st...> - 2008-04-28 16:56:22
|
Ron Teitelbaum wrote: > Here are the right values: > > ldd _ldap.so > linux-gate.so.1 => (0x00d5e000) > libldap_r-2.4.so.2 => /usr/local/openldap/lib/libldap_r-2.4.so.2 > (0x00bfe000) > liblber-2.4.so.2 => /usr/local/openldap/lib/liblber-2.4.so.2 > (0x00ae2000) Did you specify these OpenLDAP libs and the accompanying header files correctly in your setup.cfg before invoking the build? Which exact version of OpenLDAP is this? Fixes to libldap mentioned in file CHANGES of not yet released OpenLDAP 2.4.9: Fixed libldap to use unsigned port (ITS#5436) Fixed libldap error message for missing close paren (ITS#5458) Fixed libldap_r tpool pause checks (ITS#5364, #5407) Fixed libldap extended decoding (ITS#5304) Fixed libldap filter abort (ITS#5300) Fixed libldap ldap_parse_sasl_bind_result (ITS#5263) Fixed libldap result codes for open (ITS#5338) Fixed libldap search timeout crash (ITS#5291) Fixed libldap paged results crash (ITS#5315) Fixed libldap cipher suite with GnuTLS (ITS#5341) Fixed libldap_r threaded library linking (ITS#4982) Fixed libldap use of %n (ITS#5324) Fixed liblber socket library linking (ITS#5224) Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-28 16:51:41
|
Ron Teitelbaum wrote: > > Here are the results: Ron, it seems I can't help much. Did you compile python-ldap from source? Any chance that there is a library/header mismatch between compile and run time with other software on your system? Also note that OpenLDAP 2.3.27 is quite old (2006/08/19) and there has been many fixes also to libldap since then which might be important for you. Unfortunately Red Hat does not support their OpenLDAP package very well. OpenLDAP 2.3's file CHANGES lists the following fixes for libldap since 2.3.27: Fixed libldap ppolicy control creation (ITS#5103) Fixed libldap ldap_add_result_entry (ITS#5056) Fixed libldap referral chasing loop (ITS#4955) Fixed libldap response code handling on rebind (ITS#4924) Fixed libldap SASL_MAX_BUFF_SIZE (ITS#4935) Fixed libldap cldap assert (ITS#4992) Fixed libldap_r thread debug issues (ITS#4972) Fixed libldap time_t signedness (ITS#4872) Fixed libldap_r tpool reset (ITS#4855,#4899) Fixed libldap missing get_option(TLS CipherSuite) (ITS#4815) Fixed libldap ldap_pvt_put_filter syntax checks (ITS#4648) Fixed libldap unchased referral leak (ITS#4545) Fixed libldap tls callback (ITS#4723) Fixed liblber/libldap error codes on Windows (ITS#4606) Fixed libldap string length assert (ITS#4740) Fixed libldap ldap.conf max line length (ITS#4669) Fixed libldap use keepalive for syncrepl (ITS#4708) Likely not everything is relevant for everybody but some issues look serious in general. Ciao, Michael. |
From: Ron T. <Ro...@US...> - 2008-04-28 16:49:17
|
I'm sorry I did it wrong again. We are running our actual server on VMWare image. I forgot to connect to that first before checking. Here are the right values: ldd _ldap.so linux-gate.so.1 => (0x00d5e000) libldap_r-2.4.so.2 => /usr/local/openldap/lib/libldap_r-2.4.so.2 (0x00bfe000) liblber-2.4.so.2 => /usr/local/openldap/lib/liblber-2.4.so.2 (0x00ae2000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00aaf000) libssl.so.6 => /lib/libssl.so.6 (0x00165000) libcrypto.so.6 => /lib/libcrypto.so.6 (0x00427000) libpthread.so.0 => /lib/libpthread.so.0 (0x00e92000) libc.so.6 => /lib/libc.so.6 (0x00259000) libresolv.so.2 => /lib/libresolv.so.2 (0x00df1000) libdl.so.2 => /lib/libdl.so.2 (0x00111000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x00115000) libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00143000) libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00d73000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x0015c000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0065d000) libz.so.1 => /usr/lib/libz.so.1 (0x001aa000) /lib/ld-linux.so.2 (0x0023e000) libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00c63000) Sorry about that, Ron > -----Original Message----- > From: Michael Ströder [mailto:mi...@st...] > Sent: Monday, April 28, 2008 11:42 AM > To: Ro...@US... > Cc: pyt...@li... > Subject: Re: Killed Python2.4 > > Ron Teitelbaum wrote: > > ldd libldap.so > > linux-gate.so.1 => (0x002d7000) > > liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x00176000) > > libresolv.so.2 => /lib/libresolv.so.2 (0x002f7000) > > libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x0089a000) > > libssl.so.6 => /lib/libssl.so.6 (0x00652000) > > libcrypto.so.6 => /lib/libcrypto.so.6 (0x00416000) > > libc.so.6 => /lib/libc.so.6 (0x00c0c000) > > libdl.so.2 => /lib/libdl.so.2 (0x00d4e000) > > libcrypt.so.1 => /lib/libcrypt.so.1 (0x0399c000) > > libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0058d000) > > libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x005bd000) > > libcom_err.so.2 => /lib/libcom_err.so.2 (0x00411000) > > libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0054b000) > > libz.so.1 => /usr/lib/libz.so.1 (0x00101000) > > /lib/ld-linux.so.2 (0x00bea000) > > libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00578000) > > libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00573000) > > libselinux.so.1 => /lib/libselinux.so.1 (0x00dde000) > > libsepol.so.1 => /lib/libsepol.so.1 (0x00d96000) > > > > It looks quite different from your version. > > Well, it likely looks differently because install paths might be > different. Is that listing complete? libldap(_r) seems to be missing. > > You should check with e.g. > rpm -qf /usr/lib/liblber-2.3.so.0 > if these files are part of a RPM package and of which version your > OpenLDAP installation is. > > Hmm, another point popping up from your lib listing above: > Any SE Linux policy prohibiting execution/linking of shared libs? > > Ciao, Michael. |
From: Ron T. <Ro...@US...> - 2008-04-28 16:41:24
|
Hi Michael, Yes CentOS 5 is the free version of Fedora 5, Here is the output: ldd libldap.so linux-gate.so.1 => (0x002d7000) liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x00176000) libresolv.so.2 => /lib/libresolv.so.2 (0x002f7000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x0089a000) libssl.so.6 => /lib/libssl.so.6 (0x00652000) libcrypto.so.6 => /lib/libcrypto.so.6 (0x00416000) libc.so.6 => /lib/libc.so.6 (0x00c0c000) libdl.so.2 => /lib/libdl.so.2 (0x00d4e000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x0399c000) libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0058d000) libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x005bd000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x00411000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0054b000) libz.so.1 => /usr/lib/libz.so.1 (0x00101000) /lib/ld-linux.so.2 (0x00bea000) libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00578000) libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00573000) libselinux.so.1 => /lib/libselinux.so.1 (0x00dde000) libsepol.so.1 => /lib/libsepol.so.1 (0x00d96000) It looks quite different from your version. Thanks, Ron > -----Original Message----- > From: Michael Ströder > > Ron Teitelbaum wrote: > > > > I know you mentioned that I should send you more info if I get an > exception. > > > > I got a SERVER_DOWN and then retried the call manually and blew up > python2.4 > > > > This is CentOS 5, python2.4.4, python-ldap 2.3.4 > > [..] > > python2.4: io.c:234: ber_flush2: Assertion `( (sb)->sb_opts.lbo_valid == > 0x3 > > )' failed. > > Aborted > > Hmm, this is a debug message of OpenLDAP's libldap. Never saw this. > Which version of OpenLDAP is installed there? CentOS is based on Fedora? > Red Hat / Fedora is far behind with its OpenLDAP version. Any chance for > a library mix with another libldap? Could you please check which libldap > is dynamically linked? Use ldd for that. > > On my system where OpenLDAP is separately compiled and installed to > prefix /opt/openldap-2.3: > > # ldd /usr/lib/python/site-packages/_ldap.so > linux-gate.so.1 => (0xffffe000) > libldap_r-2.3.so.0 => /opt/openldap-2.3/lib/libldap_r-2.3.so.0 > (0xb7ecf000) > liblber-2.3.so.0 => /opt/openldap-2.3/lib/liblber-2.3.so.0 > (0xb7ec1000) > libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb7e92000) > libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0xb7e4f000) > libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0xb7d08000) > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7be7000) > libpthread.so.0 => /lib/libpthread.so.0 (0xb7bd0000) > libc.so.6 => /lib/libc.so.6 (0xb7a9d000) > libresolv.so.2 => /lib/libresolv.so.2 (0xb7a8a000) > libdl.so.2 => /lib/libdl.so.2 (0xb7a86000) > libz.so.1 => /lib/libz.so.1 (0xb7a72000) > libutil.so.1 => /lib/libutil.so.1 (0xb7a6e000) > libm.so.6 => /lib/libm.so.6 (0xb7a49000) > /lib/ld-linux.so.2 (0x80000000) > > > I thought I'd send it to you incase it gives you any clues about > SERVER_DOWN > > which has been a royal pain! > > It shouldn't be a problem. It works for me very often. I believe it's an > issue with your local installation. > > > I actually was able to reproduce this error twice. 3rd time worked. > > Strange. > > Ciao, Michael. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/jav > aone > _______________________________________________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev |
From: Ron T. <Ro...@US...> - 2008-04-28 16:36:00
|
Hi Michael, Here are the results: $ rpm -qf /usr/lib/liblber-2.3.so.0 openldap-2.3.27-8.el5_1.3 $ rpm -qf /lib/libresolv.so.2 glibc-2.5-18.el5_1.1 $ rpm -qf /usr/lib/libsasl2.so.2 cyrus-sasl-lib-2.1.22-4 $ rpm -qf /lib/libssl.so.6 openssl-0.9.8b-8.3.el5_0.2 $ rpm -qf /lib/libcrypt.so.1 glibc-2.5-18.el5_1.1 $ rpm -qf /usr/lib/libgssapi_krb5.so.2 krb5-libs-1.6.1-17.el5_1.1 $ rpm -qf /usr/lib/libkrb5.so.3 krb5-libs-1.6.1-17.el5_1.1 There is no limit on linking that I know of. Here is a proper listing using _ldap.so. Sorry about that I did libldap.so ldd /usr/lib/python2.4/site-packages/_ldap.so linux-gate.so.1 => (0x00774000) libldap_r-2.3.so.0 => /usr/lib/libldap_r-2.3.so.0 (0x002dd000) liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x0040c000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00582000) libssl.so.6 => /lib/libssl.so.6 (0x00b5a000) libcrypto.so.6 => /lib/libcrypto.so.6 (0x00110000) libpthread.so.0 => /lib/libpthread.so.0 (0x0053e000) libc.so.6 => /lib/libc.so.6 (0x00d83000) libresolv.so.2 => /lib/libresolv.so.2 (0x00708000) libdl.so.2 => /lib/libdl.so.2 (0x00243000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x00247000) libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00275000) libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00322000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x00832000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00f1f000) libz.so.1 => /usr/lib/libz.so.1 (0x00a05000) /lib/ld-linux.so.2 (0x00bea000) libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x002a3000) libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x002ac000) libselinux.so.1 => /lib/libselinux.so.1 (0x002af000) libsepol.so.1 => /lib/libsepol.so.1 (0x004c1000) Thanks, Ron > -----Original Message----- > From: Michael Ströder [mailto:mi...@st...] > > Ron Teitelbaum wrote: > > ldd libldap.so > > linux-gate.so.1 => (0x002d7000) > > liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x00176000) > > libresolv.so.2 => /lib/libresolv.so.2 (0x002f7000) > > libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x0089a000) > > libssl.so.6 => /lib/libssl.so.6 (0x00652000) > > libcrypto.so.6 => /lib/libcrypto.so.6 (0x00416000) > > libc.so.6 => /lib/libc.so.6 (0x00c0c000) > > libdl.so.2 => /lib/libdl.so.2 (0x00d4e000) > > libcrypt.so.1 => /lib/libcrypt.so.1 (0x0399c000) > > libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0058d000) > > libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x005bd000) > > libcom_err.so.2 => /lib/libcom_err.so.2 (0x00411000) > > libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0054b000) > > libz.so.1 => /usr/lib/libz.so.1 (0x00101000) > > /lib/ld-linux.so.2 (0x00bea000) > > libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00578000) > > libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00573000) > > libselinux.so.1 => /lib/libselinux.so.1 (0x00dde000) > > libsepol.so.1 => /lib/libsepol.so.1 (0x00d96000) > > > > It looks quite different from your version. > > Well, it likely looks differently because install paths might be > different. Is that listing complete? libldap(_r) seems to be missing. > > You should check with e.g. > rpm -qf /usr/lib/liblber-2.3.so.0 > if these files are part of a RPM package and of which version your > OpenLDAP installation is. > > Hmm, another point popping up from your lib listing above: > Any SE Linux policy prohibiting execution/linking of shared libs? > > Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-28 15:45:04
|
Ron Teitelbaum wrote: > ldd libldap.so > linux-gate.so.1 => (0x002d7000) > liblber-2.3.so.0 => /usr/lib/liblber-2.3.so.0 (0x00176000) > libresolv.so.2 => /lib/libresolv.so.2 (0x002f7000) > libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x0089a000) > libssl.so.6 => /lib/libssl.so.6 (0x00652000) > libcrypto.so.6 => /lib/libcrypto.so.6 (0x00416000) > libc.so.6 => /lib/libc.so.6 (0x00c0c000) > libdl.so.2 => /lib/libdl.so.2 (0x00d4e000) > libcrypt.so.1 => /lib/libcrypt.so.1 (0x0399c000) > libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0058d000) > libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x005bd000) > libcom_err.so.2 => /lib/libcom_err.so.2 (0x00411000) > libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x0054b000) > libz.so.1 => /usr/lib/libz.so.1 (0x00101000) > /lib/ld-linux.so.2 (0x00bea000) > libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00578000) > libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00573000) > libselinux.so.1 => /lib/libselinux.so.1 (0x00dde000) > libsepol.so.1 => /lib/libsepol.so.1 (0x00d96000) > > It looks quite different from your version. Well, it likely looks differently because install paths might be different. Is that listing complete? libldap(_r) seems to be missing. You should check with e.g. rpm -qf /usr/lib/liblber-2.3.so.0 if these files are part of a RPM package and of which version your OpenLDAP installation is. Hmm, another point popping up from your lib listing above: Any SE Linux policy prohibiting execution/linking of shared libs? Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-26 09:13:53
|
Ron Teitelbaum wrote: > > I know you mentioned that I should send you more info if I get an exception. > > I got a SERVER_DOWN and then retried the call manually and blew up python2.4 > > This is CentOS 5, python2.4.4, python-ldap 2.3.4 > [..] > python2.4: io.c:234: ber_flush2: Assertion `( (sb)->sb_opts.lbo_valid == 0x3 > )' failed. > Aborted Hmm, this is a debug message of OpenLDAP's libldap. Never saw this. Which version of OpenLDAP is installed there? CentOS is based on Fedora? Red Hat / Fedora is far behind with its OpenLDAP version. Any chance for a library mix with another libldap? Could you please check which libldap is dynamically linked? Use ldd for that. On my system where OpenLDAP is separately compiled and installed to prefix /opt/openldap-2.3: # ldd /usr/lib/python/site-packages/_ldap.so linux-gate.so.1 => (0xffffe000) libldap_r-2.3.so.0 => /opt/openldap-2.3/lib/libldap_r-2.3.so.0 (0xb7ecf000) liblber-2.3.so.0 => /opt/openldap-2.3/lib/liblber-2.3.so.0 (0xb7ec1000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb7e92000) libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0xb7e4f000) libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0xb7d08000) libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7be7000) libpthread.so.0 => /lib/libpthread.so.0 (0xb7bd0000) libc.so.6 => /lib/libc.so.6 (0xb7a9d000) libresolv.so.2 => /lib/libresolv.so.2 (0xb7a8a000) libdl.so.2 => /lib/libdl.so.2 (0xb7a86000) libz.so.1 => /lib/libz.so.1 (0xb7a72000) libutil.so.1 => /lib/libutil.so.1 (0xb7a6e000) libm.so.6 => /lib/libm.so.6 (0xb7a49000) /lib/ld-linux.so.2 (0x80000000) > I thought I'd send it to you incase it gives you any clues about SERVER_DOWN > which has been a royal pain! It shouldn't be a problem. It works for me very often. I believe it's an issue with your local installation. > I actually was able to reproduce this error twice. 3rd time worked. Strange. Ciao, Michael. |
From: Ron T. <Ro...@US...> - 2008-04-26 03:39:29
|
Hi Michael, I know you mentioned that I should send you more info if I get an exception. I got a SERVER_DOWN and then retried the call manually and blew up python2.4 This is CentOS 5, python2.4.4, python-ldap 2.3.4 File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 507, in search_s return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout= self.timeout) File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 501, in search_ext_s return self.result(msgid,all=1,timeout=timeout)[1] File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 427, in result res_type,res_data,res_msgid = self.result2(msgid,all,timeout) File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 431, in result2 res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout) File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 437, in result3 ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout) File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 96, in _ldap_call result = func(*args,**kwargs) ldap.SERVER_DOWN: {'desc': "Can't contact LDAP server"} >>> ico.getNewUsersThatWereInvited() python2.4: io.c:234: ber_flush2: Assertion `( (sb)->sb_opts.lbo_valid == 0x3 )' failed. Aborted I thought I'd send it to you incase it gives you any clues about SERVER_DOWN which has been a royal pain! I actually was able to reproduce this error twice. 3rd time worked. Thanks again for all your help! Ron |
From: Ron T. <Ro...@US...> - 2008-04-23 17:01:51
|
Hi Michael, Thanks for your response. I'll play around with it. The sleep time added was to enable us to test the behavior of result. We are calling python through Smalltalk and we add the sleep on our end (the calling thread in Smalltalk not python) to enable other threads to process while waiting on responses. I guess I assumed that the result wouldn't take more then 1 or 2 waits, and the next call would retrieve the full result set. I didn't expect that I needed to call result once for each record. Thanks again for your suggestions and all your help! Ron > -----Original Message----- > From: Michael Ströder > > Ron Teitelbaum wrote: > > While polling it appears that we have to call result for every record > that > > is waiting to be read. Since we added a 250 millisecond delay between > calls > > larger queries are taking a really long time. > > Why do you wait such a long time in an extra time.sleep() call? > > > result = self.connection.result(id, True, 0) > > time.sleep(0.25) > > Hmm, I don't know very much of the inner workings of OpenLDAP's function > ldap_result(). The behaviour also may depend on the version of OpenLDAP. > > But how about fiddling around a little bit with the timeout argument for > result()? You're blocking your while-loop with time.sleep() anyway. And > the C wrapper module releases Python's GIL. > > Something like > > [..within while loop..] > try: > result = l.result(msgid,True,0.25) > except ldap.TIMEOUT: > continue > else: > # Process result > [..within while loop..] > > I played around a little bit with the script attached on a local server > with more than 1000 entries. > > BTW: If you're after correctly dispatching results to several > outstanding search requests you should probably use method result2() > which also returns the message ID of the originating request: > > http://python- > ldap.sourceforge.net/doc/html/ldap.html#ldap.LDAPObject.result2 > > Use result3() if LDAPv3 extended controls are to be used to also receive > controls sent by the server. > > Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-23 14:31:45
|
Olivier, please follow-up on the python-ldap-dev (Cc:-ed) list because this is certainly of general interest. Olivier Sessink wrote: > 2008/4/23 Michael Ströder <mi...@st...>: >> Hmm, I'm not sure I would consider this to be very high-level. If a >> higher-level API is ever add to python-ldap it will definitely be >> subschema-aware to map OID to NAME aliases and some more stuff and make use >> of defaultdict stuff new in Python 2.5. > > Can you explain a little what the subschema-awareness would bring for > the python-ldap programmer? Can you give a (pseudo-code) example what > that could look like? It eases dealing with different attribute names and the accompanying OIDs. There's already something implemented in (undocumented) class ldap.schema.models.Entry which I heavily use in web2ldap. It does not implement methods for invoking the LDAP add and modify operations. It is still undocumented because it was never thoroughly reviewed by others and probably some details may need a re-design. Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-23 14:05:20
|
Ron Teitelbaum wrote: > While polling it appears that we have to call result for every record that > is waiting to be read. Since we added a 250 millisecond delay between calls > larger queries are taking a really long time. Why do you wait such a long time in an extra time.sleep() call? > result = self.connection.result(id, True, 0) > time.sleep(0.25) Hmm, I don't know very much of the inner workings of OpenLDAP's function ldap_result(). The behaviour also may depend on the version of OpenLDAP. But how about fiddling around a little bit with the timeout argument for result()? You're blocking your while-loop with time.sleep() anyway. And the C wrapper module releases Python's GIL. Something like [..within while loop..] try: result = l.result(msgid,True,0.25) except ldap.TIMEOUT: continue else: # Process result [..within while loop..] I played around a little bit with the script attached on a local server with more than 1000 entries. BTW: If you're after correctly dispatching results to several outstanding search requests you should probably use method result2() which also returns the message ID of the originating request: http://python-ldap.sourceforge.net/doc/html/ldap.html#ldap.LDAPObject.result2 Use result3() if LDAPv3 extended controls are to be used to also receive controls sent by the server. Ciao, Michael. |
From: Michael S. <mi...@st...> - 2008-04-23 11:26:20
|
Olivier, Olivier Sessink wrote: > > In my use of python-ldap I've often used a self-developed high level > class for ldap-object handling. > > Adding a new ldap entry for example (ld is a python-ldap object): > > lo = LdapOO.LdapObject() > lo.set_dn_attribs(['cn']) > lo.add_attribute_value('cn','test2') > lo.set_base_dn('ou=People,o=myorg') > lo.add_attribute_value('objectClass','inetOrgPerson') > lo.commit_s(ld) > > or modifying an existing ldap entry: > > res=ld.search_s('ou=People,o=fakenet',ldap.SCOPE_SUBTREE,'(sn=surname)') > lo = LdapOO.LdapObject(res[0][0],res[0][1]) > lo.add_attribute_value('sn','surname') > if (not lo.has_attribute('street')): > lo.add_attribute_value('street','new street') > lo.commit_s(ld) Hmm, I'm not sure I would consider this to be very high-level. If a higher-level API is ever add to python-ldap it will definitely be subschema-aware to map OID to NAME aliases and some more stuff and make use of defaultdict stuff new in Python 2.5. > since I use this class often, I was wondering if there are more people > that like such a high-level API, and perhaps this can be developed > further and added to python-ldap ? I'd prefer you to release this as a separate package on your own web space since I wouldn't use it myself and therefore I'd not maintain it. If you do so I would be glad to link to your project page from python-ldap's web page so that others can find it easily. Ciao, Michael. |
From: Olivier S. <oli...@gm...> - 2008-04-22 19:26:40
|
Hi all, I've been using python-ldap a lot, thanks for the great work! In my use of python-ldap I've often used a self-developed high level class for ldap-object handling. Adding a new ldap entry for example (ld is a python-ldap object): lo = LdapOO.LdapObject() lo.set_dn_attribs(['cn']) lo.add_attribute_value('cn','test2') lo.set_base_dn('ou=People,o=myorg') lo.add_attribute_value('objectClass','inetOrgPerson') lo.commit_s(ld) or modifying an existing ldap entry: res=ld.search_s('ou=People,o=fakenet',ldap.SCOPE_SUBTREE,'(sn=surname)') lo = LdapOO.LdapObject(res[0][0],res[0][1]) lo.add_attribute_value('sn','surname') if (not lo.has_attribute('street')): lo.add_attribute_value('street','new street') lo.commit_s(ld) since I use this class often, I was wondering if there are more people that like such a high-level API, and perhaps this can be developed further and added to python-ldap ? regards, Olivier Sessink |
From: Ron T. <Ro...@US...> - 2008-04-22 16:40:26
|
Hi all, We are experiencing something pretty odd. CentOS 5 python2.4.4 python-ldap 2.3.4 While polling it appears that we have to call result for every record that is waiting to be read. Since we added a 250 millisecond delay between calls larger queries are taking a really long time. def searchForAsync(self, searchString): id = self.connection.search('dc=my,dc=base,dc=rec',2,searchStr ing,['*','+']) result = [None, None] count = 0 start = time.time() while(result[0] == None): count = count + 1 result = self.connection.result(id, True, 0) time.sleep(0.25) print "Total call count: " + str(count) print "Total query time: " + str(time.time - start) return result The result: With 165 records the total call count is 167 and the total time 42.1 seconds. Is this expected or did we do something wrong? Thanks for your help! Ron |
From: Michael S. <mi...@st...> - 2008-04-21 11:00:17
|
Torsten Kurbad wrote: > > I boiled some new eggs for you. Thanks for contributing your builds. Could you please provide some descriptive text (HTML snippet) to be added to the web site at http://python-ldap.sourceforge.net/download.shtml? Ciao, Michael. |
From: Torsten K. <pyt...@tk...> - 2008-04-21 09:46:15
|
Hi Folks, I boiled some new eggs for you. In particular: python_ldap-2.3.4-py2.4-linux-i686.egg python_ldap-2.3.4-py2.4-linux-x86_64.egg python_ldap-2.3.4-py2.4-win32.egg python_ldap-2.3.4-py2.5-win32.egg The Linux eggs have been built with OpenLDAP-2.3 and Cyrus-SASL support. The Windows versions have been linked against MinGW versions of OpenSSL-0.98g and OpenLDAP-2.4.8. The get the win32 eggs running, you also need to unzip the file OpenLDAP-2.4.8+OpenSSL-0.9.8g-Win32.zip to a directory in your path, e.g. C:\Windows\System32. It contains the necessary DLLs. All files can be downloaded from our development web server at http://svn.kmrc.de/download/distribution Have fun, Torsten -- Our similarities are different. -Dale Berra, son of Yogi |