pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0035-Ensure-users-exist-when-assigning-tokens-to-them.patch

e3ffab
From 6e7474a1db6d49a4b07cd01663ec7f55df5225c4 Mon Sep 17 00:00:00 2001
e3ffab
From: Nathaniel McCallum <npmccallum@redhat.com>
e3ffab
Date: Fri, 24 Oct 2014 16:16:50 -0400
e3ffab
Subject: [PATCH] Ensure users exist when assigning tokens to them
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4642
e3ffab
e3ffab
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
e3ffab
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
e3ffab
---
e3ffab
 ipalib/plugins/otptoken.py | 7 +++++--
e3ffab
 1 file changed, 5 insertions(+), 2 deletions(-)
e3ffab
e3ffab
diff --git a/ipalib/plugins/otptoken.py b/ipalib/plugins/otptoken.py
e3ffab
index 77366bafe7a102f5d2c048ac3d5f7d9948ed7fe4..f48feeee0502992f1b5fed4f342cace1c404624b 100644
e3ffab
--- a/ipalib/plugins/otptoken.py
e3ffab
+++ b/ipalib/plugins/otptoken.py
e3ffab
@@ -100,8 +100,11 @@ def _convert_owner(userobj, entry_attrs, options):
e3ffab
 
e3ffab
 def _normalize_owner(userobj, entry_attrs):
e3ffab
     owner = entry_attrs.get('ipatokenowner', None)
e3ffab
-    if owner is not None:
e3ffab
-        entry_attrs['ipatokenowner'] = userobj.get_dn(owner)
e3ffab
+    if owner:
e3ffab
+        try:
e3ffab
+            entry_attrs['ipatokenowner'] = userobj._normalize_manager(owner)[0]
e3ffab
+        except NotFound:
e3ffab
+            userobj.handle_not_found(owner)
e3ffab
 
e3ffab
 def _check_interval(not_before, not_after):
e3ffab
     if not_before and not_after:
e3ffab
-- 
e3ffab
2.1.0
e3ffab