The Samba-Bugzilla – Attachment 79 Details for
Bug 296
corrupted DN: unneeded utf8 translation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Call smbldap_get_dn() instead of ldap_get_dn() for pdb_ldap
bug296.patch (text/plain), 4.00 KB, created by
Tim Potter
on 2003-08-14 16:18:24 UTC
(
hide
)
Description:
Call smbldap_get_dn() instead of ldap_get_dn() for pdb_ldap
Filename:
MIME Type:
Creator:
Tim Potter
Created:
2003-08-14 16:18:24 UTC
Size:
4.00 KB
patch
obsolete
>Index: lib/smbldap.c >=================================================================== >RCS file: /data/cvs/samba/source/lib/smbldap.c,v >retrieving revision 1.1.2.12 >diff -u -r1.1.2.12 smbldap.c >--- lib/smbldap.c 13 Aug 2003 00:08:27 -0000 1.1.2.12 >+++ lib/smbldap.c 14 Aug 2003 23:15:17 -0000 >@@ -282,6 +282,31 @@ > } > > /******************************************************************* >+Return a copy of the DN for a LDAPMessage. >+******************************************************************/ >+char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry) >+{ >+ char *result, *utf8_result; >+ >+ result = ldap_get_dn(ld, entry); >+ >+ if (!result) >+ return result; >+ >+ if (push_utf8_allocate(&utf8_result, result) == (size_t) -1) { >+ DEBUG (0, ("smbldap_get_dn: String conversion failure!\n")); >+ return NULL; >+ } >+ >+ ldap_memfree(result); >+ >+ /* Eek! This assumes that ldap_memfree is a simple wrapper >+ around free(). */ >+ >+ return utf8_result; >+} >+ >+/******************************************************************* > search an attribute and return the first value found. > ******************************************************************/ > BOOL smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry, >@@ -1328,4 +1353,3 @@ > > return ret; > } >- >Index: passdb/pdb_ldap.c >=================================================================== >RCS file: /data/cvs/samba/source/passdb/pdb_ldap.c,v >retrieving revision 1.28.2.86 >diff -u -r1.28.2.86 pdb_ldap.c >--- passdb/pdb_ldap.c 6 Aug 2003 19:16:17 -0000 1.28.2.86 >+++ passdb/pdb_ldap.c 14 Aug 2003 23:15:18 -0000 >@@ -51,6 +51,11 @@ > #include <lber.h> > #include <ldap.h> > >+/* Stupid Linker Trick to prevent usage of ldap_get_dn() which will >+ introduce a character set bug. */ >+ >+#define ldap_get_dn __use_smbldap_get_dn_instead >+ > /* > * Work around versions of the LDAP client libs that don't have the OIDs > * defined, or have them defined under the old name. >@@ -269,7 +274,7 @@ > } > > entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, result); >- dn = ldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); >+ dn = smbldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); > > if (lp_ldap_delete_dn()) { > NTSTATUS ret = NT_STATUS_OK; >@@ -1379,7 +1384,7 @@ > } > > entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, result); >- dn = ldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); >+ dn = smbldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); > > DEBUG(4, ("user %s to be modified has dn: %s\n", pdb_get_username(newpwd), dn)); > >@@ -1520,7 +1525,7 @@ > DEBUG(3,("User exists without samba attributes: adding them\n")); > ldap_op = LDAP_MOD_REPLACE; > entry = ldap_first_entry (ldap_state->smbldap_state->ldap_struct, result); >- tmp = ldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); >+ tmp = smbldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); > slprintf (dn, sizeof (dn) - 1, "%s", tmp); > ldap_memfree (tmp); > >@@ -1558,7 +1563,7 @@ > DEBUG(3,("User exists without samba attributes: adding them\n")); > ldap_op = LDAP_MOD_REPLACE; > entry = ldap_first_entry (ldap_state->smbldap_state->ldap_struct, result); >- tmp = ldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); >+ tmp = smbldap_get_dn (ldap_state->smbldap_state->ldap_struct, entry); > slprintf (dn, sizeof (dn) - 1, "%s", tmp); > ldap_memfree (tmp); > } >@@ -1928,7 +1933,7 @@ > } > > entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, result); >- tmp = ldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); >+ tmp = smbldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); > pstrcpy(dn, tmp); > ldap_memfree(tmp); > >@@ -1993,7 +1998,7 @@ > } > > entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, result); >- dn = ldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); >+ dn = smbldap_get_dn(ldap_state->smbldap_state->ldap_struct, entry); > > if (!init_ldap_from_group(ldap_state->smbldap_state->ldap_struct, > result, &mods, map)) { >@@ -2379,5 +2384,3 @@ > > return NT_STATUS_OK; > } >- >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 296
: 79