[Zope] Strange error/traceback
Phil Harris
phil.harris@zope.co.uk
Tue, 27 Feb 2001 13:00:58 -0000
Chris/all,
as requested by ChrisW
def auth_LDAP(self,cn=None,pwd=None):
if cn==None or pwd==None:
return None
l=ldap.open('medico.uwcm.ac.uk')
cn='cn='+cn
l.search_s('',ldap.SCOPE_SUBTREE,cn) # this is where it fails
res=l.result()
auth=[res[1][0][0],pwd]
l.simple_bind_s(auth[0],auth[1])
l.unbind_s()
return 1
It's basically trying to :
1. do an anonymous bind to an LDAP server to find the dn of a particular
user
2. take the dn returned and then try to authenticate that user
but it don't get that far.
(I know there is no error trapping etc. I took it out to see what exactly
was happening.)
It always fails on the l.search_s, the cn and the pwd are returned from a
form (actually the login form of LoginManager).
I know the function works when not called from Zope but I really can't see
how that could possibly matter.
Any ideas?
Phil
----- Original Message -----
From: "Chris Withers" <chrisw@nipltd.com>
To: "Phil Harris" <phil.harris@zope.co.uk>
Cc: <zope@zope.org>
Sent: Tuesday, February 27, 2001 12:47 PM
Subject: Re: [Zope] Strange error/traceback
> Phil Harris wrote:
> >
> > Hi all,
> >
> > Anyone got any idea what this means:
> >
> > argument 1: expected string without null bytes, string found
>
> The line throwing this error and the declaration line of the function
being
> called would be handy...
>
> cheers,
>
> Chris