From ee44733f94864fb0a1ae15d48e3335c0705a82ae Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 3 Apr 2004 12:29:21 +0000 Subject: added the rest of the ldb_modify() code, which required a fairly large change in the ldb API. The API is now much closer to LDAP. (This used to be commit e9e85c464411c561c5073d262a2e3533fec175ca) --- source4/lib/ldb/tools/ldbadd.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source4/lib/ldb/tools/ldbadd.c') diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index 3eb7cb8de2..92ed29e6b8 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -37,7 +37,7 @@ int main(void) { static struct ldb_context *ldb; - struct ldb_message *msg; + struct ldb_ldif *ldif; int ret; int count=0, failures=0; const char *ldb_url; @@ -54,16 +54,23 @@ exit(1); } - while ((msg = ldif_read_file(stdin))) { - ret = ldb_add(ldb, msg); + while ((ldif = ldif_read_file(stdin))) { + + if (ldif->changetype != LDB_CHANGETYPE_ADD && + ldif->changetype != LDB_CHANGETYPE_NONE) { + fprintf(stderr, "Only CHANGETYPE_ADD records allowed\n"); + break; + } + + ret = ldb_add(ldb, &ldif->msg); if (ret != 0) { fprintf(stderr, "ERR: \"%s\" on DN %s\n", - ldb_errstring(ldb), msg->dn); + ldb_errstring(ldb), ldif->msg.dn); failures++; } else { count++; } - ldif_read_free(msg); + ldif_read_free(ldif); } ldb_close(ldb); -- cgit