summaryrefslogtreecommitdiffstats
path: root/source/libads
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-03-27 02:58:58 +0000
committerJim McDonough <jmcd@samba.org>2002-03-27 02:58:58 +0000
commit2bebc8a391bd80bd0e5adbedb3757fb4279ec414 (patch)
tree5f8e7d3587d1fad895eb1a2fcf196161cfef4de3 /source/libads
parentea60c50109462b35825be1dd3cc6b28f739a1b59 (diff)
downloadsamba-2bebc8a391bd80bd0e5adbedb3757fb4279ec414.tar.gz
samba-2bebc8a391bd80bd0e5adbedb3757fb4279ec414.tar.xz
samba-2bebc8a391bd80bd0e5adbedb3757fb4279ec414.zip
Add server control to prevent referrals in paged searches. This keeps
the scope limited to the domain at hand, and also keeps the openldap libs happy, since they don't currently chase referrals and return server controls properly at the same time.
Diffstat (limited to 'source/libads')
-rw-r--r--source/libads/ldap.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index c8661c2ebb2..92898bc4db2 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -78,11 +78,13 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
{
int rc;
#define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
+#define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
int version;
LDAPControl PagedResults;
+ LDAPControl NoReferrals;
BerElement *berelem = NULL;
struct berval *berval = NULL;
- LDAPControl *controls[2];
+ LDAPControl *controls[3];
LDAPControl **rcontrols, *cur_control;
*res = NULL;
@@ -105,19 +107,29 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
}
ber_flatten(berelem, &berval);
PagedResults.ldctl_oid = ADS_PAGE_CTL_OID;
- PagedResults.ldctl_iscritical = (char) 1;
+ PagedResults.ldctl_iscritical = (char) 0;
PagedResults.ldctl_value.bv_len = berval->bv_len;
PagedResults.ldctl_value.bv_val = berval->bv_val;
-
- controls[0] = &PagedResults;
- controls[1] = NULL;
+
+ NoReferrals.ldctl_oid = ADS_NO_REFERRALS_OID;
+ NoReferrals.ldctl_iscritical = (char) 0;
+ NoReferrals.ldctl_value.bv_len = 0;
+ NoReferrals.ldctl_value.bv_val = "";
+
+ controls[0] = &NoReferrals;
+ controls[1] = &PagedResults;
+ controls[2] = NULL;
*res = NULL;
/* we need to disable referrals as the openldap libs don't
seem to handle them correctly. They result in the result
record containing the server control being removed from the
- result list (tridge) */
+ result list (tridge)
+
+ leaving this in despite the control that says don't generate
+ referrals, in case the server doesn't support it (jmcd)
+ */
ldap_set_option(ads->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
rc = ldap_search_ext_s(ads->ld, bind_path, scope, exp,