1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-01-20 10:52:15 +01:00
This commit is contained in:
Paul Chen 2008-12-02 18:53:47 +00:00
parent 7f8ecb4728
commit 9a9a41072e

View File

@ -14,7 +14,7 @@ if ($nonce == '') {
$client = getHttpVal('id', 0);
if ($client <= 0) {
reply(S_MISSING_PARAMETER, '', $client, $nonce, 'client');
reply(S_MISSING_PARAMETER, '', $client, $nonce, 'id');
exit;
}
$ci = getClientInfo($client);
@ -25,12 +25,6 @@ if ($h == '') {
exit;
}
$sn = getHttpVal('sn', '');
if ($sn == '') {
reply(S_MISSING_PARAMETER, '', $client, $nonce, 'sn');
exit;
}
$op = getHttpVal('operation', '');
if ($op == '') {
@ -66,13 +60,19 @@ $reqArr['nonce'] = $nonce;
$reqArr['operation'] = 'add_key';
$reqHash = sign($reqArr, $ci['secret']);
if ($reqHash != $h) {
reply(S_BAD_SIGNATURE, $ci['secret'], $client, $nonce, $h);
reply(S_BAD_SIGNATURE, $ci['secret'], $client, $nonce);
if ($trace) {
echo 'Secret: '.$ci['secret']."\n";
echo 'Sign: '; print_r($reqArr);
echo 'Correct h: '.$reqHash;
}
exit;
}
$tokenId = base64_encode(genRandRaw(6));
$secret = base64_encode(genRandRaw(16));
$keyid = addNewKey($tokenId, 1, $secret, '', $client, $sn);
$keyid = addNewKey($tokenId, 1, $secret, '', $client);
if ($keyid > 0) {
debug('Key '.$keyid.' added');