summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-05-08 14:52:31 +1200
committerDouglas Bagnall <dbagnall@samba.org>2019-05-09 22:39:27 +0000
commit215eef5b6f5949b84b17fb131383b9b97ba94958 (patch)
tree795a8547de6901d75481a1cc93aab19c9982d383 /source4/dsdb
parentcb9fe0360beee81c47931b2b3acb1836d2542614 (diff)
downloadsamba-215eef5b6f5949b84b17fb131383b9b97ba94958.tar.gz
s4/dsdb/util_samr: check some return codes (CID 1444977)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/common/util_samr.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source4/dsdb/common/util_samr.c b/source4/dsdb/common/util_samr.c
index bb906fa0488..5370fc94eba 100644
--- a/source4/dsdb/common/util_samr.c
+++ b/source4/dsdb/common/util_samr.c
@@ -154,11 +154,20 @@ NTSTATUS dsdb_add_user(struct ldb_context *ldb,
return NT_STATUS_FOOBAR;
}
- ldb_msg_add_string(msg, "sAMAccountName", account_name);
- ldb_msg_add_string(msg, "objectClass", obj_class);
- samdb_msg_add_uint(ldb, tmp_ctx, msg,
- "userAccountControl",
- user_account_control);
+ ret = ldb_msg_add_string(msg, "sAMAccountName", account_name);
+ if (ret != LDB_SUCCESS) {
+ goto failed;
+ }
+ ret = ldb_msg_add_string(msg, "objectClass", obj_class);
+ if (ret != LDB_SUCCESS) {
+ goto failed;
+ }
+ ret = samdb_msg_add_uint(ldb, tmp_ctx, msg,
+ "userAccountControl",
+ user_account_control);
+ if (ret != LDB_SUCCESS) {
+ goto failed;
+ }
/* This is only here for migrations using pdb_samba4, the
* caller and the samldb are responsible for ensuring it makes
@@ -237,6 +246,11 @@ NTSTATUS dsdb_add_user(struct ldb_context *ldb,
}
talloc_free(tmp_ctx);
return NT_STATUS_OK;
+
+ failed:
+ ldb_transaction_cancel(ldb);
+ talloc_free(tmp_ctx);
+ return NT_STATUS_INTERNAL_ERROR;
}
/*