summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-10-12 11:34:58 +0200
committerKarolin Seeger <kseeger@samba.org>2009-11-26 11:39:13 +0100
commitd3871d27aa85509a8a050e652ee95f03d6799850 (patch)
tree9e3d4d351f11c3b4e554e85092f7e889d45d0cfa /source3/lib
parent18989d6bac6db6c062c6d6f7398f48ec24ef8fad (diff)
downloadsamba-d3871d27aa85509a8a050e652ee95f03d6799850.tar.gz
samba-d3871d27aa85509a8a050e652ee95f03d6799850.tar.xz
samba-d3871d27aa85509a8a050e652ee95f03d6799850.zip
s3/smbldap: add option to disable following LDAP refs
Fix bug #6717. (cherry picked from commit c5d5969e24913ea544590dd16378f7e071b07c4b) (cherry picked from commit a50372629107d98d933bc7851c7973076b3674fe)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbldap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index c96801a72b2..47b2208880e 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -721,9 +721,18 @@ int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
rc = ldap_initialize(ldap_struct, uri);
if (rc) {
DEBUG(0, ("ldap_initialize: %s\n", ldap_err2string(rc)));
+ return rc;
}
- return rc;
+ if (lp_ldap_ref_follow() != Auto) {
+ rc = ldap_set_option(*ldap_struct, LDAP_OPT_REFERRALS,
+ lp_ldap_ref_follow() ? LDAP_OPT_ON : LDAP_OPT_OFF);
+ if (rc != LDAP_SUCCESS)
+ DEBUG(0, ("Failed to set LDAP_OPT_REFERRALS: %s\n",
+ ldap_err2string(rc)));
+ }
+
+ return LDAP_SUCCESS;
#else
/* Parse the string manually */
@@ -774,7 +783,6 @@ int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri)
}
#endif /* HAVE_LDAP_INITIALIZE */
-
/* now set connection timeout */
#ifdef LDAP_X_OPT_CONNECT_TIMEOUT /* Netscape */
{