diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2019-08-20 11:11:54 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2019-08-20 11:11:54 +0000 |
commit | a4fbcc2a55be4811f79f78f25fc7a2d0f915a435 (patch) | |
tree | be233344081782d76b33a7e9422bdc9350017a9a | |
parent | 89cade2cff6fc5462bf1b745192220687d564784 (diff) |
fix error reporting, specifically having two repos on the same site may
lead to one repo closing handles from the other to avoid DoS, as exemplified
by stable-packages.
okay sthen@
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index e84a8900826..87530764b87 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.167 2019/07/22 06:59:41 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.168 2019/08/20 11:11:53 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -281,8 +281,12 @@ sub parse_problems { my ($self, $filename, $hint, $object) = @_; CORE::open(my $fh, '<', $filename) or return; - my $baseurl = $self->url; + my $objecturl = $baseurl; + if (defined $object) { + $objecturl = $object->url; + $object->{error_reported} = 1; + } my $notyet = 1; my $broken = 0; my $signify_error = 0; @@ -306,7 +310,9 @@ sub parse_problems next if m/^(?:200|220|221|226|229|230|227|250|331|500|150)[\s\-]/o; next if m/^EPSV command not understood/o; next if m/^Trying [\da-f\.\:]+\.\.\./o; - next if m/^Requesting \Q$baseurl\E/; + # XXX make_room may call close_now on objects of the right + # type, but from a different repository + next if m/^Requesting (?:\Q$baseurl\E|\Q$objecturl\E)/; next if m/^Remote system type is\s+/o; next if m/^Connected to\s+/o; next if m/^remote\:\s+/o; @@ -354,12 +360,7 @@ sub parse_problems # so it's superfluous next if m/^signify:/ && $self->{lasterror}; if ($notyet) { - my $url = $baseurl; - if (defined $object) { - $url = $object->url; - $object->{error_reported} = 1; - } - $self->{state}->errprint("#1: ", $url); + $self->{state}->errprint("#1: ", $objecturl); $notyet = 0; } if (m/^signify:/) { |