[GitHub] zookeeper pull request #248: [ZOOKEEPER-2779] Provide a means to disable set...

2017-05-30 Thread afine
Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/248#discussion_r119181608
  
--- Diff: 
src/java/test/org/apache/zookeeper/test/ReconfigExceptionTestCase.java ---
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.test;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.PortAssignment;
+import org.apache.zookeeper.ZKTestCase;
+import org.apache.zookeeper.admin.ZooKeeperAdmin;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+public class ReconfigExceptionTestCase extends ZKTestCase {
--- End diff --

agreed, thanks for the explanation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #248: [ZOOKEEPER-2779] Provide a means to disable set...

2017-05-30 Thread Randgalt
Github user Randgalt commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/248#discussion_r119179974
  
--- Diff: 
src/java/test/org/apache/zookeeper/test/ReconfigExceptionTestCase.java ---
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.test;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.PortAssignment;
+import org.apache.zookeeper.ZKTestCase;
+import org.apache.zookeeper.admin.ZooKeeperAdmin;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+public class ReconfigExceptionTestCase extends ZKTestCase {
--- End diff --

The problem is that the System property needs to be set. The setup() method 
would have to be parameterized or something. It's far easier to have a separate 
class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #248: [ZOOKEEPER-2779] Provide a means to disable set...

2017-05-30 Thread afine
Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/248#discussion_r119178381
  
--- Diff: 
src/java/test/org/apache/zookeeper/test/ReconfigExceptionTestCase.java ---
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.test;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.PortAssignment;
+import org.apache.zookeeper.ZKTestCase;
+import org.apache.zookeeper.admin.ZooKeeperAdmin;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeoutException;
+
+public class ReconfigExceptionTestCase extends ZKTestCase {
--- End diff --

this seems like a little bit of overkill for me. 3 classes for just 2 tests?

Could we condense this to one class, say, "ConfigNodeACLTest"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #248: [ZOOKEEPER-2779] Provide a means to disable set...

2017-05-30 Thread afine
Github user afine commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/248#discussion_r119176943
  
--- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
@@ -254,12 +262,14 @@ public void addConfigNode() {
 }
 
 nodes.put(configZookeeper, configDataNode);
-try {
-// Reconfig node is access controlled by default 
(ZOOKEEPER-2014).
-setACL(configZookeeper, ZooDefs.Ids.READ_ACL_UNSAFE, -1);
-} catch (KeeperException.NoNodeException e) {
-assert false : "There's no " + configZookeeper +
-" znode - this should never happen.";
+if ( !skipDefaultACLForReconfig ) {
--- End diff --

nit: no spaces around the condition


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #248: [ZOOKEEPER-2779} Provide a means to disable set...

2017-05-09 Thread Randgalt
GitHub user Randgalt opened a pull request:

https://github.com/apache/zookeeper/pull/248

[ZOOKEEPER-2779} Provide a means to disable setting of the Read Only ACL 
for the reconfig node

Provide a means to disable setting of the Read Only ACL for the reconfig 
node added in ZOOKEEPER-2014. That change made it very cumbersome to use the 
reconfig feature and also could worsen security as the entire ZK database is 
open to "super" user while the reconfig node is being changed (the only 
possible method as of ZOOKEEPER-2014).

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Randgalt/zookeeper ZOOKEEPER-2779

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/248.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #248


commit de07e525ec8b4aa24283eedb159f8df2b576e71b
Author: randgalt 
Date:   2017-05-09T14:12:41Z

Provide a means to disable setting of the Read Only ACL for the reconfig 
node added in ZOOKEEPER-2014. That change made it very cumbersome to use the 
reconfig feature and also could worsen security as the entire ZK database is 
open to "super" user while the reconfig node is being changed (the only 
possible method as of ZOOKEEPER-2014).




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---