summaryrefslogtreecommitdiffstats
path: root/ipa-server
diff options
context:
space:
mode:
authorrcritten@redhat.com <rcritten@redhat.com>2007-09-11 02:48:53 -0400
committerrcritten@redhat.com <rcritten@redhat.com>2007-09-11 02:48:53 -0400
commited6ab17c9c703edb43c92a3205c5536771ce4d4f (patch)
treeaf34ee5fdda2896a180ac332b0db4d9e57d2533d /ipa-server
parent2ca655980b623a4a65a635a1467c0db90f421f25 (diff)
downloadfreeipa.git-ed6ab17c9c703edb43c92a3205c5536771ce4d4f.tar.gz
freeipa.git-ed6ab17c9c703edb43c92a3205c5536771ce4d4f.tar.xz
freeipa.git-ed6ab17c9c703edb43c92a3205c5536771ce4d4f.zip
Add function to allow user's to set/reset their kerberos password
Remove some unused calls to retrieve the current realm
Diffstat (limited to 'ipa-server')
-rw-r--r--ipa-server/ipaserver/ipaldap.py18
-rw-r--r--ipa-server/xmlrpc-server/funcs.py18
-rw-r--r--ipa-server/xmlrpc-server/ipaxmlrpc.py1
3 files changed, 37 insertions, 0 deletions
diff --git a/ipa-server/ipaserver/ipaldap.py b/ipa-server/ipaserver/ipaldap.py
index c0452b05..27a8903d 100644
--- a/ipa-server/ipaserver/ipaldap.py
+++ b/ipa-server/ipaserver/ipaldap.py
@@ -469,6 +469,24 @@ class IPAdmin(SimpleLDAPObject):
raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR, None, e)
return "Success"
+ def modifyPassword(self,dn,oldpass,newpass):
+ """Set the user password using RFC 3062, LDAP Password Modify Extended
+ Operation. This ends up calling the IPA password slapi plugin
+ handler so the Kerberos password gets set properly.
+
+ oldpass is not mandatory
+ """
+
+ sctrl = self.__get_server_controls__()
+
+ try:
+ if sctrl is not None:
+ self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl)
+ self.passwd_s(dn, oldpass, newpass)
+ except ldap.LDAPError, e:
+ raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR, None, e)
+ return "Success"
+
def __wrapmethods(self):
"""This wraps all methods of SimpleLDAPObject, so that we can intercept
the methods that deal with entries. Instead of using a raw list of tuples
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index 66fabf4b..79dd04d6 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -524,6 +524,24 @@ class IPAServer:
self.releaseConnection(conn)
return res
+ def modifyPassword (self, uid, oldpass, newpass, opts=None):
+ """Set/Reset a user's password
+
+ uid tells us who's password to change
+ oldpass is the old password (if available)
+ newpass is the new password
+ """
+ user_dn = self.get_user_by_uid(uid, ['dn', 'uid', 'objectclass'], opts)
+ if user_dn is None:
+ raise ipaerror.gen_exception(ipaerror.LDAP_NOT_FOUND)
+
+ conn = self.getConnection(opts)
+ try:
+ res = conn.modifyPassword(user_dn['dn'], oldpass, newpass)
+ finally:
+ self.releaseConnection(conn)
+ return res
+
# Group support
def __is_group_unique(self, cn, opts):
diff --git a/ipa-server/xmlrpc-server/ipaxmlrpc.py b/ipa-server/xmlrpc-server/ipaxmlrpc.py
index f2ddd35e..a4ae4e7c 100644
--- a/ipa-server/xmlrpc-server/ipaxmlrpc.py
+++ b/ipa-server/xmlrpc-server/ipaxmlrpc.py
@@ -308,6 +308,7 @@ def handler(req, profiling=False):
h.register_function(f.update_user)
h.register_function(f.delete_user)
h.register_function(f.mark_user_deleted)
+ h.register_function(f.modifyPassword)
h.register_function(f.get_group_by_cn)
h.register_function(f.get_group_by_dn)
h.register_function(f.add_group)