//------------------------------------------------------------------------------
// home ftp server
// (c) 2004-2008 ari pikivirta [ari.pikivirta@kolumbus.fi]
//------------------------------------------------------------------------------
// send email about bugs, features needed and features you would like;
// if you like this very much, feel free to donate and support supporting
// and developing these at www.paypal.com - (ari pikivirta@kolumbus.fi).
//------------------------------------------------------------------------------
//
// 21062008, r1.5.1.97, ari pikivirta
// * fixed checksum function even on bad clients that doesn't do " marks on file(s)
// * fixed bug on resizing window while clients active
//
// 21062008, r1.5.0.96, ari pikivirta
// * added unicode support for all names
// * fixed bug on list column widths (api_listbox was updated)
// * client editor shows virtual enables only if there's directories defined
// * client editor window remembers it's position
//
// 20062008, r1.4.8.95, ari pikivirta
// * fixed memory leaks caused by IdThreadPool (removed this component)
//
// 16062008, r1.4.7.94, ari pikivirta
// * internet updater updated
//
// 05062008, r1.4.7.93, ari pikivirta
// * added exception message if trying to change directory even not allowed
// * fixed bug on disconnecting client by clicking on disconnect button (remove from list)
// * all lists updated using begin and end update functions
// * readded freeing windows cache on entering no clients state
//
// 03062008, r1.4.6.92, ari pikivirta
// * fixed bug on virtual directory allows on editing clients change/make/delete directory
// checks were swapped
//
// 30052008, r1.4.6.91, ari pikivirta
// * invalid password delay changed from 1 seconds to 3 seconds
// * removed read timeout of 5 minutes from the connections -
// maby should be set to 3 hours or something?
// * requires PASV and PORT from same IP now
// * replaced written maximum integer value with high(integer) on statistics
//
// 01032008, r1.4.6.90, ari pikivirta
// * separated allows for the home directory and the virtual directories
// on ftp accounts
//
// 08022008, r1.4.5.89, ari pikivirta
// * updated indy10 component library to latest snapshot 07022008
//
// 27012008, r1.4.5.88, ari pikivirta
// * fixed bug in web interface showing home directory on view account
// * removed forcing of windows cache freeing on no clients connected (memory
// allocated is because it's needed anyway, letting os handle it)
//
// 04012008, r1.4.5.87, ari pikivirta
// * open ssl libraries updated (these supplied with might need to be replaced
// according to platform, tested on vista 32 and 64bit)
//
// 03012008, r1.4.5.86, ari pikivirta
// * removed passive ip address
// * fixed bug on setting passive port range
// * updater now showing progress as it was before upgrading to id10
//
// 29122007, r1.4.5.85, ari pikivirta
// * indy 10.2.3 snapshot 28122007
// * forced reuse of socket address to prevent (500 Could not bind so..)
//
// 06122007, r1.4.4.82, ari pikivirta
// * included working openssl libraries into the installation package
// * updated home page location to /products.html
//
// 30112007, r1.4.4, b81, ari pikivirta
// * not raising exception on directory listing even the directory does not exist
// * updated to indy 10.2.3
//
// 01112007, r1.4.4, b80, ari pikivirta
// * updated some components at the background
//
// 27072007, r1.4.3, b79, ari pikivirta
// * fixed another bug in disconnecting selected client
//
// 25072007, r1.4.3, b78, ari pikivirta
// * anonymous showing in log as red and always with name "Anonymous"
// * replaced critical sections with mrews in most places that will affect speed
// * selected list items are no longer forgotten on update
// * members modified on double click also
//
// 19072007, r1.4.3, b77, ari pikivirta
// * fixed critical security bug on logging in with only using the name
// directly from the browser (user@location)
//
// 11072007, r1.4.3, b76, ari pikivirta
// * put back connection and read timeouts of 1 minute
// * added set creation time, set modification time
// * re-added support for MLST
// * added communication log view (server<>client)
// * did some minor changes on authentication
// * added different color for the username in the visible log book
// * added possibility to disconnect individual clients
// * added possibility to ban selected clients from active clients windows
//
// 11042007, r1.4.2, b74, ari pikivirta
// * added/assigned compressor (zlib) for the ftp server
// * removed unnecessary events from the source, cleaning
//
// r1.4.2, b73, ari pikivirta
// * if accessing anonymous with some different username than anonymous
// we'll show "anonymous" as authenticated
// * force first tab visible on re-open account modify window
// * from this on installer allows to upgrade on installer execute
//
// r1.4.2, b71, ari pikivirta
// * fixed log texts of combining files
// * added more loggings out of the "important" log items
//
// 19032007, r1.4.2, b70, ari pikivirta
// * fixed bug on start on windows startup check (was connected to on program
// startup check)
//
// 16032007, r1.4.2, b69, ari pikivirta
// * minor changes in the account code (might be slightly faster on some operations)
// * removed unnecessary upload speed checking from combining files
// * separated some of the banner texts (only supported by some clients)
//
// 14032007, r1.4.2, b68, ari pikivirta
// * compiled with finished api_pack, previous release was with preliminary
//
// 14032007, r1.4.2, b67, ari pikivirta
// * added open ssl support (Implicit TLS, Explicit TLS and Require TLS)
// * fixed updating of account list when contents is changed
// * removed virtual directories from the accounts list on the main view
// * fixed hint text on the clear visible log button
// * added several log options to the ftp setting window
// * bug in saving of account last accesstimes fixed
// * re-added monired files list updating
//
// 08032007, r1.4.1, b66, ari pikivirta
// * added password generator into the account view
// * fixed bug on retrieve unexisting file (caused exeption on some clients)
// * start location of virtual directories set empty
// * added combine files
//
// 06032007, r1.4.1, b65, ari pikivirta
// * added port information to separate clients connecting from same ip
//
// 06032007, r1.4.1, b64, ari pikivirta
// * implemented statistics to transfer stream as internal (was as events before)
//
// 28022007, r1.4.0, b63, ari pikivirta
// (beta)
// * changed from indy9.0.50 to indy 10.1.6 on communication, rewrote again
// * supports now large files also (>2G, even >4G)
// * rechecked put/store file approvals
// * doesn't work using firefox ftp client anymore, firefox tries to get
// the file and doesn't recover from the fact that directory is not a file
// * re-added passive mode ranges and address
// * added possibility to hide the trayicon when minimized
// * separated log file max lines from visible log max lines
// * defaults set to maximum log lines count
// * added assigning file stream for the crc command
//
// 22022007, r1.3.12, b62, ari pikivirta
// (beta)
// * changed from ics v5 to indy 9.0.50
// * rewrote whole settings structure (file remains same for bwcompatibility)
// * rewrote whole ftp directory management to work with ie7 and other
// "bad" ftp clients
// * fixed bug in member account checking regarding new multithreading model
// * changed active users contents
// * added file transfers view to monitor progress
// * added some checking(s) before settings are applied
// * replaced api_memo with api_richedit on the log view (same than in web server)
// * free the cache memory when idle or stopped
// * ip banning changed to allow also value ranges to the number fields as 23-123
// * added possibility to limit anonymous up/down transfer speed, member
// accounts can be set individually
// * autoban list not updated if not specific type set, also not checked at all
// if autoban check is not checked
// * changed the way to prevent addresses banned on connect
// * added time left estimation to the transfers view
// * active client time online shown in more understandable units
//
// 18022007, r1.2.11, b61, ari pikivirta
// * removed "allow all actions" from the enable anonymous check's text
// * directory browsing now supports directory creation
// * anonymous folder no more shown to member accounts logged in
//
// 14122006, r1.2.10, b60, ari pikivirta
// * added rm/mk/cg dir to autoban feature(s)
// * no longer possible to succesfully go into unexisting directories
//
// 30112006, r1.2.9, b59, ari pikivirta
// * updated internet updating part to also be able to receive messages from
// the file server
// * added gradient into the bottom of sub windows (visual only)
// * added trayicon hint to show running state and amount of active clients
//
// 22112006, r1.1.8, b58, ari pikivirta
// * fixed spelling mistake in ftp server settings on general tab (cloise =))
//
// 21112006, r1.1.8, b57, ari pikivirta
// * implemented support for configurator tool (available for registered users)
//
// 05112006, r1.0.8, b56, ari pikivirta
// * as you all could have very well noticed the version info was messed up from now on..
// * added minimum height to the message view (server<>client) at the bottom of the log tab
// * fixed application exceptions caused by bugs in autoban module
//
// 01102006, r1.0.8, b50, ari pikivirta
// * added import/export settings function
//
// 28072006, r1.0.7, b49, ari pikivirta
// * compiled again because of some minor change in api_pack components,
// also seemed to help to problem showing buttons on some winxp
// * tray icon not showing while main application is showing
// * fixed bug on confirm close checkbox
//
// 17112005, r1.0.7, b48, ari pikivirta
// * fixed remove on windows startup registry function
//
// 20092005, r1.0.7, b47, ari pikivirta
// * hided web interface's passwords (font color = background color)
// * changed fonts to use gradien grbutton
// * stores now setting of headercontrol section widths
//
// 15092005, r1.0.7, b46, ari pikivirta
// * added possibility to disable close confirmation
// * added left gradient panel to all views
// * changed the log window detailed log view sizer to orange
// * fixed security problem with traversing virtual directories
//
// 15072005, r1.0.7, b45, ari pikivirta
// * fixed bug that clients were able to go into root of home drive, erronous
// tries will cause client to go into home directory
//
// 17042005, r1.0.7, b44, ari pikivirta
// * added application to restore position on close query
// * ftp server saves settings also on apply settings (in case of win crash)
// * ftp server saves user file after any modifications done
// * added inter application communication for command line member modifying
// * added possibility to change ftp server greeting message to client
//
// 03022005, r1.0.7, b43, ari pikivirta
// * added download/upload monitoring
// * improved autoban feature with unsuccesfull mkdir limit
//
// 02022005, r1.0.7, b42, ari pikivirta
// * fixed file monitoring auto collect function
// * added autoban feature to ban ip's automatically with some most
// needed options
// * added reason field for banning
//
// 01022005, r1.0.7, b41, ari pikivirta
// * added file control to be member specific also - feat request
// * improved file control to manage also renaming - feat request
// * added query for closing to prevent closing ftp server by accident
//
// 30012005, r1.0.6, b40, ari pikivirta
// * possibility to prevent uploading certain file types (extension) - feat request
// * exit, start and stop server functions into system tray pop-up - feat request
//
// 30012005, r1.0.6, b39, ari pikivirta
// * changed log settings to same window with other settings
// * small changes in layout (removed unnecessary components)
// * added automatically add file to file monitoring if enabled
// * added possibility to monitor client/server real discussions
//
// 28122004, r1.0.6, b38, ari pikivirta
// * fixed another list problem that came up while earlier changes (with
// virtual directories)
// * added possibility to alter ftp port
//
// 27122004, r1.0.6, b37, ari pikivirta
// * fixed the problem with listboxes (lines with spaces were splitted onto several
// lines)
//
// 03112004, r1.0.6, b36, ari pikivirta
// * rebuild just for fun (some component updates done)
//
// 23102004, r1.0.6, b35, ari pikivirta
// * added anonymous user properties to ftp server settings window
// * added virtual dirs for anonymous user
// * changed system log to have same look with web server
//
// 11092004, r1.0.5, b34, ari pikivirta
// * added serversoftware name into ftp settings for web interface
// * fixed spelling mistake in web interface login view
//
// 26082004, r1.0.5, b33, ari pikivirta
// * fixed button components to not to go scrambled
// * compiled with md5 hash support (ics)
// * user guide added into installation package
// * added saving of last windows position and size, also tab index
//
// 24082004, b32, ari pikivirta
// * removed read of registry entries that does not exist in 98SE or ME.
//
// 19082004, b31, ari pikivirta
// * fixed memory leak in logging messages (they were not decreased at any point!)
//
// 18082004, b30, ari pikivirta
// * fixed log from emptying after every program launch
//
// 17082004, b29, ari pikivirta
// * added possibility to enable/disable fading effect of the windows
//
// 16082004, b28, ari pikivirta
// * added max clients property in ftp settings
//
// 14082004, b27, ari pikivirta
// * fixed web interface problem viewing the first member
// * changed member and monitored file list save file format
// * fixed settings window virtual directories clean up when adding new member
//
// 13082004, r1.04, b27, ari pikivirta
// * fixed wrong user name displaying when deleting members
// * fixed building of directories and filepaths to work with virtual directories
// there was problems with "real" ftp clients - now tested with most
// * rechecked access checking when trying to go up dir below home dir
// * added last access time per member to member view
// * added virtual dirs visible in member view
// * fixed edit font colors when focused and editing
// * added banned addresses list and connection checking
// * added web interface competely
//
// 12082004, b26, ari pikivirta
// * updates some components
// * fixed allow check of remove directory
// * separated files monitoring from member/clint module
// * added virtual directories (per user)
// * added possibility to follow client activities in static mode view
// * added possibility to kick one or all clients
//
// 03082004, b25, ari pikivirta
// * added possibility to sort listed items
//
// 27072004, r1.03, b24, ari pikivirta
// * added compiler definitions to allow easy beta/real changing..
// * added special file reset button
// * fixed security holes in previus release version (allows)
// * released as real version without open ssl support, but with all other
// nice new features included
//
// 26072004, r1.02, b23, ari pikivirta
// * removed list directory logging
// * added file list permissions when listing directory
// * fixed directory parsing of current / home / selected directory
// * added member address information update on every connect
// * added member last address to be visible on member list tab
//
// 22072004, r1.02, b22, ari pikivirta
// * changed to using indy internet components
// * due to above, folders are refreshed without immediate buffering
// * added hints on visible objects
// * fixed ftp banner in ftp settings
// * added ssl / tls server (can run just one or both)
//
// 21072004, r1.01, b21, ari pikivirta
// * fixed downloaded and uploaded bytes counters
// * added log messages also show up in statusbar
//
// 14072004, b20, ari pikivirta
// * fized internet updating..
//
// 12072004, b19, ari pikivirta
// * added resizable header for column names for members
// * changed file creation time > now get through fileage function
// * added possibility to monitor selected files
// * added logging downloads/uploads to file
//
// 09072004, b18, ari pikivirta
// * added ftplock separately to the uusers unit (in case multithreaded)
// * fixed upload / download counters
// * fixed session counter (now counts only authenticated sessions)
// * fixed the member regognition on authenticate (was ismember(user, user) :=))
//
// 07072004, b17, ari pikivirta
// * added home serie logo
// * fixed anonymous access
// * added some statistics
//
// 06072004, b16, ari pikivirta
// * home server was split into four different server applications