From 7e4b0a072e69351496010d7b2151c9b434c8fdb0 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Sat, 4 Oct 2008 01:50:59 -0400 Subject: Implement user-find and user-add backend functions so they work over XML-RPC Change port to 8880 to not conflict with a running IPA v1 instance Encode incoming values from unicode as utf-8 before sending to LDAP --- ipa_server/ipaldap.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ipa_server/ipaldap.py') diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index c1d134a0..07b207dc 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -33,7 +33,8 @@ import struct import ldap.sasl from ldap.controls import LDAPControl,DecodeControlTuples,EncodeControlTuples from ldap.ldapobject import SimpleLDAPObject -import ipautil +from ipa_server import ipautil + # Global variable to define SASL auth sasl_auth = ldap.sasl.sasl({},'GSSAPI') @@ -108,7 +109,11 @@ class Entry: """Convert the attrs and values to a list of 2-tuples. The first element of the tuple is the attribute name. The second element is either a single value or a list of values.""" - return self.data.items() + r = [] + for i in self.data.iteritems(): + n = ipautil.utf8_encode_values(i[1]) + r.append((i[0], n)) + return r def __str__(self): """Convert the Entry to its LDIF representation""" -- cgit From e012e860b472bcb5a00a089e73113fb6989fde20 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 7 Oct 2008 04:31:22 -0400 Subject: Implement user-mod --- ipa_server/ipaldap.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ipa_server/ipaldap.py') diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index 07b207dc..4ab0d759 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -115,6 +115,15 @@ class Entry: r.append((i[0], n)) return r + def toDict(self): + """Convert the attrs and values to a dict. The dict is keyed on the + attribute name. The value is either single value or a list of values.""" + result = ipautil.CIDict(self.data) + for i in result.keys(): + result[i] = ipautil.utf8_encode_values(result[i]) + result['dn'] = self.dn + return result + def __str__(self): """Convert the Entry to its LDIF representation""" return self.__repr__() -- cgit