martbab's pull request #80: "ipa passwd: use correct normalizer for user 
principals" was opened

PR body:
"""
Commit c2af032c0333f7e210c54369159d1d9f5e3fec74 introduced a regression in the
handling of user principals supplied to the`ipa passwd` command. This patch
restores the original behavior which lowercases the username portion of the
principal.

https://fedorahosted.org/freeipa/ticket/6329
"""

See the full pull-request at https://github.com/freeipa/freeipa/pull/80
... or pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/80/head:pr80
git checkout pr80
From 8f17dcd7ada1ea296f589962c5ca24dd7f9089b8 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Tue, 13 Sep 2016 15:40:04 +0200
Subject: [PATCH] ipa passwd: use correct normalizer for user principals

Commit c2af032c0333f7e210c54369159d1d9f5e3fec74 introduced a regression in the
handling of user principals supplied to the`ipa passwd` command. This patch
restores the original behavior which lowercases the username portion of the
principal.

https://fedorahosted.org/freeipa/ticket/6329
---
 ipaserver/plugins/passwd.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipaserver/plugins/passwd.py b/ipaserver/plugins/passwd.py
index 1576c4c..ebc41d9 100644
--- a/ipaserver/plugins/passwd.py
+++ b/ipaserver/plugins/passwd.py
@@ -29,7 +29,8 @@
 from ipalib.request import context
 from ipapython import kerberos
 from ipapython.dn import DN
-from ipaserver.plugins.service import validate_realm, normalize_principal
+from ipaserver.plugins.baseuser import normalize_user_principal
+from ipaserver.plugins.service import validate_realm
 
 if six.PY3:
     unicode = str
@@ -66,7 +67,7 @@ def get_current_password(principal):
     be ignored later.
     """
     current_principal = krb_utils.get_principal()
-    if current_principal == unicode(normalize_principal(principal)):
+    if current_principal == unicode(normalize_user_principal(principal)):
         return None
     else:
         return MAGIC_VALUE
@@ -84,7 +85,7 @@ class passwd(Command):
             primary_key=True,
             autofill=True,
             default_from=lambda: kerberos.Principal(krb_utils.get_principal()),
-            normalizer=lambda value: normalize_principal(value),
+            normalizer=lambda value: normalize_user_principal(value),
         ),
         Password('password',
                  label=_('New Password'),
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to