mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +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:
parent
1b93173813
commit
b50ebc3228
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user