*r = NULL;
*count = 0;
+ if (tmp_ctx == NULL) {
+ return WERR_NOT_ENOUGH_MEMORY;
+ }
+
ret = dsdb_search_dn(sam_ctx, tmp_ctx, &res, dn, attrs, 0);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
/* partition hasn't been replicated yet */
struct ldb_message_element *el;
unsigned int i;
+ if (tmp_ctx == NULL) {
+ goto failed;
+ }
+
msg = ldb_msg_new(tmp_ctx);
+ if (msg == NULL) {
+ goto failed;
+ }
msg->dn = dn;
if (ldb_msg_add_empty(msg, attr, LDB_FLAG_MOD_REPLACE, &el) != LDB_SUCCESS) {
goto failed;
struct dsdb_control_current_partition *p_ctrl;
struct ldb_result *res;
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
res = talloc_zero(tmp_ctx, struct ldb_result);
if (!res) {
talloc_free(tmp_ctx);
struct ldb_message *msg;
TALLOC_CTX *tmp_ctx = talloc_new(sam_ctx);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(sam_ctx);
+ }
+
ret = samdb_get_ntds_obj_by_guid(tmp_ctx,
sam_ctx,
objectGUID,
}
tmp_ctx = talloc_new(sam_ctx);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(sam_ctx);
+ }
ret = dsdb_search_dn(sam_ctx, tmp_ctx, &res, NULL, attrs, 0);
tokens[i][0] = toupper(tokens[i][0]);
ret = talloc_strdup(mem_ctx, tokens[0]);
- for (i = 1; tokens[i] != NULL; i++)
+ if (ret == NULL) {
+ talloc_free(tokens);
+ return NULL;
+ }
+ for (i = 1; tokens[i] != NULL; i++) {
ret = talloc_asprintf_append_buffer(ret, "%s", tokens[i]);
+ if (ret == NULL) {
+ talloc_free(tokens);
+ return NULL;
+ }
+ }
talloc_free(tokens);
struct ldb_dn *dn;
struct ldb_result *res = NULL;
+ if (tmp_ctx == NULL) {
+ return ldb_oom(samdb);
+ }
+
/* construct the magic WKGUID DN */
dn = ldb_dn_new_fmt(tmp_ctx, samdb, "<WKGUID=%s,%s>",
wk_guid, ldb_dn_get_linearized(nc_root));
struct ldb_result *res;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
res = talloc_zero(tmp_ctx, struct ldb_result);
if (!res) {
talloc_free(tmp_ctx);
struct ldb_dn *dn;
int ret;
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
dn = ldb_dn_new_fmt(tmp_ctx, ldb, "<GUID=%s>", GUID_string(tmp_ctx, guid));
if (dn == NULL) {
talloc_free(tmp_ctx);
/* cross-partitions searches with a basedn break multi-domain support */
SMB_ASSERT(basedn == NULL || (dsdb_flags & DSDB_SEARCH_SEARCH_ALL_PARTITIONS) == 0);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
res = talloc_zero(tmp_ctx, struct ldb_result);
if (!res) {
talloc_free(tmp_ctx);
char *expression = NULL;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
dsdb_flags |= DSDB_SEARCH_ONE_ONLY;
res = talloc_zero(tmp_ctx, struct ldb_result);
struct dom_sid sid2;
NTSTATUS status;
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
config_dn = ldb_get_config_basedn(ldb);
ret = dsdb_search_one(ldb, tmp_ctx, &msg, config_dn, LDB_SCOPE_SUBTREE,
struct ldb_message *msg;
int ret;
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
+
msg = ldb_msg_new(tmp_ctx);
if (msg == NULL) {
talloc_free(tmp_ctx);
bool same_nc = true;
tmp_ctx = talloc_new(mem_ctx);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
ret = dsdb_find_nc_root(ldb, tmp_ctx, source_dn, &source_nc);
/* fix clang warning */
*count = 0;
tmp_ctx = talloc_new(ldb);
+ if (tmp_ctx == NULL) {
+ return ldb_oom(ldb);
+ }
context = talloc_zero(tmp_ctx, struct dsdb_count_domain_context);
if (context == NULL) {
salt.data = talloc_strndup(io->ac,
(char *)salt_data.data,
salt_data.length);
- io->g.salt = salt.data;
- salt.length = strlen(io->g.salt);
-
smb_krb5_free_data_contents(io->smb_krb5_context->krb5_context,
&salt_data);
+ if (salt.data == NULL) {
+ return ldb_oom(ldb);
+ }
+ io->g.salt = salt.data;
+ salt.length = strlen(io->g.salt);
/*
* create ENCTYPE_AES256_CTS_HMAC_SHA1_96 key out of
return LDB_ERR_OPERATIONS_ERROR;
}
hash_value->scheme = talloc_strdup(ctx, CRYPT);
+ if (hash_value->scheme == NULL) {
+ TALLOC_FREE(frame);
+ return ldb_oom(ldb);
+ }
hash_value->scheme_len = strlen(CRYPT) + 1;
/* generate the id/salt parameter used by crypt */
algorithm,
rounds,
salt);
+ if (cmd == NULL) {
+ TALLOC_FREE(frame);
+ return ldb_oom(ldb);
+ }
} else {
cmd = talloc_asprintf(frame, "$%d$%s", algorithm, salt);
+ if (cmd == NULL) {
+ TALLOC_FREE(frame);
+ return ldb_oom(ldb);
+ }
}
/*
}
io->n.nt_hash = talloc(io->ac, struct samr_Password);
+ if (io->n.nt_hash == NULL) {
+ return ldb_oom(ldb);
+ }
memcpy(io->n.nt_hash->hash, quoted_utf16->data,
MIN(quoted_utf16->length, sizeof(io->n.nt_hash->hash)));
}
}
io->og.nt_hash = talloc(io->ac, struct samr_Password);
+ if (io->og.nt_hash == NULL) {
+ return ldb_oom(ldb);
+ }
memcpy(io->og.nt_hash->hash, old_quoted_utf16->data,
MIN(old_quoted_utf16->length, sizeof(io->og.nt_hash->hash)));
}