summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-03-19 12:20:11 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-04-14 12:53:56 +1000
commit3b3e21bd9ba701a97e752205263a7903619541c7 (patch)
tree3f0cdf8e4d5a550a323e73d229083d6329b3f236 /source3/passdb
parent4786a493f70070dce6de4cbe488c9de1bdbb75ad (diff)
downloadsamba-3b3e21bd9ba701a97e752205263a7903619541c7.tar.gz
samba-3b3e21bd9ba701a97e752205263a7903619541c7.tar.bz2
samba-3b3e21bd9ba701a97e752205263a7903619541c7.zip
Convert Samba3 to use the common lib/util/charset API
This removes calls to push_*_allocate() and pull_*_allocate(), as well as convert_string_allocate, as they are not in the common API To allow transition to a common charcnv in future, provide Samba4-like strupper functions in source3/lib/charcnv.c (the actual implementation remains distinct, but the API is now shared) Andrew Bartlett
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_ldap.c22
-rw-r--r--source3/passdb/secrets.c8
2 files changed, 15 insertions, 15 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index b706721e77..35ce8bb41a 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1711,22 +1711,22 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
}
}
- if (!push_utf8_allocate(&utf8_password,
+ if (!push_utf8_talloc(talloc_tos(), &utf8_password,
pdb_get_plaintext_passwd(newpwd),
&converted_size))
{
return NT_STATUS_NO_MEMORY;
}
- if (!push_utf8_allocate(&utf8_dn, dn, &converted_size)) {
- SAFE_FREE(utf8_password);
+ if (!push_utf8_talloc(talloc_tos(), &utf8_dn, dn, &converted_size)) {
+ TALLOC_FREE(utf8_password);
return NT_STATUS_NO_MEMORY;
}
if ((ber = ber_alloc_t(LBER_USE_DER))==NULL) {
DEBUG(0,("ber_alloc_t returns NULL\n"));
- SAFE_FREE(utf8_password);
- SAFE_FREE(utf8_dn);
+ TALLOC_FREE(utf8_password);
+ TALLOC_FREE(utf8_dn);
return NT_STATUS_UNSUCCESSFUL;
}
@@ -1736,21 +1736,21 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
(ber_printf (ber, "n}") < 0)) {
DEBUG(0,("ldapsam_modify_entry: ber_printf returns a value <0\n"));
ber_free(ber,1);
- SAFE_FREE(utf8_dn);
- SAFE_FREE(utf8_password);
+ TALLOC_FREE(utf8_dn);
+ TALLOC_FREE(utf8_password);
return NT_STATUS_UNSUCCESSFUL;
}
if ((rc = ber_flatten (ber, &bv))<0) {
DEBUG(0,("ldapsam_modify_entry: ber_flatten returns a value <0\n"));
ber_free(ber,1);
- SAFE_FREE(utf8_dn);
- SAFE_FREE(utf8_password);
+ TALLOC_FREE(utf8_dn);
+ TALLOC_FREE(utf8_password);
return NT_STATUS_UNSUCCESSFUL;
}
- SAFE_FREE(utf8_dn);
- SAFE_FREE(utf8_password);
+ TALLOC_FREE(utf8_dn);
+ TALLOC_FREE(utf8_password);
ber_free(ber, 1);
if (!ldap_state->is_nds_ldap) {
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 8e64a49e22..2b507d0c4d 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -720,7 +720,7 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
struct trusted_dom_pass pass;
ZERO_STRUCT(pass);
- if (!push_ucs2_allocate(&uni_dom_name, domain, &converted_size)) {
+ if (!push_ucs2_talloc(talloc_tos(), &uni_dom_name, domain, &converted_size)) {
DEBUG(0, ("Could not convert domain name %s to unicode\n",
domain));
return False;
@@ -728,7 +728,7 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
strncpy_w(pass.uni_name, uni_dom_name, sizeof(pass.uni_name) - 1);
pass.uni_name_len = strlen_w(uni_dom_name)+1;
- SAFE_FREE(uni_dom_name);
+ TALLOC_FREE(uni_dom_name);
/* last change time */
pass.mod_time = time(NULL);
@@ -742,14 +742,14 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
/* Calculate the length. */
pass_len = tdb_trusted_dom_pass_pack(NULL, 0, &pass);
- pass_buf = SMB_MALLOC_ARRAY(uint8, pass_len);
+ pass_buf = talloc_array(talloc_tos(), uint8, pass_len);
if (!pass_buf) {
return false;
}
pass_len = tdb_trusted_dom_pass_pack(pass_buf, pass_len, &pass);
ret = secrets_store(trustdom_keystr(domain), (void *)pass_buf,
pass_len);
- SAFE_FREE(pass_buf);
+ TALLOC_FREE(pass_buf);
return ret;
}