mirror of
https://github.com/samba-team/samba.git
synced 2025-02-01 05:47:28 +03:00
s4/ldb - remove now superflous "ldb_dn_validate" checks
If we immediately afterwards perform an LDB base operation then we don't need an explicit "ldb_dn_validate" check anymore (only OOM makes sense). Reviewed by: Tridge
This commit is contained in:
parent
349b9b72ec
commit
ea12adf544
@ -3761,9 +3761,9 @@ int dsdb_search_by_dn_guid(struct ldb_context *ldb,
|
||||
int ret;
|
||||
|
||||
dn = ldb_dn_new_fmt(tmp_ctx, ldb, "<GUID=%s>", GUID_string(tmp_ctx, guid));
|
||||
if (!ldb_dn_validate(dn)) {
|
||||
if (dn == NULL) {
|
||||
talloc_free(tmp_ctx);
|
||||
return LDB_ERR_INVALID_DN_SYNTAX;
|
||||
return ldb_oom(ldb);
|
||||
}
|
||||
|
||||
ret = dsdb_search_dn(ldb, mem_ctx, _res, dn, attrs, dsdb_flags);
|
||||
|
@ -507,7 +507,7 @@ NTSTATUS dsdb_lookup_rids(struct ldb_context *ldb,
|
||||
dom_sid_string(tmp_ctx,
|
||||
dom_sid_add_rid(tmp_ctx, domain_sid,
|
||||
rids[i])));
|
||||
if (!dn || !ldb_dn_validate(dn)) {
|
||||
if (dn == NULL) {
|
||||
talloc_free(tmp_ctx);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ static int expand_dn_in_message(struct ldb_module *module, struct ldb_message *m
|
||||
}
|
||||
|
||||
dn = ldb_dn_new(tmp_ctx, ldb, dn_string);
|
||||
if (!ldb_dn_validate(dn)) {
|
||||
if (dn == NULL) {
|
||||
talloc_free(tmp_ctx);
|
||||
return ldb_operr(ldb);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
|
||||
}
|
||||
|
||||
basedn = ldb_dn_new(tmp_ctx, conn->ldb, NULL);
|
||||
if ( ! ldb_dn_validate(basedn)) {
|
||||
if (basedn == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,8 @@ int main(int argc, const char **argv)
|
||||
struct ldb_dn *dn;
|
||||
|
||||
dn = ldb_dn_new(ldb, ldb, options->argv[i]);
|
||||
if ( ! ldb_dn_validate(dn)) {
|
||||
printf("Invalid DN format\n");
|
||||
return LDB_ERR_INVALID_DN_SYNTAX;
|
||||
if (dn == NULL) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
if (options->recursive) {
|
||||
ret = ldb_delete_recursive(ldb, dn,req_ctrls);
|
||||
|
@ -326,9 +326,8 @@ int main(int argc, const char **argv)
|
||||
|
||||
if (options->basedn != NULL) {
|
||||
basedn = ldb_dn_new(ldb, ldb, options->basedn);
|
||||
if ( ! ldb_dn_validate(basedn)) {
|
||||
printf("Invalid Base DN format\n");
|
||||
return LDB_ERR_INVALID_DN_SYNTAX;
|
||||
if (basedn == NULL) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,8 @@ 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;
|
||||
if ((dn1 == NULL) || (dn2 == NULL)) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
ret = ldb_rename(ldb, dn1, dn2);
|
||||
|
@ -297,9 +297,8 @@ int main(int argc, const char **argv)
|
||||
|
||||
if (options->basedn != NULL) {
|
||||
basedn = ldb_dn_new(ldb, ldb, options->basedn);
|
||||
if ( ! ldb_dn_validate(basedn)) {
|
||||
fprintf(stderr, "Invalid Base DN format\n");
|
||||
return LDB_ERR_INVALID_DN_SYNTAX;
|
||||
if (basedn == NULL) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
|
||||
}
|
||||
|
||||
account_dn = ldb_dn_new(tmp_ctx, remote_ldb, account_dn_str);
|
||||
if (! ldb_dn_validate(account_dn)) {
|
||||
if (account_dn == NULL) {
|
||||
r->out.error_string = talloc_asprintf(r, "Invalid account dn: %s",
|
||||
account_dn_str);
|
||||
talloc_free(tmp_ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user