Fix digest handling

This commit is contained in:
Dietmar Maurer
2011-09-07 12:01:25 +02:00
parent 04a2e4f39f
commit dfe98e6437
2 changed files with 3 additions and 5 deletions

View File

@ -254,6 +254,8 @@ __PACKAGE__->register_method ({
},
digest => {
type => 'string',
description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
maxLength => 40,
optional => 1,
}
},

View File

@ -425,15 +425,13 @@ sub parse_config {
my $ids = {};
my $sha1 = Digest::SHA1->new;
my $digest = Digest::SHA1::sha1_hex($raw);
my $pri = 0;
while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
my $line = $1;
$sha1->add ($line); # compute digest
next if $line =~ m/^\#/;
next if $line =~ m/^\s*$/;
@ -526,8 +524,6 @@ sub parse_config {
}
}
my $digest = $sha1->hexdigest;
my $cfg = { ids => $ids, digest => $digest};
return $cfg;