]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1308032 - Cache::Memcached::Fast from bugzilla bug 1189281 and bug 1274764
authorDylan William Hardison <dylan@hardison.net>
Tue, 11 Oct 2016 00:20:12 +0000 (20:20 -0400)
committerDylan William Hardison <dylan@hardison.net>
Tue, 11 Oct 2016 00:20:12 +0000 (20:20 -0400)
Bugzilla/Memcached.pm
META.json
META.yml
Makefile.PL

index 1339a119ce06a0ee6674e8d9a198f7607f04f801..cdadf4601450b298b384a4bbcdadc72e1ca99f2f 100644 (file)
@@ -12,7 +12,6 @@ use strict;
 use warnings;
 
 use Bugzilla::Error;
-use Bugzilla::Util qw(trick_taint);
 use Scalar::Util qw(blessed);
 use URI::Escape;
 use Encode;
@@ -30,13 +29,11 @@ sub _new {
     # disabled.
     my $servers = Bugzilla->get_param_with_override('memcached_servers');
     if (Bugzilla->feature('memcached') && $servers) {
-        require Cache::Memcached;
         $self->{namespace} = Bugzilla->get_param_with_override('memcached_namespace');
-        $self->{memcached} =
-            Cache::Memcached->new({
-                servers   => [ split(/[, ]+/, $servers) ],
-                namespace => $self->{namespace},
-            });
+        $self->{memcached} = Cache::Memcached::Fast->new({
+            servers   => [ split(/[, ]+/, $servers) ],
+            namespace => $self->{namespace},
+        });
     }
     return bless($self, $class);
 }
@@ -249,51 +246,7 @@ sub _get {
 
     $key = $self->_encode_key($key)
         or return;
-    my $value = $self->{memcached}->get($key);
-    return unless defined $value;
-
-    # detaint returned values
-    # hashes and arrays are detainted just one level deep
-    if (ref($value) eq 'HASH') {
-        _detaint_hashref($value);
-    }
-    elsif (ref($value) eq 'ARRAY') {
-        foreach my $value (@$value) {
-            next unless defined $value;
-            # arrays of hashes and arrays are common
-            if (ref($value) eq 'HASH') {
-                _detaint_hashref($value);
-            }
-            elsif (ref($value) eq 'ARRAY') {
-                _detaint_arrayref($value);
-            }
-            elsif (!ref($value)) {
-                trick_taint($value);
-            }
-        }
-    }
-    elsif (!ref($value)) {
-        trick_taint($value);
-    }
-    return $value;
-}
-
-sub _detaint_hashref {
-    my ($hashref) = @_;
-    foreach my $value (values %$hashref) {
-        if (defined($value) && !ref($value)) {
-            trick_taint($value);
-        }
-    }
-}
-
-sub _detaint_arrayref {
-    my ($arrayref) = @_;
-    foreach my $value (@$arrayref) {
-        if (defined($value) && !ref($value)) {
-            trick_taint($value);
-        }
-    }
+    return $self->{memcached}->get($key);
 }
 
 sub _delete {
@@ -346,9 +299,7 @@ L<Bugzilla::Memcached> provides an interface to a Memcached server/servers, with
 the ability to get, set, or clear entries from the cache.
 
 The stored value must be an unblessed hashref, unblessed array ref, or a
-scalar.  Currently nested data structures are supported but require manual
-de-tainting after reading from Memcached (flat data structures are automatically
-de-tainted).
+scalar. 
 
 All values are stored in the Memcached systems using the prefix configured with
 the C<memcached_namespace> parameter, as well as an additional prefix managed
index a853c4a2cfb59b47d0ed4628677512aa2f6502bf..3f3c44b4844a05e0653a93aabc47ae0aab5a9660 100644 (file)
--- a/META.json
+++ b/META.json
@@ -56,7 +56,7 @@
             "runtime" : {
                "requires" : {
                   "Auth::GoogleAuth" : "1.01",
-                  "Cache::Memcached" : "0.17",
+                  "Cache::Memcached::Fast" : "0.17",
                   "Chart::Lines" : "v2.4.10",
                   "DBD::mysql" : "4.037",
                   "Daemon::Generic" : "0",
          "prereqs" : {
             "runtime" : {
                "requires" : {
-                  "Cache::Memcached" : "0.17"
+                  "Cache::Memcached::Fast" : "0.17"
                }
             }
          }
index 78810ed271d9fc1555cea6a260be40bdd1a0bde1..489cad1b020bcd9a5367c9f81db05bf8691ff6ed 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -37,7 +37,7 @@ optional_features:
     description: 'features that bmo needs'
     requires:
       Auth::GoogleAuth: '1.01'
-      Cache::Memcached: '0.17'
+      Cache::Memcached::Fast: '0.17'
       Chart::Lines: v2.4.10
       DBD::mysql: '4.037'
       Daemon::Generic: '0'
@@ -126,7 +126,7 @@ optional_features:
   memcached:
     description: 'Memcached Support'
     requires:
-      Cache::Memcached: '0.17'
+      Cache::Memcached::Fast: '0.17'
   mfa:
     description: 'Multi-Factor Authentication'
     requires:
index f3b03f0dba08a500ad185d9f3cc9e80a74264da4..a84aa1cdf58fce9bff60b92934bf6ce04629a369 100644 (file)
@@ -120,7 +120,7 @@ my %optional_features = (
     memcached => {
         description => 'Memcached Support',
         prereqs     => {
-            runtime => { requires => { 'Cache::Memcached' => '0.17' } }
+            runtime => { requires => { 'Cache::Memcached::Fast' => '0.17' } }
         }
     },
     auth_delegation => {