#if 0
if (ldb_lock(ldb, "transaction") != 0) {
printf("transaction lock failed\n");
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
#endif
for (i=0;i<count;i++) {
if (ldb_add(ldb, &msg) != 0) {
printf("Add of %s failed - %s\n", name, ldb_errstring(ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
printf("adding uid %s\r", name);
#if 0
if (ldb_unlock(ldb, "transaction") != 0) {
printf("transaction unlock failed\n");
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
#endif
printf("\n");
if (ldb_modify(ldb, &msg) != 0) {
printf("Modify of %s failed - %s\n", name, ldb_errstring(ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
printf("Modifying uid %s\r", name);
if (ldb_delete(ldb, dn) != 0) {
printf("Delete of %s failed - %s\n", ldb_dn_get_linearized(dn), ldb_errstring(ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
talloc_free(name);
}
if (ret != LDB_SUCCESS || (uid < nrecords && res->count != 1)) {
printf("Failed to find %s - %s\n", expr, ldb_errstring(ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
if (uid >= nrecords && res->count > 0) {
printf("Found %s !? - %d\n", expr, ret);
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
printf("Testing uid %d/%d - %d \r", i, uid, res->count);
basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) {
printf("Invalid base DN\n");
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
printf("Adding %d records\n", nrecords);
if (ldb_add(*ldb, msg) != 0) {
printf("Add of %s failed - %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(*ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
basedn = ldb_dn_new(*ldb, *ldb, options->basedn);
if (ldb_add(*ldb, msg) != 0) {
printf("Add of %s failed - %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(*ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
if (talloc_free(*ldb) != 0) {
printf("failed to free/close ldb database");
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
(*ldb) = ldb_init(options, NULL);
ret = ldb_connect(*ldb, options->url, flags, NULL);
if (ret != 0) {
printf("failed to connect to %s\n", options->url);
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
basedn = ldb_dn_new(*ldb, *ldb, options->basedn);
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);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
if(res->count != 1) {
printf("Should have found 1 record - found %d\n", res->count);
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
indexlist = ldb_dn_new(*ldb, *ldb, "@INDEXLIST");
if (ldb_delete(*ldb, msg->dn) != 0 ||
ldb_delete(*ldb, indexlist) != 0) {
printf("cleanup failed - %s\n", ldb_errstring(*ldb));
- exit(1);
+ exit(LDB_ERR_OPERATIONS_ERROR);
}
printf("Finished index test\n");