فهرست منبع

Merge pull request #11343 from jakesmith/hpcc-19414

HPCC-19414 Prevent protected status being copied into super.

Reviewed-By: Attila Vamos <attila.vamos@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 سال پیش
والد
کامیت
4ab986431d
1فایلهای تغییر یافته به همراه16 افزوده شده و 6 حذف شده
  1. 16 6
      dali/base/dadfs.cpp

+ 16 - 6
dali/base/dadfs.cpp

@@ -5139,7 +5139,8 @@ protected:
         // first renumber all above
         StringBuffer path;
         IPropertyTree *sub;
-        for (unsigned i=subfiles.ordinality();i>pos;i--) {
+        for (unsigned i=subfiles.ordinality();i>pos;i--)
+        {
             sub = root->queryPropTree(getSubPath(path.clear(),i-1).str());
             if (!sub)
                 throw MakeStringException(-1,"C(2): Corrupt subfile file part %d cannot be found",i);
@@ -5148,8 +5149,11 @@ protected:
         sub = createPTree();
         sub->setPropInt("@num",pos+1);
         sub->setProp("@name",file->queryLogicalName());
-        if (pos==0) {
-            resetFileAttr(createPTreeFromIPT(&file->queryAttributes()));
+        if (pos==0)
+        {
+            Owned<IPropertyTree> superAttrs = createPTreeFromIPT(&file->queryAttributes());
+            superAttrs->removeProp("Protect"); // do not automatically inherit protected status
+            resetFileAttr(superAttrs.getClear());
         }
         root->addPropTree("SubFile",sub);
         subfiles.add(*file.getClear(),pos);
@@ -5165,16 +5169,22 @@ protected:
             throw MakeStringException(-1,"CDistributedSuperFile(3): Corrupt subfile file part %d cannot be found",pos+1);
         root->removeTree(sub);
         // now renumber all above
-        for (unsigned i=pos+1; i<subfiles.ordinality(); i++) {
+        for (unsigned i=pos+1; i<subfiles.ordinality(); i++)
+        {
             sub = root->queryPropTree(getSubPath(path.clear(),i).str());
             if (!sub)
                 throw MakeStringException(-1,"CDistributedSuperFile(2): Corrupt subfile file part %d cannot be found",i+1);
             sub->setPropInt("@num",i);
         }
         subfiles.remove(pos);
-        if (pos==0) {
+        if (pos==0)
+        {
             if (subfiles.ordinality())
-                resetFileAttr(createPTreeFromIPT(&subfiles.item(0).queryAttributes()));
+            {
+                Owned<IPropertyTree> superAttrs = createPTreeFromIPT(&subfiles.item(0).queryAttributes());
+                superAttrs->removeProp("Protect"); // do not automatically inherit protected status
+                resetFileAttr(superAttrs.getClear());
+            }
             else
                 resetFileAttr(getEmptyAttr());
         }