Bug 296 - corrupted DN: unneeded utf8 translation
corrupted DN: unneeded utf8 translation
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: User/Group Accounts
3.0.0preX
All FreeBSD
: P3 normal
: none
Assigned To: Gerald (Jerry) Carter
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-08-13 00:42 UTC by Alex Deiter
Modified: 2005-08-24 10:24 UTC (History)
1 user (show)

See Also:


Attachments
Call smbldap_get_dn() instead of ldap_get_dn() for pdb_ldap (4.00 KB, patch)
2003-08-14 16:18 UTC, Tim Potter
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Deiter 2003-08-13 00:42:53 UTC
i use samba 3_0_0 (from cvs) with ldapsam backend on FreeBSD 5.1.
i cannot change/delete user attributes (description,password, etc) if user
entry has a UTF8 dn:

# smbpasswd -x tiamat
could not delete attributes for cn=§á¡ö§á¨g§á¨k§ñ©°§á¨g§ñ©¤ §á░§á¨m§á¨g§á¨l§ñ©¦§á¨c§á¨o§á¨f§ñ©¤
§á¨ˆ§á¨c§á¨m§á¨g§ñ©¤§ñ¨{§á¨g§á¨e§á¨j§ñ©È,ou=§á¨U§á¨m§ñ©´§á¨h§á¨d§á¨c
§á¨c§á¨e§ñ©°§á¨p§á¨n§á¨c§ñ©°§á¨j§á¨i§á¨c§ñ©À§á¨j§á¨j,ou=People,dc=komi,dc=mts,dc=ru, error: No such
object ()
Failed to delete entry for user tiamat.
Failed to modify password entry for user tiamat

# pdbedit -h /tmp tiamat
Searching for:[(&(objectClass=sambaDomain)(sambaDomainName=KOMI))]
smbldap_search_suffix: searching
for:[(&(objectClass=sambaDomain)(sambaDomainName=KOMI))]
smbldap_open_connection: connection opened
Searching for:[(&(objectClass=sambaDomain)(sambaDomainName=KOMI))]
smbldap_search_suffix: searching
for:[(&(objectClass=sambaDomain)(sambaDomainName=KOMI))]
smbldap_open_connection: connection opened
smbldap_search_suffix: searching
for:[(&(uid=tiamat)(objectclass=sambaSamAccount))]
Entry found for user: tiamat
Setting entry for user: tiamat
failed to modify user dn= cn=§á¡ö§á¨g§á¨k§ñ©°§á¨g§ñ©¤ §á░§á¨m§á¨g§á¨l§ñ©¦§á¨c§á¨o§á¨f§ñ©¤
§á¨ˆ§á¨c§á¨m§á¨g§ñ©¤§ñ¨{§á¨g§á¨e§á¨j§ñ©È,ou=§á¨U§á¨m§ñ©´§á¨h§á¨d§á¨c
§á¨c§á¨e§ñ©°§á¨p§á¨n§á¨c§ñ©°§á¨j§á¨i§á¨c§ñ©À§á¨j§á¨j,ou=People,dc=komi,dc=mts,dc=ru with: No such
object

failed to modify user with uid = tiamat, error:  (Protocol error)
Unable to modify entry!

in passdb\pdb_ldap.c used function dn = ldap_get_dn(...) that return UTF8
dn. Then call ldapsam_modify_entry (...,dn,...) -> smbldap_modify(...,dn,..)
in lib\smbldap.c:smbldap_modify dn converted from CH_UNIX to CH_UTF8 and dn
corrupted.

my smb.conf:

        dos charset = 866
        unix charset = KOI8-R
        display charset = KOI8-R

Thanks!
Comment 1 Tim Potter 2003-08-13 17:01:42 UTC
There seems to be quite a few places where we call smbldap_modify so this
problem is potentially in other places in the code.

This is a bit of a re-run of the dos codepage vs unix codepage strings saga. 
There is no way to tell what codepage a string is in.  We should fix our ldap
routines to accept and return strings in Samba's internal character set only
(unix charset?).
Comment 2 Tim Potter 2003-08-13 17:02:02 UTC
cc me
Comment 3 Tim Potter 2003-08-14 00:13:14 UTC
I am testing a patch where ldap_get_dn() is called from a wrapper that converts
the result to unix charset before returning it.  This should solve the defect.

The ads code will require a look to see if it has the same problem.
Comment 4 Tim Potter 2003-08-14 16:18:24 UTC
Created attachment 79 [details]
Call smbldap_get_dn() instead of ldap_get_dn() for pdb_ldap

Here's the patch.
Comment 5 Tim Potter 2003-08-14 16:22:21 UTC
I haven't changed the other caller of ldap_get_dn() which is the printer
publishing code, and the idmap_ldap module.
Comment 6 Alex Deiter 2003-08-25 13:33:41 UTC
When this patch will be commited ?
Comment 7 Jeremy Allison 2003-09-10 15:34:22 UTC
The patch wasn't quite right (converted *to* utf8, not from :-), but
was close enough for me to commit a fix (plus added error checking !).
Marking as closed.
Jeremy.
Comment 8 Gerald (Jerry) Carter 2005-02-07 08:41:29 UTC
originally reported against 3.0.0beta3.  CLeaning out 
non-production release versions.
Comment 9 Gerald (Jerry) Carter 2005-08-24 10:24:35 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.