From d3024fe2ba2b8315449ef40fd1a7e150c965c6d6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 15 Aug 2020 14:24:33 -0700 Subject: [PATCH] Girocco/Config.pm: add max_clone_objects limit Add $max_clone_objects configuration item to the size limits configuration section to set the maximum number of allowed objects in a newly cloned repository. Signed-off-by: Kyle J. McKay --- Girocco/Config.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Girocco/Config.pm b/Girocco/Config.pm index 0c5c6b2..070c3f4 100644 --- a/Girocco/Config.pm +++ b/Girocco/Config.pm @@ -819,6 +819,16 @@ our %reserved_suffixes = ( # our $max_file_size512 = undef; # default is no limit +# If this is set to a non-zero value, after an otherwise successful clone, +# if the repository contains more than this many objects, the clone will +# be considered to fail. +# +# This setting only takes effect after an otherwise successful clone which +# means that if $max_file_size512 is non-zero that the resulting clone did +# not exceed the file size limit if it fails this check. +# +our $max_clone_objects = undef; # default is no limit + # ## ------------------------- @@ -1175,6 +1185,9 @@ $suppress_git_ssh_logging = $suppress_git_ssh_logging ? 1 : ''; (defined($max_file_size512) && !$max_file_size512) and $max_file_size512 = undef; (not defined($max_file_size512) or $max_file_size512 =~ /^[1-9][0-9]*$/ && $max_file_size512 <= 2147483647) or die "Girocco::Config \$max_file_size512 must be undef or a positive integer <= 2147483647"; +(defined($max_clone_objects) && !$max_clone_objects) and $max_clone_objects = undef; +(not defined($max_clone_objects) or $max_clone_objects =~ /^[1-9][0-9]*$/) + or die "Girocco::Config \$max_clone_objects must be undef or a positive integer"; (not $posix_sh_bin or $posix_sh_bin !~ /\s/) or die "Girocco::Config: \$posix_sh_bin must not contain any whitespace"; (not $perl_bin or $perl_bin !~ /\s/) or die "Girocco::Config: \$perl_bin must not contain any whitespace"; !$delay_gfi_redelta and $delay_gfi_redelta = undef; -- 2.11.4.GIT