summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/ldbadd.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/tools/ldbadd.c')
-rw-r--r--source4/lib/ldb/tools/ldbadd.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index e057b873a8..42470656fb 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -1,4 +1,4 @@
-/*
+/*
ldb database library
Copyright (C) Andrew Tridgell 2004
@@ -6,7 +6,7 @@
** NOTE! The following LGPL license applies to the ldb
** library. This does NOT imply that all of Samba is released
** under the LGPL
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@@ -40,7 +40,7 @@ static struct ldb_cmdline *options;
static void usage(void)
{
- printf("Usage: ldbadd <options> <ldif...>\n");
+ printf("Usage: ldbadd <options> <ldif...>\n");
printf("Adds records to a ldb, reading ldif the specified list of files\n\n");
ldb_cmdline_help("ldbadd", stdout);
exit(1);
@@ -68,7 +68,15 @@ static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count)
break;
}
- ldif->msg = ldb_msg_canonicalize(ldb, ldif->msg);
+ ret = ldb_msg_normalize(ldb, ldif, ldif->msg, &ldif->msg);
+ if (ret != LDB_SUCCESS) {
+ fprintf(stderr,
+ "ERR: Message canonicalize failed - %s\n",
+ ldb_strerror(ret));
+ failures++;
+ ldb_ldif_read_free(ldb, ldif);
+ continue;
+ }
ret = ldb_add_ctrl(ldb, ldif->msg,req_ctrls);
if (ret != LDB_SUCCESS) {
@@ -134,6 +142,6 @@ int main(int argc, const char **argv)
talloc_free(mem_ctx);
printf("Added %d records with %d failures\n", count, failures);
-
+
return ret;
}