summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins
diff options
context:
space:
mode:
authorTomas Krizek <tkrizek@redhat.com>2016-08-24 13:29:37 +0200
committerMartin Basti <mbasti@redhat.com>2016-08-24 15:16:27 +0200
commit6f9a029bf5d33e6c8267cb330bd48033c5517188 (patch)
tree26ab91bdc338a385a3a8341c2ecf45dbda5d2cd7 /ipaserver/plugins
parentc346a2d1d19dea645d5afbc9578e7d6049d36275 (diff)
downloadfreeipa-6f9a029bf5d33e6c8267cb330bd48033c5517188.tar.gz
freeipa-6f9a029bf5d33e6c8267cb330bd48033c5517188.tar.xz
freeipa-6f9a029bf5d33e6c8267cb330bd48033c5517188.zip
Validate key in otptoken-add
Verify that key is not empty when adding otp token. If it is empty, raise an appropriate error. https://fedorahosted.org/freeipa/ticket/6200 Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r--ipaserver/plugins/otptoken.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ipaserver/plugins/otptoken.py b/ipaserver/plugins/otptoken.py
index 39012e2f9..f695678ab 100644
--- a/ipaserver/plugins/otptoken.py
+++ b/ipaserver/plugins/otptoken.py
@@ -323,6 +323,10 @@ class otptoken_add(LDAPCreate):
except (NotFound, IndexError):
pass
+ # Check if key is not empty
+ if entry_attrs['ipatokenotpkey'] is None:
+ raise ValidationError(name='key', error=_(u'cannot be empty'))
+
# Build the URI parameters
args = {}
args['issuer'] = issuer