URL: https://github.com/freeipa/freeipa/pull/951
Author: stlaz
 Title: #951: server plugin: pass bytes to ldap.modify_s
Action: opened

PR body:
"""
The server-del command passes str instance instead of bytes to
ldap.modify_s which results in the target server not being
removed properly.

https://pagure.io/freeipa/issue/4985
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/951/head:pr951
git checkout pr951
From 25514d945951c6e7c98564d86a3c0887be9347f0 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Wed, 2 Aug 2017 09:47:47 +0200
Subject: [PATCH] server plugin: pass bytes to ldap.modify_s

The server-del command passes str instance instead of bytes to
ldap.modify_s which results in the target server not being
removed properly.

https://pagure.io/freeipa/issue/4985
---
 ipaserver/plugins/server.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py
index e21c47199f..0a59d67195 100644
--- a/ipaserver/plugins/server.py
+++ b/ipaserver/plugins/server.py
@@ -558,19 +558,19 @@ def _remove_server_principal_references(self, master):
         conn = self.Backend.ldap2
         env = self.api.env
 
-        master_principal = "{}@{}".format(master, env.realm)
+        master_principal = "{}@{}".format(master, env.realm).encode('utf-8')
 
         # remove replica memberPrincipal from s4u2proxy configuration
         s4u2proxy_subtree = DN(env.container_s4u2proxy,
                                env.basedn)
         dn1 = DN(('cn', 'ipa-http-delegation'), s4u2proxy_subtree)
-        member_principal1 = "HTTP/{}".format(master_principal)
+        member_principal1 = b"HTTP/%b" % master_principal
 
         dn2 = DN(('cn', 'ipa-ldap-delegation-targets'), s4u2proxy_subtree)
-        member_principal2 = "ldap/{}".format(master_principal)
+        member_principal2 = b"ldap/%b" % master_principal
 
         dn3 = DN(('cn', 'ipa-cifs-delegation-targets'), s4u2proxy_subtree)
-        member_principal3 = "cifs/{}".format(master_principal)
+        member_principal3 = b"cifs/%b" % master_principal
 
         for (dn, member_principal) in ((dn1, member_principal1),
                                        (dn2, member_principal2),
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to