예제 #1
0
파일: nfsd.cs 프로젝트: zaubererty/NFS
        private void ReadDir(rpcCracker cracker, rpcPacker packer)
        {
            fhandle fh     = new fhandle(cracker);
            uint    cookie = cracker.get_uint32();
            uint    count  = cracker.get_uint32();

            FileEntry dir = FileTable.LookupFileEntry(fh);

            //Console.WriteLine("ReadDir:{0}, cookie:{1}, count:{2}, resultsNULL:{3}", dir.Name, cookie, count, results == null);

            if (cookie == 0 || results == null)
            {
                if (dir == null)
                {
                    throw new NFSStatusException(NFSStatus.NFSERR_EXIST);
                }

                try
                {
                    results = new readdirres(dir.Name, count);
                }
                catch (DirectoryNotFoundException)
                {
                    FileTable.Remove(fh);
                    throw;
                }
            }

            if (results.Pack(packer, cookie, count) == true)
            {
                results = null;
            }
        }
예제 #2
0
파일: nfsd.cs 프로젝트: petebarber/NFS
        private void ReadDir(rpcCracker cracker, rpcPacker packer)
        {
            fhandle fh	= new fhandle(cracker);
            uint cookie	= cracker.get_uint32();
            uint count	= cracker.get_uint32();

            FileEntry dir = FileTable.LookupFileEntry(fh);

            //Console.WriteLine("ReadDir:{0}, cookie:{1}, count:{2}, resultsNULL:{3}", dir.Name, cookie, count, results == null);

            if (cookie == 0 || results == null)
            {
                if (dir == null) throw new NFSStatusException(NFSStatus.NFSERR_EXIST);

                try
                {
                    results = new readdirres(dir.Name, count);
                }
                catch(DirectoryNotFoundException)
                {
                    FileTable.Remove(fh);
                    throw;
                }
            }

            if (results.Pack(packer, cookie, count) == true)
                results = null;
        }