{ 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) {
public DiscFolder(IFtpFolder parent, String name, String localPath) : base(parent, name) { this.fLocalPath = localPath; //this.WorldRead = true; //this.WorldWrite = true; }
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; }
public EmptyFile(IFtpFolder parent, String name) : base(parent, name) { this.UserRead = false; this.UserWrite = false; this.Complete = false; }
public VirtualFolder(IFtpFolder aParent, string aName) : this(aParent, aName, "system", "system", false) { fFileList = new Hashtable(); WorldRead = true; WorldWrite = false; Date = DateTime.Now; }
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()); } }
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"; }
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; }
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"; }
protected FtpItem(IFtpFolder aParent, string aName) { fParent = aParent; fName = aName; UserRead = true; UserWrite = true; GroupRead = true; OwningUser = "******"; OwningGroup = "system"; Date = DateTime.Now; }
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); }
protected FtpItem(IFtpFolder parent, String name) { fParent = parent; fName = name; UserRead = true; UserWrite = true; GroupRead = true; OwningUser = "******"; OwningGroup = "system"; Date = DateTime.Now; }
protected FtpItem(IFtpFolder parent, String name) { Parent = parent; Name = name; UserRead = true; UserWrite = true; GroupRead = true; OwningUser = "******"; OwningGroup = "system"; Date = DateTime.Now; }
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); }
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)); } }
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; }
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; }
public CatalogFile(IFtpFolder parent, String name, String root) :base(parent, name) { this.root = root; }
public SecureFile(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName) { fStorage = aStorage; SecureFileName = fStorage.GetNewFilename(); WorldRead = true; }
protected FtpFolder(IFtpFolder aParent, string aName) : base(aParent, aName) { fSubFolderList = new Hashtable(); }
protected FtpFile(IFtpFolder parent, String name) : base(parent, name) { }
public EmptyFile(IFtpFolder aParent, string aName) : base(aParent, aName) { UserRead = false; UserWrite = false; Complete = false; }
protected FtpFolder(IFtpFolder parent, String name) : base(parent, name) { this.fSubFolderList = new Hashtable(); }
public VirtualFolder(IFtpFolder parent, String name) : this(parent, name, "system", "system", false) { }
public DiscFolder(IFtpFolder aParent, string aName, string aLocalPath) : base(aParent, aName) { fLocalPath = aLocalPath; WorldRead = true; WorldWrite = true; }
public CatalogFile(IFtpFolder parent, String name, String root) : base(parent, name) { this.root = root; }
protected FtpFile(IFtpFolder aParent, string aName) : base(aParent, aName) { }
public SecureFile(IFtpFolder aParent, string aName, SecureStorage aStorage) : base(aParent, aName)