Commit 8644c4ed authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix various mysql 5.7 date conversion problems (format no longer

supported).
parent 64c6c6bb
......@@ -1078,6 +1078,7 @@ sub PostHistoryRecord($)
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Could not parse $slot: $date");
}
$record->{$slot} = $parsed_date;
push(@insert_data, "$slot=FROM_UNIXTIME($parsed_date)");
}
# Only toplevel aggregates
......@@ -1133,9 +1134,9 @@ sub PostHistoryRecord($)
#
if (defined($record->{'destroyed'})) {
if (!defined($row->{'destroyed'})) {
my $destroyed = DBQuoteSpecial($record->{'destroyed'});
my $destroyed = $record->{'destroyed'};
DBQueryWarn("update aggregate_history set ".
" destroyed=$destroyed ".
" destroyed=FROM_UNIXTIME($destroyed) ".
"where idx='$aggregate_idx'");
}
}
......@@ -1145,12 +1146,12 @@ sub PostHistoryRecord($)
# Optional Manifest.
#
if (exists($record->{'manifest'})) {
my $created = DBQuoteSpecial($record->{'created'});
my $created = $record->{'created'};
my $manifest_result =
DBQueryWarn("select idx from manifest_history ".
"where aggregate_uuid=$aggregate_uuid and ".
" aggregate_urn=$aggregate_urn and ".
" created=$created");
" created=FROM_UNIXTIME($created)");
return GeniResponse->Create(GENIRESPONSE_ERROR)
if (!defined($manifest_result));
......@@ -1161,7 +1162,8 @@ sub PostHistoryRecord($)
DBQueryWarn("insert into manifest_history set idx=NULL, " .
" aggregate_uuid=$aggregate_uuid, " .
" aggregate_urn=$aggregate_urn, " .
" created=$created, manifest=$safe_manifest")
" created=FROM_UNIXTIME($created), ".
" manifest=$safe_manifest")
or return GeniResponse->Create(GENIRESPONSE_ERROR);
}
}
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2008-2016 University of Utah and the Flux Group.
# Copyright (c) 2008-2017 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -1231,6 +1231,12 @@ sub StoreCRL($$$)
return -1;
}
$expires =~ s/^nextupdate=//i;
my $converted = str2time($expires);
if (!$converted) {
print STDERR "Could not parse expiration: '$expires'\n";
return -1;
}
$converted = $converted - (3600 * 24);
my $issuer = `$OPENSSL crl -noout -issuer -in $filename`;
chomp($issuer);
if (! (defined($issuer) && ($issuer =~ /^issuer/i))) {
......@@ -1239,10 +1245,8 @@ sub StoreCRL($$$)
}
$issuer =~ s/^issuer=//i;
my $safe_cert = DBQuoteSpecial($string);
my $safe_expires = DBQuoteSpecial($expires);
my $safe_issuer = DBQuoteSpecial($issuer);
my $dateconvert = "DATE_SUB(STR_TO_DATE($safe_expires, ".
"'%b %e %T %Y'), INTERVAL 1 DAY)";
my $dateconvert = "FROM_UNIXTIME($converted)";
DBQueryWarn("replace into geni_crls set ".
" uuid='$uuid', created=now(), expires=$dateconvert, ".
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2008-2016 University of Utah and the Flux Group.
# Copyright (c) 2008-2017 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -803,16 +803,11 @@ sub Sign($$)
# Credential expiration: hard-code to 24 hours, if the underlying
# object does not define an expiration.
my $expires = $self->expires();
if (!defined($expires)) {
$expires = POSIX::strftime("20%y-%m-%dT%H:%M:%SZ",
gmtime(time() + 24 * 60 * 60));
}
else {
$expires = POSIX::strftime("20%y-%m-%dT%H:%M:%SZ",
gmtime(str2time($expires)));
if (!defined($self->expires())) {
$self->SetExpiration(time() + 24 * 60 * 60);
}
$self->{'valid_until'} = $expires;
my $expires = POSIX::strftime("20%y-%m-%dT%H:%M:%SZ",
gmtime(str2time($self->expires())));
#
# Create a template xml file to sign.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment