summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-26 13:29:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-26 13:29:37 +0000
commitb292909eadbeb18578e6d7198884b0282eb2a367 (patch)
treece3b98a746d362932cefa848d52af56ed0d9e45e /source3/passdb
parent56d2bb2b953dd61a161313c149e3ea76e25963a4 (diff)
downloadsamba-b292909eadbeb18578e6d7198884b0282eb2a367.tar.gz
samba-b292909eadbeb18578e6d7198884b0282eb2a367.tar.bz2
samba-b292909eadbeb18578e6d7198884b0282eb2a367.zip
After a quick run with the 'weird' charset, squash a few bugs in our new
'UF8-safe' LDAP code. I hope I've caught all the places where we were pushing strings into or out of LDAP now. Andrew Bartlett (This used to be commit 70bf7a5f71f71aeb5338723d1f5b32a89d5c4f91)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_ldap.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 7344835fde..4390e9d5ba 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -555,7 +555,7 @@ static int ldapsam_search(struct ldapsam_privates *ldap_state,
continue;
rc = ldap_search_s(ldap_state->ldap_struct, base, scope,
- filter, (char **)attrs, attrsonly, res);
+ utf8_filter, (char **)attrs, attrsonly, res);
}
if (rc == LDAP_SERVER_DOWN) {
@@ -584,7 +584,7 @@ static int ldapsam_modify(struct ldapsam_privates *ldap_state, const char *dn, L
if ((rc = ldapsam_retry_open(ldap_state,&attempts)) != LDAP_SUCCESS)
continue;
- rc = ldap_modify_s(ldap_state->ldap_struct, dn, attrs);
+ rc = ldap_modify_s(ldap_state->ldap_struct, utf8_dn, attrs);
}
if (rc == LDAP_SERVER_DOWN) {
@@ -613,7 +613,7 @@ static int ldapsam_add(struct ldapsam_privates *ldap_state, const char *dn, LDAP
if ((rc = ldapsam_retry_open(ldap_state,&attempts)) != LDAP_SUCCESS)
continue;
- rc = ldap_add_s(ldap_state->ldap_struct, dn, attrs);
+ rc = ldap_add_s(ldap_state->ldap_struct, utf8_dn, attrs);
}
if (rc == LDAP_SERVER_DOWN) {
@@ -642,7 +642,7 @@ static int ldapsam_delete(struct ldapsam_privates *ldap_state, char *dn)
if ((rc = ldapsam_retry_open(ldap_state,&attempts)) != LDAP_SUCCESS)
continue;
- rc = ldap_delete_s(ldap_state->ldap_struct, dn);
+ rc = ldap_delete_s(ldap_state->ldap_struct, utf8_dn);
}
if (rc == LDAP_SERVER_DOWN) {
@@ -1919,11 +1919,16 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
char *retoid;
struct berval *retdata;
char *utf8_password;
+ char *utf8_dn;
if (push_utf8_allocate(&utf8_password, pdb_get_plaintext_passwd(newpwd)) == (size_t)-1) {
return NT_STATUS_NO_MEMORY;
}
+ if (push_utf8_allocate(&utf8_dn, dn) == (size_t)-1) {
+ 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);
@@ -1931,17 +1936,19 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
}
ber_printf (ber, "{");
- ber_printf (ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID,dn);
+ ber_printf (ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID, utf8_dn);
ber_printf (ber, "ts", LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW, utf8_password);
ber_printf (ber, "N}");
if ((rc = ber_flatten (ber, &bv))<0) {
DEBUG(0,("ber_flatten returns a value <0\n"));
ber_free(ber,1);
+ SAFE_FREE(utf8_dn);
SAFE_FREE(utf8_password);
return NT_STATUS_UNSUCCESSFUL;
}
+ SAFE_FREE(utf8_dn);
SAFE_FREE(utf8_password);
ber_free(ber, 1);