Fix the mess with ldb includes.
[kamenim/samba.git] / source4 / lib / ldb / tools / ldbtest.c
index 7644433f125f33d2b8e216911c601275d85561d0..edaa9fb85c0cbff2dd0fcdcafffab8acdd5e4f98 100644 (file)
@@ -18,8 +18,7 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
 /*
@@ -32,7 +31,7 @@
  *  Author: Andrew Tridgell
  */
 
-#include "ldb_includes.h"
+#include "ldb.h"
 #include "tools/cmdline.h"
 
 static struct timeval tp1,tp2;
@@ -94,7 +93,7 @@ static void add_records(struct ldb_context *ldb,
                el[2].name = talloc_strdup(tmp_ctx, "uid");
                el[2].num_values = 1;
                el[2].values = vals[2];
-               vals[2][0].data = (uint8_t *)ldb_casefold(ldb, tmp_ctx, name);
+               vals[2][0].data = (uint8_t *)ldb_casefold(ldb, tmp_ctx, name, strlen(name));
                vals[2][0].length = strlen((char *)vals[2][0].data);
 
                el[3].flags = 0;
@@ -228,7 +227,7 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, int nreco
                int ret;
 
                expr = talloc_asprintf(ldb, "(uid=TEST%d)", uid);
-               ret = ldb_search(ldb, basedn, LDB_SCOPE_SUBTREE, expr, NULL, &res);
+               ret = ldb_search(ldb, ldb, &res, basedn, LDB_SCOPE_SUBTREE, NULL, "%s", expr);
 
                if (ret != LDB_SUCCESS || (uid < nrecords && res->count != 1)) {
                        printf("Failed to find %s - %s\n", expr, ldb_errstring(ldb));
@@ -345,7 +344,7 @@ static void start_test_index(struct ldb_context **ldb)
                exit(1);
        }
 
-       (*ldb) = ldb_init(options);
+       (*ldb) = ldb_init(options, NULL);
 
        ret = ldb_connect(*ldb, options->url, flags, NULL);
        if (ret != 0) {
@@ -355,7 +354,7 @@ static void start_test_index(struct ldb_context **ldb)
 
        basedn = ldb_dn_new(*ldb, *ldb, options->basedn);
 
-       ret = ldb_search(*ldb, basedn, LDB_SCOPE_SUBTREE, "uid=test", NULL, &res);
+       ret = ldb_search(*ldb, *ldb, &res, basedn, LDB_SCOPE_SUBTREE, NULL, "uid=test");
        if (ret != LDB_SUCCESS) { 
                printf("Search with (uid=test) filter failed!\n");
                exit(1);
@@ -394,9 +393,7 @@ int main(int argc, const char **argv)
        TALLOC_CTX *mem_ctx = talloc_new(NULL);
        struct ldb_context *ldb;
 
-       ldb_global_init();
-
-       ldb = ldb_init(mem_ctx);
+       ldb = ldb_init(mem_ctx, NULL);
 
        options = ldb_cmdline_process(ldb, argc, argv, usage);