diff --git a/NEWS b/NEWS index 949326c..35f3da4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ * Version 1.4 unreleased + * Don't use PDO rowCount, it is not portable. + Issue #2 reported by arte42.ripe, see: + http://code.google.com/p/yubikey-ksm/issues/detail?id=2>. + * Fixed perl warning in ykksm-gen-keys. Issue #3 reported by toddejohnson, see: http://code.google.com/p/yubikey-ksm/issues/detail?id=3>. diff --git a/ykksm-decrypt.php b/ykksm-decrypt.php index bf1c195..1d322fe 100644 --- a/ykksm-decrypt.php +++ b/ykksm-decrypt.php @@ -1,7 +1,7 @@ . -# Copyright (c) 2009 Yubico AB +# Copyright (c) 2009, 2010 Yubico AB # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -64,15 +64,15 @@ if (!$result) { die("ERR Database error\n"); } -if ($result->rowCount() != 1) { - syslog(LOG_INFO, "Unknown yubikey: " . $otp); - die("ERR Unknown yubikey\n"); - } - $row = $result->fetch(PDO::FETCH_ASSOC); $aeskey = $row['aeskey']; $internalname = $row['internalname']; +if (!$aeskey) { + syslog(LOG_INFO, "Unknown yubikey: " . $otp); + die("ERR Unknown yubikey\n"); + } + $ciphertext = modhex2hex($modhex_ciphertext); $plaintext = aes128ecb_decrypt($aeskey, $ciphertext);