summaryrefslogtreecommitdiff
path: root/lib/ldb/tools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2012-10-31 16:06:03 +1100
committerAndrew Tridgell <tridge@samba.org>2012-11-01 15:40:41 +1100
commit30ffdda45bd3ae602b453c9c1bbdb77ea3de8a8d (patch)
tree2859583eec07abce06678d464aea79501dd3e554 /lib/ldb/tools
parentfc47b0d03c577730ce0ef9e09092f80c0712d5d0 (diff)
downloadsamba-30ffdda45bd3ae602b453c9c1bbdb77ea3de8a8d.tar.gz
samba-30ffdda45bd3ae602b453c9c1bbdb77ea3de8a8d.tar.bz2
samba-30ffdda45bd3ae602b453c9c1bbdb77ea3de8a8d.zip
ldb: fixed callers for ldb_pack_data() and ldb_unpack_data()
with ltdb_pack_data() and ltdb_unpack_data() now moved into common, we need to increase the minor version and fixup callers of the API Note that this relies on struct ldb_val being the same shape as TDB_DATA, in much the same way as we rely on ldb_val and DATA_BLOB being the same shape. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb/tools')
-rw-r--r--lib/ldb/tools/ldbdump.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ldb/tools/ldbdump.c b/lib/ldb/tools/ldbdump.c
index 7a2ba3d385..edf7b5efb5 100644
--- a/lib/ldb/tools/ldbdump.c
+++ b/lib/ldb/tools/ldbdump.c
@@ -25,7 +25,7 @@
#include "system/wait.h"
#include <tdb.h>
#include <ldb.h>
-#include "../ldb_tdb/ldb_tdb.h"
+#include <ldb_private.h>
static struct ldb_context *ldb;
bool show_index = false;
@@ -43,7 +43,8 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *stat
if (!msg) {
return -1;
}
- ret = ltdb_unpack_data(ldb, &dbuf, msg);
+
+ ret = ldb_unpack_data(ldb, &dbuf, msg);
if (ret != 0) {
fprintf(stderr, "Failed to parse record %*.*s as an LDB record\n", (int)key.dsize, (int)key.dsize, (char *)key.dptr);
TALLOC_FREE(msg);
@@ -57,7 +58,13 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *stat
if (!show_index && ldb_dn_is_special(msg->dn)) {
const char *dn_lin = ldb_dn_get_linearized(msg->dn);
- if ((strcmp(dn_lin, LTDB_BASEINFO) == 0) || (strncmp(dn_lin, LTDB_INDEX ":", strlen( LTDB_INDEX ":")) == 0)) {
+ if ((strcmp(dn_lin, "@BASEINFO") == 0) || (strncmp(dn_lin, "@INDEX:", strlen("@INDEX:")) == 0)) {
+ /*
+ the user has asked not to show index
+ records. Also exclude BASEINFO as it
+ contains meta-data which will be re-created
+ if this database is restored
+ */
TALLOC_FREE(msg);
return 0;
}
@@ -154,7 +161,7 @@ static int dump_tdb(const char *fname, struct ldb_dn *dn, bool emergency)
static void usage( void)
{
- printf( "Usage: tdbdump [options] <filename>\n\n");
+ printf( "Usage: ldbdump [options] <filename>\n\n");
printf( " -h this help message\n");
printf( " -d DN dumps DN only\n");
printf( " -e emergency dump, for corrupt databases\n");