Issue #131 resolved

Incorrect value type for use_ldaps setting returned when using PostgreSQL as a back-end

created an issue

When using PostgreSQL as a back-end and setting up LDAP authentication, ldap_settings.get('ldap_ldaps') will return a string which always evaluates to True.

As a consequence, RhodeCode will always try to bind using ldaps even though the setting for 'ldap_ldaps' says 'false' in the database.

Possible solution: In, before instantiating AuthLdap the content of kwargs['use_ldaps'] should be inspected and if it is a string rather than a True/False value, the string should be properly converted to a boolean, such as (or anything smarter than this):

{{{ if isinstance(kwargs['use_ldaps'],basestring): log.debug("use_ldaps is a string") if kwargs['use_ldaps'].lower() == 'false': kwargs['use_ldaps'] = False elif kwargs['use_ldaps'].lower() == 'true': kwargs['use_ldaps'] = True }}}

Comments (3)

  1. Marcin Kuzminski repo owner

    When setting up ldap the value stored as ldap_ldaps is '' (empty string that in python defaults to false) when setting ldaps it's turned into 'true' adnw hen You disable ldaps it's not converted to '' but to 'false' which is eventually true also.

    RhodeCode have already special functions to convert string to boolean. I'll fix that soon thanks for posting.

  2. Log in to comment