admin: distfiles/file-fetcher.pl, distfiles/request-handler.pl - no brainos...

glen glen at pld-linux.org
Mon Mar 9 12:07:36 CET 2009


Author: glen                         Date: Mon Mar  9 11:07:36 2009 GMT
Module: admin                         Tag: HEAD
---- Log message:
- no brainos in regexps

---- Files affected:
admin/distfiles:
   file-fetcher.pl (1.47 -> 1.48) , request-handler.pl (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: admin/distfiles/file-fetcher.pl
diff -u admin/distfiles/file-fetcher.pl:1.47 admin/distfiles/file-fetcher.pl:1.48
--- admin/distfiles/file-fetcher.pl:1.47	Sun Mar  8 21:42:49 2009
+++ admin/distfiles/file-fetcher.pl	Mon Mar  9 12:07:31 2009
@@ -40,21 +40,21 @@
 }
 
 # read file from spool, and try unlink it. if cannot unlink -- exit
-# sets $requester (email), $problems, @md5 (arrays of md5's) 
+# sets $requester (email), $problems, @md5 (arrays of md5's)
 # and @url (map from md5 to urls)
 sub read_spool_file()
 {
   open(F, "< $file") || exit 0;
   $requester = <F>;
   chomp $requester;
-  $requester =~ /^[a-zA-Z_\-0-9\@\.]+$/ 
+  $requester =~ /^[a-zA-Z_0-9 at .-]+$/
 	or die "$file: evil requester: $requester";
   $req_login = "";
   $requester =~ /^([^@]+)\@/ and $req_login = $1;
-  $req_login =~ /^[a-z0-9A-Z_\.]+$/ or die "$file: evil requester $requester";
+  $req_login =~ /^[a-z0-9A-Z_.]+$/ or die "$file: evil requester $requester";
   my $flags = <F>;
   $force_reply++ if ($flags =~ /force-reply/);
-	
+
   while (<F>) {
     if (/^ERROR/) {
       s/^ERROR: //;
@@ -120,7 +120,7 @@
   my ($md5, $url, $local_copy) = @_;
 
   my $bn = basename($url);
-  
+
   if ($local_copy ne "$tmp_dir/$md5/$bn") {
     if (system("mv -f \"$local_copy\" \"$tmp_dir/$md5/$bn\"")) {
       $problems .= "FATAL: cannot move $local_copy to $tmp_dir\n";
@@ -128,7 +128,7 @@
     }
     $local_copy = "$tmp_dir/$md5/$bn";
   }
-  
+
   if (open(D, "> $tmp_dir/$md5/$bn.desc")) {
     print D "URL: $url\n";
     print D "Login: $req_login\n";
@@ -143,7 +143,7 @@
   my $dir = by_md5($md5, $url);
   $dir =~ s|/[^/]+/[^/]+$||;
   if (copy_to_df("$tmp_dir/$md5/", $dir) == 0) {
-    $normal_out .= 
+    $normal_out .=
       "STORED: $url\n" .
       "\t$md5  " . basename($url) . "\n" .
       "\tSize: " .  (-s $local_copy) . " bytes\n";
@@ -154,9 +154,9 @@
 sub make_src_symlink($$)
 {
   my ($md5, $url) = @_;
-  
+
   return unless ($url =~ /^no-url/);
-  
+
   my $b = basename($url);
   if (open(S, "> $tmp_dir/$b.link")) {
     if ($url =~ /^no-url-copy/) {
@@ -193,7 +193,7 @@
 sub handle_no_url($$)
 {
   my ($md5, $url) = @_;
-  
+
   unless ($url =~ m#://([^/]+)#) {
     $problems .= "$url: corrupted! (no-url)";
     return;
@@ -227,7 +227,7 @@
   push @files, $bn;
 
   if (got_on_distfiles($md5, $url)) {
-    $normal_out .= 
+    $normal_out .=
     	"ALREADY GOT: $url\n" .
     	"\t$md5  " . basename($url) . "\n";
     make_src_symlink($md5, $url);
@@ -235,12 +235,12 @@
   }
 
   mkdir("$tmp_dir/$md5");
-  
+
   if ($url =~ /^no-url/) {
     handle_no_url($md5, $url);
     return;
   }
-  
+
   open(W, "$cmd 2>&1 |");
   while (<W>) {
     $all_out .= $_;
@@ -313,8 +313,8 @@
 
   splice(@files, 10, @files - 10, "...")
     if (@files > 10);
-  
-  print EMAIL 
+
+  print EMAIL
 "From: $req_login <$requester>
 To: $commits_list
 Cc: $requester

================================================================
Index: admin/distfiles/request-handler.pl
diff -u admin/distfiles/request-handler.pl:1.15 admin/distfiles/request-handler.pl:1.16
--- admin/distfiles/request-handler.pl:1.15	Sun Mar  8 20:06:41 2009
+++ admin/distfiles/request-handler.pl	Mon Mar  9 12:07:31 2009
@@ -49,10 +49,10 @@
 
 while (<STDIN>) {
   chomp;
-  /^X-Spec: ([\+a-zA-Z0-9_\-\.]+\.spec)/i and $spec = $1;
-  /^X-Branch: ([a-zA-Z0-9_\-]+)/i and $branch = $1;
-  /^X-Login: ([a-zA-Z0-9_\.]+)/i and $from = $1;
-  /^X-Flags: ([a-zA-Z0-9\-_ ]+)/i and $flags = $1;
+  /^X-Spec: ([a-z0-9_.+-]+\.spec)/i and $spec = $1;
+  /^X-Branch: ([a-z0-9_-]+)/i and $branch = $1;
+  /^X-Login: ([a-z0-9_.]+)/i and $from = $1;
+  /^X-Flags: ([a-z0-9_ -]+)/i and $flags = $1;
 }
 
 die "ill-formed request" if (!defined $from);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/admin/distfiles/file-fetcher.pl?r1=1.47&r2=1.48&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/admin/distfiles/request-handler.pl?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list