summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/ldbdel.c
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-12-22 20:44:19 +0300
committerSimo Sorce <idra@samba.org>2009-12-23 08:09:19 -0500
commit3bd4f6792c63fffec66548ae5cfde60e45f865fa (patch)
treeae6081f371dd4e710c0346f1f420da6e6f36ed77 /source4/lib/ldb/tools/ldbdel.c
parent5aa0d97464dd876e64b95cc9b302509430603217 (diff)
downloadsamba-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/ldbdel.c')
-rw-r--r--source4/lib/ldb/tools/ldbdel.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 5740f22503..4180afb99c 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -33,6 +33,7 @@
#include "ldb.h"
#include "tools/cmdline.h"
+#include "ldbutil.h"
static int dn_cmp(const void *p1, const void *p2)
{
@@ -42,7 +43,7 @@ static int dn_cmp(const void *p1, const void *p2)
return ldb_dn_compare(msg1->dn, msg2->dn);
}
-static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn)
+static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struct ldb_control **req_ctrls)
{
int ret, i, total=0;
const char *attrs[] = { NULL };
@@ -55,7 +56,7 @@ static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn)
qsort(res->msgs, res->count, sizeof(res->msgs[0]), dn_cmp);
for (i = 0; i < res->count; i++) {
- if (ldb_delete(ldb, res->msgs[i]->dn) == 0) {
+ if (ldb_delete_ctrl(ldb, res->msgs[i]->dn,req_ctrls) == 0) {
total++;
} else {
printf("Failed to delete '%s' - %s\n",
@@ -95,6 +96,11 @@ int main(int argc, const char **argv)
usage();
exit(1);
}
+ 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;
+ }
for (i=0;i<options->argc;i++) {
struct ldb_dn *dn;
@@ -105,9 +111,9 @@ int main(int argc, const char **argv)
exit(1);
}
if (options->recursive) {
- ret = ldb_delete_recursive(ldb, dn);
+ ret = ldb_delete_recursive(ldb, dn,req_ctrls);
} else {
- ret = ldb_delete(ldb, dn);
+ ret = ldb_delete_ctrl(ldb, dn,req_ctrls);
if (ret == 0) {
printf("Deleted 1 record\n");
}