示例#1
0
    {
      if (aFullPath.Length == 0) 
        return this;
      
      int p = aFullPath.IndexOf('/');
      if (p >= 0)
      {
        string lSubFolder = aFullPath.Substring(0,p);

        IFtpFolder lFolder = GetSubFolder(lSubFolder, aSession);

        if (lFolder != null)
        {
          aFullPath = aFullPath.Substring(p+1);
          return lFolder.DigForSubFolder(aFullPath, aSession);
        }  

        else
        {
          return null;
        }
      }
      else 
      {
        return GetSubFolder(aFullPath, aSession);
      }
    }
    public void FindBaseFolderForFilename(string aPath, out IFtpFolder aFolder, out string aFilename, VirtualFtpSession aSession)
    {
示例#2
0
 public DiscFolder(IFtpFolder parent, String name, String localPath)
     : base(parent, name)
 {
     this.fLocalPath = localPath;
     //this.WorldRead = true;
     //this.WorldWrite = true;
 }
示例#3
0
        protected FtpItem(IFtpFolder parent, String name)
        {
            fParent = parent;
            fName   = name;

            if (parent != null)
            {
                UserRead    = ((FtpItem)parent).UserRead;
                UserWrite   = ((FtpItem)parent).UserWrite;
                GroupRead   = ((FtpItem)parent).GroupRead;
                OwningUser  = parent.OwningUser;
                OwningGroup = parent.OwningGroup;
            }

            /*
             * UserRead = true;
             * UserWrite = true;
             * GroupRead = true;
             *
             * OwningUser = "******";
             * OwningGroup = "system";
             */

            Date = DateTime.Now;
        }
示例#4
0
 public EmptyFile(IFtpFolder parent, String name)
     : base(parent, name)
 {
     this.UserRead = false;
     this.UserWrite = false;
     this.Complete = false;
 }
示例#5
0
		public VirtualFolder(IFtpFolder aParent, string aName) : this(aParent, aName, "system", "system", false)
		{
      fFileList = new Hashtable();
      WorldRead = true;
      WorldWrite = false;
      Date = DateTime.Now;
    }
示例#6
0
 public DiscFolder(IFtpFolder parent, String name, String localPath)
     : base(parent, name)
 {
     this.fLocalPath = localPath;
     //this.WorldRead = true;
     //this.WorldWrite = true;
 }
示例#7
0
 public EmptyFile(IFtpFolder parent, String name)
     : base(parent, name)
 {
     this.UserRead  = false;
     this.UserWrite = false;
     this.Complete  = false;
 }
示例#8
0
        public override void DeleteFolder(String folder, Boolean recursive, VirtualFtpSession session)
        {
            if (!HasSubfolder(folder))
            {
                throw new FtpException(String.Format("A folder named \"{0}\" does not exists.", folder));
            }

            if (!AllowDeleteItems(session))
            {
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete from this folder denied.", folder));
            }

            IFtpFolder lFolder = GetSubFolder(folder, session);

            if (!lFolder.AllowDeleteThis(session))
            {
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete folder denied.", folder));
            }

            lock (this)
            {
                lFolder.Invalidate();
                SubFolderList.Remove(folder.ToLower());
            }
        }
示例#9
0
        public IFtpFolder DigForSubFolder(String fullPath, VirtualFtpSession session)
        {
            if (fullPath.Length == 0)
            {
                return(this);
            }

            Int32 lSeparatorIndex = fullPath.IndexOf('/');

            if (lSeparatorIndex < 0)
            {
                return(this.GetSubFolder(fullPath, session));
            }

            String lSubFolder = fullPath.Substring(0, lSeparatorIndex);

            IFtpFolder lFolder = GetSubFolder(lSubFolder, session);

            if (lFolder == null)
            {
                return(null);
            }

            fullPath = fullPath.Substring(lSeparatorIndex + 1);
            return(lFolder.DigForSubFolder(fullPath, session));
        }
 public SecureFolder(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName)
 {
     fStorage    = aStorage;
     WorldRead   = true;
     WorldWrite  = true;
     OwningUser  = "******";
     OwningGroup = "system";
 }
示例#11
0
 public SecureFolder(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName)
 {
   fStorage = aStorage;
   WorldRead = true;
   WorldWrite = true;
   OwningUser = "******";
   OwningGroup = "system";
 }
示例#12
0
 public VirtualFolder(IFtpFolder aParent, string aName, string aOwningUser, string aOwningGroup, bool aWorldWritable) : base(aParent, aName)
 {
   fFileList = new Hashtable();
   WorldRead = true;
   WorldWrite = aWorldWritable;
   OwningUser = aOwningUser;
   OwningGroup = aOwningGroup;
   Date = DateTime.Now;
 }
示例#13
0
 public VirtualFolder(IFtpFolder parent, String name, String ownerUser, String ownerGroup, Boolean aWorldWritable)
     : base(parent, name)
 {
     this.fFileList   = new Hashtable();
     this.WorldRead   = true;
     this.WorldWrite  = aWorldWritable;
     this.OwningUser  = ownerUser;
     this.OwningGroup = ownerGroup;
     this.Date        = DateTime.Now;
 }
 public SecureFolder(IFtpFolder aParent, string aName, SecureStorage aStorage, bool aPrivcate) : this(aParent, aName, aStorage)
 {
     fStorage    = aStorage;
     GroupRead   = false;
     GroupWrite  = false;
     WorldRead   = false;
     WorldWrite  = false;
     OwningUser  = "******";
     OwningGroup = "system";
 }
示例#15
0
 public SecureFolder(IFtpFolder aParent, string aName, SecureStorage aStorage, bool aPrivcate) : this(aParent, aName, aStorage)
 {
   fStorage = aStorage;
   GroupRead = false;
   GroupWrite = false;
   WorldRead = false;
   WorldWrite = false;
   OwningUser = "******";
   OwningGroup = "system";
 }
示例#16
0
 public VirtualFolder(IFtpFolder parent, String name, String ownerUser, String ownerGroup, Boolean aWorldWritable)
     : base(parent, name)
 {
     this.fFileList = new Hashtable();
     this.WorldRead = true;
     this.WorldWrite = aWorldWritable;
     this.OwningUser = ownerUser;
     this.OwningGroup = ownerGroup;
     this.Date = DateTime.Now;
 }
示例#17
0
    protected FtpItem(IFtpFolder aParent, string aName)
    {
      fParent = aParent;
      fName = aName;

      UserRead = true;
      UserWrite = true;
      GroupRead = true;
      
      OwningUser = "******";
      OwningGroup = "system";

      Date = DateTime.Now;
    }
示例#18
0
        public override IFtpFolder GetSubFolder(String folder, VirtualFtpSession session)
        {
            //if (!AllowBrowse(session))
            //    throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to access items in this folder denied.", folder));

            IFtpFolder lFolder = SubFolderList[folder.ToLower()] as IFtpFolder;

            if (lFolder != null && !lFolder.AllowBrowse(session))
            {
                throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to browse folder denied.", folder));
            }

            return(lFolder);
        }
示例#19
0
        protected FtpItem(IFtpFolder parent, String name)
        {
            fParent = parent;
            fName   = name;

            UserRead  = true;
            UserWrite = true;
            GroupRead = true;

            OwningUser  = "******";
            OwningGroup = "system";

            Date = DateTime.Now;
        }
示例#20
0
		protected FtpItem(IFtpFolder parent, String name)
		{
			Parent = parent;
			Name = name;

			UserRead = true;
			UserWrite = true;
			GroupRead = true;

			OwningUser = "******";
			OwningGroup = "system";

			Date = DateTime.Now;
		}
示例#21
0
        protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs e)
        {
            String lPath = e.NewDirectory;

            if (lPath.IndexOf('/') != 0)
            {
                throw new Exception(String.Format("Not an absolute path: \"{0}\"", lPath));
            }

            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;
            IFtpFolder        lFolder  = RootFolder.DigForSubFolder(lPath.Substring(1), lSession);

            if (lFolder != null)
            {
                ((VirtualFtpSession)e.Session).CurrentFolder = lFolder;
            }

            e.ChangeDirOk = (lFolder != null);
            base.InvokeOnChangeDirectory(e);
        }
示例#22
0
        private IFtpFolder GetUserFolder(VirtualFtpSession session)
        {
            IFtpFolder userFolder = rootFolder.GetSubFolder(session.Username, session);

            if (userFolder != null)
            {
                return(userFolder);
            }
            else
            {
                if (session.IsFileAdmin)
                {
                    return(CreateRootFolder(session));
                }

                if (session.Username.ToLower().EndsWith("_admin"))
                {
                    return(CreateAdminFolder(session));
                }

                return(CreateUserFolder(session));
            }
        }
示例#23
0
        protected FtpItem(IFtpFolder parent, String name)
        {
            fParent = parent;
            fName = name;

            if (parent != null)
            {
                UserRead = ((FtpItem)parent).UserRead;
                UserWrite = ((FtpItem)parent).UserWrite;
                GroupRead = ((FtpItem)parent).GroupRead;
                OwningUser = parent.OwningUser;
                OwningGroup = parent.OwningGroup;
            }
            /*
            UserRead = true;           
            UserWrite = true;
            GroupRead = true;

            OwningUser = "******";
            OwningGroup = "system";
            */

            Date = DateTime.Now;
        }
示例#24
0
        public void FindBaseFolderForFilename(String path, out IFtpFolder folder, out String filename, VirtualFtpSession session)
        {
            if (path.IndexOf('/') != -1)
            {
                if (path.StartsWith("/"))
                {
                    folder = Root;
                    path   = path.Substring(1); /* remove / */
                }
                else
                {
                    folder = this;
                }

                Int32 lSeparatorIndex = path.IndexOf('/');
                while (lSeparatorIndex >= 0)
                {
                    String lFolderName = path.Substring(0, lSeparatorIndex);
                    folder = folder.GetSubFolder(lFolderName, session);

                    if (folder == null || !folder.AllowBrowse(session))
                    {
                        throw new FtpException(550, String.Format("Folder \"{0}\" does not exists, or access denied.", path));
                    }

                    path            = path.Substring(lSeparatorIndex + 1);
                    lSeparatorIndex = path.IndexOf('/');
                }
            }
            else
            {
                folder = this;
            }

            filename = path;
        }
示例#25
0
 public CatalogFile(IFtpFolder parent, String name, String root)
     :base(parent, name)
 {
     this.root = root;
 }
示例#26
0
 public SecureFile(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName)
 {
     fStorage       = aStorage;
     SecureFileName = fStorage.GetNewFilename();
     WorldRead      = true;
 }
示例#27
0
 protected FtpFolder(IFtpFolder aParent, string aName) : base(aParent, aName)
 {
   fSubFolderList = new Hashtable();
 }
示例#28
0
 protected FtpFile(IFtpFolder parent, String name)
     : base(parent, name)
 {
 }
示例#29
0
		public EmptyFile(IFtpFolder aParent, string aName) : base(aParent, aName)
		{
      UserRead = false;
      UserWrite = false;
      Complete = false;
    }
示例#30
0
 protected FtpFolder(IFtpFolder parent, String name)
     : base(parent, name)
 {
     this.fSubFolderList = new Hashtable();
 }
示例#31
0
 public VirtualFolder(IFtpFolder parent, String name)
     : this(parent, name, "system", "system", false)
 {
 }
示例#32
0
 public DiscFolder(IFtpFolder aParent, string aName, string aLocalPath) : base(aParent, aName)
 {
   fLocalPath = aLocalPath;
   WorldRead = true;
   WorldWrite = true;
 }
示例#33
0
 public CatalogFile(IFtpFolder parent, String name, String root)
     : base(parent, name)
 {
     this.root = root;
 }
示例#34
0
    protected FtpFile(IFtpFolder aParent, string aName) : base(aParent, aName)
		{
		}
示例#35
0
		protected FtpFile(IFtpFolder parent, String name)
			: base(parent, name)
		{
		}
示例#36
0
 public SecureFile(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName)
示例#37
0
 public VirtualFolder(IFtpFolder parent, String name)
     : this(parent, name, "system", "system", false)
 {
 }