1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

ldb:ldb tools - return LDB_ERR_INVALID_DN_SYNTAX on wrong DN parameters

Not all LDB databases have further DN checks.

Reviewed by: Tridge
This commit is contained in:
Matthias Dieter Wallnöfer 2011-03-02 22:40:13 +01:00
parent 1b93173813
commit b50ebc3228
5 changed files with 9 additions and 5 deletions

View File

@ -113,7 +113,7 @@ int main(int argc, const char **argv)
dn = ldb_dn_new(ldb, ldb, options->argv[i]); dn = ldb_dn_new(ldb, ldb, options->argv[i]);
if ( ! ldb_dn_validate(dn)) { if ( ! ldb_dn_validate(dn)) {
printf("Invalid DN format\n"); printf("Invalid DN format\n");
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_INVALID_DN_SYNTAX;
} }
if (options->recursive) { if (options->recursive) {
ret = ldb_delete_recursive(ldb, dn,req_ctrls); ret = ldb_delete_recursive(ldb, dn,req_ctrls);

View File

@ -328,7 +328,7 @@ int main(int argc, const char **argv)
basedn = ldb_dn_new(ldb, ldb, options->basedn); basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) { if ( ! ldb_dn_validate(basedn)) {
printf("Invalid Base DN format\n"); printf("Invalid Base DN format\n");
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_INVALID_DN_SYNTAX;
} }
} }

View File

@ -66,6 +66,10 @@ int main(int argc, const char **argv)
dn1 = ldb_dn_new(ldb, ldb, options->argv[0]); dn1 = ldb_dn_new(ldb, ldb, options->argv[0]);
dn2 = ldb_dn_new(ldb, ldb, options->argv[1]); 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); ret = ldb_rename(ldb, dn1, dn2);
if (ret == LDB_SUCCESS) { if (ret == LDB_SUCCESS) {

View File

@ -299,7 +299,7 @@ int main(int argc, const char **argv)
basedn = ldb_dn_new(ldb, ldb, options->basedn); basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) { if ( ! ldb_dn_validate(basedn)) {
fprintf(stderr, "Invalid Base DN format\n"); fprintf(stderr, "Invalid Base DN format\n");
return LDB_ERR_OPERATIONS_ERROR; return LDB_ERR_INVALID_DN_SYNTAX;
} }
} }

View File

@ -264,8 +264,8 @@ static void start_test(struct ldb_context *ldb, unsigned int nrecords,
basedn = ldb_dn_new(ldb, ldb, options->basedn); basedn = ldb_dn_new(ldb, ldb, options->basedn);
if ( ! ldb_dn_validate(basedn)) { if ( ! ldb_dn_validate(basedn)) {
printf("Invalid base DN\n"); printf("Invalid base DN format\n");
exit(LDB_ERR_OPERATIONS_ERROR); exit(LDB_ERR_INVALID_DN_SYNTAX);
} }
printf("Adding %d records\n", nrecords); printf("Adding %d records\n", nrecords);