summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-09-10 22:33:06 +0000
committerJeremy Allison <jra@samba.org>2003-09-10 22:33:06 +0000
commitca1c6ebb11361dabaca22015736f3876d51833a2 (patch)
tree462e0afef069859619591cbf0e83742c94457fb4 /source3/lib
parentb5f07b9ca802747816c407e9c79bcfb4009d605f (diff)
downloadsamba-ca1c6ebb11361dabaca22015736f3876d51833a2.tar.gz
samba-ca1c6ebb11361dabaca22015736f3876d51833a2.tar.bz2
samba-ca1c6ebb11361dabaca22015736f3876d51833a2.zip
Fix a nasty mess, and also bug #296. passdb/pdb_ldap.c was not converting
to/from utf8 for some calls. The libads code gets this right. Wonder why the passdb code doesn't use it ? Jeremy. (This used to be commit 910d21d3164c2c64773031fddaad35ea88e72a04)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbldap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 1ce03491da..7bdb8ea5a5 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1329,3 +1329,23 @@ NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
return ret;
}
+/*******************************************************************
+ Return a copy of the DN for a LDAPMessage. Convert from utf8 to CH_UNIX.
+********************************************************************/
+
+char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry)
+{
+ char *utf8_dn, *unix_dn;
+
+ utf8_dn = ldap_get_dn(ld, entry);
+ if (!utf8_dn) {
+ DEBUG (5, ("smbldap_get_dn: ldap_get_dn failed\n"));
+ return NULL;
+ }
+ if (pull_utf8_allocate((void **) &unix_dn, utf8_dn) == (size_t)-1) {
+ DEBUG (0, ("smbldap_get_dn: String conversion failure utf8 [%s]\n", utf8_dn));
+ return NULL;
+ }
+ ldap_memfree(utf8_dn);
+ return unix_dn;
+}