diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-02 22:28:27 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-03-04 08:51:45 +0100 |
commit | 1b9317381344c48be2d90353ba61490161615485 (patch) | |
tree | 5e7401e4ed7fcb7c6606e4f40a919bec1cd8c229 /source4 | |
parent | 1343c0723f129606a3bc6fedd8d5f92f1080392b (diff) | |
download | samba-1b9317381344c48be2d90353ba61490161615485.tar.gz samba-1b9317381344c48be2d90353ba61490161615485.tar.bz2 samba-1b9317381344c48be2d90353ba61490161615485.zip |
ldb:ldb tools - ldbtest - convert other result values to LDB codes as well
I've forgotten this in my first patchset.
Reviewed by: Tridge
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index 28c0674fdf..15c1e8b61e 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -66,7 +66,7 @@ static void add_records(struct ldb_context *ldb, #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++) { @@ -128,7 +128,7 @@ static void add_records(struct ldb_context *ldb, 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); @@ -139,7 +139,7 @@ static void add_records(struct ldb_context *ldb, #if 0 if (ldb_unlock(ldb, "transaction") != 0) { printf("transaction unlock failed\n"); - exit(1); + exit(LDB_ERR_OPERATIONS_ERROR); } #endif printf("\n"); @@ -185,7 +185,7 @@ static void modify_records(struct ldb_context *ldb, 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); @@ -215,7 +215,7 @@ static void delete_records(struct ldb_context *ldb, 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); } @@ -239,12 +239,12 @@ static void search_uid(struct ldb_context *ldb, struct ldb_dn *basedn, 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); @@ -265,7 +265,7 @@ static void start_test(struct ldb_context *ldb, unsigned int nrecords, 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); @@ -330,7 +330,7 @@ static void start_test_index(struct ldb_context **ldb) 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); @@ -345,12 +345,12 @@ static void start_test_index(struct ldb_context **ldb) 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); @@ -358,7 +358,7 @@ static void start_test_index(struct ldb_context **ldb) 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); @@ -368,11 +368,11 @@ static void start_test_index(struct ldb_context **ldb) 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"); @@ -380,7 +380,7 @@ static void start_test_index(struct ldb_context **ldb) 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"); |