make "net ads user" and "net ads group" also use the new paged interface
authorAndrew Tridgell <tridge@samba.org>
Tue, 19 Mar 2002 22:16:19 +0000 (22:16 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 19 Mar 2002 22:16:19 +0000 (22:16 +0000)
(This used to be commit 98769f08e723c616a98a2f0c427e9b0e22b28be9)

source3/utils/net_ads.c

index 31bf38726b3943f92452a3de635fd5b44b59c299..54d8eccbd7d242de59871d0389953beef79fb2c8 100644 (file)
@@ -125,26 +125,19 @@ static int net_ads_user(int argc, const char **argv)
        ADS_STRUCT *ads;
        ADS_STATUS rc;
        void *res;
-       int rescount;
-       void *cookie = NULL;
        const char *attrs[] = {"sAMAccountName", "name", "objectSid", NULL};
        
        if (!(ads = ads_startup())) return -1;
 
-       do {
-               rc = ads_do_paged_search(ads, ads->bind_path, 
-                                        LDAP_SCOPE_SUBTREE, 
-                                        "(objectclass=user)", attrs, &res, 
-                                        &rescount, &cookie);
-
-               if (!ADS_ERR_OK(rc)) {
-                       d_printf("ads_search: %s\n", ads_errstr(rc));
-                       return -1;
-               }
-               ads_dump(ads, res);
-
-       } while (cookie);
+       rc = ads_do_search_all(ads, ads->bind_path, 
+                              LDAP_SCOPE_SUBTREE, 
+                              "(objectclass=user)", attrs, &res);
 
+       if (!ADS_ERR_OK(rc)) {
+               d_printf("ads_search: %s\n", ads_errstr(rc));
+               return -1;
+       }
+       ads_dump(ads, res);
        ads_destroy(&ads);
        return 0;
 }
@@ -154,26 +147,19 @@ static int net_ads_group(int argc, const char **argv)
        ADS_STRUCT *ads;
        ADS_STATUS rc;
        void *res;
-       int rescount;
-       void *cookie = NULL;
        const char *attrs[] = {"sAMAccountName", "name", "objectSid", NULL};
 
        if (!(ads = ads_startup())) return -1;
 
-       do {
-               rc = ads_do_paged_search(ads, ads->bind_path, 
-                                        LDAP_SCOPE_SUBTREE, 
-                                        "(objectclass=group)", attrs, &res, 
-                                        &rescount, &cookie);
-
-               if (!ADS_ERR_OK(rc)) {
-                       d_printf("ads_search: %s\n", ads_errstr(rc));
-                       return -1;
-               }
-               ads_dump(ads, res);
-
-       } while (cookie);
+       rc = ads_do_search_all(ads, ads->bind_path, 
+                              LDAP_SCOPE_SUBTREE, 
+                              "(objectclass=group)", attrs, &res);
+       if (!ADS_ERR_OK(rc)) {
+               d_printf("ads_search: %s\n", ads_errstr(rc));
+               return -1;
+       }
 
+       ads_dump(ads, res);
        ads_destroy(&ads);
        return 0;
 }