Patch attached.
>From e7eac9997750ee1a8ce864746dbc6faa54de766b Mon Sep 17 00:00:00 2001
From: Nathaniel McCallum <npmccal...@redhat.com>
Date: Mon, 10 Feb 2014 12:07:51 -0500
Subject: [PATCH] Fix generation of invalid OTP URIs

---
 ipalib/plugins/otptoken.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ipalib/plugins/otptoken.py b/ipalib/plugins/otptoken.py
index 5a5d35d153e7b3698aeebe1e93831b48a8b8f91e..ff92efa11776171b09993060e0805c8ffa6806da 100644
--- a/ipalib/plugins/otptoken.py
+++ b/ipalib/plugins/otptoken.py
@@ -202,6 +202,15 @@ class otptoken_add(LDAPCreate):
     )
 
     def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
+        # These are values we always want to write to LDAP. So if they are
+        # specified as a value that evaluates to False (i.e. None), delete them
+        # and fill in the defaults below.
+        for attr in ('ipatokentotpclockoffset', 'ipatokentotptimestep',
+                     'ipatokenotpalgorithm', 'ipatokenotpdigits',
+                     'ipatokenotpkey'):
+            if attr in entry_attrs and not entry_attrs[attr]:
+                del entry_attrs[attr]
+
         # Set defaults. This needs to happen on the server side because we may
         # have global configurable defaults in the near future.
         options.setdefault('type', TOKEN_TYPES[0])
-- 
1.8.5.3

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

Reply via email to