[PATCH] LDAP_EXOP charset fix
Dariush Forouher
dariush at forouher.de
Wed Sep 17 16:12:36 GMT 2003
Samba gives the password to ldap_extended_operation in unicode, while it
should be saved in local charset (e.g. ISO-8859-15) instead. The current
behaviour causes problems with other ldap clients like pam_ldap, because
they don't transcode the password to unicode. Attached patch should fix
this.
ciao
Dariush
-------------- next part --------------
--- pdb_ldap.c.orig 2003-09-09 06:07:15.000000000 +0200
+++ pdb_ldap.c 2003-09-17 18:01:58.000000000 +0200
@@ -1238,38 +1238,30 @@
struct berval *bv;
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);
return NT_STATUS_UNSUCCESSFUL;
}
ber_printf (ber, "{");
ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_ID, utf8_dn);
- ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, utf8_password);
+ ber_printf (ber, "ts", LDAP_TAG_EXOP_MODIFY_PASSWD_NEW, pdb_get_plaintext_passwd(newpwd));
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);
if ((rc = smbldap_extended_operation(ldap_state->smbldap_state,
More information about the samba-technical
mailing list