Commit 3c9047f6 authored by Dietmar Maurer's avatar Dietmar Maurer

only save required information

parent 4b59ea39
...@@ -62,6 +62,16 @@ sub parse_key { ...@@ -62,6 +62,16 @@ sub parse_key {
return undef; return undef;
} }
my $saved_fields = {
key => 1,
checktime => 1,
status => 1,
validdirectory => 1,
productname => 1,
regdate => 1,
nextduedate => 1,
};
sub check_fields { sub check_fields {
my ($info, $server_id, $req_sockets) = @_; my ($info, $server_id, $req_sockets) = @_;
...@@ -85,7 +95,7 @@ sub check_fields { ...@@ -85,7 +95,7 @@ sub check_fields {
return undef if $info->{status} ne 'Active'; return undef if $info->{status} ne 'Active';
foreach my $f (qw(validdirectory productname regdate nextduedate)) { foreach my $f (keys %$saved_fields) {
if (!$info->{$f}) { if (!$info->{$f}) {
die "Missing field '$f'\n"; die "Missing field '$f'\n";
} }
...@@ -233,6 +243,7 @@ sub check_subscription { ...@@ -233,6 +243,7 @@ sub check_subscription {
my $subinfo = {}; my $subinfo = {};
while ($raw =~ m/<(.*?)>([^<]+)<\/\1>/g) { while ($raw =~ m/<(.*?)>([^<]+)<\/\1>/g) {
my ($k, $v) = ($1, $2); my ($k, $v) = ($1, $2);
next if !($k eq 'md5hash' || $saved_fields->{$k});
$subinfo->{$k} = $v; $subinfo->{$k} = $v;
} }
$subinfo->{checktime} = time(); $subinfo->{checktime} = time();
...@@ -245,6 +256,8 @@ sub check_subscription { ...@@ -245,6 +256,8 @@ sub check_subscription {
} }
} }
delete $subinfo->{md5hash};
check_fields($subinfo, $server_id, $req_sockets); check_fields($subinfo, $server_id, $req_sockets);
return $subinfo; return $subinfo;
......
Markdown is supported
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