Attribute values passed by --{set,add,del}attr parameters were
normalized and validated using appropriate parameter, but were
never encoded for the backend. This make prevents manipulation
with dirsvr BOOL attributes where framework tries to pass
boolean value instead of encoded "TRUE"/"FALSE" values.

https://fedorahosted.org/freeipa/ticket/2418

>From 1156dcb5a62ef0beb22b165cff1278071dd1c859 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Wed, 22 Feb 2012 13:41:23 +0100
Subject: [PATCH] Fix encoding for setattr/addattr/delattr

Attribute values passed by --{set,add,del}attr parameters were
normalized and validated using appropriate parameter, but were
never encoded for the backend. This make prevents manipulation
with dirsvr BOOL attributes where framework tries to pass
boolean value instead of encoded "TRUE"/"FALSE" values.

https://fedorahosted.org/freeipa/ticket/2418
---
 ipalib/plugins/baseldap.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index d619f14ee06d4157b456e2f21ead314f16c44efb..ca455b36b97c82049df5c9bb6dfc558479902530 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -768,6 +768,8 @@ last, after all sets and adds."""),
                 except errors.ValidationError, err:
                     (name, error) = str(err.strerror).split(':')
                     raise errors.ValidationError(name=attr, error=error)
+                if self.api.env.in_server:
+                    value = self.params[attr].encode(value)
             if append and attr in newdict:
                 if type(value) in (tuple,):
                     newdict[attr] += list(value)
-- 
1.7.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to