Projet

Général

Profil

0002-ldap-set-default-timeout-to-5-seconds-fixes-29386.patch

Benjamin Dauvergne, 12 mars 2019 12:37

Télécharger (1,76 ko)

Voir les différences:

Subject: [PATCH 2/2] ldap: set default timeout to 5 seconds (fixes #29386)

Also change behaviour to set the network *and* default timeout, see
ldap.conf(5) :

  NETWORK_TIMEOUT <integer>
      Specifies the timeout (in seconds) after which the poll(2)/select(2)
      following a connect(2) returns in case of no activity.

  TIMEOUT <integer>
      Specifies a timeout (in seconds) after which calls to synchronous
      LDAP APIs will abort if no response is received. Also used for any
      ldap_result(3) calls where a NULL timeout parameter is supplied.
 src/authentic2/backends/ldap_backend.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/authentic2/backends/ldap_backend.py
391 391
        'email_field': 'mail',
392 392
        'fname_field': 'givenName',
393 393
        'lname_field': 'sn',
394
        'timeout': -1,
394
        'timeout': 5,
395 395
        'referrals': False,
396 396
        'disable_update': False,
397 397
        'bind_with_username': False,
......
1190 1190
            conn = LDAPObject(url)
1191 1191
            if block['timeout'] > 0:
1192 1192
                conn.set_option(ldap.OPT_NETWORK_TIMEOUT, block['timeout'])
1193
                conn.set_option(ldap.OPT_TIMEOUT, block['timeout'])
1193 1194
            conn.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,
1194 1195
                            getattr(ldap, 'OPT_X_TLS_' + block['require_cert'].upper()))
1195 1196
            if block['cacertfile']:
1196
-