diff options
author | Jim McDonough <jmcd@samba.org> | 2002-03-27 02:58:58 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2002-03-27 02:58:58 +0000 |
commit | 1a06eeb6dae9b148a6e70470660e51a42def2399 (patch) | |
tree | 3c4cad44b533d7ba2b4e8035748dd8644f5491fb /source3/libads | |
parent | 0d87fb91c4385679a104eb9f6110acf10157c0cb (diff) | |
download | samba-1a06eeb6dae9b148a6e70470660e51a42def2399.tar.gz samba-1a06eeb6dae9b148a6e70470660e51a42def2399.tar.bz2 samba-1a06eeb6dae9b148a6e70470660e51a42def2399.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.
(This used to be commit 2bebc8a391bd80bd0e5adbedb3757fb4279ec414)
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ldap.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index c8661c2ebb..92898bc4db 100644 --- a/source3/libads/ldap.c +++ b/source3/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, |