fef02c
From 8750c84bbfef36ceeaac8e7c8e3b788c31f68317 Mon Sep 17 00:00:00 2001
fef02c
From: Martin Babinsky <mbabinsk@redhat.com>
fef02c
Date: Tue, 13 Sep 2016 15:40:04 +0200
fef02c
Subject: [PATCH] ipa passwd: use correct normalizer for user principals
fef02c
fef02c
Commit c2af032c0333f7e210c54369159d1d9f5e3fec74 introduced a regression in the
fef02c
handling of user principals supplied to the`ipa passwd` command. This patch
fef02c
restores the original behavior which lowercases the username portion of the
fef02c
principal.
fef02c
fef02c
https://fedorahosted.org/freeipa/ticket/6329
fef02c
fef02c
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
fef02c
---
fef02c
 ipaserver/plugins/passwd.py | 7 ++++---
fef02c
 1 file changed, 4 insertions(+), 3 deletions(-)
fef02c
fef02c
diff --git a/ipaserver/plugins/passwd.py b/ipaserver/plugins/passwd.py
fef02c
index 1576c4ca85cb761d2a124a932a26b371b9e87107..ebc41d90009d7145ada75f3cabe3c01c6d25f6ea 100644
fef02c
--- a/ipaserver/plugins/passwd.py
fef02c
+++ b/ipaserver/plugins/passwd.py
fef02c
@@ -29,7 +29,8 @@ from ipalib.plugable import Registry
fef02c
 from ipalib.request import context
fef02c
 from ipapython import kerberos
fef02c
 from ipapython.dn import DN
fef02c
-from ipaserver.plugins.service import validate_realm, normalize_principal
fef02c
+from ipaserver.plugins.baseuser import normalize_user_principal
fef02c
+from ipaserver.plugins.service import validate_realm
fef02c
 
fef02c
 if six.PY3:
fef02c
     unicode = str
fef02c
@@ -66,7 +67,7 @@ def get_current_password(principal):
fef02c
     be ignored later.
fef02c
     """
fef02c
     current_principal = krb_utils.get_principal()
fef02c
-    if current_principal == unicode(normalize_principal(principal)):
fef02c
+    if current_principal == unicode(normalize_user_principal(principal)):
fef02c
         return None
fef02c
     else:
fef02c
         return MAGIC_VALUE
fef02c
@@ -84,7 +85,7 @@ class passwd(Command):
fef02c
             primary_key=True,
fef02c
             autofill=True,
fef02c
             default_from=lambda: kerberos.Principal(krb_utils.get_principal()),
fef02c
-            normalizer=lambda value: normalize_principal(value),
fef02c
+            normalizer=lambda value: normalize_user_principal(value),
fef02c
         ),
fef02c
         Password('password',
fef02c
                  label=_('New Password'),
fef02c
-- 
fef02c
2.10.2
fef02c