summaryrefslogtreecommitdiff
path: root/perl/Wallet/ACL.pm
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2007-12-01 01:55:18 +0000
committerRuss Allbery <rra@stanford.edu>2007-12-01 01:55:18 +0000
commit45d8382fb2cc3f32b176675c0edb7eef5ca6aa21 (patch)
treec8e8fba8ead6ff59205536be23aeab688ebb7d02 /perl/Wallet/ACL.pm
parenta4bedfb2e84598b3b0d66cbb2fc30417126124eb (diff)
Expiration dates are now expressed in YYYY-MM-DD HH:MM:SS instead of
seconds since epoch and returned the same way. Timestamps are now stored in the database as correct date and time types rather than seconds since epoch to work properly with MySQL.
Diffstat (limited to 'perl/Wallet/ACL.pm')
-rw-r--r--perl/Wallet/ACL.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/perl/Wallet/ACL.pm b/perl/Wallet/ACL.pm
index f04217e..bc318a1 100644
--- a/perl/Wallet/ACL.pm
+++ b/perl/Wallet/ACL.pm
@@ -87,9 +87,10 @@ sub create {
$dbh->do ($sql, undef, $name);
$id = $dbh->last_insert_id (undef, undef, 'acls', 'ac_id');
die "unable to retrieve new ACL ID" unless defined $id;
+ my $date = strftime ('%Y-%m-%d %T', localtime $time);
$sql = "insert into acl_history (ah_acl, ah_action, ah_by, ah_from,
ah_on) values (?, 'create', ?, ?, ?)";
- $dbh->do ($sql, undef, $id, $user, $host, $time);
+ $dbh->do ($sql, undef, $id, $user, $host, $date);
$dbh->commit;
};
if ($@) {
@@ -143,10 +144,11 @@ sub log_acl {
unless ($action =~ /^(add|remove)\z/) {
die "invalid history action $action";
}
+ my $date = strftime ('%Y-%m-%d %T', localtime $time);
my $sql = 'insert into acl_history (ah_acl, ah_action, ah_scheme,
ah_identifier, ah_by, ah_from, ah_on) values (?, ?, ?, ?, ?, ?, ?)';
$self->{dbh}->do ($sql, undef, $self->{id}, $action, $scheme, $identifier,
- $user, $host, $time);
+ $user, $host, $date);
}
##############################################################################
@@ -317,8 +319,7 @@ sub history {
$sth->execute ($self->{id});
my @data;
while (@data = $sth->fetchrow_array) {
- my $time = strftime ('%Y-%m-%d %H:%M:%S', localtime $data[5]);
- $output .= "$time ";
+ $output .= "$data[5] ";
if ($data[0] eq 'add' or $data[0] eq 'remove') {
$output .= "$data[0] $data[1] $data[2]";
} else {