From 80a364839a3d00988c9b9e40af8e4927818d593d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20W=C3=B3jtowicz?= Date: Thu, 1 Jul 2021 11:36:44 +0000 Subject: [PATCH] Fix yubikey from session. --- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm index 786795a48..c940c306a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -174,7 +174,11 @@ sub verify { # Verify OTP my $yubikey = $self->_findYubikey( $req, $session ); - unless ( $yubikey ) { + if ( + index( $yubikey, + substr( $code, 0, $self->conf->{yubikey2fPublicIDSize} ) ) == -1 + ) + { $self->userLogger->warn('Yubikey not registered'); return PE_BADOTP; }