summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-02 22:40:13 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-04 08:51:57 +0100
commitb50ebc3228c9b4eacbccaf1ec4572c3ee7b07e1c (patch)
treedf6a6102845bd055c9f757323b0ae8489c9954c9 /source4
parent1b9317381344c48be2d90353ba61490161615485 (diff)
downloadsamba-b50ebc3228c9b4eacbccaf1ec4572c3ee7b07e1c.tar.gz
samba-b50ebc3228c9b4eacbccaf1ec4572c3ee7b07e1c.tar.bz2
samba-b50ebc3228c9b4eacbccaf1ec4572c3ee7b07e1c.zip
ldb:ldb tools - return LDB_ERR_INVALID_DN_SYNTAX on wrong DN parameters
Not all LDB databases have further DN checks. Reviewed by: Tridge
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/tools/ldbdel.c2
-rw-r--r--source4/lib/ldb/tools/ldbedit.c2
-rw-r--r--source4/lib/ldb/tools/ldbrename.c4
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c2
-rw-r--r--source4/lib/ldb/tools/ldbtest.c4
5 files changed, 9 insertions, 5 deletions
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index d374fa96e3..270cb83b53 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -113,7 +113,7 @@ int main(int argc, const char **argv)
dn = ldb_dn_new(ldb, ldb, options->argv[i]);
if ( ! ldb_dn_validate(dn)) {
printf("Invalid DN format\n");
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_INVALID_DN_SYNTAX;
}
if (options->recursive) {
ret = ldb_delete_recursive(ldb, dn,req_ctrls);
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 6509263a58..8df37060c6 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -328,7 +328,7 @@ int main(int argc, const char **argv)
basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) {
printf("Invalid Base DN format\n");
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_INVALID_DN_SYNTAX;
}
}
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index 0a539cc651..e8f67500fc 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -66,6 +66,10 @@ int main(int argc, const char **argv)
dn1 = ldb_dn_new(ldb, ldb, options->argv[0]);
dn2 = ldb_dn_new(ldb, ldb, options->argv[1]);
+ if ((!ldb_dn_validate(dn1)) || (!ldb_dn_validate(dn2))) {
+ printf("Invalid DN format(s)\n");
+ return LDB_ERR_INVALID_DN_SYNTAX;
+ }
ret = ldb_rename(ldb, dn1, dn2);
if (ret == LDB_SUCCESS) {
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 398710c658..8c101719a3 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -299,7 +299,7 @@ int main(int argc, const char **argv)
basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) {
fprintf(stderr, "Invalid Base DN format\n");
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_INVALID_DN_SYNTAX;
}
}
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 15c1e8b61e..a9d8fafe81 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -264,8 +264,8 @@ static void start_test(struct ldb_context *ldb, unsigned int nrecords,
basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) {
- printf("Invalid base DN\n");
- exit(LDB_ERR_OPERATIONS_ERROR);
+ printf("Invalid base DN format\n");
+ exit(LDB_ERR_INVALID_DN_SYNTAX);
}
printf("Adding %d records\n", nrecords);