From 142c92d50ad1f0b7e7de02da8e67d96cccb4a5cd Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Sat, 2 Oct 2010 17:38:27 -0400 Subject: [PATCH] tighten up regexps for context and peer --- msva-perl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/msva-perl b/msva-perl index 4647721..a0ebe58 100755 --- a/msva-perl +++ b/msva-perl @@ -23,6 +23,7 @@ use strict; use parent qw(HTTP::Server::Simple::CGI); require Crypt::X509; + use Regexp::Common qw /net/; use Convert::ASN1; use MIME::Base64; use IO::Socket; @@ -326,17 +327,13 @@ use strict; sub getuid { my $data = shift; - if ($data->{context} =~ /(https|ssh)/) { + if ($data->{context} =~ /^(https|ssh)$/) { $data->{context} = $1; - } else { - return []; - } - if ($data->{peer} =~ /(^[^\s]*$)/) { - $data->{peer} = $1; - } else { - return []; + if ($data->{peer} =~ /^($RE{net}{domain})$/) { + $data->{peer} = $1; + return $data->{context}.'://'.$data->{peer}; + } } - return $data->{context}.'://'.$data->{peer}; } sub reviewcert { -- 2.26.2