From 39a3753d0cd38ff1752b00f24627cbaba412848a Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 26 Nov 2011 01:13:18 +0100 Subject: Bug 255606: Do not let buglist.cgi return all bugs by default r/a=mkanat --- Bugzilla/Config.pm | 5 +++++ Bugzilla/Config/Query.pm | 2 +- Bugzilla/Search.pm | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index c247a072a..990fd8dd2 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -193,6 +193,11 @@ sub update_params { $new_params{'ssl_redirect'} = 1; } + # "specific_search_allow_empty_words" has been renamed to "search_allow_no_criteria". + if (exists $param->{'specific_search_allow_empty_words'}) { + $new_params{'search_allow_no_criteria'} = $param->{'specific_search_allow_empty_words'}; + } + # --- DEFAULTS FOR NEW PARAMS --- _load_params unless %params; diff --git a/Bugzilla/Config/Query.pm b/Bugzilla/Config/Query.pm index 17a74998e..4038c13ef 100644 --- a/Bugzilla/Config/Query.pm +++ b/Bugzilla/Config/Query.pm @@ -68,7 +68,7 @@ sub get_param_list { }, { - name => 'specific_search_allow_empty_words', + name => 'search_allow_no_criteria', type => 'b', default => 1 }, diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index d47e0ae99..6bbf4ab42 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1168,6 +1168,11 @@ sub _sql_where { if ($clause_sql) { $where .= "\n AND " . $clause_sql; } + elsif (!Bugzilla->params->{'search_allow_no_criteria'} + && !$self->{allow_unlimited}) + { + ThrowUserError('buglist_parameters_required'); + } return $where; } -- cgit v1.2.3-24-g4f1b From fb5a11226b8c5c65df7afa90547e6ddfe711a839 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 26 Nov 2011 14:18:04 +0100 Subject: Bug 368250: collectstats.pl creates files with wrong ownership r/a=mkanat --- Bugzilla/Install/Filesystem.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 15106dab9..c5215ecfa 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -46,6 +46,7 @@ our @EXPORT = qw( update_filesystem create_htaccess fix_all_file_permissions + fix_dir_permissions fix_file_permissions ); @@ -645,6 +646,26 @@ sub _update_old_charts { } } +sub fix_dir_permissions { + my ($dir) = @_; + return if ON_WINDOWS; + # Note that _get_owner_and_group is always silent here. + my ($owner_id, $group_id) = _get_owner_and_group(); + + my $perms; + my $fs = FILESYSTEM(); + if ($perms = $fs->{recurse_dirs}->{$dir}) { + _fix_perms_recursively($dir, $owner_id, $group_id, $perms); + } + elsif ($perms = $fs->{all_dirs}->{$dir}) { + _fix_perms($dir, $owner_id, $group_id, $perms); + } + else { + # Do nothing. We know nothing about this directory. + warn "Unknown directory $dir"; + } +} + sub fix_file_permissions { my ($file) = @_; return if ON_WINDOWS; @@ -843,6 +864,12 @@ Params: C<$output> - C if you want this function to print Returns: nothing +=item C + +Given the name of a directory, its permissions will be fixed according to +how they are supposed to be set in Bugzilla's current configuration. +If it fails to set the permissions, a warning will be printed to STDERR. + =item C Given the name of a file, its permissions will be fixed according to -- cgit v1.2.3-24-g4f1b From 2fe1db36b3ced43ca9b76a5fbc293c845fd13066 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Mon, 28 Nov 2011 17:10:07 +0100 Subject: Bug 705393: Improve the error message thrown by Update.pm when updates.bugzilla.org is unavailable r=glob a=LpSolit --- Bugzilla/Constants.pm | 7 +++++++ Bugzilla/Update.pm | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 5c9fecc57..e44306520 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -40,6 +40,9 @@ use Memoize; @Bugzilla::Constants::EXPORT = qw( BUGZILLA_VERSION + REMOTE_FILE + LOCAL_FILE + bz_locations IS_NULL @@ -201,6 +204,10 @@ use Memoize; # Bugzilla version use constant BUGZILLA_VERSION => "4.1.3+"; +# Location of the remote and local XML files to track new releases. +use constant REMOTE_FILE => 'http://updates.bugzilla.org/bugzilla-update.xml'; +use constant LOCAL_FILE => 'bugzilla-update.xml'; # Relative to datadir. + # These are unique values that are unlikely to match a string or a number, # to be used in criteria for match() functions and other things. They start # and end with spaces because most Bugzilla stuff has trim() called on it, diff --git a/Bugzilla/Update.pm b/Bugzilla/Update.pm index a94fd167d..c9942a4f0 100644 --- a/Bugzilla/Update.pm +++ b/Bugzilla/Update.pm @@ -20,8 +20,6 @@ use strict; use Bugzilla::Constants; -use constant REMOTE_FILE => 'http://updates.bugzilla.org/bugzilla-update.xml'; -use constant LOCAL_FILE => "/bugzilla-update.xml"; # Relative to datadir. use constant TIME_INTERVAL => 86400; # Default is one day, in seconds. use constant TIMEOUT => 5; # Number of seconds before timeout. @@ -30,26 +28,25 @@ sub get_notifications { return if !Bugzilla->feature('updates'); return if (Bugzilla->params->{'upgrade_notification'} eq 'disabled'); - my $local_file = bz_locations()->{'datadir'} . LOCAL_FILE; + my $local_file = bz_locations()->{'datadir'} . '/' . LOCAL_FILE; # Update the local XML file if this one doesn't exist or if # the last modification time (stat[9]) is older than TIME_INTERVAL. if (!-e $local_file || (time() - (stat($local_file))[9] > TIME_INTERVAL)) { unlink $local_file; # Make sure the old copy is away. - if (-e $local_file) { - return { 'error' => 'no_update', xml_file => $local_file }; - } + return { 'error' => 'no_update' } if (-e $local_file); + my $error = _synchronize_data(); # If an error is returned, leave now. return $error if $error; } # If we cannot access the local XML file, ignore it. - return {'error' => 'no_access', 'xml_file' => $local_file} unless (-r $local_file); + return { 'error' => 'no_access' } unless (-r $local_file); my $twig = XML::Twig->new(); $twig->safe_parsefile($local_file); # If the XML file is invalid, return. - return {'error' => 'corrupted', 'xml_file' => $local_file} if $@; + return { 'error' => 'corrupted' } if $@; my $root = $twig->root; my @releases; @@ -119,7 +116,7 @@ sub get_notifications { } sub _synchronize_data { - my $local_file = bz_locations()->{'datadir'} . LOCAL_FILE; + my $local_file = bz_locations()->{'datadir'} . '/' . LOCAL_FILE; my $ua = LWP::UserAgent->new(); $ua->timeout(TIMEOUT); @@ -133,7 +130,7 @@ sub _synchronize_data { else { $ua->env_proxy; } - $ua->mirror(REMOTE_FILE, $local_file); + my $response = eval { $ua->mirror(REMOTE_FILE, $local_file) }; # $ua->mirror() forces the modification time of the local XML file # to match the modification time of the remote one. @@ -144,11 +141,14 @@ sub _synchronize_data { # Try to alter its last modification time. my $can_alter = utime(undef, undef, $local_file); # This error should never happen. - $can_alter || return {'error' => 'no_update', 'xml_file' => $local_file}; + $can_alter || return { 'error' => 'no_update' }; } - else { + elsif ($response && $response->is_error) { # We have been unable to download the file. - return {'error' => 'cannot_download', 'xml_file' => $local_file}; + return { 'error' => 'cannot_download', 'reason' => $response->status_line }; + } + else { + return { 'error' => 'no_write', 'reason' => $@ }; } # Everything went well. -- cgit v1.2.3-24-g4f1b