From 521b41bde99a8643d6ce7f21e92bde678b225d32 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 18 Mar 2009 14:53:46 +0000 Subject: [PATCH] Drop accessed field. --- TODO | 3 --- ykksm-db.sql | 3 +-- ykksm-decrypt.php | 8 -------- ykksm-import.pl | 6 +++--- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index 2117258..0000000 --- a/TODO +++ /dev/null @@ -1,3 +0,0 @@ -- Do we really need the 'accessed' column? It leads to database - writes, and it seems this information could be stored on the - validation server anyway. diff --git a/ykksm-db.sql b/ykksm-db.sql index e91ce26..e62960e 100644 --- a/ykksm-db.sql +++ b/ykksm-db.sql @@ -11,7 +11,6 @@ create table yubikeys ( -- timestamps: created datetime not null, - accessed datetime, -- the data: internalName varchar(12) not null, @@ -34,5 +33,5 @@ create table yubikeys ( drop user ykksmreader; create user ykksmreader; -grant select, update(accessed) on ykksm.yubikeys to 'ykksmreader'@'localhost'; +grant select on ykksm.yubikeys to 'ykksmreader'@'localhost'; flush privileges; diff --git a/ykksm-decrypt.php b/ykksm-decrypt.php index 4e5e5aa..a4d20a6 100644 --- a/ykksm-decrypt.php +++ b/ykksm-decrypt.php @@ -92,14 +92,6 @@ if (strcmp(substr($plaintext, 0, 12), $internalName) != 0) { die("ERR Corrupt OTP\n");; } -$sql = "UPDATE yubikeys SET accessed = NOW() " . - "WHERE publicName = '$id'"; -$result = mysql_query($sql); -if (!$result) { - syslog(LOG_ERR, "Database update error: " . mysql_error()); - die("ERR Database error\n"); - } - # Mask out interesting fields $counter = substr($plaintext, 14, 2) . substr($plaintext, 12, 2); diff --git a/ykksm-import.pl b/ykksm-import.pl index 7c4c49b..b5d9765 100755 --- a/ykksm-import.pl +++ b/ykksm-import.pl @@ -117,9 +117,9 @@ die "Input not signed?" if !$signed_by; my $dbh = DBI->connect($db, $dbuser, $dbpasswd, {'RaiseError' => 1}); my $inserth = $dbh->prepare_cached(qq{ -INSERT INTO yubikeys (creator, created, accessed, serialNr, +INSERT INTO yubikeys (creator, created, serialNr, publicName, internalName, aesKey, lockCode) -VALUES (?, ?, ?, ?, ?, ?, ?, ?) +VALUES (?, ?, ?, ?, ?, ?, ?) }); my $now = strftime "%Y-%m-%dT%H:%M:%S", localtime; @@ -147,7 +147,7 @@ while () { $created = $now if !$created; $accessed = "NULL" if !$accessed; - $inserth->execute($creator, $created, $accessed, $serialNr, + $inserth->execute($creator, $created, $serialNr, $publicName, $internalName, $aesKey, $lockCode) or die "Database insert error: " . $dbh->errstr;