[Samba] Slow ldap authentication against samba 4

Rowland Penny rowlandpenny at googlemail.com
Tue Jan 20 04:42:13 MST 2015


On 20/01/15 11:14, Jefferson Parreira dos Santos Emerick wrote:
> ​ Yeah.. I wrote a simple script in python to test it. Here is the scrit:
>
> *import ldap*
> *from threading import Thread*
> *import time*
> *import sys*
> *
> *
> *class LDAPTtryThread(Thread):*
> *
> *
> *  def __init__(self, **kwargs):*
> *      Thread.__init__(self)*
> *self.id <http://self.id> = kwargs.get('id')*
> *      self.host = kwargs.get('host')*
> *      self.username = kwargs.get('username')*
> *      self.password = kwargs.get('password')*
> *      self.timeout = kwargs.get('timeout',None)*
> *
> *
> *  def run(self):*
> *      try:*
> *          l = ldap.open(self.host)*
> *          l.protocol_version = ldap.VERSION3*
> *          l.port = 389*
> *          if self.timeout:*
> *              l.set_option(ldap.OPT_TIMEOUT, self.timeout)*
> *          l.simple_bind_s(self.username, self.password)*
> *          print '%s OK' %self.id <http://self.id>*
> *      except ldap.LDAPError, e:*
> *          print '%s FAIL' %self.id <http://self.id>, e*
> *
> *
> *for i in range(int(sys.argv[4])):*
> *  timeout = None*
> *  if len(sys.argv) > 5:*
> *      timeout = int(sys.argv[5])*
> *  LDAPTesteThread(*
> *      id=i, host=sys.argv[1], username=sys.argv[2], 
> password=sys.argv[3],timeout=timeout).start()*
>>

Hmm, no idea if that is part of the problem or not, to me python is a 
snake :-D

Why do you want to use ldap authentication ?

Do you have some specific programs that you want to connect to AD ?

Rowland




More information about the samba mailing list