Beispiel #1
0
        /// <summary>
        /// Guarded by
        /// <see cref="FSNamesystem.ReadLock()"/>
        ///
        /// </summary>
        /// <exception cref="Org.Apache.Hadoop.Security.AccessControlException"/>
        private void CheckSubAccess(byte[][] pathByNameArr, int pathIdx, INode inode, int
                                    snapshotId, FsAction access, bool ignoreEmptyDir)
        {
            if (inode == null || !inode.IsDirectory())
            {
                return;
            }
            Stack <INodeDirectory> directories = new Stack <INodeDirectory>();

            for (directories.Push(inode.AsDirectory()); !directories.IsEmpty();)
            {
                INodeDirectory       d     = directories.Pop();
                ReadOnlyList <INode> cList = d.GetChildrenList(snapshotId);
                if (!(cList.IsEmpty() && ignoreEmptyDir))
                {
                    //TODO have to figure this out with inodeattribute provider
                    Check(GetINodeAttrs(pathByNameArr, pathIdx, d, snapshotId), inode.GetFullPathName
                              (), access);
                }
                foreach (INode child in cList)
                {
                    if (child.IsDirectory())
                    {
                        directories.Push(child.AsDirectory());
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>To check if the request id is the same as saved id.</summary>
 /// <remarks>
 /// To check if the request id is the same as saved id. Don't check fileId
 /// with GRANDFATHER_INODE_ID for backward compatibility.
 /// </remarks>
 /// <exception cref="System.IO.FileNotFoundException"/>
 public static void CheckId(long requestId, INode inode)
 {
     if (requestId != GrandfatherInodeId && requestId != inode.GetId())
     {
         throw new FileNotFoundException("ID mismatch. Request id and saved id: " + requestId
                                         + " , " + inode.GetId() + " for file " + inode.GetFullPathName());
     }
 }