You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ca...@apache.org on 2013/06/21 19:58:12 UTC

svn commit: r1495523 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/contrib/zkperl/ZooKeeper.xs src/contrib/zkperl/t/50_access.t

Author: camille
Date: Fri Jun 21 17:58:12 2013
New Revision: 1495523

URL: http://svn.apache.org/r1495523
Log:
  ZOOKEEPER-1714 perl client segfaults if ZOO_READ_ACL_UNSAFE constant is used
  (Botond Hejj via camille)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/contrib/zkperl/ZooKeeper.xs
    zookeeper/branches/branch-3.4/src/contrib/zkperl/t/50_access.t

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1495523&r1=1495522&r2=1495523&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Fri Jun 21 17:58:12 2013
@@ -69,6 +69,8 @@ BUGFIXES:
   
   ZOOKEEPER-1663. scripts don't work when path contains spaces (Amichai Rothman via camille)
 
+  ZOOKEEPER-1714 perl client segfaults if ZOO_READ_ACL_UNSAFE constant is used
+  (Botond Hejj via camille)
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/contrib/zkperl/ZooKeeper.xs
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/contrib/zkperl/ZooKeeper.xs?rev=1495523&r1=1495522&r2=1495523&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/contrib/zkperl/ZooKeeper.xs (original)
+++ zookeeper/branches/branch-3.4/src/contrib/zkperl/ZooKeeper.xs Fri Jun 21 17:58:12 2013
@@ -695,13 +695,13 @@ zk_acl_constant(alias=Nullch)
             alias = GvNAME(CvGV(cv));
         }
 
-        if (ix == 1 || strEQ(alias, "ZOO_OPEN_ACL_UNSAFE")) {
+        if (ix == 1 || (alias != NULL && strEQ(alias, "ZOO_OPEN_ACL_UNSAFE"))) {
             acl = ZOO_OPEN_ACL_UNSAFE;
         }
-        else if (ix == 2 || strEQ(alias, "ZOO_READ_ACL_UNSAFE")) {
+        else if (ix == 2 || (alias != NULL && strEQ(alias, "ZOO_READ_ACL_UNSAFE"))) {
             acl = ZOO_READ_ACL_UNSAFE;
         }
-        else if (ix == 3 || strEQ(alias, "ZOO_CREATOR_ALL_ACL")) {
+        else if (ix == 3 || (alias != NULL && strEQ(alias, "ZOO_CREATOR_ALL_ACL"))) {
             acl = ZOO_CREATOR_ALL_ACL;
         }
         else {

Modified: zookeeper/branches/branch-3.4/src/contrib/zkperl/t/50_access.t
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/contrib/zkperl/t/50_access.t?rev=1495523&r1=1495522&r2=1495523&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/contrib/zkperl/t/50_access.t (original)
+++ zookeeper/branches/branch-3.4/src/contrib/zkperl/t/50_access.t Fri Jun 21 17:58:12 2013
@@ -17,7 +17,7 @@
 # limitations under the License.
 
 use File::Spec;
-use Test::More tests => 38;
+use Test::More tests => 40;
 
 BEGIN { use_ok('Net::ZooKeeper', qw(:all)) };
 
@@ -51,6 +51,22 @@ SKIP: {
         $no_read_acl->[0]->{'perms'} == ZOO_PERM_ALL),
        '_zk_acl_constant(): returned default ACL');
 
+    my $zoo_read_acl_unsafe = ZOO_READ_ACL_UNSAFE;
+    ok((ref($zoo_read_acl_unsafe) eq 'ARRAY' and
+        @{$zoo_read_acl_unsafe} == 1 and
+        ref($zoo_read_acl_unsafe->[0]) eq 'HASH' and
+        keys(%{$zoo_read_acl_unsafe->[0]}) == 3 and
+        $zoo_read_acl_unsafe->[0]->{'perms'} == ZOO_PERM_READ),
+       '_zk_acl_constant(): returned good ACL');
+
+    my $zoo_creator_all_acl = ZOO_CREATOR_ALL_ACL;
+    ok((ref($zoo_creator_all_acl) eq 'ARRAY' and
+        @{$zoo_creator_all_acl} == 1 and
+        ref($zoo_creator_all_acl->[0]) eq 'HASH' and
+        keys(%{$zoo_creator_all_acl->[0]}) == 3 and
+        $zoo_creator_all_acl->[0]->{'perms'} == ZOO_PERM_ALL),
+       '_zk_acl_constant(): returned good ACL');
+
     $no_read_acl->[0]->{'perms'} &= ~ZOO_PERM_READ;
     is($no_read_acl->[0]->{'perms'}, ((ZOO_PERM_ALL) & ~ZOO_PERM_READ),
        'assign: altered default ACL');