diff options
author | Matthieu Patou <mat@matws.net> | 2009-12-22 20:44:19 +0300 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-12-23 08:09:19 -0500 |
commit | 3bd4f6792c63fffec66548ae5cfde60e45f865fa (patch) | |
tree | ae6081f371dd4e710c0346f1f420da6e6f36ed77 /source4/lib/ldb/tools/ldbadd.c | |
parent | 5aa0d97464dd876e64b95cc9b302509430603217 (diff) | |
download | samba-3bd4f6792c63fffec66548ae5cfde60e45f865fa.tar.gz samba-3bd4f6792c63fffec66548ae5cfde60e45f865fa.tar.bz2 samba-3bd4f6792c63fffec66548ae5cfde60e45f865fa.zip |
s4: make ldbadd/ldbmodify/ldbdelete really use the --controls switch
Diffstat (limited to 'source4/lib/ldb/tools/ldbadd.c')
-rw-r--r-- | source4/lib/ldb/tools/ldbadd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index a87c99aaee..4ff07a5bef 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -33,6 +33,7 @@ #include "ldb.h" #include "tools/cmdline.h" +#include "ldbutil.h" static int failures; static struct ldb_cmdline *options; @@ -53,6 +54,12 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) { struct ldb_ldif *ldif; int ret = LDB_SUCCESS; + struct ldb_control **req_ctrls = ldb_parse_control_strings(ldb, ldb, (const char **)options->controls); + if (options->controls != NULL && req_ctrls== NULL) { + printf("parsing controls failed: %s\n", ldb_errstring(ldb)); + return -1; + } + while ((ldif = ldb_ldif_read_file(ldb, f))) { if (ldif->changetype != LDB_CHANGETYPE_ADD && @@ -63,7 +70,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) ldif->msg = ldb_msg_canonicalize(ldb, ldif->msg); - ret = ldb_add(ldb, ldif->msg); + ret = ldb_add_ctrl(ldb, ldif->msg,req_ctrls); if (ret != LDB_SUCCESS) { fprintf(stderr, "ERR: \"%s\" on DN %s\n", ldb_errstring(ldb), ldb_dn_get_linearized(ldif->msg->dn)); |