r18697: Make sure that adssearch.pl does not
authorGünther Deschner <gd@samba.org>
Tue, 19 Sep 2006 22:57:13 +0000 (22:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:00:48 +0000 (12:00 -0500)
* chase referrals
* use paged search control

when using the LDAP change notify control for monitoring changes.

Guenther
(This used to be commit d6849a83c01ee444931ffaa34c77b5fb7f4c8a5c)

examples/misc/adssearch.pl

index f2be1ddcdeee45ade78701ed7c439679880e5d78..70c8f37cd48a84c28f06d793fe6ad7fa29586235 100755 (executable)
@@ -130,7 +130,7 @@ if ($opt_fastbind && !$opt_simpleauth) {
 }
 
 if ($opt_notify) {
-       $opt_paging = 0;
+       $opt_paging = undef;
 }
 
 # get the query
@@ -1562,7 +1562,7 @@ sub default_callback {
 
        my ($res,$obj) = @_;
 
-       if ($res->code == LDAP_REFERRAL) {
+       if (!$opt_notify && $res->code == LDAP_REFERRAL) {
                return;
        }
 
@@ -1753,7 +1753,7 @@ sub main () {
                        scope => $scope,
                                ) || die "cannot search";
 
-               if ($async_search->code == LDAP_REFERRAL) {
+               if (!$opt_notify && ($async_search->code == LDAP_REFERRAL)) {
                        foreach my $ref ($async_search->referrals) {
                                print "\ngot Referral: [$ref]\n";
                                $async_ldap_hd->unbind();