s4:dsdb Allow a NULL search expression in dsdb_search()
authorAndrew Bartlett <abartlet@samba.org>
Thu, 20 May 2010 22:11:13 +0000 (08:11 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 24 May 2010 13:08:11 +0000 (23:08 +1000)
The NULL search expression expands to (objectClass=*), but %s expands
NULL to (NULL) which doesn't parse...

Andrew Bartlett

source4/dsdb/common/util.c

index da4d0b39402519126273fb45768c5c6d5160c1c9..987864f74830c76584db602c384d1ec53e631e19 100644 (file)
@@ -3641,10 +3641,13 @@ int dsdb_search_one(struct ldb_context *ldb,
                        talloc_free(tmp_ctx);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
+               ret = dsdb_search(ldb, tmp_ctx, &res, basedn, scope, attrs,
+                                 dsdb_flags, "%s", expression);
+       } else {
+               ret = dsdb_search(ldb, tmp_ctx, &res, basedn, scope, attrs,
+                                 dsdb_flags, NULL);
        }
 
-       ret = dsdb_search(ldb, tmp_ctx, &res, basedn, scope, attrs,
-                         dsdb_flags, "%s", expression);
        if (ret != LDB_SUCCESS) {
                talloc_free(tmp_ctx);
                return ret;