mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-02-20 08:03 pm

[dw-free] posts moved between privacy levels become forbidden to all users

[commit: http://hg.dwscoalition.org/dw-free/rev/81c4ae9ff0ff]

http://bugs.dwscoalition.org/show_bug.cgi?id=296

Fix editing entries saving the wrong data to memcache.

Patch by [personal profile] afuna.

--------------------------------------------------------------------------------
diff -r 1a6d8d606e8d -r 81c4ae9ff0ff cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Fri Feb 20 10:25:19 2009 +0000
+++ b/cgi-bin/ljprotocol.pl	Fri Feb 20 20:03:04 2009 +0000
@@ -1814,7 +1814,7 @@ sub editevent
         $sec = 0 if $security eq 'private';
         $sec = 2**63 if $security eq 'public';
 
-        my $row = pack("NNNNN", $oldevent->{'posterid'},
+        my $row = pack("NNNQN", $oldevent->{'posterid'},
                        LJ::mysqldate_to_time($eventtime, 1),
                        LJ::mysqldate_to_time($oldevent->{'logtime'}, 1),
                        $sec,
diff -r 1a6d8d606e8d -r 81c4ae9ff0ff htdocs/admin/memcache_view.bml
--- a/htdocs/admin/memcache_view.bml	Fri Feb 20 10:25:19 2009 +0000
+++ b/htdocs/admin/memcache_view.bml	Fri Feb 20 20:03:04 2009 +0000
@@ -102,7 +102,7 @@
 
      if ($key =~ /^log2:/) {
          my $item = {};
-         @$item{'posterid', 'eventtime', 'logtime', 'allowmask', 'ditemid'} = unpack("NNNNN", $val);
+         @$item{'posterid', 'eventtime', 'logtime', 'allowmask', 'ditemid'} = unpack("NNNQN", $val);
          $item->{'security'} = ($item->{'allowmask'} == 0 ? 'private' :
                                ($item->{'allowmask'} == 2**63 ? 'public' : 'usemask'));
          @$item{'jitemid', 'anum'} = ($item->{'ditemid'} >> 8, $item->{'ditemid'} % 256);
@@ -121,10 +121,10 @@
          push @$newval, unpack("N", substr($val, 1, 4)) 
              if $ver>=2;
          
-         my $n = (length($val) - $offset )/20;
+         my $n = (length($val) - $offset )/24;
          for (my $i=0; $i<$n; $i++) {
              my ($posterid, $eventtime, $rlogtime, $allowmask, $ditemid) =
-                 unpack("NNNNN", substr($val, $i*20+$offset, 20));
+                 unpack("NNNQN", substr($val, $i*24+$offset, 24));
             $eventtime = LJ::mysql_time($eventtime, 1);
             my $security = $allowmask == 0 ? 'private' :
                 ($allowmask == 2**63 ? 'public' : 'usemask');
--------------------------------------------------------------------------------