Skip to content

Commit

Permalink
Change: Set LDAP version to 3 after initialization (#723)
Browse files Browse the repository at this point in the history
* Set LDAP version to 3 after initialization

LDAP version is by default set to 3, but when StarTLS
is disabled then the initialization is done for the second time.
And after the initialization version is set to 2. This change
is to set the version back to 3.

Signed-off-by: Franciszek Klajn <fklajn@opera.com>

* Fix coding style

Signed-off-by: Franciszek Klajn <fklajn@opera.com>
  • Loading branch information
fklajn committed Dec 7, 2022
1 parent 2532976 commit b727c7e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions util/ldaputils.c
Expand Up @@ -333,6 +333,31 @@ ldap_auth_bind (const gchar *host, const gchar *userdn, const gchar *password,
g_free (ldapuri);
goto fail;
}
// Set LDAP version to 3 after initialization
ldap_return =
ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &ldapv3);
if (ldap_return != LDAP_SUCCESS)
{
g_warning (
"Aborting, could not set ldap protocol version to 3: %s.",
ldap_err2string (ldap_return));
g_free (ldapuri);
goto fail;
}
}
}
else
{
// Set LDAP version to 3 after initialization
ldap_return =
ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &ldapv3);
if (ldap_return != LDAP_SUCCESS)
{
g_warning (
"Aborting, could not set ldap protocol version to 3: %s.",
ldap_err2string (ldap_return));
g_free (ldapuri);
goto fail;
}
}
}
Expand Down

0 comments on commit b727c7e

Please sign in to comment.