> -----Original Message-----
> From: Michael Ströder [mailto:[email protected]]
> Sent: 05 August 2009 16:11
> To: Mike Peters
> Cc: [email protected]
> Subject: Re: ldap.passwd_s with Active Direcory
>
> [email protected] wrote:
> > Michael Ströder wrote:
> >> Did you search for the MSDN article? The value has to be in your
> case
> >> above:
> >>
> >> '"password"'.encode('utf-16-le')
> >>
> >> Note the quotes and the UTF-16 low-endian encoding.
> >
> > Thanks again for your help. I tried that but to no avail. I still get
> the
> > same error.
>
> It should work. It's the way I've implemented it in web2ldap. You must
> use
> either LDAPS or StartTLS ext.op.
>
> You might wanna look what's going on by setting trace_level=2 when
> calling
> ldap.initialize().
>
With trace_level=2 I get the following:
In [1]: import ldap
In [2]: l = ldap.initialize("ldaps://ad01.demo.local:636", trace_level=2)
*** ldaps://ad01.demo.local:636 - SimpleLDAPObject.set_option ((17, 3),{})
In [3]: l.simple_bind_s(u'u...@addemo', u'secret')
*** ldaps://ad01.demo.local:636 - SimpleLDAPObject.simple_bind
((u'u...@addemo', u'secret', None, None),{})
=> result: 1
*** ldaps://ad01.demo.local:636 - SimpleLDAPObject.result3 ((1, 1, -1),{})
=> result: (97, [], 1, [])
Out[3]: (97, [])
In [4]: mod_attrs = [( ldap.MOD_REPLACE, 'unicodePwd',
'"password"'.encode('utf-16-le') )]
In [5]: dn = 'CN=Barney Rubble,OU=Users,OU=ADDEMO,DC=demo,DC=local'
In [6]: r = l.modify_s(dn, mod_attrs)*** ldaps://ad01.demo.local:636 -
SimpleLDAPObject.modify_ext (('CN=Barney
Rubble,OU=Users,OU=ADDEMO,DC=demo,DC=local', [(2, 'unicodePwd',
'"\x00p\x00a\x00s\x00s\x00w\x00o\x00r\x00d\x00"\x00')], None, None),{})
=> result: 2
*** ldaps://ad01.demo.local:636 - SimpleLDAPObject.result3 ((2, 1, -1),{})
=> LDAPError - UNWILLING_TO_PERFORM: {'info': '0000052D: SvcErr: DSID-031A0FC0,
problem 5003 (WILL_NOT_PERFORM), data 0\n', 'desc': 'Server is unwilling to
perform'}
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (134, 0))
---------------------------------------------------------------------------
UNWILLING_TO_PERFORM Traceback (most recent call last)
/home/django/pplace/<ipython console> in <module>()
/usr/lib/python2.5/site-packages/ldap/ldapobject.pyc in modify_s(self, dn,
modlist)
326 def modify_s(self,dn,modlist):
327 msgid = self.modify(dn,modlist)
--> 328 return self.result(msgid,all=1,timeout=self.timeout)
329
330 def modrdn(self,dn,newrdn,delold=1):
/usr/lib/python2.5/site-packages/ldap/ldapobject.pyc in result(self, msgid,
all, timeout)
426 polling (timeout = 0), in which case (None, None) is returned.
427 """
--> 428 res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
429 return res_type,res_data
430
/usr/lib/python2.5/site-packages/ldap/ldapobject.pyc in result2(self, msgid,
all, timeout)
430
431 def result2(self,msgid=_ldap.RES_ANY,all=1,timeout=None):
--> 432 res_type, res_data, res_msgid, srv_ctrls =
self.result3(msgid,all,timeout)
433 return res_type, res_data, res_msgid
434
/usr/lib/python2.5/site-packages/ldap/ldapobject.pyc in result3(self, msgid,
all, timeout)
436 if timeout is None:
437 timeout = self.timeout
--> 438 ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
439 if ldap_result is None:
440 rtype, rdata, rmsgid, decoded_serverctrls = (None,None,None,None)
/usr/lib/python2.5/site-packages/ldap/ldapobject.pyc in _ldap_call(self, func,
*args, **kwargs)
94 try:
95 try:
---> 96 result = func(*args,**kwargs)
97 finally:
98 self._ldap_object_lock.release()
UNWILLING_TO_PERFORM: {'info': '0000052D: SvcErr: DSID-031A0FC0, problem 5003
(WILL_NOT_PERFORM), data 0\n', 'desc': 'Server is unwilling to perform'}
Does the encoded password look right?
Thanks
Mike Peters
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Python-LDAP-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev