summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-06-26 20:53:08 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-06-26 14:10:17 +0200
commit43555d6439460d2bafa54300221856142c83aa3f (patch)
treec21507e5ee590eee21398fadbac2e94b3805d0b7 /source4
parenta7f26d5c6d441e1688382e5b9d3543f8a81dd74d (diff)
downloadsamba-43555d6439460d2bafa54300221856142c83aa3f.tar.gz
samba-43555d6439460d2bafa54300221856142c83aa3f.tar.bz2
samba-43555d6439460d2bafa54300221856142c83aa3f.zip
s4-samldb: do not talloc_steal() the elements of the original request
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index a859fc9c73..bb306055f2 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1689,8 +1689,10 @@ static int samldb_sam_accountname_check(struct samldb_ctx *ac)
if (ret != LDB_SUCCESS) {
return ret;
}
- sam_accountname = talloc_steal(ac,
- ldb_msg_find_attr_as_string(tmp_msg, "sAMAccountName", NULL));
+
+ /* We must not steal the original string, it belongs to the caller! */
+ sam_accountname = talloc_strdup(ac,
+ ldb_msg_find_attr_as_string(tmp_msg, "sAMAccountName", NULL));
talloc_free(tmp_msg);
if (sam_accountname == NULL) {
@@ -1901,8 +1903,12 @@ static int samldb_service_principal_names_change(struct samldb_ctx *ac)
if (ret != LDB_SUCCESS) {
return ret;
}
- dns_hostname = talloc_steal(ac,
- ldb_msg_find_attr_as_string(msg, "dNSHostName", NULL));
+ dns_hostname = talloc_strdup(ac,
+ ldb_msg_find_attr_as_string(msg, "dNSHostName", NULL));
+ if (dns_hostname == NULL) {
+ return ldb_module_oom(ac->module);
+ }
+
talloc_free(msg);
ret = dsdb_module_search_dn(ac->module, ac, &res, ac->msg->dn,