change strings to be encoded using value.encode("utf-8").

fix update to set 'cn' instead of 'sn'.
remove str() in funcs.add_user().
This commit is contained in:
Kevin McCarthy
2007-08-17 15:32:05 -07:00
parent a0e2fa00f1
commit 5f0f192ae3
2 changed files with 4 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ def set_ldap_value(hash, key, value):
"""Converts unicode strings to normal strings
(because LDAP is choking on unicode strings"""
if value != None:
value = str(value)
value = value.encode('utf-8')
hash[key] = value
@@ -137,7 +137,7 @@ class Root(controllers.RootController):
#
# this is a hack until we decide on the policy for names/cn/sn/givenName
#
set_ldap_value(new_user, 'sn',
set_ldap_value(new_user, 'cn',
"%s %s" % (kw.get('givenname'), kw.get('sn')))
orig_user = to_ldap_hash(orig_user)

View File

@@ -197,7 +197,7 @@ class IPAServer:
user = user[0]
dn="uid=%s,%s,%s" % (user['uid'], user_container,self.basedn)
entry = ipaserver.ipaldap.Entry(str(dn))
entry = ipaserver.ipaldap.Entry(dn)
# some required objectclasses
entry.setValues('objectClass', 'top', 'posixAccount', 'shadowAccount', 'account', 'person', 'inetOrgPerson', 'organizationalPerson', 'krbPrincipalAux', 'krbTicketPolicyAux')
@@ -214,7 +214,7 @@ class IPAServer:
# fill in our new entry with everything sent by the user
for u in user:
entry.setValues(str(u), str(user[u]))
entry.setValues(u, user[u])
if opts:
self.set_principal(opts['remoteuser'])