From 7fa382617fbaccc0ce522b2b3adbbee9db5ad227 Mon Sep 17 00:00:00 2001 From: fextracker Date: Wed, 18 Feb 2015 16:48:45 +0100 Subject: [PATCH] Original release 20150120 2015-01-17: new fex.ph config variable $mail_authid (default yes) 2015-01-16: fixed bug no notfication for still existing file (overwrite) 2015-01-15: fixed bug no locale reminder notfication 2015-01-15: fixed bug wrong result for recipients with NOTIFICATION=no 2015-01-13: fexsend: added option -N resend notification email 2015-01-13: resending notification email deletes download ip restriction 2015-01-13: fup: fixed bug sending to groups broken 2015-01-10: fexsend: added option -S show server/user settings 2015-01-10: fup: added command LISTSETTINGS 2015-01-09: foc: added save-or-display (MIME) option for download 2015-01-04: fexsend: fixed bug dies too early on multiple files and one 2015-01-04: file has been already transfered 2014-12-25: fexget,fexsend,sexsend: use default SSL_cipher_list 2014-12-25: DEFAULT:!3DES:!MD5 2014-12-24: fexget,fexsend,sexsend: evaluate environment variables SSLVERIFY 2014-12-24: SSLVERSION SSLCAPATH SSLCAFILE SSLCIPHERLIST 2014-12-24: fexget,fexsend,sexsend: use TLS, not SSL 2014-12-23: fexsend: $HOME/.fex/config with $opt_* and %alias variables 2014-12-23: fexget: $HOME/.fex/config with $opt_* and %autoview variables 2014-12-19: fur: fixed bug race condition with fex_cleanup (external->internal) 2014-12-17: install/update: fixed bug some spool files are owned by user root 2014-12-16: fexsrv: fixed bug handling of User-Agent FDM 2014-12-09: added l ll lf to distribution 2014-12-09: fexwall: also mail to sub and group users 2014-12-03: fup: remove file after upload if restricted user has set NOMAIL 2014-12-03: fup: fixed bug wrong message "user notified" if NOMAIL 2014-12-02: fup: also check recipient restrictions on command CHECKRECIPIENT 2014-11-24: fexget: autoview gif jpg png tif after download 2014-11-20: count unfinished upload size into quota, too 2014-11-20: fixed bug wrong quota calculation on SysV UNIX like Solaris 2014-11-18: fexsend: added environment variables SSLVERIFY SSLCAPATH SSLCAFILE 2014-11-18: dop: added HTTP basic authentication for htdoc directory with 2014-11-18: .htauth file 2014-11-14: ignore @forbidden_recipients if $SPOOL/$USER exists 2014-11-14: (admin has created user) 2014-11-11: fup: fixed bug groups from other users in address book selection 2014-11-11: fup: added useragent to $SPOOL/$TO/$FROM/$FILE/ 2014-11-10: fup: present locales in recipient query form, too 2014-11-07: FAQ: added text anchor URLs 2014-11-03: added missing fexget fexsend sexget sexsend for tools.html 2014-10-23: fexsend: on multiple recipients check only the first for resume 2014-10-14: fac: added option -L (list files detailed) 2014-10-01: fex_cleanup: fixed bug wrong default spool for virtual hosts 2014-09-19: sex: added transfered bytes to sex.log 2014-09-17: fup: fixed bug no locales presentation 2014-09-14: fex_cleanup: send new release notification to $admin 2014-09-11: dop: exclude .* and *~ from stream files 2014-09-01: fup: upload status bar waits longer, until $timeout 2014-08-27: fex_cleanup: use wget for new release dedection 2014-08-18: fexsend: workaround for stunnel bug (options -s and -g) 2014-08-18: fex_cleanup,fexsend: always restrict permissions on fexsend id-file 2014-08-16: fac: added options -P and -E (more examples) 2014-08-15: install: fixed bug wrong owner in spool 2014-08-15: fex_cleanup: do not terminate on error, but print warning 2014-08-13: fexsrv,fexsend,fexget: reenabled IPv6 support 2014-08-10: fac: added option -/ to set new admin 2014-08-08: moved $admin_pw from fex.ph to auth-ID for user $admin 2014-08-08: fex_cleanup: fixed bug in notify_newrelease 2014-08-08: fac(CGI): switched from HTTP basic authorization to auth-ID/akey 2014-08-08: fexsend: always use CHECKRECIPIENT, not only for aliases 2014-08-07: dop: generate on-the-fly gzipped documents if requested 2014-08-06: fixed bug install script dysfunctional (permission, hostname) 2014-07-25: reenabled vhost support 2014-07-13: dop: in directory index, list only files which are readable by 2014-07-13: group or other 2014-07-10: fup: fixed bug wildcards not working in @forbidden_recipients 2014-06-25: fup,fop: sender can download the files he has sent, too, 2014-06-25: if he uses the same ip for upload and download 2014-06-19: fac(CGI): @admin_hosts is now mandatory in fex.ph 2014-06-12: fur: reallow registration of internal and external users from 2014-06-12: the same ip range 2014-06-05: new fex.ph config variable @forbidden_hosts 2014-06-03: fuc: fixed bug cannot edit and save groups 2014-05-26: fuc: ignore akey cookie to prevent cross-site request forgery 2014-05-26: fup,foc,fuc,rup,pup: better parameter filtering to prevent 2014-05-26: cross-site scripting attacks 2014-05-25: fup: fixed bug insecure dependency when forwarding a file 2014-05-25: to a user which has set a default keep value 2014-05-23: fexget: fixed bug download fails on big file and slow disk 2014-05-12: set Reply-To in notification emails for @remote_domains 2014-05-03: fup: fixed bug wrong (old) keep time on forword-copy (bounce) 2014-04-10: fexsend: added "exclude from archive" option -# 2014-03-28: fexsend: do not copy "NOMAIL" comment in forward 2014-03-28: fexget: fixed bug server timeout because of storage check 2014-03-07: new fex.ph config variable $disclaimer to be appended to every email 2014-03-05: added bin/fexwall and doc/newfeatures 2014-03-04: fuc,foc: added PGP/GPG email encryption option 2014-02-26: fex.pp: fixed bug $keep_default ignored 2014-02-13: fur,fex.ph: config variable @local_domains may contain wildcard * 2014-02-13: in domain names 2014-01-03: fexget: checks storage capacity before download 2013-11-26: dop: substitute $variable$ in HTML document only if there is a 2013-11-26: corresponding environment variable 2013-10-15: fac: fixed bug wrong output with option -l 2013-10-14: fexget: use archive name as default extraction directory 2013-10-09: fixed bug afex URL for only one download availably 2013-10-07: fup: fixed bug no download links on multiple NOMAIL recipients 2013-09-23: fexsend: fixed bug option -c sends uncompressed file 2013-09-19: sub and group users have the same quota amount like their main user 2013-09-18: fixed bug permission denied for locale htdocs 2013-09-18: anonymous user now with hostname domain instead of mail domain 2013-09-17: dop: set locale cookie, too 2013-09-15: foc: added "Change the disclaimer" option 2013-09-12: fup: expand domainless address with server hostname if such a user 2013-09-12: exists (needed for fbm/nettest) 2013-09-09: new FAQ design (questions first, then Q+A) 2013-09-04: fac: modify $hostname when vhost fex.ph is created 2013-09-04: fuc: recognize comment=NOMAIL 2013-08-26: fexsend: always show download URL if recipient is "." 2013-08-20: fup,fop: fixed bug no DELETE and RESUME for fexmail and anonymous 2013-08-20: users (because of storage swap) 2013-08-18: sexsend: fixed bug data corruption when using https 2013-08-18: fop,fup: fixed bug bad file locking when using multiple recipients 2013-08-18: fexsend: fixed bug hangs on server error when sending archive 2013-08-17: fixed bug $sender_from ignored 2013-08-17: fup,foc: added notification email resending on user request 2013-08-16: fac: fixed bug wrong output order for option -l 2013-08-14: fop: fixed bug no multiple downloads for fexmail 2013-08-14: fac: added option -M for resending notification emails 2013-08-09: afex: fixed bug ID for input 2013-08-06: fexsrv: always includes "Server: fexsrv" in HTTP reply 2013-08-06: fexsend: terminates if no fexsrv HTTP reply 2013-07-28: dop: added .htaccessfrom support 2013-07-27: fex.ph,dop: security enhancement: 2013-07-27: static documents must be in @doc_dirs 2013-07-27: dop: documents with leading . are not allowed 2013-07-25: fexsend: added option -= to upload a file with another name 2013-07-21: fixed bug environment variables are cut at newline 2013-07-18: fup,fexsend: use header Content-Location instead of Content-Type for 2013-07-18: file linking 2013-07-15: fup: modifying keep references actual time, not upload date 2013-07-15: fexsend: fixed bug no feedback on option -x -k (modify keep) 2013-07-13: fup: fixed bug user specific keep and autodelete defaults are ignored 2013-07-12: fup,fop: added file link support 2013-07-12: fexsend: added option -/ for file linking 2013-07-09: fexget: added option -P proxy:port 2013-06-28: new all-in-one FAQ 2013-06-27: fup: to/from storage swap for fexmail and anonymous users 2013-06-27: fup: anonymous recipient with random number 2013-06-26: fop: allow multiple downloads from same ip 2013-06-26: fup,fac: extended "fex yourself" support 2013-06-26: added sup.html 2013-06-22: fop,fexsend: Location output for fexmail for already transfered files 2013-06-19: fexget: fixed bug cannot download MIME file 2013-06-15: fex.ph: new config variable $notify_newrelease checks 2013-06-15: fex.rus.uni-stuttgart.de for new release and sends mail 2013-06-12: fac(CGI): fixed bug wrong spooldir for virtual server 2013-06-11: fex.ph: new config variable $usage_conditions for registrations mails 2013-06-11: fop: fixed bug fexmail download possible only once 2013-06-10: fac: added option -D to disable a user 2013-06-10: (with hooks in fop,fop.fuc,foc,fur) 2013-06-03: fuc: fixed bug user can modify his auth-ID to an illegal value 2013-05-30: install: force creation of $admin_pw 2013-05-30: fex_cleanup: fixed bug wrong fexadmin fexid for reactivation emails 2013-05-25: added afex and asex to distribution 2013-05-23: dop: fixed bug no output on file.stream 2013-05-22: install script installs as user fex (and not as root) 2013-05-19: security patch: config variable @local_rhosts restricts download of 2013-05-19: files from new external users to specific ip ranges 2013-05-19: use <from> and <to> syntax in notification email header 2013-05-19: added support for $max_fail_handler() 2013-05-18: fac: fixed bug option -rd does not work 2013-05-18: fac: added option -R 2013-05-16: fop: fexmail support (multiple downloads allowed) 2013-05-09: fup: fixed bug anonymous only works if $mdomain is defined 2013-05-09: fop: fixed bug anonymous only works if recipient host is in 2013-05-09: @anonymous_upload list 2013-05-07: fup: fixed bug multiple Location HTTP headers generate an error with 2013-05-07: some web browsers 2013-05-03: added support for axel download accelerator (multiple HTTP Range) 2013-05-02: add X-FEX-File-ID header to notification emails 2013-04-23: dop: fixed bug HTTP 301 redirection timeout on symlinks 2013-04-05: fexsend: fixed bug server timeout when sending huge ZIPs 2013-02-20: fac: added -m maintenance mode 2013-02-17: fup: fixed bug stored comment in spool not in UTF8 2013-02-17: fop: fixed bug file deletion also deletes fop.log 2013-02-16: fur,fex.ph: allow "*" for local domains self registration 2013-02-16: fex.ph: new config variable @registration_hosts 2013-02-16: fex.ph: new config variable @admin_hosts 2013-02-11: fur: fixed bug insecure dependency with exuser 2013-01-31: receiving of reminder emails is user configurable 2013-01-24: fup: decode UTF8 comment 2013-01-07: added X-Frame-Options header to prevent clickjacking 2012-12-26: fup,fexsend: added replyto option 2012-12-21: dop: download manager prevention: 2012-12-21: no concurrent downloads from same client with HTTP Range 2012-12-17: fop: fixed bug ip based download restriction 2012-12-16: added name based virtual host server 2012-12-15: fexsrv: HTTP error logging to error.log 2012-12-07: fex.ph: added optional config variable @durl 2012-12-04: new feature forward a file from incoming spool 2012-11-21: fac: show more user information 2012-11-20: added CAPTIVE user mode 2012-11-19: fup: with comment NOSTORE file will not be stored ==> benchmarking 2012-11-14: fexsend: fixed bug gkey and skey URL recipients not working 2012-11-12: fexsend: 7z archives without compression 2012-11-08: fop: fixed bug cannot use "?" in file name with fexsend 2012-11-07: fixed security bug restricted user can redirect files 2012-11-06: fup: show download-URL after upload if sender = recipient 2012-11-06: fup,fop,fac: added user up/download IP restriction by admin 2012-11-05: added HTTP Strict Transport Security if $force_https is enabled 2012-11-05: fixed bug afex accessible via xkey from everywhere 2012-11-02: fup: fixed bug one time upload URL gives "no recipient specified" 2012-11-02: error 2012-11-01: fup: fixed bug public upload always gives error 2012-10-16: fop,fup: added afex support 2012-10-16: fup: accept recipients . and // 2012-10-15: sex,sexsend: added anonymous mode (no auth-ID necessary) 2012-10-14: fop,fup: added support for fexsend anonymous mode 2012-10-11: fex.ph: added optional config variable $overwrite 2012-10-10: fup: anonymous upload with non-anonymous recipient 2012-09-30: fup: fixed bug groups not working any more (NOMAIL) 2012-09-19: fup: logout functions respects login CGI (or symlink) 2012-09-19: foc: detailed/brief notification mail configuration 2012-09-18: fexsend: added options -. and -n 2012-09-18: fup: added shortmail option in comment 2012-09-17: added mailmode configuration option in fex.ph 2012-09-17: fup: shows download-URL if NOMAIL 2012-09-15: sex: public URL parameter may be in base64 format, too 2012-09-10: dop: added more security checks 2012-09-01: dop: added streaming document output 2012-08-30: sex: fixed bug second receiving client corrupts the stream 2012-08-26: Changed licence from AGPL to Perl Artistic 2012-08-21: schwuppdiwupp: error handling on network failures for Windows 2012-08-21: schwuppdiwupp: removed Tk::FileSelect for Windows 2012-07-11: fop: fixed bug no multiple downloads for anonymous uploads 2012-07-10: fixed French, Spanish and Czech localization (code syntax) bugs 2012-07-09: fup: anonymous upload with modifyable keep option and multiple 2012-07-09: downloads 2012-07-05: fexsrv: added camel easteregg 2012-07-02: fup: added optional anonymous upload with fex.ph variable 2012-07-02: @anonymous_upload 2012-07-02: fup: fixed bug throttle 0 configuration is ignored 2012-07-01: fexsend: optional argument '@' as files/recipients separator 2012-07-01: fexsend: fixed bug notification email for recipient '.' 2012-06-21: dop: inside HTML documents: #include "file" 2012-06-06: fexget: new option -+ 2012-06-05: fexsend: new option -+ 2012-06-01: fup: show transfered size instead of total size in status window 2012-05-04: fexsrv: added bunny easteregg 2012-05-02: fexsrv: allow HTTP 1.0 with Range header (wget!) 2012-05-02: fexsrv: disallow negative value in Range (client signed int bug) 2012-04-26: Changed licence from GPL to AGPL 2012-04-07: foc: check new address book for syntax errors 2012-04-06: foc: added comment field for new subuser information 2012-04-04: removed F*IX because of too many bugs and no maintainer any more 2012-03-05: fup: fixed bug shell wildcards in recipient address are expanded to 2012-03-05: known users from spool 2012-03-05: fex.ph: added optional config variable @locales 2012-03-01: dop: delivers MIME type text/plain if "?!" is appended to URL 2012-02-20: foc: show auth-ID after click on link 2012-02-07: fop: MIME-type text/html is no longer possible for security reasons 2012-02-04: added optional french localization 2012-02-03: fixed bug 0.0.0.0 not recognized as ip address 2012-02-02: HTTP parameter filtering to prevent cross-site scripting attacks 2012-02-01: config variable @throttle may also contains ip addresses 2012-01-25: pup: locale selection in native language, default autodelete=no 2012-01-25: fup: "send another file" with same keep and autodelete parameters 2012-01-17: fixed bug reactivation.txt in czech instead english 2012-01-06: fup: fixed bug show wrong remaining keep days 2012-01-02: fup.pl: fixed bug bad FAQ link 2011-12-31: fex_cleanup: fixed bug notification emails not localized 2011-12-30: fup: additional dkey.log 2011-12-05: fup: respect @throttle config for all clients 2011-11-29: dop: delivers text files (scripts!) without x-bit as "text/plain" 2011-11-15: fup: fixed bug with $autodelete = $NUMBER; 2011-11-08: fac: added option -S statistics 2011-11-02: fup: show remaining keep time in files listing 2011-10-28: fup: fixed bug uninitialized value when using copy-forward 2011-10-13: fup: FILESIZE hack for firefox 7 to support uploads > 4 GB 2011-10-05: fup: fixed bug wrong sender quota calculation 2011-10-03: fex.ph: added configuration variables @upload_hosts @download_hosts 2011-09-30: fexsend: added option -g for sending encrypted files 2011-09-21: fexsrv: use $default_locale if client sends illegal locale cookie 2011-09-20: fex.ph: added optional config variable $boring for unhumorous mode 2011-09-19: fur: $USER/.auto contains additional info about account creation 2011-09-07: fac(CGI): fixed bug infinitve loop in watch logfile 2011-09-06: fup,fac,fur: new additional login URL type: 2011-09-06: http://FEXSERVER/fup/B64ID 2011-09-06: fup: show "or select from address book" only if there are entries 2011-09-05: fexsrv: fixed bug locale cookie not fetched on http://cgi?parameter 2011-09-01: rup: fixed bug cannot find files (no more SID in akeys directory) 2011-08-30: fex.ph: new config variable @forbidden_recipients 2011-08-29: fexsend: accept file number for delete option -d, too 2011-08-29: dop: fixed bug no text document output if external file command is 2011-08-29: non-GNU 2011-08-26: added one time upload OKEY 2011-08-13: fex_cleanup: fixed bug comment missing in reminder email 2011-08-11: dop: #if ... #else ... #elseif ... #endif inside HTML documents 2011-08-11: dop: show HTML sourcecode if "!" is appended to URL 2011-08-10: fex_cleanup: delete obsolete users, too, via fex.ph $account_expire 2011-08-10: new FAQ design (with Javascript/CSS) 2011-08-09: fup: show error on invalid SKEY or GKEY 2011-08-09: fuc: fixed bug subuser and groupuser not lowercase forced 2011-08-09: address book may also contain option locale=<languange> 2011-08-08: fex_cleanup: auto-expire user accounts with fex.ph variable 2011-08-08: $account_expire 2011-08-08: fexsend,fup: allow forward with locale 2011-08-08: dop: extra security check: files from lib and spool are not allowed 2011-08-07: fup: subusers and groupusers can also select a locale 2011-08-07: fup: if user selects a locale login, save it as default locale 2011-08-07: (does not affect fexsend and schwuppdiwupp) 2011-08-07: notification emails come in default locale 2011-08-03: fexsend: fixed bug uninitialized value when using chunked mode 2011-08-03: fexsend: added undocumented option -F female mode 2011-07-31: fexsend: added option -s streaming data 2011-07-31: fup: accept streaming data 2011-07-30: fexsend: -a tar archives no longer use a intermediate transferfile, 2011-07-30: but send via pipe (streaming) 2011-07-30: fexsend: fixed bug no resume on -a archives 2011-07-30: fexsend: always ask server if file already has been uploaded 2011-07-30: fup: more information on F*EX clients download and configuration 2011-07-27: fup: if comment contains "!bcc!" then sender will get a bcc 2011-07-27: of notification email 2011-07-26: fexget: added option -X do not extract archive file 2011-07-26: fexget: added option -a get all files 2011-07-26: fexsrv: fixed bug uninitialized value when using a reverse proxy 2011-07-26: fex_cleanup: fixed bug notify reminder email not localized 2011-07-22: fac(CGI): fixed bug displaying < and & in logfiles 2011-07-22: fac(CGI): added getting error.log 2011-07-22: fop: allow multiple downloads from any client if sender = recipient 2011-07-16: added doc/reverse_proxy 2011-07-14: added optional czech localization 2011-07-01: FAQ.html reformated 2011-06-30: translate install job 20 times faster 2011-06-27: added robots.txt to disallow web robots indexing 2011-06-22: fup: disable HTML code in file listing (filename & comment) 2011-06-21: added optional italian localization 2011-06-17: fixed bug $bcc is ignored 2011-06-16: fexsend,fexget: better reverse proxy support 2011-06-16: (always send Host header) 2011-06-16: added optional galician localization 2011-06-15: fup: fixed bug always keep_default days in notification email 2011-06-14: fexsend: transparent proxy detection (and support) 2011-06-14: fixed bug $docdir ignored 2011-06-10: fex.ph: new config variable $bcc for notification emails 2011-06-09: set Reply-To in all notification emails 2011-06-09: fup: fixed security bug everyone can upload files with empty auth-ID 2011-06-05: fup: fixed bug insecure dependency in printf on "forward file" 2011-06-03: fup,fop: added throttle bandwith limit option (fex.ph) 2011-06-02: fup: added bandwith limit option 2011-06-01: added PID and request-number to the logs 2011-06-01: fex_cleanup: fixed bug no expire with AUTODELETE=NO 2011-05-31: support for FEXLIB /usr/local/share/fex/lib /usr/share/fex/lib 2011-05-30: fup,fexsend: added option -x to modify file parameters 2011-05-29: fup,fexsend: forward files with new comment and keep time 2011-05-29: rup: add mdomain to addresses without domain 2011-05-18: fup: fixed bug restricted users can forward files to anybody 2011-05-17: fixed bug access problems with AKEYs: now use SID instead of SIP 2011-05-11: added helper script mksgkeys (regenerates missing SKEYs and GKEYs) 2011-05-10: fex_cleanup: cleanup ADDRESS_BOOK file upload 2011-05-10: fex.ph,fex_cleanup: AUTODELETE=NUMBER ==> 2011-05-10: delete file on next NUMBER day after download 2011-05-09: fac,fup: added user specific autodelete default 2011-05-09: fac,fex_cleanup: added user specific keep default 2011-04-27: fexsend: fixed bug archiv.zip not working on Windows 2011-04-27: dop: added index function for htdoc directory with .htindex file 2011-04-25: fexsend: better proxy support (non-persistent connections) 2011-04-24: xx: better ESXi support (heuristic guessing of tar format) 2011-04-22: sexsend: base64 support for $FEXID and $FEXXX 2011-04-01: fexsend: continue without SID if SID is not available 2011-03-26: fexsrv: deactivate header_hook (inquisition) if request is a 2011-03-26: regular fop request 2011-03-18: fexsend: base64 support for $FEXID and $FEXXX 2011-03-09: fexget,fexsend: fixed bug no file listing for https 2011-03-04: removed "use Switch" because of warnings with perl 5.12 2011-02-28: sexsend: added option -g show transfer rate 2011-02-24: dop: evaluate <<perl-code>> inside html documents 2011-02-21: fexsend,fup: added option fexsend -U show authorized (login) URL 2011-02-18: do not modify download URL protocol if $dkey is set in fex.ph 2011-02-18: fac(CGI): fixed bug uninitialized value $server 2011-02-18: URLs in notification emails are derived from config variable $durl 2011-02-17: fup: fixed bug access denied with SKEY 2011-02-08: fup,fop,fuc: fixed bug access problems with sip in AKEYs 2011-02-08: fup: fixed bug no notification email for multiple recipients 2011-02-07: fexsend,fop: do not send same file (filename and mtime) twice 2011-02-06: fup: fixed bug no notification email after first failed upload 2011-01-31: schwuppdiwupp: added ISO-8859-1 support 2011-01-30: schwuppdiwupp: added running camel 2011-01-28: schwuppdiwupp: added chunksize to proxy options 2011-01-28: schwuppdiwupp: fixed bug timeout when using address book 2011-01-28: fexsend: fixed bug chunksize 0 2011-01-27: schwuppdiwupp: added advanced preferences Proxy and TMPDIR 2011-01-26: fex_cleanup: fixed bug uninitialized value in debuglog 2011-01-26: fex_cleanup: added option -v 2011-01-26: fexsend,fexget,sexsend: added option -V show version 2011-01-26: schwuppdiwupp: added drag&drop support for windows 2011-01-26: schwuppdiwupp: added 7zG support 2011-01-25: fuc: fixed bug cannot delete all subusers 2011-01-25: schwuppdiwupp: fixed bug 7-zip not found 2011-01-25: schwuppdiwupp: added drive letters in directory selection 2011-01-24: fop: IE bug workaround to store *.exe files 2011-01-18: schwuppdiwupp: added tar, zip and 7z container 2011-01-17: fexsend: fixed bug option -l not working with https URL 2011-01-16: fup: added 7zip hint in notification emails 2011-01-13: schwuppdiwupp: fixed bug no transfer at all when comment is set 2011-01-12: rup: added logging 2011-01-12: rup: wrong recipient cannot download file, but will get an error 2011-01-12: fac(CGI): fixed bug $server not declared 2011-01-07: fexget: keep file permission in overwrite mode 2011-01-04: fex_cleanup: fixed bug autodelete after partial download 2010-12-26: fex_cleanup: fixed bug too early expire for forwarded files 2010-12-10: new config variable @public_recipients for new CGI pup 2010-12-10: (public upload) - upload without auth-ID 2010-12-09: fex.ph,fur: new config variable @local_rdomain for self- 2010-12-09: registration of restricted external-to-internal users 2010-12-08: fup,foc: no access to foc for restricted users 2010-12-02: fup: if there is a cgi-bin/login it will be called on "logout" 2010-11-24: fex.ph: new config variable $default_locale 2010-11-24: dop: auto-expires every document (to prevent browser caching) 2010-11-16: fexsrv: better error handling if CGI is not executable 2010-11-09: new SKEYs and GKEYs, because old ones could be not unique 2010-11-09: access for subuser only with SKEY 2010-11-09: access for groupuser only with GKEY 2010-11-07: fup,fuc: added GKEY 2010-11-07: fexsend: SKEY or GKEY URLs can be recipients, too 2010-11-04: fexget: added (hidden) option -K 2010-11-03: fexsend: fixed bug proxy usage failed 2010-11-02: fop: fixed bug corrupted download with Internet Explorer 2010-10-25: fop,fup: better locking: no uploading is possible while a 2010-10-25: download is in progress for the same file 2010-10-24: fix,fop: fixed bug subuser not working (SKEY problem) 2010-10-24: xx: added locking 2010-10-23: xx,fop: added xx :slot option (multiple storage slots) 2010-10-20: fup,fop,fexsend: fexsend for subuser with SKEY 2010-10-19: fup: expires *KEY cookies on logout 2010-10-12: fup: fixed bug wrong interpretation of SKEY parameter+cookie 2010-10-05: fexend,fup: support of http reverse proxy 2010-09-27: fup: fixed bug missing Content-Type in upload status report 2010-09-20: fexsrv: IPv6 http support 2010-09-15: fac(CGI): fixed bug cannot delete and (re)create user 2010-09-15: fac(CGI): fixed bug cannot create user who was a recipient 2010-09-12: fexsend,fop: fixed bug resuming upload does not work with alias 2010-09-12: fup: fixed bug resuming upload handles autodelete and keep 2010-09-12: parameters incorrectly 2010-09-07: fac(CGI): fixed bug not working if there is no user at all 2010-09-05: fop: extra parameter keep=days 2010-08-31: install: fixed bug wrong ownership for spool files 2010-08-25: perl 5.8 required 2010-08-25: fexget: -s can write to named pipe or character special file 2010-08-21: fop: $limited_download checks dkey cookie instead of client IP 2009-08-20: removed mma 2010-08-18: fex_cleanup: fixed bug not expiring 2010-08-17: fac: fixed bug accept users without domain 2010-08-17: install: fixed bug empty $admin_pw 2010-08-15: fex.ph: optional fix address $sender_from (instead of F*EX user) in 2010-08-15: notification email From 2010-08-14: added optional spanish localization 2010-08-12: fup: speedup 90% 2010-08-12: fop: speedup 20% 2010-08-12: fop: better fexget compatibility 2010-08-12: (close connection after file delivery) 2010-08-11: fop: fixed IE download bug (missing header separating line) 2010-08-11: fop: fixed 1 min delay bug on AUTODELETE=YES 2010-08-08: sex: support for compressed streams 2010-08-08: sex,sexsend: removed unneccesary text mode (option -t) 2010-08-08: sex,sexsend: speedup factor 5 2010-08-08: added sexxx 2010-08-06: sex: fixed various bugs in client and server 2010-08-06: fac(CGI): fixed bug AKEY not working 2010-08-03: xx: no user inquiry for postprocessing if output is a pipe 2010-08-02: added optional german localization 2010-07-31: separated subusers in extra file $SPOOL/$USER/@SUBUSER 2010-07-25: fop: log also aborted downloads 2010-07-23: added fac CGI 2010-07-18: fexsrv,fup,fexsend: extra XKEY download with short // URL 2010-07-18: fexsend: fixed bug CHECKRECIPIENT not working 2010-07-16: added cookie support (for AKEY and SKEY) 2010-07-16: fup: fixed bug showstatus window too small for close button 2010-07-13: schwuppdiwupp: added CHECKRECIPIENT 2010-07-12: fop,xx: allow several concurrent downloads of STDFEX 2010-07-10: fop: workaround for stupid IE download bug 2010-07-03: fex.ph,fex.pp: new config variable @remote_domains 2010-07-01: fexsrv,fex.ph: new config variable $force_https 2010-06-29: fop: new config variable $limited_download with default NO 2010-06-29: => allow multiple downloads through proxy farm (varying IPs) 2010-06-29: fop: note every successful download in spool file "download" 2010-06-25: fexget: fixed bug download status info update too often 2010-06-23: fur: better sendmail clone compatibility: 2010-06-23: use space instead of comma as address separator 2010-06-19: fexget: new option -o overwrite mode 2010-06-19: fexget: use ./$file.tmp for downloading instead of $HOME/.fex/tmp/ 2010-06-16: schwuppdiwupp: edit and select address book entries 2010-06-15: rup: fixed bug case sensitive recipient address 2010-06-12: fop: send X-File-ID on HEAD request, too 2010-06-12: fexget: added support of X-File-ID 2010-06-11: schwuppdiwupp: (chunked) multi-POST for proxy with 4 GB limit 2010-06-11: schwuppdiwupp: X-File-ID support 2010-06-08: fup,fexsend: (chunked) multi-POST for proxy with 4 GB limit 2010-06-06: fup,fop,fexsend: protocol extension X-File-ID (contains mtime 2010-06-06: of file) is the successor of X-Size for more 2010-06-06: reliable resume function 2010-06-02: schwuppdiwupp: added proxy support 2010-05-31: fexsend: fixed bug windows path elements in filename 2010-05-30: better server proxy support: 2010-05-30: AKEY and SKEY no longer rely on client ip 2010-05-29: fexsend: added proxy support 2010-05-28: fur: allow registration confirmation more than once 2010-05-27: fexsend: added option -b bounce (copy-forward) 2010-05-26: fup,foc: added copy-forward feature 2010-05-20: fexsend: fixed bug uninitialized value with option -@ 2010-05-20: fur: fixed bug $main::admin not declared 2010-05-17: fexsend: added option -H for hints 2010-05-17: fexsend: added option -A for edit server address book 2010-05-16: fexsend: added HTTPS proxy support 2010-05-16: fup: fixed bug uninitialized value (line 1059) 2010-05-13: fup: fixed bug ignored KEEP and AUTODELETE options for groups 2010-05-12: fup: fixed bug ignored autodelete option from ADDRESSBOOK 2010-04-30: fup: fixed bug uninitialized value with CHECKRECIPIENT 2010-04-30: fexsend: no SID for https 2010-04-28: fup: fixed bug case sensitiv group addresses 2010-04-27: fexsend: fixed bug ignored server address book options 2010-04-27: fexsend: displays recipients and options before starting post 2010-04-27: fup: fixed bug ignored server address book autodelete option 2010-04-26: fexsrv: log all HTTP headers (no more ignore list) 2010-04-25: fexsrv: accept HTTP header with continuation lines 2010-04-22: fex.pp: added htdocs/header.html support 2010-04-22: fex.ph: added variable @H1_extra organization link and logo 2010-04-20: fexsrv,fexsend: HTTP header X-Timeout (info server->client) 2010-04-20: fexsrv: logging with locking 2010-04-19: fexsend: removed broken option -A and replaced it with more 2010-04-19: flexible feature "." for recipient address 2010-04-19: fexsend: fixed bug dies if sender is subuser (ADDRESS_BOOK error) 2010-04-19: fup: fixed bug no COMMENT in notification email 2010-04-19: dop: fixed bug error output with non GNU file command 2010-04-17: fexsend,fexget: added option -i for alternative accounts or servers 2010-04-12: fexsend: new verbose output format --> <-- 2010-04-11: fexsend: added option -Q quota query 2010-04-09: fup,fac: added quota support 2010-03-25: fup: fixed bug "Insecure dependency" when using AKEY parameter 2010-03-25: (eg: sending a second file) 2010-03-25: fup_template.html: fixed bug upload status window always shows 2010-03-25: "ERROR: no file data received" 2010-03-24: fexsend: fixed bug dies if there is no server address book 2010-03-22: FIX.jar: fixed bug interpret HTTP response "200 OK" as error. 2010-03-20: fup,fop: set mtime on user directory for last successfull access 2010-03-19: fexsend: fixed bug abort on short address if there is no server 2010-03-19: address book 2010-03-19: fex_cleanup: better cleanup for dkeys directory 2010-03-18: fup: fixed bug cannot DELETE with group recipient 2010-03-17: fup: fixed bug wrong success message on aborted uploads 2010-03-17: fop: fixed bug cannot handle @group names 2010-03-16: fup,fuc: fixed bug mixed case in F*EX group names and addresses 2010-03-14: fex.pp: do not send notification emails on empty files 2010-03-12: fup,fop: fixed bug case sensitiv FROM and TO addresses 2010-03-05: fup: fixed bug aliases are not accepted with fop_auth 2010-03-04: fexsrv: use CGI login if it exists as start-page 2010-02-26: fexsend: first check server address book, then mutt aliases 2010-02-26: fop: do not terminate session after ADDRESSBOOK request 2010-02-18: fexget: fixed bug always append existing file, ask for overwriting 2010-02-08: fexsrv: fixed bug uninitialized value in substitution (line 229) 2010-02-08: fex.pp: better qmail compatibility (space separated addresses) 2010-02-07: fac: fixed bug uninitialized $EDITOR environment variable 2009-12-28: fup,fop,fexsend: protocol extension X-Size for more reliable 2009-12-28: resume function (checks size of file) 2009-12-09: FIX.jar: can send more than one file (in zip archive) 2009-12-04: fex_cleanup: fixed bug send unnecessary reminder on AUTODELETE=NO 2009-11-26: fexsend,fexget,fup: added -z option for logfile inquiry 2009-11-13: fup,fuc: keep and autodelete options in server address book 2009-11-12: fexsrv: support for HTTP/1.0 persistant connections (for proxys) 2009-11-12: PID:SID in fexsrv.log CONNECT string (debugging help) 2009-11-06: added error.log 2009-11-03: fex_cleanup: also cleanup $SPOOL/.reg directory 2009-10-23: fup: added X-FEX-Filesize header in notification email 2009-10-18: fup: also test if $FROM is a valid email address 2009-10-11: fex_cleanup: fixed bug no cleanup at all on AUTODELETE=NO 2009-09-25: fex.pp: added X-Mailer in sent mails to please stupid spamfilter at 2009-09-25: hotmail or gmail 2009-09-02: fur,fex.pp: fixed bug not removing quote chars in qqq strings 2009-08-28: rup: fixed bug UTF-8 file names 2009-08-25: FIX.jar: accepts parameters TO, AKEY and SKEY (for subusers) 2009-08-24: fex_cleanup: fixed bug warning unitialized variable 2009-08-17: fex_cleanup: fixed bug typo mitime --> mtime 2009-08-12: fup: fixed bug "send another file" for subusers 2009-08-10: fexsend: fixed bug timeout on big archives 2009-07-27: to and from addresses in spool are now always localpart@domain, 2009-07-27: install contains automatic spool converter 2009-07-27: fup: fixed bug short aliases address list mismatch 2009-07-24: fup,fex_cleanup: fixed bug delete all files for multiple 2009-07-24: recipients after any download 2009-07-24: fexget: fixed bug delete local file before download 2009-07-20: fup: added autodelete and keep hack for HTML form 2009-07-18: fup: fixed bug leading . in file directory name 2009-07-18: fup: added CHECKRECIPIENT support 2009-07-18: fup: code cleanup, new 3-stage user interface 2009-07-18: fexsend: added CHECKRECIPIENT feature 2009-07-17: fexget: fixed bug wrong UTF8 handling 2009-07-16: fop: fixed bug sending wrong file size if TO or FROM has 2009-07-16: uppercase chars ==> resuming upload did not work 2009-07-11: fup: can select more than one address from address book 2009-07-08: fup,fex.pp: fixed bug wrong download URLs 2009-07-07: new spool directory layout $TO/$FROM/urlencode($FILENAME) 2009-07-07: fup: be more restrictive in accepting (illegal) parameters values 2009-07-07: fup,fuc: subuser access key name is now SKEY (KEY is depreciated) 2009-07-07: rup: new HTML layout, fixed bug in file select box 2009-07-06: fup: substitute all control characters in file name and comment 2009-07-06: with "_" 2009-07-02: better install script, guesses IP 2009-06-29: changed spool directory layout 2009-06-29: $TO/$FROM/$FILE --> $TO/$FROM/md5h($FILENAME) 2009-06-29: to avoid filename collisions 2009-06-28: added mailman authorization mma 2009-06-28: better address-book integration in fup 2009-06-26: FIX.jar: fixed several bugs, now working with Windows Vista, too 2009-06-25: added fup_template.html as an example for customizing upload page 2009-06-22: fup,fexsend,fexget: LIST also shows COMMENT 2009-06-10: default timeout 10 s --> 30 s 2009-06-01: fexsend: show transfer status on STDERR (also for xx) 2009-05-31: fexsend,fexget: show transfer rate (kB/s) 2009-05-29: fexsend: auto-reconnect after SIGPIPE (link failure, etc) 2009-05-26: fexsrv: ignore HTML anchors in GET requests (from stupid msnbot) 2009-05-17: fup: check if there is enough free space in spool 2009-04-07: new perl based install; requires server IP for xinetd binding 2009-03-25: fexget: fixed bug saving failed if on other partition then FEXHOME 2009-03-25: fexget: fixed bug calculated wrong transfer rate 2009-03-25: fexget: changed default answers to more secure values 2009-03-24: fexsend: new option -l for listing sent files 2009-03-24: fup: support for listing sent files 2009-03-24: fex.pp: default charset is now UTF-8 in HTTP reply 2009-03-16: fur: fixed bug no lower case transformation for user and domain 2009-03-05: fop: fixed bug no parallel download possible on multiple recipients 2009-03-03: dop: send Last-Modified HTTP header (java needs it) 2009-02-27: fuc: send information emails to sub-users by click-on-address 2009-02-22: fop: fixed bug download failed without FROM parameter 2009-02-20: test for /usr/lib/sendmail and /usr/sbin/sendmail 2009-02-18: fop: fixed bug file size query for alias recipient 2009-02-18: fexget: added option -a to get address-book from server 2009-02-17: fup,fuc: better linking 2009-02-14: fup: first send notification emails, then send HTTP 200 OK to client 2009-02-14: fup: accept ADDRESS_BOOK as upload 2009-02-13: fup,foc,fuc: added ADDRESS_BOOK support 2009-02-13: added fix and FIX.jar (Java applet client) 2009-02-11: fop: fixed bug file size request with multiple $to gives always 0 2009-02-11: (no upload resume possible with multiple recipients) 2009-02-11: fop: check for valid recipient address (in file path) 2009-02-11: ==> early abort possible when client uses illegal address for 2009-02-11: upload (resume-HEAD-request) 2009-02-10: fur: catch errors from sendmail(clone) and save them to $log 2009-02-09: fexsrv: fixed bug wrong log sequence in debug files 2009-02-04: fup: fixed bug cannot delete files by web interface 2009-02-03: fexsrv: fixed bug wrong download URL by HTTP_HOST from client request 2009-01-31: fexsrv: fixed bug handling of missing trailing / in doc requests 2009-01-30: rup: fixed bug wrong download URL in notification email 2009-01-26: fexsend: archive format 7z and zip with default compression 2009-01-26: fup,fuc,foc,rup: link to F*EX start page in top header 2009-01-21: fuc: URL for subusers with KEY parameter 2009-01-21: fup.fuc,foc: fixed bug wrong AKEY lookup 2009-01-20: fexsrv: better handling of URLs with trailing / (==> index.html) 2009-01-20: fop: fixed bug endless loop with fop_auth mode 2009-01-13: fup,fop: support for MIME-file types 2009-01-13: fexsend: added option -M for MIME-file to be displayed in webbrowser 2009-01-13: on download 2009-01-04: fup: increase minimum timeout to 10 s 2008-12-26: fup: do not allow re-upload (overwrite) if file is in download 2008-12-26: process 2008-12-23: sexsend,sexget: added HTTPS/SSL support 2008-12-21: fup: fixed bug removing old autodelete and error files failed 2008-12-20: added logwatch 2008-12-18: fexget: fixed bug responsiveness on slow links 2008-12-18: fexget: fixed bug save file name for archives 2008-12-12: fexget: better responsiveness on slow links (modem, ISDN) 2008-12-12: fup: added warning for incompatible clients (konqueror, etc) 2008-12-11: fexsend: allow comments in ID file 2008-12-03: fup,fex.pp: fixed bug UTF-8 subject in notfication email 2008-12-02: fexsend: better responsiveness on slow links (modem, ISDN) 2008-12-02: fexget: save original filename (parse HTTP header) 2008-11-28: fexserv: added special FlashGet (download sucker) brake 2008-11-27: added htdocs/version and htdocs/tools.html 2008-11-27: added fexsend, fexget, sexsend, sexget to htdocs/download 2008-11-27: dop: fixed bug symlink of symlink leads to hangup 2008-11-27: fop: teergrub download managers and other suckers 2008-11-26: fop: with URL parameter ?KEEP file can be downloaded more than once 2008-11-26: fexget: added option -k for keep on server 2008-11-24: fex_cleanup: fixed bug $autodelete not defined 2008-11-24: fexget: added HTTPS/SSL support 2008-11-22: fexsrv: reject requests with IP hostnames in HTTP Host header 2008-11-21: fex.ph,fop: $autodelete="DELAY" allows file download many times 2008-11-21: (but only from same IP and until next fex_cleanup run) 2008-11-21: fup,fop: fixed bug options keep and delete autodelay do not 2008-11-21: work with spool on NFS 2008-11-20: fexsend: added HTTPS/SSL support 2008-11-20: fex.ph: added config variable $autodelete 2008-11-20: fup: fixed bug subuser cannot send files 2008-11-19: use md5-hash of $from:$id instead of URL parameters FROM=$from&ID=$id 2008-11-19: fac: set correct exit status 2008-11-16: fup: fixed bug DELETE not working 2008-11-16: install: do not overwrite lib/fup.pl (perhaps contains site config) 2008-11-15: fex_cleanup: clean up $SPOOL/.ukeys/, too 2008-11-14: fup: show "user config" link only after authorization 2008-11-13: foc,fuc,fup: quick sub-user creation with auto-notification. 2008-11-10: fexget: fixed bug query <> instead of <STDIN> 2008-10-29: fup: do not require HTTP authorization if request already 2008-10-29: contains ID (methode used by xx) 2008-10-28: fex.pp: fixed bug $warning not defined 2008-10-28: fup: fixed bug do not allow subuser in fop_auth mode 2008-10-27: install: do not overwrite existing htdoc/index.html 2008-10-27: fup: fixed bug resend (SEEK) leads to HTTP error 666 2008-10-26: fexsrv: accept HTTP request with absolute URLs (http://...), too 2008-10-23: fexsrv: fixed bug continue connect logfile entry 2008-10-17: fexsrv: fixed bug keep_alive with HTTP/1.0 2008-10-17: fexsrv: fixed bug wrong warning in debug mode with empty line 2008-10-07: fexsrv: moved TIMEOUT message to debug.log 2008-10-06: dop: fixed bug opening file (did not deliver any file!) 2008-10-06: dop: implemented HTTP keep-alive (delivering more than one 2008-10-06: document per session) 2008-10-04: if config variable $fop_auth is set, download requires 2008-10-04: authentication and upload is restricted to registered users 2008-10-02: dop: declare exectuable scripts as application/octet-stream 2008-10-02: fup: added link to Windows client schwuppdiwupp.exe 2008-09-29: write upload speed to upload directory 2008-09-17: fac: fixed bug locating FEXLIB 2008-09-12: fup: added config lib/fup.pl 2008-09-05: fexsend: added rudimentary windows support 2008-09-03: dop: redirect on relative non-parent symlinks 2008-08-31: added fur (F*EX User (auto-) Registration) 2008-08-25: will die when no hostname is available 2008-08-21: added fexsend to htdocs/download 2008-08-21: fup: added ID mail sendback option 2008-08-20: fac: added -l option 2008-08-19: fexsrv: fixed bug SSL handling 2008-08-15: fup,fuc,fexsrv: dynamic protocol detection (HTTP/HTTPS) 2008-08-14: fup: fixed bug login possible with wrong login data (but no upload) 2008-08-13: fup: showstatus terminates immediately when empty file was uploaded 2008-08-13: fup: showstatus shows error message on illegal recipient address 2008-08-13: or when no file was uploaded 2008-08-13: (nececessary for stupid Internet Explorer!) 2008-08-11: splitted debugfiles with time stamp in filename 2008-08-11: fex_cleanup: clean up aborted uploads, .ukeys/ and .debug/, too 2008-08-11: fexsend,fexget: allow more than one file (with all options) 2008-08-08: fup: eliminate superfluous newlines in logfile on error handling 2008-08-08: changed bareword filehandles to indirect filehandles 2008-08-06: fup: decode %NUMBERs in file names from POST 2008-08-02: fexsend: bug fix -A option and argument handling 2008-08-01: fup: regular users can change the recipient in the upload form, 2008-08-01: sub users can not 2008-07-31: fup: fixed bug internet explorer not showing upload status window 2008-07-31: fup: fixed bug with id / special id / real id mixup 2008-07-31: fuc: nearly complete rewrite, better user interface 2008-07-30: fup: fixed bug when account is a symlink 2008-07-30: fup: fixed bug in authentication of subusers 2008-07-03: fop: workaround for Internet Explorer download bug 2008-07-02: fup,fop: switched default charset from ISO-8859-1 to UTF-8 2008-07-02: fup: uid for showstatus synchronization 2008-06-21: fexget: downloading without wget, file number as argument 2008-06-20: fexget,fop: added DELETE option 2008-06-20: fexsend: send more files in one run 2008-05-30: added missing sex to distribution 2008-05-30: fexsend: added -A archiv to yourself option 2008-05-28: fup: fixed bug in LIST and DELETE commands 2008-05-27: fexsrv: correct HTTP redirect on missing trailing / in URL 2008-05-26: sex,sexsend: better public mode 2008-05-24: sex,sexsend: added text mode option 2008-05-23: added missing foc and rup to distribution 2008-05-20: fexsend: fixed bug in list parsing (-l option) 2008-05-15: fexsrv,dop: fixed bug in HTTP keep_alive multi-requests 2008-05-02: fexsrv,dop: support for HTTP keep_alive multi-requests 2008-05-02: fexsrv: more robust header parsing (ignore superfluous spaces) 2008-04-28: added support for HTTP keep_alive 2008-04-20: added foc and rup 2008-04-20: or is expired; error message is kept 3*keep_default days 2008-04-19: install: do not overwrite old fex.ph, but create fex.ph_new instead 2008-04-18: fup: fixed bug filename with path in notification email 2008-04-16: fexsrv,fop,dop: implemented HTTP HEAD 2008-04-14: renamed cgilaunch to fexsrv 2008-04-14: fup: do not send notify-mail if file already exists (overwrite mode) 2008-04-14: fup: do not accept file if authentication fails 2008-04-14: fup,fop,fexsend: new secure download URL scheme with random dkey 2008-04-11: fup: fixed bug in upload bar with 8-bit file names 2008-04-11: fex_cleanup: fixed bug not removing aborted uploads 2008-04-10: added F*EX camel logo 2008-04-09: added dop (generic document output) 2008-04-08: renamed confusing ID to auth-ID (request by chris@citecs.de) 2008-04-08: fuc: fixed bug with more than 1 sub-user 2008-04-07: fup: readded keep parameter (code got lost sometime?) 2008-04-06: fup: use Net::DNS instead of external host command 2008-04-02: install: better error handling (patch by chris@citecs.de) 2008-04-02: more docs and improved logging 2008-04-01: cgilaunch: fixed bug in determing REMOTE_HOST when using stunnel 2008-04-01: sex,sexsend: added public mode 2008-03-31: changed project name to F*EX because of name collision with 2008-03-28: xx: changed syntax, now compatible to zz 2008-03-27: fup: fixed bug in mail address verification 2008-03-24: fup,fexsend: show transfer rate in kB if filesize < 2 MB 2008-03-24: fex.pp: umask 077 2008-03-23: fup: fixed bug in using multiple recipients 2008-03-22: first public release 2008-03-22: 2006-11-?? 2008-03-22: first code --- README | 35 + bin/afex | 180 ++ bin/asex | 1 + bin/ezz | 56 + bin/fac | 915 ++++++++ bin/fbm | 469 ++++ bin/fex_cleanup | 587 +++++ bin/fexget | 1074 +++++++++ bin/fexsend | 3055 ++++++++++++++++++++++++++ bin/fexsrv | 821 +++++++ bin/fexwall | 124 ++ bin/l | 597 +++++ bin/lf | 1 + bin/ll | 1 + bin/logwatch | 211 ++ bin/mksgkeys | 64 + bin/sexget | 1 + bin/sexsend | 723 ++++++ bin/sexxx | 1 + bin/xx | 1 + bin/zz | 55 + cgi-bin/fac | 902 ++++++++ cgi-bin/foc | 243 ++ cgi-bin/fop | 1087 +++++++++ cgi-bin/fuc | 1222 +++++++++++ cgi-bin/fup | 3038 +++++++++++++++++++++++++ cgi-bin/fur | 416 ++++ cgi-bin/pup | 198 ++ cgi-bin/rup | 250 +++ cgi-bin/sex | 236 ++ doc/Changes | 805 +++++++ doc/Contribs | 62 + doc/IPv6 | 17 + doc/Licence | 120 + doc/SEX | 119 + doc/SSL | 61 + doc/concept | 697 ++++++ doc/debugging | 16 + doc/fex-client_1.pdf | Bin 0 -> 9406 bytes doc/fex-client_2.pdf | Bin 0 -> 12289 bytes doc/installation | 92 + doc/new | 7 + doc/newfeatures | 47 + doc/reverse_proxy | 32 + doc/version | 1 + doc/xx | 99 + etc/mime.types | 36 + etc/xinetd_fex | 20 + htdocs/FAQ/FAQ.html | 1 + htdocs/FAQ/admin.faq | 156 ++ htdocs/FAQ/admin.html | 12 + htdocs/FAQ/all.html | 12 + htdocs/FAQ/faq.pl | 142 ++ htdocs/FAQ/index.html | 1 + htdocs/FAQ/local.faq | 7 + htdocs/FAQ/local.html | 12 + htdocs/FAQ/meta.faq | 83 + htdocs/FAQ/meta.html | 12 + htdocs/FAQ/misc.faq | 17 + htdocs/FAQ/misc.html | 12 + htdocs/FAQ/user.faq | 136 ++ htdocs/FAQ/user.html | 12 + htdocs/Licence | 120 + htdocs/SEX.html | 64 + htdocs/action-fex-camel.gif | Bin 0 -> 33666 bytes htdocs/download/fexget | 1074 +++++++++ htdocs/download/fexsend | 3055 ++++++++++++++++++++++++++ htdocs/download/sex.stream | 1 + htdocs/download/sexget | 1 + htdocs/download/sexsend | 723 ++++++ htdocs/dynamic.html | 35 + htdocs/favicon.ico | 0 htdocs/features.html | 69 + htdocs/fup_template.html | 52 + htdocs/index.html | 140 ++ htdocs/logo.jpg | Bin 0 -> 14240 bytes htdocs/robots.txt | 2 + htdocs/small_logo.jpg | Bin 0 -> 5104 bytes htdocs/sup.html | 61 + htdocs/tools.html | 40 + htdocs/version | 1 + install | 514 +++++ lib/dop | 614 ++++++ lib/fex.ph | 156 ++ lib/fex.pp | 1449 ++++++++++++ lib/fup.pl | 40 + lib/reactivation.txt | 1 + locale/czech/htdocs/index.html | 139 ++ locale/czech/lang.html | 1 + locale/czech/lib/fup.pl | 35 + locale/czech/lib/reactivation.txt | 1 + locale/debian_translate | 132 ++ locale/french/htdocs/FAQ/FAQ.html | 12 + locale/french/htdocs/FAQ/admin.faq | 47 + locale/french/htdocs/FAQ/admin.html | 12 + locale/french/htdocs/FAQ/all.html | 12 + locale/french/htdocs/FAQ/faq.pl | 119 + locale/french/htdocs/FAQ/index.html | 1 + locale/french/htdocs/FAQ/local.faq | 7 + locale/french/htdocs/FAQ/local.html | 12 + locale/french/htdocs/FAQ/meta.faq | 48 + locale/french/htdocs/FAQ/meta.html | 12 + locale/french/htdocs/FAQ/misc.faq | 12 + locale/french/htdocs/FAQ/misc.html | 12 + locale/french/htdocs/FAQ/user.faq | 60 + locale/french/htdocs/FAQ/user.html | 12 + locale/french/htdocs/index.html | 131 ++ locale/french/lang.html | 1 + locale/french/lib/fup.pl | 32 + locale/french/lib/reactivation.txt | 1 + locale/galician/htdocs/FAQ.html | 264 +++ locale/galician/htdocs/index.html | 133 ++ locale/galician/lang.html | 1 + locale/galician/lib/fup.pl | 35 + locale/galician/lib/reactivation.txt | 1 + locale/german/htdocs/FAQ.html | 260 +++ locale/german/htdocs/index.html | 135 ++ locale/german/lang.html | 1 + locale/german/lib/fup.pl | 46 + locale/german/lib/reactivation.txt | 1 + locale/italian/htdocs/FAQ.html | 297 +++ locale/italian/htdocs/index.html | 128 ++ locale/italian/lang.html | 1 + locale/italian/lib/fup.pl | 35 + locale/italian/lib/reactivation.txt | 1 + locale/spanish/htdocs/FAQ.html | 254 +++ locale/spanish/htdocs/index.html | 136 ++ locale/spanish/lang.html | 1 + locale/spanish/lib/fup.pl | 35 + locale/spanish/lib/reactivation.txt | 1 + locale/translate | 205 ++ locale/translations | 2852 ++++++++++++++++++++++++ upgrade | 1 + 133 files changed, 33297 insertions(+) create mode 100644 README create mode 100755 bin/afex create mode 120000 bin/asex create mode 100755 bin/ezz create mode 100755 bin/fac create mode 100755 bin/fbm create mode 100755 bin/fex_cleanup create mode 100755 bin/fexget create mode 100755 bin/fexsend create mode 100755 bin/fexsrv create mode 100755 bin/fexwall create mode 100755 bin/l create mode 120000 bin/lf create mode 120000 bin/ll create mode 100755 bin/logwatch create mode 100755 bin/mksgkeys create mode 120000 bin/sexget create mode 100755 bin/sexsend create mode 120000 bin/sexxx create mode 120000 bin/xx create mode 100755 bin/zz create mode 100755 cgi-bin/fac create mode 100755 cgi-bin/foc create mode 100755 cgi-bin/fop create mode 100755 cgi-bin/fuc create mode 100755 cgi-bin/fup create mode 100755 cgi-bin/fur create mode 100755 cgi-bin/pup create mode 100755 cgi-bin/rup create mode 100755 cgi-bin/sex create mode 100644 doc/Changes create mode 100644 doc/Contribs create mode 100644 doc/IPv6 create mode 100644 doc/Licence create mode 100644 doc/SEX create mode 100644 doc/SSL create mode 100644 doc/concept create mode 100644 doc/debugging create mode 100644 doc/fex-client_1.pdf create mode 100644 doc/fex-client_2.pdf create mode 100644 doc/installation create mode 100644 doc/new create mode 100644 doc/newfeatures create mode 100644 doc/reverse_proxy create mode 100644 doc/version create mode 100644 doc/xx create mode 100644 etc/mime.types create mode 100644 etc/xinetd_fex create mode 120000 htdocs/FAQ/FAQ.html create mode 100644 htdocs/FAQ/admin.faq create mode 100644 htdocs/FAQ/admin.html create mode 100644 htdocs/FAQ/all.html create mode 100644 htdocs/FAQ/faq.pl create mode 120000 htdocs/FAQ/index.html create mode 100644 htdocs/FAQ/local.faq create mode 100644 htdocs/FAQ/local.html create mode 100644 htdocs/FAQ/meta.faq create mode 100644 htdocs/FAQ/meta.html create mode 100644 htdocs/FAQ/misc.faq create mode 100644 htdocs/FAQ/misc.html create mode 100644 htdocs/FAQ/user.faq create mode 100644 htdocs/FAQ/user.html create mode 100644 htdocs/Licence create mode 100644 htdocs/SEX.html create mode 100644 htdocs/action-fex-camel.gif create mode 100755 htdocs/download/fexget create mode 100755 htdocs/download/fexsend create mode 120000 htdocs/download/sex.stream create mode 120000 htdocs/download/sexget create mode 100755 htdocs/download/sexsend create mode 100644 htdocs/dynamic.html create mode 100644 htdocs/favicon.ico create mode 100644 htdocs/features.html create mode 100644 htdocs/fup_template.html create mode 100644 htdocs/index.html create mode 100644 htdocs/logo.jpg create mode 100644 htdocs/robots.txt create mode 100644 htdocs/small_logo.jpg create mode 100644 htdocs/sup.html create mode 100644 htdocs/tools.html create mode 100644 htdocs/version create mode 100755 install create mode 100755 lib/dop create mode 100644 lib/fex.ph create mode 100644 lib/fex.pp create mode 100644 lib/fup.pl create mode 100644 lib/reactivation.txt create mode 100644 locale/czech/htdocs/index.html create mode 100644 locale/czech/lang.html create mode 100644 locale/czech/lib/fup.pl create mode 100644 locale/czech/lib/reactivation.txt create mode 100755 locale/debian_translate create mode 100644 locale/french/htdocs/FAQ/FAQ.html create mode 100644 locale/french/htdocs/FAQ/admin.faq create mode 100644 locale/french/htdocs/FAQ/admin.html create mode 100644 locale/french/htdocs/FAQ/all.html create mode 100644 locale/french/htdocs/FAQ/faq.pl create mode 120000 locale/french/htdocs/FAQ/index.html create mode 100644 locale/french/htdocs/FAQ/local.faq create mode 100644 locale/french/htdocs/FAQ/local.html create mode 100644 locale/french/htdocs/FAQ/meta.faq create mode 100644 locale/french/htdocs/FAQ/meta.html create mode 100644 locale/french/htdocs/FAQ/misc.faq create mode 100644 locale/french/htdocs/FAQ/misc.html create mode 100644 locale/french/htdocs/FAQ/user.faq create mode 100644 locale/french/htdocs/FAQ/user.html create mode 100644 locale/french/htdocs/index.html create mode 100644 locale/french/lang.html create mode 100644 locale/french/lib/fup.pl create mode 100644 locale/french/lib/reactivation.txt create mode 100644 locale/galician/htdocs/FAQ.html create mode 100644 locale/galician/htdocs/index.html create mode 100644 locale/galician/lang.html create mode 100644 locale/galician/lib/fup.pl create mode 100644 locale/galician/lib/reactivation.txt create mode 100644 locale/german/htdocs/FAQ.html create mode 100644 locale/german/htdocs/index.html create mode 100644 locale/german/lang.html create mode 100644 locale/german/lib/fup.pl create mode 100644 locale/german/lib/reactivation.txt create mode 100644 locale/italian/htdocs/FAQ.html create mode 100644 locale/italian/htdocs/index.html create mode 100644 locale/italian/lang.html create mode 100644 locale/italian/lib/fup.pl create mode 100644 locale/italian/lib/reactivation.txt create mode 100644 locale/spanish/htdocs/FAQ.html create mode 100644 locale/spanish/htdocs/index.html create mode 100644 locale/spanish/lang.html create mode 100644 locale/spanish/lib/fup.pl create mode 100644 locale/spanish/lib/reactivation.txt create mode 100755 locale/translate create mode 100644 locale/translations create mode 120000 upgrade diff --git a/README b/README new file mode 100644 index 0000000..d866cd3 --- /dev/null +++ b/README @@ -0,0 +1,35 @@ +F*EX (File EXchange) is a service to send big (large, huge, giant, ...) files +from sender user A to recipient user B by HTTP. + +Sender and recipient user must have an e-mail-address and a web-browser, +that is all (for them). + +The sender uploads the file to the F*EX-server and the recipient +automatically gets a notification e-mail with a download-URL. + +The sender must have a valid auth-ID, given by the F*EX administrator. + +This F*EX distribution contains the F*EX server and the optional client +programs fexsend, fexget, sexsend, sexget, xx and zz which run on UNIX. + +Simply run "./install", which installs all files into /home/fex/ +Then edit /home/fex/lib/fex.ph and set your local config. + +Afterwards you can add F*EX users with /home/fex/bin/fac + +If you want to upgrade from a previous F*EX version, you also can run +"./install" which is save, because it will not overwrite: + /home/fex/lib/fex.ph + /home/fex/lib/fup.pl + /home/fex/lib/reactivation.txt + /home/fex/htdocs/index.html +but will create *_new versions of these files which you then can copy manually +if you want. + +See directory doc for more information. + +If you have comments, suggestions, requests, etc, send me an e-mail: +framstag@rus.uni-stuttgart.de + +Or fex some nice, funny, interesting videos (eg cute pets) to this address :-) + diff --git a/bin/afex b/bin/afex new file mode 100755 index 0000000..f9b1a0c --- /dev/null +++ b/bin/afex @@ -0,0 +1,180 @@ +#!/usr/bin/perl -w + +# client for anonymous FEX or SEX +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +$fexserver = ''; + +$0 =~ s:.*/::;; + +$u = $ENV{AFEX} || $fexserver || &guessserver; +$u = "http://$u" if $u !~ /^http/; + +if (@ARGV and $ARGV[0] eq '-h' or not @ARGV and -t STDIN) { &usage } + +$opt_v = (@ARGV and $ARGV[0] eq '-v') ? shift @ARGV : ''; + +if ($0 eq 'asex') { + $a = "$u/anonymous"; + if (-t STDIN and @ARGV and "@ARGV" =~ /^(\d+)( -)?$/) { + $id = $1; + if ($2) { + vexec("sexget $opt_v $a $id | tar xvf -"); + } else { + vexec(ws("sexget $opt_v $a $id")); + } + } else { + if (@ARGV and $ARGV[0] =~ /^\d+$/) { + $id = shift @ARGV; + } else { + $id = sprintf("%06d",rand(1000000)); + } + print "# commands for SEX recipient:\n"; + if (@ARGV) { + print "wget -qO- $u/sex?anonymous=$id | tar xvf -\n"; + print "asex $id -\n"; + print "# streaming files and waiting for SEX recipient:\n"; + vexec("tar cvf - @ARGV | sexsend -q $opt_v $a $id"); + } else { + print "wget -qO- $u/sex?anonymous=$id\n"; + print "asex $id\n"; + vexec(ws("sexsend -q $opt_v $a $id")); + } + } + exit; +} + +if ($0 eq 'afex') { + + if ("@ARGV" =~ /^-(\d+)$/) { + $n = $1; + $cmd = "wget -qO/dev/null $u/fop/anonymous/anonymous/afex_$n.tar?DELETE"; + vsystem(ws($cmd)); + print "not " if $?; + print "deleted\n"; + exit; + } + + # download + if (-t STDIN and "@ARGV" =~ /^(\d+)( -)?$/) { + $id = $1; + $nq = $2; + $u .= "/fop/anonymous/anonymous/afex_$id.tar"; + if ($nq) { + vexec("fexget $opt_v -s- $u | tar xvf -"); + } else { + $aft = "/tmp/afex_$id.tar"; + $cmd = "fexget $opt_v -s- $u >$aft"; + vsystem($cmd); + if (`file $aft` =~ /tar archive/) { + print "Files in archive:\n"; + $cmd = "tar tvf $aft"; + vsystem(ws($cmd)); + print "extract these files (Y/n)? "; + if ((||'y') =~ /^[Yy\n]/) { + $cmd = "tar xvf $aft"; + vsystem(ws($cmd)); + unlink $aft; + } else { + print "keeping $aft\n"; + } + } else { + open $aft,$aft or die "$0: cannot open $aft = $!\n"; + unlink $aft; + print while read($aft,$_,65536); + } + } + exit; + } + + # upload + else { + if (@ARGV and $ARGV[0] =~ /^\d+$/) { + $id = shift @ARGV; + } else { + $id = sprintf("%06d",rand(1000000)); + } + $aft = "afex_$id.tar"; + my $durl ="$u/fop/anonymous/anonymous/$aft??ID=ANONYMOUS"; + if (`wget -S --spider $durl 2>&1` =~ /X-Location:/) { + die "$0: afex $id already exists - choose another ID\n"; + } + @fexsend = ws("fexsend $opt_v -o -K -k 1"); + if (@ARGV) { + vsystem(@fexsend,'-a',$aft,@ARGV,"$u/anonymous"); + exit $? if $?; + } elsif (not -t STDIN) { + $aft = "/tmp/$aft"; + open $aft,'>',$aft or die "$0: cannot write $aft - $!\n"; + print {$aft} $_ while read(STDIN,$_,65536); + close $aft; + $s = vsystem(@fexsend,$aft,"$u/anonymous"); + unlink $aft; + exit $s if $s; + } else { + die "say captain, say WHOT?!"; + } + print "For download use:\n"; + print "$u//$aft\n" if -t STDIN; + print "afex $id\n"; + } + exit; +} + +&usage; + +sub guessserver { + my $fexserver = ''; + my $rc = '/etc/resolv.conf'; + local $_; + + open $rc,$rc or die "$0: cannot open $rc - $!\n"; + while (<$rc>) { + if (/^\s*domain\s+([\w.-]+)/) { + $fexserver = "http://fex.$1"; + last; + } + if (/^\s*search\s+([\w.-]+)/) { + $fexserver = "http://fex.$1"; + } + } + close $rc; + return $fexserver; +} + +sub ws { + local $_ = shift; + return split; +} + +sub vexec { + warn "@_\n" if $opt_v; + exec @_; +} + +sub vsystem { + warn "@_\n" if $opt_v; + system @_; +} + +sub usage { + if ($0 eq 'afex') { + print "file input usage: $0 [ID] files...\n"; + print "file output usage: $0 ID [-]\n"; + print "pipe input usage: ... | $0 [ID]\n"; + print "pipe output usage: $0 ID | ...\n"; + print "delete usage: $0 -ID\n"; + exit; + } + if ($0 eq 'asex') { + print "file input usage: $0 [ID] files...\n"; + print "file output usage: $0 ID -\n"; + print "pipe input usage: ... | $0 [ID]\n"; + print "pipe output usage: $0 ID | ...\n"; + exit; + } + die "program name must be a afex or asex, not $0\n"; +} diff --git a/bin/asex b/bin/asex new file mode 120000 index 0000000..0bb73f5 --- /dev/null +++ b/bin/asex @@ -0,0 +1 @@ +afex \ No newline at end of file diff --git a/bin/ezz b/bin/ezz new file mode 100755 index 0000000..c15ece3 --- /dev/null +++ b/bin/ezz @@ -0,0 +1,56 @@ +#!/bin/sh + +ZZ=${ZZ:-$HOME/.zz} + +usage() { + exec cat<>$ZZ + else + cat >$ZZ + fi +fi + +test -z "$1" && exec ${EDITOR:-vi} $ZZ + +case "X$*" in + X-h) usage;; + X-r) exec mv $ZZ~ $ZZ;; +esac + +OUT="$1" +test "X$OUT" = X- && shift +test -z "$1" && exec cat $ZZ +mv $ZZ $ZZ~ +case `type "$1" 2>&1` in + *not\ found) perl -pe "$@" <$ZZ~>$ZZ || mv $ZZ~ $ZZ;; + *) "$@" <$ZZ~>$ZZ || mv $ZZ~ $ZZ;; +esac +test "X$OUT" = X- && exec cat $ZZ diff --git a/bin/fac b/bin/fac new file mode 100755 index 0000000..0946704 --- /dev/null +++ b/bin/fac @@ -0,0 +1,915 @@ +#!/usr/bin/perl -w + +# CLI admin client for the FEX service +# +# Author: Ulli Horlacher +# + +use 5.006; +use Getopt::Std; +use File::Basename; +use Cwd 'abs_path'; +use Digest::MD5 'md5_hex'; + +use constant M => 1024*1024; +use constant DS => 60*60*24; + +# do not run as CGI! +exit if $ENV{SCRIPT_NAME}; + +unless ($FEXLIB = $ENV{FEXLIB}) { + if ($ENV{FEXHOME}) { + $FEXLIB = $ENV{FEXHOME}.'/lib'; + } elsif (-f '/usr/share/fex/lib/fex.ph') { + $FEXLIB = '/usr/share/fex/lib'; + } else { + $FEXLIB = dirname(dirname(abs_path($0))).'/lib'; + } + $ENV{FEXLIB} = $FEXLIB; +} +die "$0: no FEXLIB\n" unless -f "$FEXLIB/fex.pp"; + +# become effective user fex +unless ($<) { + if (my @pw = getpwnam('fex')) { + $) = $pw[3]; + $> = $pw[2]; + $ENV{HOME} = $pw[7]; + } else { + die "$0: no such user 'fex'\n"; + } +} + +umask 077; + +# import from fex.pp +our ($FEXHOME,$FHS,$hostname,$spooldir,$logdir,$akeydir,$docdir); +our ($durl,@durl,$mdomain,$admin,$mailmode); +our ($autodelete,$keep_default,$keep_max,$recipient_quota,$sender_quota); +our (@local_rdomains); +local $notification = 'full'; + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +die "$0: \$admin not configured in $FEXLIB/fex.ph\n" unless $admin; + +$EDITOR = $ENV{EDITOR} || $ENV{VISUAL} || + (-x '/usr/bin/editor' ? '/usr/bin/editor' : 'vi'); + +$opt_c = $opt_v = $opt_l = $opt_L = $opt_h = $opt_w = $opt_u = $opt_R = 0; +$opt_M = $opt_E = 0; +$opt_r = $opt_d = $opt_q = $opt_a = $opt_n = $opt_k = $opt_m = ''; +$opt_y = $opt_S = $opt_C = $opt_D = $opt_A = $opt_V = $opt_P = ''; +${'opt_/'} = ''; + +@__ = @ARGV; +while (my $a = shift @__) { + if ($a eq '-V') { + shift @__; + } else { + push @_ARGV,$a; + } +} + +chdir $spooldir or die "$0: no $spooldir\n"; + +@stat = stat $spooldir or die "$0: cannot access $spooldir - $!\n"; +warn "WARNING: $spooldir with owner=root !?\n" unless $stat[4]; +if (abs_path($spooldir) ne abs_path("$FEXHOME/spool")) { + warn "WARNING: \$spooldir differs from $FEXHOME/spool !\n"; +} + +getopts('hcvlLwuMRE/q:r:d:a:n:k:m:y:S:C:A:V:D:P:') or usage(2); +usage(0) if $opt_h; +examples() if $opt_E; + +if (${'opt_/'}) { + my $admin = shift; + my $id = shift or die "usage: $0 -/ admin-email-address auth-ID\n"; + if ($admin !~ /.\@[\w.-]+\.[a-z]+$/) { + die "$0: $admin is not an email address\n"; + } + mkdir $admin; + my $aa = "$spooldir/$admin/@"; + open $aa,'>',$aa or die "$0: cannot write $aa - $!\n"; + print {$aa} $id,"\n"; + close $aa or die "$0: cannot write $aa - $!\n"; + my $fph = "$FEXLIB/fex.ph"; + $_ = slurp($fph) or die "$0: cannot read $fph\n"; + s/^\s*\$admin\s*=.*/\$admin = '$admin';/m or + $_ = "\$admin = '$admin';\n".$_; + open $fph,">$fph.new" or die "$0: cannot write $fph.new\n"; + print {$fph} $_; + close $fph; + rename "$fph.new",$fph or die "$0: cannot rename $fph.new to $fph\n"; + my $fid = "$ENV{HOME}/.fex/id"; + mkdir dirname($fid); + rename $fid,$fid.'_save'; + open $fid,'>',$fid or die "$0: cannot create $fid - $!\n"; + if ($durl =~ m{(https?://.+?)/}) { + print {$fid} "$1\n"; + } else { + print {$fid} "$hostname\n"; + } + print {$fid} "$admin\n"; + print {$fid} "$id\n"; + close $fid; + print "new admin account: $admin\n"; + exit; +} + +&check_admin; + +if ($opt_V) { + while (my ($hh,$vh) = each (%vhost)) { + if ($opt_V eq basename($vh) or $opt_V eq $hh) { + $ENV{HTTP_HOST} = $hh; + $ENV{VHOST} = "$hh:$vh"; + $ENV{FEXLIB} = "$vh/lib"; + die "$0: no $ENV{FEXLIB}/fex.ph\n" unless -f "$ENV{FEXLIB}/fex.ph"; + exec $0,@_ARGV; + die "$0: cannot re-exec\n"; + } + } + die "$0: no virtual host $opt_V defined\n"; +} + +$fup = $durl; +$fup =~ s:/[^/]+$:/fup:; + +# maintenance mode +if ($opt_m) { + if ($opt_m eq 'exit') { + if (unlink '@MAINTENANCE') { + warn "$0: leaving maintenance mode\n"; + } else { + warn "$0: no maintenance mode\n"; + } + } else { + unlink '@MAINTENANCE'; + symlink $opt_m,'@MAINTENANCE' + or die "$0: cannot write $spooldir/\@MAINTENANCE - $!"; + warn "$0: entering maintenance mode\n"; + } + exit; +} + +# list files or resend notification e-mails +if ($opt_M) { + my ($mtime,$comment,$file,$keep); + local $_; + + if (@ARGV) { + foreach $file (glob("@ARGV")) { + $mtime = mtime("$file/data") or next; + $comment = slurp("$file/comment")||''; + next if $comment =~ /NOMAIL/; + $keep = readlink "$file/keep" + || readlink "$file/../../\@KEEP" + || $keep_default; + $keep = $keep - int((time-mtime("$file/data"))/60/60/24); + + notify( + status => 'new', + dkey => readlink "$file/dkey", + filename => filename($file), + keep => $keep, + comment => $comment, + warn => int(($mtime-time)/DS)+$keep, + autodelete => readlink "$file/autodelete" || $autodelete, + ); + print "send notification e-mail for $file\n"; + } + } else { + # just list files + foreach $file (glob "*/*/*/data") { + next if $file =~ /^_?(anonymous|fexmail)/; + $file =~ s:/data$::; + $comment = "$file/comment"; + if (open $comment,$comment and <$comment> =~ /NOMAIL/) { + next; + } + print "$file\n"; + } + } + exit; +} + +# show logfile +if ($opt_w) { + $log = "$logdir/fexsrv.log"; + warn "$0: polling $log\n\n"; + exec "$FEXHOME/bin/logwatch",$log; + die "$0: logwatch not found\n"; +} + +# list files and download URLs +if ($opt_l) { + my ($file,$dkey,@L); + chdir $spooldir or die "$0: $spooldir - $!\n"; + foreach $file (glob "*/*/*") { + if (-s "$file/data" and + $dkey = readlink("$file/dkey") and + -l ".dkeys/$dkey" + ) { + push @L,sprintf "%2\$s --> %1\$s : $durl/$dkey/%3\$s\n",split "/",$file; + } + } + print sort @L if @L; + exit; +} + +# list files detailed +if ($opt_L) { + my $filter = shift; + my ($comment,$file,$keep,$old,$size,$download); + local $_; + + foreach $file (glob "*/*/*/data") { + next if $file =~ m:(.+?)/: and -l $1; + $size = -s $file or next; + $file =~ s:/data$::; + next if $filter and $file !~ /$filter/; + $comment = slurp("$file/comment")||''; + $dkey = readlink("$file/dkey")||''; + $keep = readlink("$file/keep")||$keep_default; + $old = int((time-mtime("$file/data"))/60/60/24); + $download = join(' & ',split("\n",(slurp("$file/download")||''))); + print "\n$file\n"; + printf " comment: %s\n",decode_utf8($comment); + printf " size: %s\n",d3($size); + printf " sender ip: %s\n",readlink("$file/ip")||''; + printf " expire in: %s days\n",$keep-$old; + printf " upload speed: %s kB/s\n",readlink("$file/speed")||0; + printf " URL: $durl/$dkey/%3\$s\n",split "/",$file; + printf " download: %s\n",$download; + } + exit; +} + +# delete user +if ($opt_d) { + $idf = "$spooldir/$opt_d/\@"; + die "$0: no such user $opt_d\n" unless -f $idf; + unlink $idf or die "$0: cannot remove $idf - $!\n"; + foreach $rf (glob "$spooldir/$opt_d/\@*") { unlink $rf } + print "$opt_d deleted\n"; + exit; +} + +# set user restriction file +if ($opt_R) { + $user = shift or die "usage: $0 -R user\n"; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + die "$0: no user $user\n" unless -d "$spooldir/$user"; + unless (@local_rdomains) { + die "$0: no \@local_rdomains in server config\n"; + } + my $rf = "$spooldir/$user/\@ALLOWED_RECIPIENTS"; + open $rf,'>',$rf or die "$0: cannot open $rf - $!"; + print {$rf} "\@LOCAL_RDOMAINS\n"; + close $rf; + print "$user restricted\n"; + exit; +} + +# edit user restriction file +if ($opt_r) { + if ($opt_r =~ /^r/i) { $opt_r = 'ALLOWED_RECIPIENTS' } + elsif ($opt_r =~ /^u/i) { $opt_r = 'UPLOAD_HOSTS' } + elsif ($opt_r =~ /^d/i) { $opt_r = 'DOWNLOAD_HOSTS' } + else { usage(2) } + $user = shift or usage(2); + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + die "$0: no user $user\n" unless -d "$spooldir/$user"; + my $rf = "$spooldir/$user/\@$opt_r"; + unless (-s $rf) { + open $rf,'>',$rf or die "$0: cannot open $rf - $!"; + if ($opt_r eq 'ALLOWED_RECIPIENTS') { + print {$rf}<$fph" or die "$0: cannot write to $fph - $!\n"; + print {$fph} $_; + close $fph; + system "cp $FEXLIB/fup.pl $vhd/lib/fup.pl"; + foreach $i (qw'dop fex.pp fup.pl lf.pl reactivation.txt') { + # symlink "$FEXLIB/$i","$vhd/lib/$i"; + symlink "../../lib/$i","$vhd/lib/$i"; + } + foreach $i (qw( + index.html tools.html SEX.html robots.txt + logo.jpg small_logo.jpg action-fex-camel.gif favicon.ico + FAQ + )) { + cpa("$docdir/$i","$vhd/htdocs"); + } + symlink "$docdir/version","../../htdocs/version"; + symlink "$docdir/download","../../htdocs/download"; + cpa("$FEXHOME/locale",$vhd); + foreach $ld (glob "$vhd/locale/*") { + if (not -l $ld and -d "$ld/cgi-bin") { + $locale = basename($ld); + rmrf("$ld/cgi-bin"); + # symlink "../../../locale/$locale/cgi-bin","$ld/cgi-bin"; + symlink "../../../locale/$locale/htdocs","$vhd/htdocs/locale/$locale"; + unlink "$ld/lib/fex.ph"; + symlink "../../../lib/fex.ph","$ld/lib/fex.ph"; + symlink "../../../../locale/$locale/lib","$ld/lib/master"; + foreach $f (qw'dop fex.pp lf.pl reactivation.txt') { + unlink "$ld/lib/$f"; + symlink "master/$f","$ld/lib/$f"; + } + } + } + $fph = "$FEXLIB/fex.ph"; + open $fph,">>$fph" or die "$0: cannot write to $fph = $!\n"; + print {$fph} "\n\$vhost{'$hhost'} = '$vhd';\n"; + close $fph; + print "You must now edit and configure $vhd/lib/fex.ph\n"; + print "or execute: $0 -V $vhost -c\n"; + exit; +} + +# show config +if ($opt_v) { + print "config from $FEXLIB/fex.ph :\n"; + print " spooldir = $spooldir\n"; + print " logdir = $logdir\n"; + print " docdir = $docdir\n"; + print " durl = @durl\n"; + print " admin = $admin\n"; + print " mdomain = $mdomain\n"; + print " mailmode = $mailmode\n"; + print " autodelete = $autodelete\n"; + print " keep_default = $keep_default\n"; + printf " keep_max = %s\n",$keep_max||'unlimited'; + printf " recipient_quota = %d GB\n",int($recipient_quota/1024); + printf " sender_quota = %d GB\n",int($sender_quota/1024); + while (($hh,$vh) = each %vhost) { + printf " virtual server %s : %s\n",basename($vh),$hh; + } +# unless (@ARGV) { +# foreach $ph (glob "$ENV{HOME}/*/lib/fex.ph") { +# $ENV{FEXLIB} = dirname($ph); +# print "\n"; +# system $0,'-v',$ph; +# } +# } + if ($m = readlink '@MAINTENANCE') { + print "server is in maintenance mode ($m)!\n" ; + } + exit; +} + +# add user or show user config +if ($opt_u) { + if ($opt_u = shift @ARGV) { + $user = lc $opt_u; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $id = shift @ARGV; + $idf = "$spooldir/$user/@"; + if (open $idf,$idf) { + chomp($ido = <$idf>||''); + close $idf; + } + unless ($id) { + die "$0: $user is not a FEX user\n" unless -f "$spooldir/$user/@"; + showuser($user,$ido); + exit; + } + unless ($user =~ /\w@[\w.-]+\.[a-z]+$/) { + die "$0: $user is not a valid email-address!\n"; + } + unless (-d "$spooldir/$user") { + mkdir "$spooldir/$user",0755 + or die "$0: cannot mkdir $spooldir/$user - $!\n"; + } + open F,">$idf" or die "$0: cannot write $idf - $!\n"; + print F $id,"\n"; + close F or die "$0: cannot write $idf - $!\n"; + showuser($user,$id); + } else { + print "Users in $spooldir:\n"; + foreach $user (glob "$spooldir/*/@") { + $user =~ s:.*/(.+)/@:$1:; + print "$user\n"; + } + } + exit; +} + +# set user autodelete default +if ($opt_a) { + $user = lc $opt_a; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $_ = shift @ARGV || ''; + if (/^n/i) { $autodelete = 'no' } + elsif (/^y/i) { $autodelete = 'yes' } + elsif (/^d/i) { $autodelete = 'delay' } + else { + die "usage: $0 -a user yes\n". + "usage: $0 -a user no\n". + "usage: $0 -a user delay\n". + "example: $0 -a framstag\@rus.uni-stuttgart.de no\n"; + } + mkdir "$spooldir/$user",0755; + my $adf = "$spooldir/$user/\@AUTODELETE"; + unlink $adf; + symlink $autodelete,$adf or die "$0: cannot create symlink $adf - $!\n"; + exit; +} + +# set user notification default +if ($opt_n) { + $user = lc $opt_n; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $_ = shift @ARGV || ''; + if (/^n/i) { $notification = 'no' } + elsif (/^[sb]/i) { $notification = 'short' } + elsif (/^[fd]/i) { $notification = '' } + else { + die "usage: $0 -n user no\n". + "usage: $0 -n user brief\n". + "usage: $0 -n user detailed\n". + "example: $0 -n framstag\@rus.uni-stuttgart.de brief\n"; + } + mkdir "$spooldir/$user",0755; + my $ndf = "$spooldir/$user/\@NOTIFICATION"; + unlink $ndf; + if ($notification) { + symlink $notification,$ndf or die "$0: cannot create symlink $ndf - $!\n"; + } + exit; +} + +# set user keep default +if ($opt_k) { + $user = lc $opt_k; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + my $keep = shift @ARGV || ''; + if ($keep !~ /^\d+$/) { + die "usage: $0 -k user keep_days\n". + "example: $0 -k framstag\@rus.uni-stuttgart.de 30\n"; + } + mkdir "$spooldir/$user",0755; + my $kf = "$spooldir/$user/\@KEEP"; + unlink $kf; + symlink $keep,$kf or die "$0: cannot create symlink $kf - $!\n"; + exit; +} + +# quota +if ($opt_q) { + $user = lc $opt_q; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + unless (-d "$spooldir/$user") { + die "$0: $user is not a regular FEX user\n"; + } + quota($user,@ARGV); + exit; +} + +if ($opt_C) { + $user = lc $opt_C; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + unless (-f "$spooldir/$user/@") { + die "$0: $user is not a regular FEX user\n"; + } + $_ = shift @ARGV || ''; + if (/^y/i) { + open $user,">>$spooldir/$user/\@CAPTIVE"; + close $user; + print "$user is now captive\n"; + } elsif (/^n/i) { + unlink "$spooldir/$user/\@CAPTIVE"; + print "$user is no more captive\n"; + } else { + die "usage: $0 -C user yes\n". + "usage: $0 -C user no\n". + "example: $0 -C framstag\@rus.uni-stuttgart.de no\n"; + } + exit; +} + +# FEXYOURSELF = user can only fex to himself via web interface +if ($opt_y) { + $user = lc $opt_y; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + unless (-f "$spooldir/$user/@") { + die "$0: $user is not a regular FEX user\n"; + } + $_ = shift @ARGV || ''; + if (/^y/i) { + open $user,">>$spooldir/$user/\@FEXYOURSELF"; + close $user; + print "$user has now \"fex yourself\" web default\n"; + } elsif (/^n/i) { + unlink "$spooldir/$user/\@FEXYOURSELF"; + print "$user has no \"fex yourself\" web default\n"; + } else { + die "usage: $0 -y user yes\n". + "usage: $0 -y user no\n". + "example: $0 -y framstag\@rus.uni-stuttgart.de no\n"; + } + exit; +} + +if ($opt_D) { + $user = lc $opt_D; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $_ = shift @ARGV || ''; + if (/^y/i) { + open $user,">>$spooldir/$user/\@DISABLED"; + close $user; + print "$user is now disabled\n"; + } elsif (/^n/i) { + unlink "$spooldir/$user/\@DISABLED"; + print "$user is now enabled\n"; + } else { + die "usage: $0 -D user yes\n". + "usage: $0 -D user no\n". + "example: $0 -D framstag\@rus.uni-stuttgart.de no\n"; + } + exit; +} + +if ($opt_P) { + $user = lc $opt_P; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $_ = shift @ARGV || ''; + if (/^y/i) { + open $user,">>$spooldir/$user/\@PERSISTENT"; + close $user; + print "$user is now persistent\n"; + } elsif (/^n/i) { + unlink "$spooldir/$user/\@PERSISTENT"; + print "$user is no more persistent\n"; + } else { + die "usage: $0 -P user yes\n". + "usage: $0 -P user no\n". + "example: $0 -P framstag\@rus.uni-stuttgart.de yes\n"; + } + exit; +} + +if ($opt_S eq 'fup') { + &fupstat; + exit; +} + +if ($opt_S eq 'fop') { + &fopstat; + exit; +} + +usage(3); + +sub showuser { + my $user = shift; + my $id = shift; + my ($keep,$autodelete,$notification); + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + + print "[using config $FEXLIB/fex.ph]\n"; + print "$fup?from=$user&id=$id\n"; + printf "%s/%s\n",$fup,b64("from=$user&id=$id"); + # printf "%s/%s\n",$fup,b64("from=$user&to=$user&id=$id&submit=."); + print "spool: $spooldir/$user/\n"; + printf "fex yourself web default: %s\n", + -e "$spooldir/$user/\@FEXYOURSELF" ? 'yes' : 'no'; + printf "persistent: %s\n", + -e "$spooldir/$user/\@PERSISTENT" ? 'yes' : 'no'; + printf "captive: %s\n", + -e "$spooldir/$user/\@CAPTIVE" ? 'yes' : 'no'; + printf "disabled: %s\n", + -e "$spooldir/$user/\@DISABLED" ? 'yes' : 'no'; + printf "recipients restrictions: %s\n", + -e "$spooldir/$user/\@ALLOWED_RECIPIENTS" ? 'yes' : 'no'; + printf "upload restrictions: %s\n", + -e "$spooldir/$user/\@UPLOAD_HOSTS" ? 'yes' : 'no'; + printf "download restrictions: %s\n", + -e "$spooldir/$user/\@DOWNLOAD_HOSTS" ? 'yes' : 'no'; + $autodelete = lc(readlink "$spooldir/$user/\@AUTODELETE" || $::autodelete); + print "autodelete default: $autodelete\n"; + $notification = lc(readlink "$spooldir/$user/\@NOTIFICATION" || $::notification); + print "notification default: $notification\n"; + $keep = readlink "$spooldir/$user/\@KEEP" || $keep_default; + print "keep default: $keep\n"; + quota($user); + printf "account creation: %s\n",slurp("$spooldir/$user/.auto")||'manual'; +} + +# set or show disk quota +sub quota { + my $user = shift; + my $rquota = ''; + my $squota = ''; + my $qf = "$spooldir/$user/\@QUOTA"; + local $_; + + if (open $qf,$qf) { + while (<$qf>) { + s/#.*//; + $rquota = $1 if /recipient.*?(\d+)/i; + $squota = $1 if /sender.*?(\d+)/i; + } + close $qf; + } + + if (@_) { + for (@_) { + $rquota = $1 if /^r.*:(\d*)/i; + $squota = $1 if /^s.*:(\d*)/i; + } + open $qf,'>',$qf or die "$0: cannot write $qf - $!\n"; + print {$qf} "recipient:$rquota\n" if $rquota =~ /\d/; + print {$qf} "sender:$squota\n" if $squota =~ /\d/; + close $qf; + } + + $rquota = $recipient_quota if $rquota !~ /\d/; + $squota = $sender_quota if $squota !~ /\d/; + printf "recpient quota (used): %d (%d) MB\n", + check_recipient_quota($user) if $rquota; + printf "sender quota (used): %d (%d) MB\n", + check_sender_quota($user) if $squota; +} + + +sub fupstat { + my (%user,%domain,%du); + my ($log,$u,$d,$z); + my $Z = 0; + + if (-t) { $log = "$logdir/fup.log" } + else { $log = '>&=STDIN' } + open $log,$log or die "$0: cannot open $log - $!\n"; + + while (<$log>) { + if (/^([\d: -]+) (\[[\d_]+\] )?(\w\S*) .* (\d+)$/) { + $z = $4; + $u = $3; + $u .= '@'.$mdomain if $mdomain and $u !~ /@/; + $user{$u} += $z; + $d = $u; + $d =~ s/.*@//; + $d =~ s/.*\.(.+\.\w+)/$1/; + $domain{$d} += $z; + $du{$d}{$u}++; + $Z += $z; + } + } + + foreach $u (sort {$user{$a} <=> $user{$b}} keys %user) { + printf "%s : %d\n",$u,$user{$u}/M; + } + print "========================================================\n"; + foreach $d (sort {$domain{$a} <=> $domain{$b}} keys %domain) { + printf "%s : %d MB, %d user\n",$d,$domain{$d}/M,scalar(keys %{$du{$d}}); + } + printf "Total: %d GB\n",$Z/M/1024; + + exit; +} + + +sub fopstat { + my $Z = 0; + my ($log,$u,$d,$z); + my (%user,%domain,%du); + + if (-t) { $log = "$logdir/fop.log" } + else { $log = '>&=STDIN' } + open $log,$log or die "$0: cannot open $log - $!\n"; + + while (<$log>) { + if (/^([\d: -]+) (\[[\d_]+\] )?[\d.]+ (.+?)\/.* (\d+)\/\d+/) { + $z = $4; + $u = $3; + $u .= '@'.$mdomain if $mdomain and $u !~ /@/; + $user{$u} += $z; + $d = $u; + $d =~ s/.*@//; + $d =~ s/.*\.(.+\.\w+)/$1/; + $domain{$d} += $z; + $du{$d}{$u}++; + $Z += $z; + } + } + + foreach $u (sort {$user{$a} <=> $user{$b}} keys %user) { + printf "%s : %d\n",$u,$user{$u}/M; + } + print "========================================================\n"; + foreach $d (sort {$domain{$a} <=> $domain{$b}} keys %domain) { + printf "%s : %d MB, %d user\n",$d,$domain{$d}/M,scalar(keys %{$du{$d}}); + } + printf "Total: %d GB\n",$Z/M/1024; + + exit; +} + + +sub cpa { + my $dd = pop @_; + + die "(cpa): $dd is not a directory" unless -d $dd; + system "rsync -a @_ $dd/" ; +} + + +sub mtime { + my @s = lstat shift; + return @s ? $s[9] : undef; +} + +sub check_admin { + + my $admin_id = slurp("$spooldir/$admin/@") or + die "$0: no admin account - you have to create it with:\n". + "$0 -/ $admin ".randstring(8)."\n"; + + chomp $admin_id; + + my $fid = "$ENV{HOME}/.fex/id"; + if (open $fid,$fid) { + $_ = <$fid>; + chomp($_ = <$fid>||''); + if ($_ ne $admin) { + warn "WARNING: user $admin not in $fid\n"; + $mismatch++; + } + chomp($_ = <$fid>||''); + if ($_ ne $admin_id) { + warn "WARNING: $admin auth-ID mismatch in $fid\n"; + $mismatch++; + } + close $fid; + if ($mismatch) { + warn "$0: moving $fid to ${fid}_save\n"; + rename $fid,$fid.'_save'; + } + } + unless (-f $fid) { + mkdir dirname($fid); + open $fid,'>',$fid or die "$0: cannot create $fid - $!\n"; + if ($durl =~ m{(https?://.+?)/}) { + print {$fid} "$1\n"; + } else { + print {$fid} "$hostname\n"; + } + print {$fid} "$admin\n"; + print {$fid} "$admin_id\n"; + close $fid; + warn "$0: new $fid created\n"; + } +} + + +sub d3 { + local $_ = shift; + while (s/(\d)(\d\d\d\b)/$1,$2/) {}; + return $_; +} + + +sub usage { + my $port = ''; + my $proto = 'http'; + + if ($durl =~ /:(\d+)/) { $port = ":$1" } + if ($durl =~ /^(https?)/) { $proto = $1 } + + $0 =~ s:.*/::; + print < +# +# Copyright: Perl Artistic + +use 5.006; +use strict qw'vars subs'; +use Config; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Getopt::Std; +use Time::HiRes qw'time'; +# use Smart::Comments; +use constant k => 2**10; +use constant M => 2**20; + +our ($SH,$windoof,$sigpipe,$useragent); +our ($FEXSERVER); +our $version = 20150120; + +# server defaults +my $server = 'fex.rus.uni-stuttgart.de'; +my $port = 80; +my $proxy = ''; + +my $from = 'nettest'; +my $to = $from; +my $id = $from; +my $proxy_prefix = ''; +my $mb; +my (@r,$r); +my $bs = 2**16; +my $timeout = 30; # server timeout + +$version ||= mtime($0); +$0 =~ s:.*/::; + +my $usage = </dev/null`||''; + chomp; + s/^Description:\s+//; + $useragent = "fbm-$version ($_)"; +} + +$| = 1; + +autoflush STDERR; + +my @_ARGV = @ARGV; # save arguments + +our $opt_n = 0; +our $opt_v = 0; +our $opt_h = 0; +our $opt_s = ''; +our $opt_P = ''; + +getopts('hvnP:s:') or die $usage; + +if ($opt_h) { + print $usage; + exit; +} + +if ($opt_P) { + if ($opt_P =~ /^[\w.-]+:\d+/) { + $proxy = $opt_P; + } else { + die "$0: proxy must be: SERVER:PORT\n"; + } +} + +$mb = shift or die $usage; +$mb =~ /^\d+$/ or die $usage; + +# $port = $1 if $server =~ s/:(\d+)//; + +if ($opt_s) { + ($server,$port) = split /:/,$opt_s; + $port = 80 unless $port; +} +$server =~ s{http://}{}; +$server =~ s{/.*}{}; + +if ($proxy) { + if ($port == 80) { $proxy_prefix = "http://$server" } + else { $proxy_prefix = "http://$server:$port" } +} + +print "Testing $server:\n"; + +@r = formdatapost( + from => $from, + to => $to, + id => $id, + comment => $opt_n ? 'NOSTORE' : 'NOMAIL', + keep => 1, + autodelete => 'YES', +); + +if (not @r or not grep /\w/,@r) { + die "$0: no response from server\n"; +} + +if (($r) = grep /ERROR:/,@r) { + $r =~ s/.*?:\s*//; + $r =~ s/<.*//; + die "$0: server error: $r\n"; +} + +if (($r) = grep /^Location: http/,@r) { + $r =~ s:.*(/fop/\w+/.+$):$1:; + download($r); +} else { + download("/ddd/$mb"); +} + +exit; + + +sub formdatapost { + my %P = @_; + my ($boundary,$filename,$filesize,$length); + my (@hh,@hb,@r,@pv); + my ($t,$bt,$t0,$t1,$t2,$tt); + my $buf = '#' x $bs; + local $_; + + + @hh = (); # HTTP header + @hb = (); # HTTP body + @r = (); + + serverconnect($server,$port); + + $boundary = randstring(48); + $P{command} = 'CHECKRECIPIENT'; + + # HTTP POST variables + @pv = qw'from to id command'; + foreach my $v (@pv) { + if ($P{$v}) { + my $name = uc($v); + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"$name\""; + push @hb,""; + push @hb,$P{$v}; + } + } + push @hb,"--$boundary--"; + + $length = length(join('',@hb)) + scalar(@hb)*2 + $mb*M; + + # HTTP header + push @hh,"POST $proxy_prefix/fup HTTP/1.1"; + push @hh,"Host: $server:$port"; + push @hh,"User-Agent: $useragent"; + push @hh,"Content-Length: $length"; + push @hh,"Content-Type: multipart/form-data; boundary=$boundary"; + push @hh,"Connection: close"; + push @hh,''; + + if ($opt_v) { + printf "--> $_\n" foreach (@hh,@hb); + } + + nvtsend(@hh,@hb) or die "$0: server has closed the connection\n"; + + while (<$SH>) { + s/[\r\n]+//; + print "<-- $_\n" if $opt_v; + push @r,$_; + last if /^$/; + } + + unless (@r and $r[0] =~ / 204 /) { + $_ = $r[0] || ''; + s/^HTTP.[.\d\s]+//; + die "$0: server error: $_\n"; + } + + @hh = (); # HTTP header + @hb = (); # HTTP body + @r = (); + $filename = 'test_'.int(time*1000); + + serverconnect($server,$port); + + # HTTP POST variables + @pv = qw'from to id keep autodelete comment filesize'; + foreach my $v (@pv) { + if ($P{$v}) { + my $name = uc($v); + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"$name\""; + push @hb,""; + push @hb,$P{$v}; + } + } + + # at last, the file + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"FILE\"; filename=\"$filename\""; + push @hb,"Content-Type: application/octet-stream"; + push @hb,""; + push @hb,""; + push @hb,"--$boundary--"; + + $length = length(join('',@hb)) + scalar(@hb)*2 + $mb*M; + + $hb[-2] = '(file content)'; + + # HTTP header + push @hh,"POST $proxy_prefix/fup HTTP/1.1"; + push @hh,"Host: $server:$port"; + push @hh,"User-Agent: $useragent"; + push @hh,"Content-Length: $length"; + push @hh,"Content-Type: multipart/form-data; boundary=$boundary"; + push @hh,"Connection: close"; + push @hh,''; + + if ($opt_v) { + printf "--> $_\n" foreach (@hh,@hb); + } + + pop @hb; + pop @hb; + nvtsend(@hh,@hb) or die "$0: server has closed the connection\n"; + + $t0 = $t2 = int(time); + $t1 = 0; + + autoflush $SH 0; + + for (;;) { + print {$SH} $buf or die "$0: server has closed the connection\n"; + $b += $bs; + $bt += $bs; + $t2 = time; + if (-t STDOUT and $t2-$t1>1) { + # smaller block size is better on slow links + if ($t1 and $bs>4096 and $bt/($t2-$t0)<65536) { + $bs = 4096; + $buf = '#' x $bs; + } + if ($bs>4096) { + printf STDERR "upload: %s MB of %d MB, %d kB/s \r", + int($bt/M), + $mb, + int($b/k/($t2-$t1)); + } else { + printf STDERR "upload: %s kB of %d MB, %d kB/s \r", + int($bt/k), + $mb, + int($b/k/($t2-$t1)); + } + $t1 = $t2; + $b = 0; + } + last if $bt >= $mb*M; + } + + autoflush $SH 1; + print {$SH} "\r\n--$boundary--\r\n"; + + while (<$SH>) { + s/[\r\n]+//; + print "<-- $_\n" if $opt_v; + last if @r and $r[0] =~ / 204 / and /^$/ or /<\/html>/i; + push @r,$_; + } + + $tt = (time-$t0)||1; + printf STDERR "upload: %d MB in %d s, %d kB/s \n", + int($bt/M),$tt,int($bt/k/$tt); + + close $SH; + undef $SH; + + return @r; +} + + +sub randstring { + my $n = shift; + my @rc = ('A'..'Z','a'..'z',0..9 ); + my $rn = @rc; + my $rs; + + for (1..$n) { $rs .= $rc[int(rand($rn))] }; + return $rs; +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH); + } + } else { + tcpconnect($server,$port); + } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub download { + my $fop = shift; + my ($file); + my ($t0,$t1,$t2,$tt,$kBs,$b,$bt,$tb,$B,$buf); + my $length = 0; + local $_; + + serverconnect($server,$port); + + sendheader( + "GET $proxy_prefix$fop HTTP/1.1", + "User-Agent: $useragent", + "Host: $server:$port", + ); + + $_ = <$SH>; + die "$0: no response from fex server $server\n" unless $_; + s/\r//; + + if (/^HTTP\/[\d.]+ 2/) { + warn "<-- $_" if $opt_v; + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^\r?\n/; + if (/^Content-length:\s*(\d+)/i) { + $length = $1; + } + } + } else { + s/HTTP\/[\d.]+ \d+ //; + die "$0: bad server reply: $_"; + } + + $t0 = $t1 = $t2 = int(time); + $tb = $B = 0; + while ($B < $length and $b = read $SH,$buf,$bs) { + $B += $b; + $tb += $b; + $bt += $b; + $t2 = time; + if (int($t2) > $t1) { + $kBs = int($bt/k/($t2-$t1)); + $kBs = int($tb/k/($t2-$t0)) if $kBs < 10; + $t1 = $t2; + $bt = 0; + # smaller block size is better on slow links + $bs = 4096 if $bs>4096 and $tb/($t2-$t0)<65536; + printf STDERR "download: %d MB in %d s, %d kB/s \r", + int($tb/M),$t2-$t0,$kBs; + } + } + close $SH; + + $tt = $t2-$t0; + $kBs = int($tb/k/($tt||1)); + printf STDERR "download: %d MB in %d s, %d kB/s \n", + int($tb/M),$tt,$kBs; +} + + +sub sendheader { + my @head = @_; + my $head; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} diff --git a/bin/fex_cleanup b/bin/fex_cleanup new file mode 100755 index 0000000..c54b2e0 --- /dev/null +++ b/bin/fex_cleanup @@ -0,0 +1,587 @@ +#!/usr/bin/perl -w + +# cleanup for F*EX service +# +# run this program via cron-job once at night! +# +# Author: Ulli Horlacher +# + +use Getopt::Std; +use File::Basename; +use IO::Socket::INET; +use Cwd 'abs_path'; +use Digest::MD5 'md5_hex'; + +use constant DS => 60*60*24; + +# do not run as CGI! +exit if $ENV{SCRIPT_NAME}; + +unless ($FEXLIB = $ENV{FEXLIB}) { + if ($ENV{FEXHOME}) { + $FEXLIB = $ENV{FEXHOME}.'/lib'; + } elsif (-f '/usr/share/fex/lib/fex.ph') { + $FEXLIB = '/usr/share/fex/lib'; + } else { + $FEXLIB = dirname(dirname(abs_path($0))).'/lib'; + } + $ENV{FEXLIB} = $FEXLIB; +} +die "$0: no FEXLIB\n" unless -r "$FEXLIB/fex.pp"; + +# program name +$_0 = $0; +$0 =~ s:.*/::; + +$| = 1; + +# use fex.ph for site configuration! +our ($FEXHOME); +our ($spooldir,$logdir,$docdir); +our ($akeydir,$ukeydir,$dkeydir,$skeydir,$gkeydir,$xkeydir,$lockdir); +our ($durl,$debug,$autodelete,$hostname,$admin,$admin_pw,$bcc); +$keep_default = 5; + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +# localized functions +# (needed for reminder and account reactivation e-mails) +foreach my $lf (glob "$FEXHOME/locale/*/lib/lf.pl") { require $lf } + +# default locale functions (from fex.pp) +$notify{english} = \¬ify; +$reactivation{english} = \&reactivation; + +@_ARGV = @ARGV; + +$opt_v = $opt_V = $opt_d = 0; +getopts('vVd'); +$opt_v = $opt_d if $opt_d; # debug mode, no real action + +$today = time; +$isodate = isodate($today); + +chdir $spooldir or die "$0: $spooldir - $!\n"; +open L,">>$logdir/cleanup.log"; + +# clean up regular spool +opendir $spooldir,'.' or die "$0: $spooldir - $!\n"; +while ($to = readdir $spooldir) { + next if $to !~ /@/ or -l $to; + if (@demo and -f "$to/.demo" and time > mtime("$to/.demo")+$demo[1]*DS) { + logdel($to,"demo user $to deleted"); + next; + } + if (-d $to and $to !~ /^\./) { + unless (opendir TO,$to) { + warn "$0: $spooldir/$to - $!\n"; + next; + } + while ($from = readdir TO) { + next if $from !~ /@/; + if ($from eq '@GROUP') { + foreach $group (glob "$to/$from/*") { + if (readlink $group and not -f $group) { + logdel($group,"$group deleted (master has gone)"); + } + } + } else { + if (-d "$to/$from" and $from !~ /^\./) { + unless (opendir FROM,"$to/$from") { + warn "$0: $spooldir/$to/$from - $!\n"; + next; + } + while ($file = readdir FROM) { + next if $file eq '.' or $file eq '..'; + if (-d "$to/$from/$file" and $file !~ /^\./) { + cleanup($to,$from,$file); + rmdir "$to/$from/$file" unless $opt_d; + } + } + closedir FROM; + rmdir "$to/$from" unless $opt_d; + } + } + } + closedir TO; + unless (-f "$to/\@PERSISTENT" or $to eq $admin) { + @glob = glob "$to/*/* $to/\@MAINUSER/* $to/\@GROUP/*"; + unless (@glob or -f "$to/\@") { + logdel($to,"$to deleted"); + } + $user = $to; + if ($login_check and -l "$user/.login") { + my $lc = &$login_check(readlink("$user/.login")); + if ($lc) { + if (-f "$user/\@~" and not "$user/@") { + rename "$user/\@~","$user/@" unless $opt_d; + logv("$isodate $user reanimated (login_check)"); + } + } else { + rename "$user/@","$user/\@~" unless $opt_d; + logv("$user deactivated (login_check)"); + } + } + } + } +} +closedir $spooldir; + +# clean up download key lookup directory +if (chdir $dkeydir and opendir D,'.') { + while ($file = readdir D) { + if ($link = readlink $file and + (not -l "$link/dkey" or readlink "$link/dkey" ne $file)) { + logdel($file,".dkeys/$file deleted"); + } + } + closedir D; +} + +# clean up upload key lookup directory +if (chdir $ukeydir and opendir D,'.') { + while ($file = readdir D) { + next if $file eq '.' or $file eq '..'; + if (($link = readlink $file and not -e "$link/upload" + or -f $file and time > mtime($file)+DS)) { + logdel($file,".ukeys/$file deleted"); + } + } + closedir D; +} + +# clean up authorization key lookup directory +if (chdir $akeydir and opendir D,'.') { + while ($file = readdir D) { + if (-l $file and time > mtime($file)+DS) { + logdel($file,".akeys/$file deleted"); + } + } + closedir D; +} + +# clean up extra download key lookup directory +if (chdir $xkeydir and opendir D,'.') { + while ($file = readdir D) { + next if $file eq '.' or $file eq '..'; + if (-l $file and not (-f "$file/upload" or -f "$file/data")) { + logdel($file,".xkeys/$file deleted"); + } + } + closedir D; +} + +# clean up lock directory +if (chdir $lockdir and opendir D,'.') { + while ($file = readdir D) { + if (-f $file and time > mtime($file)+DS) { + logdel($file,".locks/$file deleted"); + } + } + closedir D; +} + +# clean up error directory +if (chdir "$spooldir/.error" and opendir D,'.') { + while ($file = readdir D) { + if (-f $file) { + $mtime = mtime($file); + if ($mtime and $today > 10*$keep_default*DS+$mtime) { + if ($opt_d) { print "unlink .error/$file\n" } + else { logdel($file,".error/$file deleted") } + } + } + } + closedir D; +} + +# clean up debug directory +if (chdir "$logdir/.debug" and opendir D,'.') { + while ($file = readdir D) { + if (-f $file) { + $mtime = mtime($file); + if ($mtime and $today > $keep_default*DS+$mtime) { + # logdel($file,".debug/$file deleted"); + if ($opt_d) { print "unlink .debug/$file\n" } + else { unlink $file } + } + } + } + closedir D; +} + +# clean up subuser keys directory +if (chdir $skeydir and opendir D,'.') { + while ($file = readdir D) { + if (-f $file and open F,$file) { + $delete = 1; + $from = $to = $id = ''; + while () { + if (/^(\w+)=(.+)/) { + $from = $2 if $1 eq 'from'; + $to = $2 if $1 eq 'to'; + $id = $2 if $1 eq 'id'; + } + } + close F; + if ($from and $to and $id and open F,"$spooldir/$to/\@SUBUSER") { + while () { + if (/^\Q$from:$id\E$/) { + $delete = 0; + last; + } + } + close F; + } + if ($delete) { + logdel($file,".skeys/$file deleted"); + } + } + } + closedir D; +} + +# clean up orphan subuser links +chdir $spooldir; +foreach $subuser (glob '*/@MAINUSER/*') { + if ($skey = readlink $subuser and not -f "$skeydir/$skey") { + logdel($subuser,"$subuser deleted"); + } +} +foreach $subuser (glob '*/@MAINUSER') { + unlink $subuser unless $opt_d; +} + +# clean up old OKEYs +chdir $spooldir; +foreach my $okey (glob '*/@OKEY/*') { + if (time > mtime($okey)+30*DS) { + logdel($okey,"$okey deleted"); + } +} + + +# clean up group keys directory +if (chdir $gkeydir and opendir D,'.') { + while ($gkey = readdir D) { + if (-f $gkey and open F,$gkey) { + $delete = 1; + $from = $group = $id = ''; + while () { + if (/^(\w+)=(.+)/) { + $from = $2 if $1 eq 'from'; + $group = $2 if $1 eq 'to'; + $id = $2 if $1 eq 'id'; + } + } + close F; + $group =~ s/^@//; + $gf = "$spooldir/$from/\@GROUP/$group"; + if ($from and $group and $id and open F,$gf) { + while () { + if (/^\Q$from:$id\E$/) { + $delete = 0; + last; + } + } + close F; + } + if ($delete) { + logdel($gkey,".gkeys/$gkey deleted"); + logdel($gf,"$gf deleted") if -l $gf; + } + } + } + closedir D; +} + +# clean up self registration directory +if (chdir "$spooldir/.reg" and opendir D,'.') { + while ($file = readdir D) { + if (-f $file) { + $mtime = mtime($file); + if ($mtime and $today > $mtime+DS) { + logdel($file,".reg/$file deleted"); + } + } + } + closedir D; +} + +# send account expiration warning +if ($account_expire and $account_expire =~ /^(\d+)/) { + my $expire = $1; + if (chdir $spooldir) { + chomp($admin_pw = slurp("$admin/\@")||''); + unless ($admin_pw) { + warn "create new fex account for $admin\n"; + $admin_pw = randstring(8); + system("$FEXHOME/bin/fac -u $admin $admin_pw"); + } + my $fid = "$FEXHOME/.fex/id"; + unless (-f $fid) { + mkdir "$FEXHOME/.fex",0700; + if (open $fid,'>',$fid) { + if ($durl =~ m{(https?://.+?)/}) { + print {$fid} "$1\n"; + } else { + print {$fid} "$hostname\n"; + } + print {$fid} "$admin\n"; + print {$fid} "$admin_pw\n"; + close $fid; + } else { + warn"$0: cannot create $fid - $!"; + } + } + chmod 0600,$fid; + opendir $spooldir,'.'; + while ($user = readdir $spooldir) { + next unless -f "$user/\@"; + next if -e "$user/$admin/reactivation.txt"; + next if -e "$user/\@PERSISTENT"; + next if $user !~ /@/ or -l $user; + next if $user =~ /^(fexmaster|fexmail)/ or $user eq $admin; + next if -l "$user/.login"; + + if (time > mtime($user)+$expire*DS) { + # print "$spooldir/$user\n"; + my $locale = readlink "$user/\@LOCALE"; + $locale = 'english' unless $locale and $reactivation{$locale}; + &{$reactivation{$locale}}($expire,$user); + sleep 1; + } + } + closedir $spooldir; + } +} + +close L; + +# vhosts +exit if $opt_V; +if (%vhost) { + foreach $vhost (keys %vhost) { + my $fexlib = $vhost{$vhost}.'/lib'; + if (-f "$fexlib/fex.ph") { + warn "run $0 for $vhost :\n" if -t or $opt_v; + my $cmd = "HTTP_HOST=$vhost FEXLIB=$fexlib $_0 -V @_ARGV"; + if ($opt_d) { print "$cmd\n" } + else { system $cmd } + } + } +} + +if ($notify_newrelease or not defined $notify_newrelease) { + $notify_newrelease ||= $admin; + $newnew = $new = ''; + $snew = $FEXHOME.'/doc/new'; + $new = slurp($snew)||''; + $_ = slurp("$FEXHOME/doc/version")||''; + if (/(\d+)/) { $qn = "new?$hostname:$1" } + else { $qn = "new?$hostname:0" } + for (1..3) { + sleep rand(10); + $newnew = `wget -qO- http://fex.rus.uni-stuttgart.de/$qn 2>/dev/null`; + last if $newnew =~ /release/; + $newnew = `wget -qO- http://fex.belwue.de/$qn 2>/dev/null`; + last if $newnew =~ /release/; + }; + if ($newnew =~ /release/) { + if ($newnew ne $new) { + if (open $sendmail,"|$sendmail $notify_newrelease $bcc") { + pq($sendmail,qq( + 'From: fex\@$hostname' + 'To: $notify_newrelease' + 'Subject: new F*EX release' + '' + '$newnew' + )); + close $sendmail; + if (open $snew,'>',$snew) { + print {$snew} $newnew; + close $snew; + } + } + } + } +} + +exit; + + +# file clean up +sub cleanup { + my ($to,$from,$file) = @_; + my ($data,$download,$notify,$mtime,$warn,$dir,$filename,$dkey,$delay); + my $comment = ''; + my $keep = $keep_default; + my $kf = "$to/$from/$file/keep"; + my $ef = "$to/$from/$file/error"; + local $_; + + $keep = readlink $kf || readlink "$to/\@KEEP" || $keep_default; + + $file = "$to/$from/$file"; + $data = "$file/data"; + $download = "$file/download"; + $notify = "$file/notify"; + + if ($file =~ /\/ADDRESS_BOOK/) { + logdel($file,"$file deleted"); + } elsif (-d $file and not -f $data) { + if ($mtime = mtime("$file/upload")) { + if ($today > $mtime+DS) { + verbose("rmrf $file (today=$today mtime_upload=$mtime)"); + logdel($file,"$file deleted"); + } + } elsif ($mtime = mtime("$file/error")) { + if ($today > 3*$keep*DS+$mtime) { + verbose("rmrf $file (today=$today mtime_error=$mtime keep=$keep)"); + logdel($file,"$file deleted"); + } + } else { + logdel($file,"$file deleted"); + } + } elsif (-s $download and -s $data and autodelete($file) !~ /NO/i) { + $delay = autodelete($file); + $delay = 1 if $delay !~ /^\d+$/; + $delay--; + $mtime = mtime($download); + if ($mtime and $today > $delay*DS+$mtime + and logdel($data,"$data deleted")) { + if (open $ef,'>',$ef) { + printf {$ef} "%s has been autodeleted after download at %s\n", + filename($file),isodate(mtime($download)); + close $ef; + } + } + } elsif (-f $data) { + my $reactivation = $file =~ m{/\Q$admin/reactivation.txt\E$}; + $warn = $reactivation ? $keep-5 : $keep-2; + $mtime = mtime("$file/filename") || mtime($data) || 0; + if ($today > $mtime+$keep*DS) { + if ($account_expire and $reactivation) { + if ($account_expire =~ /delete/) { + logdel($to,"$to removed - expired"); + } else { + if (open $sendmail,"|$sendmail $admin $bcc") { + $account_expire =~ /(\d+)/; + my $expire = $1 || 0; + pq($sendmail,qq( + 'From: fex\@$hostname' + 'To: $admin' + 'Subject: user $to expired' + '' + 'F*EX user $to has been inactive for $expire days' + 'and has ignored the account reactivation mail.' + 'You may want to delete this account.' + )); + close $sendmail; + unlink $data; + } else { + warn "$0: cannot send mail - $!\n"; + } + } + } else { + if ($file =~ /^anonymous.*\/afex_\d/ or $to =~ /^_.+_/) { + # also _fexmail_* + logdel($file,"$file deleted") and + verbose("rmrf $file (today=$today mtime_upload=$mtime)"); + } elsif (logdel($data,"$data deleted")) { + verbose("unlink $data (today=$today mtime=$mtime keep=$keep)"); + if (open $ef,'>',$ef) { + $filename = $file; + $filename =~ s:.*/::; + print $ef "$filename is expired"; + close $ef; + } + } + } + } + elsif ($file !~ /STDFEX$/ and + $mtime+$warn*DS < $today and + $dkey = readlink("$file/dkey") and + not -s $download and + not -f $notify and + (readlink("$to/\@REMINDER")||'yes') ne 'no') + { + my $locale = readlink "$to/\@LOCALE" || readlink "$file/\@LOCALE"; + $locale = 'english' unless $locale and $notify{$locale}; + if (open my $c,"$file/comment") { + chomp ($comment = <$c>||''); + close $c; + } + &{$notify{$locale}}( + status => 'remind', + dkey => $dkey, + filename => filename($file), + keep => $keep, + comment => $comment, + warn => int(($mtime-$today)/DS)+$keep, + autodelete => autodelete($file), + ); + open $notify,'>',$notify; + close $notify; + print "sent reminder for $file\n" if -t or $opt_v; + } + } +} + +sub autodelete { + my $file = shift; + my $adf = "$file/autodelete"; + my $autodelete; + + if (-l $adf) { + $autodelete = readlink $adf || ''; + } elsif (open $adf,$adf) { + chomp($autodelete = <$adf>||''); + close $adf; + } + + return $autodelete||$::autodelete; +} + +sub mtime { + my @s = lstat shift; + return @s ? $s[9] : undef; +} + +sub logdel { + my ($file,$msg) = @_; + my $status = 0; + + if ($opt_d) { + print "$msg\n"; + } else { + if ($status = rmrf($file)) { + logv($msg); + } else { + print L "$isodate $file DEL FAILED : $!\n"; + warn "$file DEL FAILED : $!\n" if -t or $opt_v; + } + } + + return $status; +} + + +sub logv { + my $msg = shift; + print L "$isodate $msg\n" unless $opt_d; + print "$msg\n" if -t or $opt_v; +} + + +sub verbose { + local $_; + if ($opt_v) { + while ($_ = shift @_) { + s/\n*$/\n/; + print; + } + } +} diff --git a/bin/fexget b/bin/fexget new file mode 100755 index 0000000..034ced1 --- /dev/null +++ b/bin/fexget @@ -0,0 +1,1074 @@ +#!/usr/bin/perl -w + +# CLI client for the FEX service for retrieving files +# +# see also: fexsend +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +use 5.006; +use strict qw'vars subs'; +use Config; +use POSIX; +use Encode; +use Getopt::Std; +use File::Basename; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Time::HiRes 'time'; +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +$| = 1; + +our $SH; +our ($fexhome,$idf,$tmpdir,$windoof,$useragent); +our ($xv,%autoview); +our $bs = 2**16; # blocksize for tcp-reading and writing file +our $version = 20150120; +our $CTYPE = 'ISO-8859-1'; +our $fexsend = $ENV{FEXSEND} || 'fexsend'; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +# inquire default character set +# cannot use "use I18N::Langinfo" because of no windows support! +eval { + local $^W = 0; + require I18N::Langinfo; + I18N::Langinfo->import(qw'langinfo CODESET'); + $CTYPE = langinfo(CODESET()); +}; + +if ($Config{osname} =~ /^mswin/i) { + $windoof = $Config{osname}; + $ENV{HOME} = $ENV{USERPROFILE}; + $fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/fex'; + $tmpdir = $ENV{FEXTMP} || $ENV{TMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $useragent = sprintf("fexget-$version (%s %s)", + $Config{osname},$Config{archname}); + $SSL{SSL_verify_mode} = 0; + chdir $ENV{USERPROFILE}.'\Desktop'; + # open XX,'>XXXXXX';close XX; +} else { + $0 =~ s:(.*)/:: and $ENV{PATH} .= ":$1"; + $fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/.fex'; + $tmpdir = $ENV{FEXTMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $_ = `(lsb_release -d||uname -a)2>/dev/null`||''; + chomp; + s/^Description:\s+//; + $useragent = "fexget-$version ($_)"; +} + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +my $usage = < 'my_prefered_image_viewer', + '\.(avi|mp4|mov)' => 'vlc -f', + '\.pdf' => 'evince', +); + +For HTTPS you can set the environment variables: +SSLVERIFY=1 # activate server identity verification +SSLVERSION=TLSv1 # this is the default +SSLCAPATH=/etc/ssl/certs # path to trusted (root) certificates +SSLCAFILE=/etc/ssl/cert.pem # file with trusted (root) certificates +SSLCIPHERLIST=HIGH:!3DES # see http://www.openssl.org/docs/apps/ciphers.html + +You can set these environment variables also in $HOME/.fex/config.pl, as well as +the $opt_* variables, e.g.: + +$ENV{SSLVERSION} = 'TLSv1'; +${'opt_+'} = 1; +$opt_m = 200; +EOD + +if ($windoof and not @ARGV and not $ENV{PROMPT}) { + # restart with cmd.exe to have mouse cut+paste + my $cmd = "cmd /k \"$0\""; + # print "$cmd\n"; + exec $cmd; + exit; +} + +my $atype = '\.(tgz|tar|zip|7z)$'; +my $proxy = ''; +my $proxy_prefix = ''; +my $chunksize; + +our ($opt_h,$opt_v,$opt_l,$opt_d,$opt_m,$opt_z,$opt_K,$opt_o,$opt_a); +our ($opt_s,$opt_k,$opt_i,$opt_V,$opt_X,$opt_f,$opt_P,$opt_L,$opt_H); +$opt_m = $opt_h = $opt_v = $opt_l = $opt_d = $opt_K = $opt_o = $opt_a = 0; +$opt_V = $opt_X = $opt_f = $opt_L = $opt_H = 0; +${'opt_+'} = 0; +$opt_s = $opt_k = $opt_i = $opt_P = ''; +$_ = "$fexhome/config.pl"; require if -f; +getopts('hvVHlLdkzoaXf+m:s:i:K:P:') or die $usage; +$opt_k = '?KEEP' if $opt_k; + +if ($opt_m =~ /(\d+)/) { + $opt_m = $1 +} else { + $opt_m = 0 +} + +print "Version: $version\n" if $opt_V; +die $usage if $opt_h; +if ($opt_H) { + print $hints; + exit; +} + +# set SSL/TLS options +$SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); +foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) +) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); +} + +if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } +} elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! +} else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + +my $ffl = "$tmpdir/fexget"; # F*EX files list (cache) + +my @rcamel = ( +' +(_*) _ _ + \\\\/ \\/ \\ + \ __ )=* + //\\\\//\\\\ +', +' \\\\/\\\\/ +', +' //\\\\//\\\\ +'); + +# get fexlog +if ($opt_z) { + my $cmd = "$fexsend -Z"; + $cmd .= " -i $opt_i" if $opt_i; + warn "$cmd\n" if $opt_v; + exec $cmd; + die "$0: cannot run $cmd : $!\n"; +} + +if ($opt_l) { + &list; + exit; +} + +if ($opt_L) { + my $cmd = "$fexsend -L"; + $cmd .= " -i $opt_i" if $opt_i; + warn "$cmd\n" if $opt_v; + exec $cmd; + die "$0: cannot run $cmd : $!\n"; +} + +if ($opt_P) { + if ($opt_P =~ /^([\w.-]+:\d+)(:(\d+))?/) { + $proxy = $1; + $chunksize = $3 || 0; + } else { + die "$0: proxy must be: SERVER:PORT\n"; + } +} + +if ($opt_a) { + $opt_X = $opt_a; + die $usage if @ARGV; + &list; + print "\n"; + if (open $ffl,$ffl) { + while (<$ffl>) { + push @ARGV,$1 if /^\s+(\d+)/; + } + close $ffl; + } +} else { + unless (@ARGV) { + if ($windoof) { + my $url; + for (;;) { + print "download-URL: "; + chomp($url = ); + if ($url =~ /^http/) { + @ARGV = ($url); + last; + } + } + } else { + die $usage; + } + } +} + +my ($file,%files,$download,$server,$port,$fop); + +if ($opt_f) { + unless ($ENV{FEXID} or -f $ENV{HOME}.'/.fex/id') { + die "$0: no local FEXID\n"; + } + $opt_f = pop(@ARGV); + if ($opt_f =~ /^\d+$|^https?:/) { + die "$0: $opt_f is not an e-mail address\n"; + } +} + +URL: foreach my $url (@ARGV) { + + # do not overrun server + sleep 1 if $fop; + + if ($url !~ /^http/) { + unless (%files) { + open $ffl,$ffl or die "$0: no $ffl, use first: $0 -l\n"; + my $from = ''; + while (<$ffl>) { + if (/^from (.+) :$/) { + $from = $1; + } elsif (/^\s*(\d+)\)\s+\d+ MB.* (http\S+)/) { + push @{$files{all}},$2; + push @{$files{$from}},$2; + } + } + close $ffl; + } + + if ($url =~ /^(\d+)$/) { + $url = ${files{all}}[$1-1] or die "$0: unknown file number\n"; + } + } + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/.*fop/\S+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $fop = $5; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + if ($proxy) { + if ($port == 80) { $proxy_prefix = "http://$server" } + elsif ($port == 443) { $proxy_prefix = "" } + else { $proxy_prefix = "http://$server:$port" } + } + + serverconnect($server,$port); + + if ($opt_f) { + forward($url); + next; + } + + if ($opt_d) { + my @r = del($url); + $_ = shift @r; + if (/^HTTP.* 200/) { + ($file) = grep { $_ = $1 if /^X-File:\s+(.+)/ } @r; + $file = $url unless $file; + $file =~ s:.*/::; + printf "%s deleted\n",urldecode($file); + } else { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_"; + } + next; + } + + if ($opt_K) { + my @r = keep($url); + $_ = shift @r; + if (/^HTTP.* 200/) { + $file = $url; + $file =~ s:.*/::; + print "$file kept\n"; + } else { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_"; + } + next; + } + + $download = download($server,$port,$fop); + exit if $opt_s eq '-'; + unlink $download unless -s $download; + exit 2 unless -f $download; + + if ($windoof) { + print "READY\n"; + exit; + } + + if (not $opt_X and $download =~ /\.gpg$/) { + if (-t) { + print "decrypt \"$download\"? "; + $_ = ||'y'; + unless (/^[y\n]/i) { + print "keeping \"$download\"\n"; + exit; + } + } + if (system('gpg',$download) == 0) { + unlink $download; + $download =~ s/\.gpg$//; + } + } + + unless ($opt_X) { + + foreach my $a (keys %autoview) { + if ($download =~ /$a$/i and $autoview{$a}) { + printf "run \"%s %s\" [Yn] ? ",$autoview{$a},basename($download); + $_ = ||''; + system sprintf("%s %s",$autoview{$a},quote($download)) if /^y|^$/i; + next URL; + } + } + + if ($ENV{DISPLAY} and $download =~ /\.(gif|jpg|png|tiff?)$/i) { + # see also mimeopen and xdg-mime + if (my $xv = $xv || pathsearch('xv') || pathsearch('xdg-open')) { + printf "run \"%s %s\" [Yn] ? ",basename($xv),basename($download); + $_ = ||''; + system $xv,$download if /^y|^$/i; + next URL; + } + } + + if ($download =~ /$atype/) { + if ($download =~ /\.(tgz|tar.gz)$/) { extract('tar tvzf','tar xvzf') } + elsif ($download =~ /\.tar$/) { extract('tar tvf','tar xvf') } + elsif ($download =~ /\.zip$/i) { extract('unzip -l','unzip') } + elsif ($download =~ /\.7z$/i) { extract('7z l','7z x') } + else { die "$0: unknown archive \"$download\"\n" } + if ($? == 0) { + unlink $download; + } else { + die "$0: keeping \"$download\"\n"; + } + } + } + +} + +exit; + +sub extract { + my $l = shift; + my $x = shift; + my $d = $download; + my $xd = '.'; + local $_; + + if (-t and not $windoof) { + print "Files in archive:\n"; + system(split(' ',$l),$download); + $d =~ s:.*/:./:; + $d =~ s/\.[^.]+$//; + for (;;) { + $xd = inquire("extract to directory (Ctrl-C to keep archive): ",$d); + last if $xd =~ s:^(\./*)*!?$:./:; + if ($xd eq '-') { + print "keeping $download\n"; + exit; + } + if ($xd !~ s/!$//) { + if (-d $xd) { + print "directory $xd does already exist, add \"!\" to overwrite\n"; + redo; + } + unless (mkdir $xd) { + print "cannot mkdir $xd - $!\n"; + redo; + } + } + unless (chdir $xd) { + print "cannot chdir $xd - $!\n"; + redo; + } + last; + } + } + print "extracting to $xd :\n"; + system(split(' ',$x),$download); +} + +sub del { + my $url = shift; + my ($server,$port); + my $del; + my @r; + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $del = $5.'?DELETE'; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + sendheader("$server:$port","GET $del HTTP/1.1","User-Agent: $useragent"); + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + warn "<-- $_" if $opt_v; + push @r,$_; + } + die "$0: no response from fex server $server\n" unless @r; + return @r; +} + + +sub forward { + my $url = shift; + my ($server,$port); + my ($uri,$dkey,$list,$cmd,$n); + my @r; + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $uri = $5; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + sendheader( + "$server:$port", + "GET $uri?COPY HTTP/1.1", + "User-Agent: $useragent", + ); + + $_ = <$SH>; + die "$0: no reply from fex server $server\n" unless $_; + warn "<-- $_" if $opt_v; + + unless (/^HTTP.*200/) { + s/^HTTP.... \d+ //; + die "$0: $_"; + } + + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + $dkey = $1 if /^Location:.*\/(\w+)\/.+/; + warn "<-- $_" if $opt_v; + } + + $cmd = 'fexsend -l >/dev/null 2>&1'; + print "$cmd\n" if $opt_v; + system 'fexsend -l >/dev/null 2>&1'; + $list = $ENV{HOME}.'/.fex/tmp/fexlist'; + open $list,$list or die "$0: cannot open $list - $!\n"; + while (<$list>) { + if (/^\s+(\d+)\) (\w+)/ and $2 eq $dkey) { + $n = $1; + $cmd = "fexsend -b $n $opt_f"; + print "$cmd\n" if $opt_v; + system $cmd; + last; + } + } + close $list; + + if ($n) { + $cmd = "fexsend -d $n >/dev/null 2>&1"; + print "$cmd\n" if $opt_v; + system $cmd; + } else { + warn "$0: forwarding failed\n"; + } +} + + +sub keep { + my $url = shift; + my ($server,$port); + my $keep; + my (@hh,@r); + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $keep = "$5?KEEP=$opt_K"; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + push @hh,"GET $keep HTTP/1.1", + "Host: $server:$port", + "User-Agent: $useragent", + ""; + + foreach (@hh) { + warn $_,"\n" if $opt_v; + print $SH $_,"\r\n"; + } + while (<$SH>) { + s/\r//; + last if /^\n/; + push @r,$_; + } + die "$0: no response from fex server $server\n" unless @r; + grep { warn "\t$_" } @r if $opt_v; + return @r; +} + + +sub download { + my ($server,$port,$fop,$nocheck) = @_; + my ($file,$download,$ssl,$pipe,$filesize,$checkstorage); + my (@hh,@r); + my ($t0,$t1,$t2,$tt,$tm,$ts,$kBs,$b,$bt,$tb,$B,$buf); + my $length = 0; + my $seek = 0; + my $tc = 0; + local $_; + local *X; + + if ($opt_s) { + $file = $opt_s; + if ($opt_s eq '-') { + $pipe = $download = $opt_s; + } elsif (-p $opt_s or -c $opt_s) { + $download = $opt_s; + } else { + $download = $file.'.tmp'; + $seek = -s $download || 0; + } + } else { + # ask server for real file name + serverconnect($server, $port); + sendheader("$server:$port","HEAD $proxy_prefix$fop HTTP/1.1","User-Agent: $useragent"); + my $reply = $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + warn "<-- $_" if $opt_v; + unless (/^HTTP\/[\d.]+ 200/) { + s:HTTP/[\d. ]+::; + die "$0: server response: $_"; + } + while (<$SH>) { + s/\r//; + warn "<-- $_" if $opt_v; + last if /^\r?\n/; + if (/^Content-Disposition: attachment; filename="(.+)"/i) { + $file = locale(decode_utf8($1)); + $file =~ s:.*/::; + } + } + unless ($file) { + $file = $fop; + $file =~ s:.*/::; + } + $download = $file.'.tmp'; + $seek = -s $download || 0; + } + + push @hh,"GET $proxy_prefix$fop$opt_k HTTP/1.1", + "User-Agent: $useragent", + "Connection: close"; + push @hh,"Range: bytes=$seek-" if $seek; + + # HTTPS needs a new connection for actually downloading the file + serverconnect($server,$port) if $opt_P and $port == 443; + sendheader("$server:$port",@hh); + $_ = <$SH>; + die "$0: no response from fex server $server\n" unless $_; + s/\r//; + + if (/^HTTP\/[\d.]+ 2/) { + warn "<-- $_" if $opt_v; + while (<$SH>) { + s/\r//; + warn "<-- $_" if $opt_v; + last if /^\r?\n/; + if (/^Content-length:\s*(\d+)/i) { + $length = $1; + } elsif (/^X-Size: (\d+)/i) { + $filesize = $1; + } + } + } else { + s/HTTP\/[\d.]+ \d+ //; + die "$0: bad server reply: $_"; + } + + if ($pipe) { + *X = *STDOUT; + } else { + if ($opt_s and $opt_s eq $download) { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + $checkstorage = $filesize unless $nocheck; + } else { + if (-e $file and not $opt_o) { + die "$0: destination file \"$file\" does already exist\n"; + } + if ($seek) { + open X,'>>',$download or die "$0: cannot write to \"$download\" - $!\n"; + } else { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + $checkstorage = $filesize unless $nocheck; + } + } + if ($checkstorage and not $nocheck) { + $t0 = time; + my $n = 0; + print STDERR "checking storage...\r"; + $buf = '.' x M; + while (-s $download < $checkstorage) { + syswrite X,$buf or do { + unlink $download; + die "\n$0: cannot write $download - $!\n"; + }; + $n++; + print STDERR "checking storage... ".$n." MB\r"; + } + close X or do { + unlink $download; + die "\n$0: cannot write $download - $!\n"; + }; + print STDERR "checking storage... ".$n." MB ok!\n"; + unlink $download; + if (time-$t0 < 25) { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + } else { + # retry after timeout + return(download($server,$port,$fop,'nocheck')) + } + } + } + + $t0 = $t1 = $t2 = int(time); + $tb = $B = 0; + printf STDERR "resuming at byte %s\n",$seek if $seek; + print $rcamel[0] if ${'opt_+'}; + while ($B < $length and $b = read $SH,$buf,$bs) { + syswrite X,$buf; + $B += $b; + $tb += $b; + $bt += $b; + $t2 = time; + if (${'opt_+'} and int($t2*10)>$tc) { + print $rcamel[$tc%2+1]; + $tc = int($t2*10); + } + if (int($t2) > $t1) { + $kBs = int($bt/k/($t2-$t1)); + $kBs = int($tb/k/($t2-$t0)) if $kBs < 10; + $t1 = $t2; + $bt = 0; + # smaller block size is better on slow links + $bs = 4096 if $bs>4096 and $tb/($t2-$t0)<65536; + if ($tb<10*M) { + printf STDERR "%s: %d kB (%d%%) %d kB/s \r", + $download, + int(($tb+$seek)/k), + int(($tb+$seek)/($length+$seek)*100), + $kBs; + } else { + printf STDERR "%s: %d MB (%d%%) %d kB/s \r", + $download, + int(($tb+$seek)/M), + int(($tb+$seek)/($length+$seek)*100), + $kBs; + } + } + if ($opt_m) { + if ($t2 == $t0 and $B > $opt_m*k) { + print "\nsleeping...\r" if $opt_v; + sleep 1; + } else { + while ($t2 > $t0 and $tb/k/($t2-$t0) > $opt_m) { + print "\nsleeping...\r" if $opt_v; + sleep 1; + $t2 = time; + } + } + } + } + close $SH; + close X; + + print $rcamel[2] if ${'opt_+'}; + + $tt = $t2-$t0; + $tm = int($tt/60); + $ts = $tt-$tm*60; + $kBs = int($tb/k/($tt||1)); + if ($seek) { + printf STDERR "$file: %d MB, last %d MB in %d s (%d kB/s) \n", + int(($tb+$seek)/M),int($tb/M),$tt,$kBs; + } else { + printf STDERR "$file: %d MB in %d s (%d kB/s) \n", + int($tb/M),$tt,$kBs; + } + + if ($tb != $length) { + if ($windoof) { + exec "\"$0\" @ARGV"; + exit; + } else { + die "$0: $server annouced $length bytes, but only $tb bytes has been read\n"; + } + } + + unless ($pipe or -p $download or -c $download) { + my @s = stat $file if -e $file; + rename $download,$file + or die "$0: cannot rename \"$download\" to \"$file\" - $!\n"; + chmod $s[2],$file if @s; + } + + return sprintf("%s/%s",getcwd(),$file); +} + + +sub list { + my $cmd = "$fexsend -L"; + $cmd .= " -i $opt_i" if $opt_i; + if ($opt_v) { + $cmd .= " -v"; + warn "$cmd\n"; + } + open $cmd,"$cmd|" or die "$0: cannot run $cmd : $!\n"; + open $ffl,'>',$ffl or die "$0: cannot open $ffl : $!\n"; + my $n; + while (<$cmd>) { + if (/\d MB .*http/) { + $n++; + printf {$ffl} "%4d) %s",$n,$_; + s:http[^\"]*/::; + printf "%4d) %s",$n,$_; + } else { + print; + print {$ffl} $_; + } + } +} + + +sub locale { + my $string = shift; + + if ($CTYPE) { + if ($CTYPE =~ /UTF-?8/i) { + return $string; + } elsif (grep { $CTYPE =~ /^$_$/i } Encode->encodings()) { + return encode($CTYPE,$string); + } else { + return encode('ISO-8859-1',$string); + } + } + + return $string; +} + + +sub pathsearch { + my $prg = shift; + + foreach my $dir (split(':',$ENV{PATH})) { + return "$dir/$prg" if -x "$dir/$prg"; + } +} + + +sub quote { + local $_ = shift; + s/([^\w¡-ÿ_%\/=~:.,-])/\\$1/g; + return $_; +} + + +{ + my $tty; + + sub inquire { + my $prompt = shift; + my $default = shift; + local $| = 1; + local $_; + + if (defined $default) { + unless ($tty) { + chomp($tty = `tty 2>/dev/null`); + eval { local $^W; require "sys/ioctl.ph"; }; + } + + if (defined(&TIOCSTI) and $tty and open($tty,'>',$tty)) { + print $prompt; + foreach my $a (split("",$default)) { ioctl($tty,&TIOCSTI,$a) } + chomp($_ = ||''); + } else { + $prompt =~ s/([\?:=]\s*)/ [$default]$1/ or $prompt .= " [$default]"; + print $prompt; + chomp($_ = ||''); + $_ = $default unless length; + } + } else { + print $prompt; + chomp($_ = ||''); + } + + return $_; + } +} + + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/bin/fexsend b/bin/fexsend new file mode 100755 index 0000000..607d139 --- /dev/null +++ b/bin/fexsend @@ -0,0 +1,3055 @@ +#!/usr/bin/perl -w + +# CLI client for the F*EX service (send, list, delete) +# +# see also: fexget +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +use 5.006; +use strict qw'vars subs'; +use Encode; +use Config; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Getopt::Std; +use File::Basename; +use Cwd qw'abs_path'; +use Fcntl qw':flock :mode'; +use Digest::MD5 qw'md5_hex'; # encrypted ID / SID +use Time::HiRes qw'time'; +# use Smart::Comments; +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +&update if "@ARGV" eq 'UPDATE'; + +$| = 1; + +our ($SH,$fexhome,$idf,$tmpdir,$windoof,$useragent,$editor,$nomail); +our ($anonymous,$public); +our ($tpid,$frecipient); +our ($FEXID,$FEXXX,$HOME); +our (%alias); +our $chunksize = 0; +our $version = 20150120; +our $_0 = $0; +our $DEBUG; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +if ($Config{osname} =~ /^mswin/i) { + $windoof = $Config{osname}; + $HOME = $ENV{USERPROFILE}; + $fexhome = $ENV{FEXHOME} || $HOME.'\fex'; + $tmpdir = $ENV{FEXTMP} || $ENV{TEMP} || "$fexhome\\tmp"; + $idf = "$fexhome\\id"; + $editor = $ENV{EDITOR} || 'notepad.exe'; + $useragent = sprintf("fexsend-$version (%s %s)", + $Config{osname},$Config{archname}); + $SSL{SSL_verify_mode} = 0; +} else { + $0 =~ s:.*/::; + $HOME = (getpwuid($<))[7]||$ENV{HOME}; + $fexhome = $HOME.'/.fex'; + $tmpdir = $ENV{FEXTMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $editor = $ENV{EDITOR} || 'vi'; + $_ = `(lsb_release -d||uname -a)2>/dev/null`||''; + chomp; + s/^Description:\s+//; + $useragent = "fexsend-$version ($_)"; + chmod 0600,$idf; +} + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +my $from = ''; +my $to = ''; +my $id = ''; +my $skey = ''; +my $gkey = ''; +my $atype = ''; # archive type +my $fexcgi; # F*EX CGI URL +my @files; # files to send +my %AB = (); # server based address book +my ($server,$port,$sid); +my $proxy = ''; +my $proxy_prefix = ''; +my $features = ''; +my $timeout = 30; # server timeout +my $fexlist = "$tmpdir/fexlist"; +my ($usage,$hints); +my $xx = $0 =~ /^xx/; + +if ($xx) { + $usage = "usage: send file(s): xx [:slot] file...\n". + " or: send STDIN: xx [:slot] -\n". + " or: send pipe: ... | xx [:slot] \n". + " or: get file(s) or STDIN: xx [:slot] \n". + " or: get file(s) no-questions: xx [:slot] --\n". + "examples: dmesg | xx\n". + " xx project\n". + " xx --\n". + " xx :conf /etc /boot\n"; +} else { + $usage = < 'user1\@domain1.org', + 'alias2' => 'user2\@domain2.org', + 'both' => 'user1\@domain1.org,user2\@domain2.org', + 'extra' => 'extra\@special.net:-i other -K -k 30', + ); + +fexsend also respects aliases in $HOME/.mutt/aliases +The alias priority is (descending): +\$HOME/.fex/config.pl +\$HOME/.mutt/aliases +fexserver address book + +In \$HOME/.fex/config.pl you can also set the SSL* environment variables and the +\$opt_* variables, e.g.: + +\$ENV{SSLVERSION} = 'TLSv1'; +\${'opt_+'} = 1; +\$opt_m = 200; +EOD +} + +my @rcamel = ( +' + _ _ c*_) + / \/ \// + *=( __ / + \\\\/\\\\/ +', +' \\\\/\\\\/ +', +' //\\\\//\\\\ +'); + +autoflush STDERR; + +if ($windoof and not @ARGV and not $ENV{PROMPT}) { + # restart with cmd.exe to have mouse cut+paste + exec qw'cmd /k',$0,'-W'; + exit; +} + +unless (-d $fexhome) { + mkdir $fexhome,0700 or die "$0: cannot create FEXHOME $fexhome - $!\n"; +} + +unless (-d $tmpdir) { + mkdir $tmpdir,0700 or die "$0: cannot create tmpdir $tmpdir - $!\n"; +} + +my @_ARGV = @ARGV; # save arguments + +our ($opt_q,$opt_h,$opt_H,$opt_v,$opt_m,$opt_c,$opt_k,$opt_d,$opt_l,$opt_I, + $opt_K,$opt_D,$opt_u,$opt_f,$opt_a,$opt_C,$opt_R,$opt_M,$opt_L,$opt_Q, + $opt_A,$opt_i,$opt_z,$opt_Z,$opt_b,$opt_P,$opt_x,$opt_X,$opt_V,$opt_U, + $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N); + +if ($xx) { + $opt_q = 1 if @ARGV and $ARGV[-1] eq '--' and pop @ARGV or not -t STDOUT; + $opt_h = $opt_v = $opt_m = $opt_I = 0; + $opt_X = ''; + $_ = "$fexhome/config.pl"; require if -f; + getopts('hvIm:') or die $usage; +} else { + $opt_h = $opt_v = $opt_m = $opt_c = $opt_k = $opt_d = $opt_l = $opt_I = 0; + $opt_H = $opt_K = $opt_D = $opt_R = $opt_M = $opt_L = $opt_Q = $opt_A = 0; + $opt_x = $opt_o = $opt_g = $opt_V = $opt_U = $opt_F = $opt_n = $opt_q = 0; + $opt_S = $opt_N = 0; + ${'opt_@'} = ${'opt_!'} = ${'opt_+'} = ${'opt_.'} = ${'opt_/'} = 0; + ${'opt_='} = ${'opt_#'} = ''; + $opt_u = $opt_f = $opt_a = $opt_C = $opt_i = $opt_b = $opt_P = $opt_X = ''; + $opt_s = $opt_r = ''; + $_ = "$fexhome/config.pl"; require if -f; + getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:=:#:') + or die $usage; + + if ($opt_H) { + print $hints; + exit; + } + + if ($opt_V) { + print "Version: $version\n"; + } + + if ($opt_K and $opt_D) { + die "$0: you cannot use both options -D and -K\n"; + } + + if ($opt_a and $opt_c) { + die "$0: you cannot use both options -a and -c\n"; + } + + if ($opt_a and $opt_s) { + die "$0: you cannot use both options -a and -s\n"; + } + + if ($opt_g and $opt_c) { + $opt_c = 0; + } + + $opt_f ||= $opt_b; + if ($opt_f and $opt_f !~ /^\d+$/) { + die "$0: option -f needs a number, see $0 -l\n"; + } + + if ($opt_I and $opt_R) { + die "$0: you cannot use both options -I and -R\n"; + } + + # $opt_C is COMMENT command in F*EX protocol + $opt_C = + ($opt_d) ? 'DELETE': + ($opt_l or $opt_L) ? 'LIST': + ($opt_Q) ? 'CHECKQUOTA': + ($opt_S) ? 'LISTSETTINGS': + ($opt_Z) ? 'RECEIVEDLOG': + ($opt_z) ? 'SENDLOG': + (${'opt_!'}) ? 'FOPLOG': + $opt_C; + + $opt_D = + ($opt_D) ? 'DELAY': + ($opt_K) ? 'NO': + $opt_D; +} + +&get_ssl_env; + +if ($opt_h) { + female_mode("show help?") if $opt_F; + print $usage; + exit; +} + + +if ($opt_R) { + ®ister; + exit; +} + + +die $usage if $opt_m and $opt_m !~ /^\d+/; + +if ($opt_P) { + if ($opt_P =~ /^([\w.-]+:\d+)(:(\d+))?/) { + $proxy = $1; + $chunksize = $3 || 0; + } else { + die "$0: proxy must be: SERVER:PORT\n"; + } +} + +if ($FEXID = $ENV{FEXID}) { + $FEXID = decode_b64($FEXID) if $FEXID !~ /\s/; + ($fexcgi,$from,$id) = split(/\s+/,$FEXID); +} else { + if ($windoof and not -f $idf) { &init_id } + if (open $idf,$idf) { + &get_id($idf); + close $idf; + } +} + +if ($xx) { + # convert old idxx file + if ($idf and open $idf,$idf.'xx') { + &get_id($idf); + close $idf; + if (open $idf,'>>',$idf) { + print {$idf} "\n[xx]\n", + "$fexcgi\n", + "$from\n", + "$id\n"; + close $idf; + unlink $idf.'xx'; + } + } + + # special xx ID? + if ($FEXXX = $ENV{FEXXX}) { + $FEXXX = decode_b64($FEXXX) if $FEXXX !~ /\s/; + ($fexcgi,$from,$id) = split(/\s+/,$FEXXX); + } elsif (open $idf,$idf) { + while (<$idf>) { + if (/^\[xx\]/) { + $proxy = $proxy_prefix = ''; + &get_id($idf); + last; + } + } + close $idf; + } + +} else { + + # alternativ ID? + if ($opt_i) { + $proxy = $proxy_prefix = ''; + open $idf,$idf or die "$0: cannot open $idf - $!\n"; + while (<$idf>) { + if (/^\[$opt_i\]/) { + &get_id($idf); + last; + } + } + close $idf; + die "$0: no [$opt_i] in $idf\n" unless $_; + } +} + +if ($opt_I) { + if ($xx) { &show_id } + else { &init_id } + exit; +} + +if (@ARGV > 1 and $ARGV[-1] =~ /(^|\/)anonymous/) { + $fexcgi = $1 if $ARGV[-1] =~ s:(.+)/::; + die "usage: $0 [options] file FEXSERVER/anonymous\n" unless $fexcgi; + $anonymous = $from = 'anonymous'; + $sid = $id = 'ANONYMOUS'; +} elsif (@ARGV > 1 and $id eq 'PUBLIC') { + $public = $sid = $id; +} elsif (@ARGV > 1 and $ARGV[-1] =~ m{^(https?://[\w.-]+(:\d+)?/fup\?[sg]key=\w+)}) { + $fexcgi = $1; + $skey = $1 if $fexcgi =~ /skey=(\w+)/; + $gkey = $1 if $fexcgi =~ /gkey=(\w+)/; +} else { + + $fexcgi = $opt_u if $opt_u; + + if (not -e $idf and not ($fexcgi and $from and $id)) { + die "$0: no ID file $idf found, use \"fexsend -I\" to create it\n"; + } + + unless ($fexcgi) { + die "$0: no FEX URL found, use \"$0 -u URL\" or \"$0 -I\"\n"; + } + + unless ($from and $id) { + die "$0: no sender found, use \"$0 -f FROM:ID\" or \"$0 -I\"\n"; + } + + if ($fexcgi !~ /^http/) { + if ($fexcgi =~ /:443/) { $fexcgi = "https://$fexcgi" } + else { $fexcgi = "http://$fexcgi" } + } + +} + +$server = $fexcgi; + +$port = 80; +$port = 443 if $server =~ s{https://}{}; +$port = $1 if $server =~ s/:(\d+)//; + +if (0 and $port == 443) { + $opt_s and die "$0: cannot use -s with https due to stunnel bug\n"; + $opt_g and die "$0: cannot use -g with https due to stunnel bug\n"; +} + +$server =~ s{http://}{}; +$server =~ s{/.*}{}; + +# $chunksize = 4*k unless $chunksize; +$chunksize *= M; + +if ($proxy) { + if ($port == 80) { $proxy_prefix = "http://$server" } + elsif ($port != 443) { $proxy_prefix = "http://$server:$port" } +} + +# xx: special file exchange between own accounts +if ($xx) { + my $transferfile = "$tmpdir/STDFEX"; + # slot? + if ($0 eq 'xxx') { + $transferfile = "$tmpdir/xx:xxx"; + } elsif (@ARGV and $ARGV[0] =~ /^:([\w.=+-]+)$/) { + $transferfile = "$tmpdir/xx:$1"; + shift @ARGV; + } + open my $lock,'>>',$transferfile + or die "$0: cannot write $transferfile - $!\n"; + flock($lock,LOCK_EX|LOCK_NB) + or die "$0: $transferfile is locked by another process\n"; + truncate $transferfile,0; + if (not @ARGV and -t) { + &get_xx($transferfile); + } else { + &send_xx($transferfile); + } + exit; +} + +# regular fexsend + +&inquire if $windoof and not @ARGV and not + ($opt_l or $opt_L or $opt_Q or $opt_A or $opt_U or $opt_I or + $opt_f or $opt_x or $opt_N); + +if (${'opt_.'}) { + $opt_C = "!SHORTMAIL! $opt_C"; +} + +if ($opt_n or $opt_C =~ /NOMAIL|!#!/) { + $nomail = 'NOMAIL'; +} + +unless ($skey or $gkey or $anonymous) { + if (not $opt_q and ( + $opt_f||$opt_x||$opt_Q||$opt_l||$opt_L||$opt_U||$opt_z||$opt_Z||$opt_A + ||$opt_d||${'opt_!'}||${'opt_@'}) + ) { warn "Server/User: $fexcgi/$from\n" } +} + +if ($opt_V and not @ARGV) { exit } +if ($opt_f) { &forward } +elsif ($opt_x) { &modify } +elsif ($opt_N) { &renotify } +elsif ($opt_Q) { &query_quotas } +elsif ($opt_S) { &query_settings } +elsif ($opt_l or $opt_L) { &list } +elsif ($opt_U) { &show_URL } +elsif ($opt_z or $opt_Z or ${'opt_!'}) { &get_log } +elsif ($opt_A) { edit_address_book($from) } +elsif (${'opt_@'}) { &show_address_book } +elsif ($opt_d and $anonymous) { &purge } +elsif ($opt_d and $ARGV[-1] =~ /^\d+$/) { &delete } +else { &send_fex } + +exit; + + +# initialize ID file or show ID +sub init_id { + my $tag; + my $proxy = ''; + + if ($opt_I) { + $tag = shift @ARGV; + die $usage if @ARGV; + } + + $fexcgi = $from = $id = ''; + + unless (-d $fexhome) { + mkdir $fexhome,0700 or die "$0: cannot create FEXHOME $fexhome - $!\n"; + } + + # show ID + if (not $tag and open $idf,$idf) { + if ($opt_i) { + while (<$idf>) { + last if /^\[$opt_i\]/; + } + } + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + close $idf; + if ($id) { + chomp($fexcgi,$from,$id); + $FEXID = encode_b64("$fexcgi $from $id"); + if (-t STDIN) { + print "# hint: to edit the ID file $idf use \"$0 -I .\" #\n"; + print "export FEXID=$FEXID\n"; + print "history -d \$((HISTCMD-1));history -d \$((HISTCMD-1))\n"; + } else { + print "FEXID=$FEXID\n"; + } + exit; + } else { + die "$0: no ID data found\n"; + } + } + + if ($tag and $tag eq '.') { exec $ENV{EDITOR}||'vi',$idf } + + if ($tag) { print "F*EX server URL for [$tag]: " } + else { print "F*EX server URL: " } + $fexcgi = ; + $fexcgi =~ s/[\s\n]//g; + die "you MUST provide a FEX-URL!\n" unless $fexcgi; + if ($fexcgi =~ /\?/) { + $from = $1 if $fexcgi =~ /\bfrom=(.+?)(&|$)/i; + $id = $1 if $fexcgi =~ /\bid=(.+?)(&|$)/i; + $skey = $1 if $fexcgi =~ /\bskey=(.+?)(&|$)/i; + $gkey = $1 if $fexcgi =~ /\bgkey=(.+?)(&|$)/i; + $fexcgi =~ s/\?.*//; + } + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "\"$fexcgi\" is not a legal FEX-URL!\n"; + } + $fexcgi =~ s:/fup/*$::; + print "proxy address (hostname:port or empty if none): "; + $proxy = ; + $proxy =~ s/[\s\n]//g; + if ($proxy =~ /^[\w.-]+:\d+$/) { + $proxy = "!$proxy"; + } elsif ($proxy =~ /\S/) { + die "wrong proxy address format\n"; + } else { + $proxy = ""; + } + if ($proxy) { + print "proxy POST limit in MB (use 2048 if unknown): "; + $_ = ; + if (/(\d+)/) { + $proxy .= "[$1]"; + } + } + if ($skey) { + $from = 'SUBUSER'; + $id = $skey; + } elsif ($gkey) { + $from = 'GROUPMEMBER'; + $id = $gkey; + } else { + unless ($from) { + print "Your e-mail address as registered at $fexcgi: "; + $from = ; + $from =~ s/[\s\n]//g; + die "you MUST provide your e-mail address!\n" unless $from; + } + unless ($from =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "\"$from\" is not a legal e-mail address!\n"; + } + unless ($id) { + print "Your auth-ID for $from at $fexcgi: "; + $id = ; + $id =~ s/[\s\n]//g; + die "you MUST provide your ID!\n" unless $id; + } + } + if (open $idf,'>>',$idf) { + print {$idf} "\n[$tag]\n" if $tag and -s $idf; + print {$idf} "$fexcgi$proxy\n", + "$from\n", + "$id\n"; + close $idf; + print "data written to $idf\n"; + } else { + die "$0: cannot write to $idf - $!\n"; + } +} + + +sub show_id { + my ($fexcgi,$from,$id); + if (open $idf,$idf) { + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + while (<$idf>) { + if (/^\[xx\]/) { + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + } + } + close $idf; + die "$0: too few data in $idf" unless defined $id; + chomp($fexcgi); + chomp($from); + chomp($id); + $FEXXX = encode_b64("$fexcgi $from $id"); + if (-t STDIN) { + print "export FEXXX=$FEXXX\n"; + print "history -d \$((HISTCMD-1));history -d \$((HISTCMD-1))\n"; + } else { + print "FEXXX=$FEXXX\n"; + } + } else { + die "$0: cannot read $idf - $!\n"; + } +} + + +sub register { + my $fs = shift @ARGV or die $usage; + my $mail = shift @ARGV or die $usage; + my $port; + my ($server,$user,$id); + + die "$0: $idf does already exist\n" if -e $idf; + + if ($fs =~ /^https/) { + die "$0: cannot handle https at this time\n"; + } + + $fs =~ s{^http://}{}; + $fs =~ s{/.*}{}; + if ($fs =~ s/:(\d+)//) { $port = $1 } + else { $port = 80 } + + tcpconnect($fs,$port); + sendheader("$fs:$port","GET $proxy_prefix/fur?user=$mail&verify=no HTTP/1.1"); + http_response(); + + while (<$SH>) { + s/\r//; + printf "<-- $_"if $opt_v; + last if /^\s*$/; + } + + while (<$SH>) { + s/\r//; + printf "<-- $_"if $opt_v; + if (m{http://(.*)/fup\?from=(.+)&ID=(.+)}) { + $server = $1; + $user = $2; + $id = $3; + + if (open F,">$idf") { + print F "$server\n", + "$user\n", + "$id\n"; + close F; + chmod 0600,$idf; + print "user data written to $idf\n"; + print "you can now fex!\n"; + exit; + } else { + die "$0: cannot write to $idf - $!\n"; + } + } + } + + die "$0: no account data received from F*EX server\n"; + +} + + +sub send_xx { + my $transferfile = shift; + my $file = ''; + my (@r,@tar); + + $SIG{PIPE} = $SIG{INT} = sub { + unlink $transferfile; + exit 3; + }; + + if ($0 eq 'xxx') { @tar = qw'tar -cv' } + else { @tar = qw'tar -cvz' } + + if (-t) { + if ("@ARGV" eq '-') { + # store STDIN to transfer file + shelldo("cat >> $transferfile"); + } elsif (@ARGV) { + print "making tar transfer file $transferfile :\n"; + # single file? then add this directly + if (scalar @ARGV == 1) { + my ($dir,$file); + # strip path if not ending with / + if ($ARGV[0] =~ m:(.+)/(.+): and $2 !~ m:/$:) { + ($dir,$file) = ($1,$2); + chdir $dir or die "$0: $dir - $!\n"; + } else { + $file = $ARGV[0]; + } + if (-l $file) { + shelldo(@tar,qw'--dereference -f',$transferfile,$file); + } else { + shelldo(@tar,'-f',$transferfile,$file); + } + } else { + shelldo(@tar,'-f',$transferfile,@ARGV); + } + if ($?) { + unlink $transferfile; + if ($? == 2) { + die "$0: interrupted making tar transfer file\n"; + } else { + die "$0: error while making tar transfer file\n"; + } + } + } + } else { + # write input from pipe to transfer file + shelldo("cat >> $transferfile"); + } + + die "$0: no transfer file\n" unless -s $transferfile; + + serverconnect($server,$port); + query_sid($server,$port); + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + file => $transferfile, + comment => 'NOMAIL', + autodelete => $transferfile =~ /STDFEX/ ? 'NO' : 'DELAY', + ); + + # open P,'|w3m -T text/html -dump' or die "$0: w3m - $!\n"; + # print P @r; + http_response(@r); + if ($transferfile =~ /:/ and $0 ne 'xxx') { + if ("@r" =~ /\s(X-)?Location: (http.*)\s/) { + print "wget -O- $2 | tar xvzf -\n"; + } + } + + unlink $transferfile; +} + + +sub query_quotas { + my (@r,$r); + local $_; + + female_mode("query quotas?") if $opt_F; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 2/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + if (($_) = grep(/^X-Sender-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "sender quota (used): $1 ($2) MB\n"; + } else { + print "sender quota: unlimited\n"; + } + if (($_) = grep(/^X-Recipient-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "recipient quota (used): $1 ($2) MB\n"; + } else { + print "recipient quota: unlimited\n"; + } +} + + +sub query_settings { + my (@r,$r); + local $_; + + female_mode("query settings?") if $opt_F; + + if ($FEXID) { + print "ID data from \$FEXID\n"; + } elsif (-f $idf) { + print "ID data from $idf\n"; + } else { + die "$0: found no ID\n"; + } + print "server: $fexcgi\n"; + print "user: $from\n"; + print "auth-ID: $id\n"; + print "login URL: "; + &show_URL; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 2/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + if (($_) = grep(/^X-Autodelete/,@r) and /:\s+(\w+)/) { + print "autodelete: $1\n"; + } + if (($_) = grep(/^X-Default-Keep/,@r) and /(\d+)/) { + print "default keep: $1 days\n"; + } + if (($_) = grep(/^X-Default-Locale/,@r) and /:\s+(\w+)/) { + print "default locale: $1\n"; + } + if (($_) = grep(/^X-MIME/,@r) and /:\s+(\w+)/) { + print "display file with browser: $1\n"; + } + if (($_) = grep(/^X-Sender-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "sender quota (used): $1 ($2) MB\n"; + } else { + print "sender quota: unlimited\n"; + } + if (($_) = grep(/^X-Recipient-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "recipient quota (used): $1 ($2) MB\n"; + } else { + print "recipient quota: unlimited\n"; + } +} + + +# list spool +sub list { + my (@r,$r); + my ($data,$dkey,$n); + local $_; + + female_mode("list spooled files?") if $opt_F; + + if ($opt_l and $n = shift @ARGV and $n =~ /^\d+$/) { + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) (.+)/ and $1 eq $n) { + serverconnect($server,$port) unless $SH; + sendheader( + "$server:$port", + "GET $proxy_prefix/fop/$2/$2?LIST HTTP/1.1", + "User-Agent: $useragent", + ); + $_ = <$SH>||''; + s/\r//; + print "<-- $_" if $opt_v; + if (/^HTTP.* 200/) { + print "<-- $_" if $opt_v; + while (<$SH>) { + s/\r//; + if (/^\n/) { + print; + print while <$SH>; + } + } + } elsif (s:HTTP/[\d\. ]+::) { + die "$0: server response: $_"; + } else { + die "$0: no response from fex server $server\n"; + } + exit; + } + } + die "$0: file \#$n not found in fexlist\n"; + } else { + @r = formdatapost( + from => $from, + to => $opt_l ? '*' : $from, + command => $opt_C, + ); + } + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + + # list sent files + if ($opt_l) { + open $fexlist,">$fexlist" or die "$0: cannot write $fexlist - $!\n"; + foreach (@r) { + next unless /
/ or $data;
+      $data = 1;
+      last if m:
:; + if (//) { $dkey = $1 } + else { $dkey = '' } +# $_ = encode_utf8($_); + s/<.*?>//g; + if (/^(to .* :)/) { + print "\n$1\n"; + print {$fexlist} "\n$1\n"; + } elsif (m/(\d+) MB (.+)/) { + $n++; + printf "%4s) %8d MB %s\n","#$n",$1,$2; + printf {$fexlist} "%3d) %s %s\n",$n,$dkey,$2; + } + } + close $fexlist; + } + + # list received files + if ($opt_L) { + foreach (@r) { + next unless /
/ or $data;
+      $data = 1;
+      next if m:
:;
+      last if m:
:; + if (/(from .* :)/) { + print "\n$1\n"; + } + if (m{(\d+) (MB.*)
(.+)( ".*")?}) { + printf "%8d %s%s%s\n",$1,$2,$3,($5||''); + } + } + } +} + + +sub show_URL { + printf "%s/fup/%s\n",$fexcgi,encode_b64("from=$from&id=$id"); +} + + +sub get_log { + my (@r); + local $_; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + while (shift @r) {} + foreach (@r) { print "$_\n" } +} + + +sub show_address_book { + my (%AB,@r); + my $alias; + local $_; + + %AB = query_address_book($server,$port,$from); + foreach $alias (sort keys %AB) { + next if $alias eq 'ADDRESS_BOOK'; + $_ = sprintf "%s = %s (%s) # %s\n", + $alias, + $AB{$alias}, + $AB{$alias}->{options}, + $AB{$alias}->{comment}; + s/ \(\)//; + s/ \# $//; + print; + } +} + + +sub purge { + die "$0: not yet implemented\n"; +} + + +sub delete { + my ($to,$file); + + while (@ARGV) { + $opt_d = shift @ARGV; + die "$usage: $0 -d #\n" if $opt_d !~ /^\d+$/; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^to (.+\@.+) :/) { + $to = $1; + } elsif (/^\s*(\d+)\) (\w+) (.+)/ and $1 eq $opt_d) { + serverconnect($server,$port) unless $SH; + sendheader( + "$server:$port", + "GET $proxy_prefix/fop/$2/$2?DELETE HTTP/1.1", + "User-Agent: $useragent", + ); + $_ = <$SH>||''; + s/\r//; + print "<-- $_" if $opt_v; + if (/^HTTP.* 200/) { + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + print "<-- $_" if $opt_v; + if (/^X-File:.*\/(.+)/) { + printf "%s deleted\n",decode_utf8(urldecode($1)); + } + } + undef $SH; + } elsif (s:HTTP/[\d\. ]+::) { + die "$0: server response: $_"; + } else { + die "$0: no response from fex server $server\n"; + } + last; + } + } + close $fexlist; + sleep 1; # do not overrun server + } + + exit; +} + + +sub send_fex { + my @to; + my $file = ''; + my @files = (); + my ($data,$aname,$alias); + my (@r,$r); + my $ma = $HOME.'/.mutt/aliases'; + my $t0 = time; + my $transferfile; + my @transferfiles; + local $_; + + if ($from =~ /^SUBUSER|GROUPMEMBER$/) { + $to = '_'; + } else { + # look for single @ in arguments + for (my $i=1; $i<$#ARGV; $i++) { + if ($ARGV[$i] eq '@') { + $ARGV[$i] = join(',',@ARGV[$i+1 .. $#ARGV]); + $#ARGV = $i; + last; + } + } + $to = pop @ARGV or die $usage; + if ($to eq '.') { + $to = $from; + $nomail = $opt_C ||= 'NOMAIL'; + } + if ($to eq ':') { + $to = $from; + $nomail = $opt_C ||= 'NOMAIL'; + } + if ($opt_g and $to =~ /,/) { + die "$0: encryption is supported to only one recipient\n"; + } + if ($to =~ m{^https?://.*/fup\?skey=(\w+)}) { + $from = 'SUBUSER'; + $to = '_'; + $id = $1; + } + if ($to =~ m{^https?://.*/fup\?gkey=(\w+)}) { + $from = 'GROUPMEMBER'; + $to = '_'; + $id = $1; + } + } + @to = split(',',lc($to)); + + die $usage unless @ARGV or $opt_a or $opt_s; + die $usage if $opt_s and @ARGV; + + # early serverconnect necessary for X-Features info + serverconnect($server,$port); + + if ($anonymous) { + my $aok; + sendheader("$server:$port","OPTIONS FEX HTTP/1.1"); + $_ = <$SH>||''; + s/\r//; + die "$0: no response from fex server $server\n" unless $_; + print "<-- $_" if $opt_v; + if (/^HTTP.* 201/) { + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last unless /\w/; + $aok = $_ if /X-Features:.*ANONYMOUS/; + } + die "$0: no anonymous support on server $server\n" unless $aok; + } else { + die "$0: bad response from server $server : $_\n"; + } + } elsif ($public) { + } else { + + query_sid($server,$port); + + if ($from eq 'SUBUSER') { + $skey = $sid; + # die "skey=$skey\nid=$id\nsid=$sid\n"; + } + + if ($from eq 'GROUPMEMBER') { + $gkey = $sid; + } + + if ($to eq '.') { + @to = ($from); + $opt_C ||= 'NOMAIL'; + } elsif ($to =~ m:^(//.*):) { + my $xkey = $1; + if ($features =~ /XKEY/) { + @to = ($from); + $opt_C = $xkey; + } else { + die "$0: server does not support XKEY\n"; + } + } elsif (grep /^[^@]*$/,@to and not $skey and not $gkey) { + %AB = query_address_book($server,$port,$from); + if ($proxy) { + serverconnect($server,$port); + query_sid($server,$port); + } + foreach $to (@to) { + # alias in local config? + if ($alias{$to}) { + if ($alias{$to} =~ /(.+?):(.+)/) { + my $ato = $1; + my $opt = $2; + my @argv = @_ARGV; + pop @argv; + # special extra upload + system $0,split(/\s/,$opt),@argv,$ato; + $to = ''; + } else { + $to = $alias{$to}; + } + } + # alias in server address book? + elsif ($AB{$to}) { + # do not substitute alias with expanded addresses because then + # keep and autodelete options from address book will get lost + # $to = $AB{$to}; + } + # look for mutt aliases + elsif ($to !~ /@/ and $to ne $from and open $ma,$ma) { + $alias = $to; + while (<$ma>) { + if (/^alias \Q$to\E\s/i) { + chomp; + s/\s*#.*//; + s/\(.*?\)//; + s/\s+$//; + s/.*\s+//; + s/[<>]//g; + if (/,/) { + warn "$0: ignoring mutt multi-alias $to = $alias\n"; + last; + } + if (/@/) { + $alias = $_; + warn "$0: found mutt alias $to = $alias\n"; + last; + } + } + } + close $ma; + $to = $alias; + } + } + } + + $to = join(',',grep /./,@to) or exit; + warn "Server/User: $fexcgi/$from\n" unless $opt_q; + + if ( + not $skey and not $gkey + and $features =~ /CHECKRECIPIENT/ + and $opt_C !~ /^(DELETE|LIST|RECEIVEDLOG|SENDLOG|FOPLOG)$/ + ) { + checkrecipient($from,$to); + if ($proxy) { + serverconnect($server,$port); + query_sid($server,$port); + } + } + } + + if (@ARGV > 1 and not ($opt_a or $opt_s or $opt_d)) { + print "Archive name (name.tar, name.tgz or name.zip) or [ENTER] to send file for file:\n"; + $opt_a = ; + $opt_a =~ s/^\s+//; + $opt_a =~ s/\s+$//; + } + + if ($opt_s) { + $opt_s =~ s/^=//; + $opt_s =~ s:.*/::; + $opt_s =~ s/[^\w_.+-]/_/g; + @files = ($opt_s); + } elsif ($opt_a) { + $opt_a =~ s/^=//; + $opt_a =~ s:.*/::; + $opt_a =~ s/[^\w_.+-]/_/g; + if ($opt_a =~ /(.+)\.(zip|tar|tgz|7z)$/) { + $aname = $1; + $atype = $2; + } else { + die "$0: archive name must be one of ". + "$opt_a.tar $opt_a.tgz $opt_a.zip\n"; + } + # no file argument left? + unless (@ARGV) { + # use file name as archive name + push @ARGV,$aname; + $opt_a =~ s:/+$::g; + $opt_a =~ s:.*/::g; + } + foreach my $file (@ARGV) { + die "$0: cannot read $file\n" unless -l $file or -r $file; + } + $opt_a .= ".$atype" if $opt_a !~ /\.$atype$/; + $transferfile = "$tmpdir/$opt_a"; + unlink $transferfile; + print "Making fex archive ($opt_a):\n"; + if ($atype eq 'zip') { + if ($windoof) { + # if ($opt_c) { system(qw'7z a -tzip',$transferfile,@ARGV) } + # else { system(qw'7z a -tzip -mm=copy',$transferfile,@ARGV) } + system(qw'7z a -tzip',$transferfile,@ARGV); + @files = ($transferfile); + } else { + # zip archives must be < 2 GB, so split as necessary + @files = zipsplit($transferfile,@ARGV); + if (scalar(@files) == 1) { + $transferfile = $files[0]; + $transferfile =~ s/_1.zip$/.zip/; + rename $files[0],$transferfile; + @files = ($transferfile); + } + } + @transferfiles = @files; + } elsif ($atype eq '7z') { + # http://www.7-zip.org/ + my @X = (); # exclude list + if (${'opt_#'}) { + foreach my $x (split('#',${'opt_#'})) { + push @X,"-x!$x"; + } + } + if ($opt_c) { system(qw'7z a',@X,$transferfile,@ARGV) } + else { system(qw'7z a -t7z -mx0',@X,$transferfile,@ARGV) } + @transferfiles = @files = ($transferfile); + } elsif ($atype eq 'tar') { + if ($windoof) { + system(qw'7z a -ttar',$transferfile,@ARGV); + @transferfiles = @files = ($transferfile); + } else { + ## tar is now handled by formdatapost() + # system(qw'tar cvf',$transferfile,@ARGV); + @files = ($opt_a); + } + } elsif ($atype eq 'tgz') { + if ($windoof) { + die "$0: archive type tgz not available, use tar, zip or 7z\n"; + } else { + ## tgz is now handled by formdatapost() + # system(qw'tar cvzf',$transferfile,@ARGV); + @files = ($opt_a); + } + } else { + die "$0: unknown archive format \"$atype\"\n"; + } + + if (@transferfiles) { + + # error in making transfer archive? + if ($?) { + unlink @transferfiles; + die "$0: $! - aborting upload\n"; + } + + # maybe timeout, so make new connect + if (time-$t0 >= $timeout) { + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + } + + } + + } else { + + unless (@ARGV) { + if ($windoof) { + &inquire; + } else { + die $usage; + } + } + + foreach (@ARGV) { + my $file = $_; + unless ($opt_d) { + unless (-f $file) { + if (-e $file) { + die "$0: $file is not a regular file, try option -a\n" + } else { + die "$0: $file does not exist\n"; + } + } + die "$0: cannot read $file\n" unless -r $file; + } + push @files,$file; + } + } + + if (${'opt_/'}) { + foreach my $file (@files) { + my @s = stat($file); + unless (@s and ($s[2] & S_IROTH) and -r $file) { + die "$0: $file is not world readable\n"; + } + } + } + + foreach my $file (@files) { + sleep 1; # do not overrun server! + unless (-s $file or $opt_d or $opt_a or $opt_s) { + die "$0: cannot send empty file $file\n"; + } + female_mode("send file $file?") if $opt_F; + @r = formdatapost( + from => $from, + to => $to, + replyto => $opt_r, + id => $sid, + file => $file, + keep => $opt_k, + comment => $opt_C, + autodelete => $opt_D, + ); + + if (not @r or not grep /\w/,@r) { + die "$0: no response from server\n"; + } + if (($r) = grep /^ERROR:/,@r) { + if ($anonymous and $r =~ /purge it/) { + die "$0: file is already on server for $to - use another anonymous recipent\n"; + } else { + $r =~ s/.*?:\s*//; + $r =~ s/<.+?>//g; + die "$0: server error: $r\n"; + } + } + if (($r) = grep /

\Q$file/,@r) { + $r =~ s/<.+?>//g; + print "$r\n"; + } + if ($opt_a !~ /^afex_\d+\.tar$/ and $file !~ /afex_\d+\.tar$/) { + # print grep({s/^(X-Recipient:.*\((.+)\))/Parameters: $2\n/i} @r); + my $nonot = 0; + my ($recipient,$location); + foreach (@r) { + if (/^(X-)?(Recipient.*)/i) { + $recipient = $2; + if (/notification=no/i) { $nonot = 1 } + else { $nonot = 0 } + } + if (/^(X-)?(Location.*)/i) { + $location = $2; + if ($from eq $to or $from =~ /^\Q$to\E@/i + or $nomail or $anonymous or $nonot) { + print "$recipient\n"; + print "$location\n"; + } + } + } + } + } + + # delete transfer tmp file + unlink $transferfile if $transferfile; +} + + +sub forward { + my (@r); + my ($to,$n,$dkey,$file,$req); + my $status = 1; + local $_; + + # look for single @ in arguments + for (my $i=1; $i<$#ARGV; $i++) { + if ($ARGV[$i] eq '@') { + $ARGV[$i] = join(',',@ARGV[$i+1 .. $#ARGV]); + $#ARGV = $i; + last; + } + } + + # if ($windoof and not @ARGV) { &inquire } + $to = pop @ARGV or die $usage; + $to = $from if $to eq '.'; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_f) { + $n = $1; + $dkey = $2; + $file = $3; + if ($file =~ s/ "(.*)"$//) { + $opt_C ||= $1 if $1 ne 'NOMAIL'; + } + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_f not found in fexlist\n"; + } + + female_mode("forward file #$opt_f?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&to=$to&dkey=$dkey&command=FORWARD"; + $req .= "&comment=$opt_C" if $opt_C; + $req .= "&keep=$opt_k" if $opt_k; + $req .= "&autodelete=$opt_D" if $opt_D; + $req .= "&$opt_X" if $opt_X; + $req .= " HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + if ($opt_v) { + print; + $status = 0 if /\Q"$file"/; + } else { + if (/\Q"$file"/) { + print; + $status = 0; + } + } + } + + if ($status) { + die "$0: server failed, rerun command with option -v\n"; + } + exit; +} + + +sub renotify { + my (@r); + my ($to,$n,$dkey,$file,$req,$recipient); + local $_; + + die $usage if @ARGV; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_N) { + $n = $1; + $dkey = $2; + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_N not found in fexlist\n"; + } + + female_mode("resend notification for file #$opt_N?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&dkey=$dkey&command=RENOTIFY" + ." HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^\s*$/; + if (/^X-Notify: (.+)\/(.+)\/(.+)/) { + $recipient = $1; + $file = $3; + } + } + + if ($file) { + print "notification e-mail for $file has been resent to $recipient\n"; + } else { + if ($opt_v) { + die "$0: server failed\n"; + } else { + die "$0: server failed, rerun command with option -v\n"; + } + } + + exit; +} + + +sub modify { + my (@r); + my ($n,$dkey,$file,$req); + local $_; + + die $usage if @ARGV; + die $usage unless $opt_C or $opt_k or $opt_D; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_x) { + $n = $1; + $dkey = $2; + $file = $3; + $file =~ s/ "(.*)"$//; + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_x not found in fexlist\n"; + } + + female_mode("modify file #$opt_x?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&dkey=$dkey&command=MODIFY"; + $req .= "&comment=$opt_C" if $opt_C; + $req .= "&keep=$opt_k" if $opt_k; + $req .= "&autodelete=$opt_D" if $opt_D; + $req .= " HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + if ($opt_v) { + print "<-- $_"; + } else { + print if /\Q$file/; + } + } + + exit; +} + + +sub get_xx { + my $transferfile = shift; + my $ft = ''; + local $_; + + # get transfer file from FEX server + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port); + } + + xxget($from,$sid,$transferfile); + + # empty file? + unless (-s $transferfile) { + unlink $transferfile; + exit; + } + + # no further processing if delivering to pipe + exec 'cat',$transferfile unless -t STDOUT; + + if ($ft = `file $transferfile 2>/dev/null`) { + if ($ft =~ /compressed/) { + rename $transferfile,"$transferfile.gz"; + shelldo(ws("gunzip $transferfile.gz")); + } + $ft = `file $transferfile`; + } + # file command failed, so we look ourself into the file... + elsif (open $transferfile,$transferfile) { + read $transferfile,$_,4; + close $transferfile; + # gzip magic? + if (/\x1F\x8B\x08\x00/) { + rename $transferfile,"$transferfile.gz"; + shelldo(ws("gunzip $transferfile.gz")); + # assuming tar + $ft = 'tar archive'; + } + } + if ($ft =~ /tar archive/) { + rename $transferfile,"$transferfile.tar"; + $transferfile .= '.tar'; + if ($opt_q) { + $_ = 'y'; + } else { + print "Files in transfer-container:\n\n"; + shelldo(ws("tar tvf $transferfile")); + print "\nExtract these files? [Yn] "; + $_ = ; + } + if (/^n/i) { + print "keeping $transferfile\n"; + } else { + system("tar xvf $transferfile && rm $transferfile"); + die "$0: error while untaring, see $transferfile\n" if -f $transferfile; + } + } else { + exec 'cat',$transferfile; + } + exit; +} + + +sub formdatapost { + my %P = @_; + my ($boundary,$filename,$filesize,$length,$buf,$file,$fpsize,$resume,$seek); + my ($flink); + my (@hh,@hb,@r,@pv,$to); + my ($bytes,$t,$bt); + my ($t0,$t1,$t2,$tt,$tc); + my $bs = 2**16; # blocksize for reading and sending file + my $fileid = int(time); + my $chunk = 0; + my $connection = ''; + my $pct = ''; + my ($tar,$aname,$atype,$tarlist,$tarerror,$location,$transferfile); + local $_; + + if (defined($file = $P{file})) { + + $to = $AB{$P{to}} || $P{to}; # for gpg + + # special file: stream from STDIN + if ($opt_s) { + $filename = encode_utf8($file); + $filesize = -1; + } + + # compression? + if ($opt_c) { + my ($if,$of); + $if = $file; + $if =~ s/([^_\w\.\-])/\\$1/g; + $transferfile = $tmpdir . '/' . basename($file) . '.gz'; + $of = $transferfile; + $of =~ s/([^_\w\.\-])/\\$1/g; + shelldo("gzip <$if>$of"); + $filesize = -s $transferfile; + die "$0: cannot gzip $file\n" unless $filesize; + $file = $transferfile; + } + + # special file: tar-on-the-fly + if (not $windoof and $opt_a and $file =~ /(.+)\.(tar|tgz)$/) { + $aname = $1; + $atype = $2; + $tarlist = "$tmpdir/$aname.list"; + $tarerror = "$tmpdir/$aname.error"; + $tar = 'tar -cv'; + $tar .= 'z' if $atype eq 'tgz'; + if (`tar --help 2>/dev/null` =~ /--index-file/) { + $tar .= " --index-file=$tarlist -f-"; + } else { + $tar .= " -f-"; + } + if (${'opt_#'}) { + foreach my $x (split('#',${'opt_#'})) { + $tar .= " --exclude=$x"; + } + } + foreach (@ARGV) { + $file = $_; + $file =~ s/([^\w\-\@\#%,.=+~_:])/\\$1/g; + $tar .= ' '.$file; + } + # print "calculating archive size... "; + open $tar,"$tar 2>$tarerror|" or die "$0: cannot run tar - $!\n"; + $t0 = int(time) if -t STDOUT; + while ($b = read $tar,$_,$bs) { + $filesize += $b; + if ($t0) { + $t1 = int(time); + if ($t1>$t0) { + printf "Archive size: %d MB\r",int($filesize/M); + $t0 = $t1; + } + } + } + printf "Archive size: %d MB\n",int($filesize/M) if -t STDOUT; + unless (close $tar) { + $_ = ''; + if (open $tarerror,$tarerror) { + local $/; + $_ = <$tarerror>; + close $tarerror; + } + unlink $tarlist,$tarerror; + die "$0: tar error:\n$_"; + } + $file = "$aname.$atype"; + $filename = encode_utf8($file); + undef $SH; # force reconnect (timeout!) + } + + # single file + else { + $filename = encode_utf8(${'opt_='} || $file); + + if ($windoof) { + $filename =~ s/^[a-z]://; + $filename =~ s/.*\\//; + } + $filename =~ s:.*/::; + $filename =~ s:[\r\n]+: :g; + if ($opt_d) { + $filesize = 0; + } elsif (not $opt_g and not $opt_s) { + $filesize = -s $file or die "$0: $file is empty or not readable\n"; + } + } + + $filename .= '.gpg' if $opt_g; + + unless ($opt_d) { + if ($opt_g) { + $filesize = -1; + $fileid = int(time); + } else { + if ($opt_a) { + $fileid = md5_hex(fmd(@ARGV)); + } else { + $fileid = fileid($file); + } + } + } + + } else { + $file = $filename = ''; + $filesize = 0; + } + + FORMDATAPOST: + + @hh = (); # HTTP header + @hb = (); # HTTP body + @r = (); + $seek = 0; + $resume = ''; + $chunk++; + + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + } + + $P{id} = $sid; # ugly hack! + + # ask server if this file has been already sent + if ($file and not $xx and not + ($opt_s or $opt_g or $opt_o or $opt_d or $opt_l or $opt_L or ${'opt_/'})) + { + ($seek,$location) = query_file($server,$port,$frecipient||$P{to},$P{from}, + $P{id},$filename,$fileid); + if ($filesize == $seek) { + print "Location: $location\n" if $location and $nomail; + warn "$0: $file has been already transferred\n"; + return $file; + } elsif ($seek and $seek < $filesize) { + $resume = " (resuming at byte $seek)"; + } elsif ($filesize <= $seek) { + $seek = 0; + } + if ($proxy) { + sleep 1; # do not overrun proxy + serverconnect($server,$port); + } + } + + # file part size + if ($chunksize and $proxy and $port != 443 + and $filesize - $seek > $chunksize - $bs) { + if ($features !~ /MULTIPOST/) { + die sprintf("$0: server does not support chunked multi-POST needed for" + ." files > %d MB via proxy\n",$chunksize/M); + } + $opt_o = 0; # no overwriting mode for next chunks + $fpsize = $chunksize - $bs; + } else { + $fpsize = $filesize - $seek; + } + + $boundary = randstring(48); + + $P{seek} = $seek; + $P{filesize} = $filesize; + + # send HTTP POST variables + if ($skey) { + $P{skey} = $skey; + @pv = qw'from to skey keep autodelete comment seek filesize'; + } elsif ($gkey) { + $P{gkey} = $gkey; + @pv = qw'from to gkey keep autodelete comment seek filesize'; + } else { + @pv = qw'from to id replyto keep autodelete comment command seek filesize'; + } + foreach my $v (@pv) { + if ($P{$v}) { + my $name = uc($v); + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"$name\""; + push @hb,""; + push @hb,encode_utf8($P{$v}); + } + } + + # at last, POST the file + if ($file) { + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"FILE\"; filename=\"$filename\""; + unless ($opt_d) { + if ($opt_M) { push @hb,"Content-Type: application/x-mime" } + else { push @hb,"Content-Type: application/octet-stream" } + if (${'opt_/'}) { + $flink = abs_path($file); + push @hb,"Content-Location: $flink"; + } else { + # push @hb,"Content-Length: " . ((-s $file||0) - $seek); # optional header! + push @hb,"Content-Length: $fpsize"; # optional header! NOT filesize! + push @hb,"X-File-ID: $fileid"; + } + push @hb,""; + } + push @hb,""; + # prevent proxy chunked mode reply + $connection = "close"; + } + + push @hb,"--$boundary--"; + + if ($fpsize < 0) { + $length = $fpsize; + } else { + $length = length(join('',@hb)) + scalar(@hb)*2 + $fpsize; + } + + if ($file and not $opt_d) { + if ($flink) { $hb[-2] = $flink } + else { $hb[-2] = '(file content)' } + } + # any other extra URL arguments + my $opt_X = ''; + $opt_X = "?$::opt_X" if $::opt_X and $file; + + # HTTP header + push @hh,"POST $proxy_prefix/fup$opt_X HTTP/1.1"; + push @hh,"Host: $server:$port"; + push @hh,"User-Agent: $useragent"; + push @hh,"Content-Length: $length"; + push @hh,"Content-Type: multipart/form-data; boundary=$boundary"; + push @hh,"Connection: $connection" if $connection; + push @hh,''; + + if ($opt_v) { + print "--> $_\n" foreach (@hh,@hb); + } + + $SIG{PIPE} = \&sigpipehandler; +# foreach $sig (keys %SIG) { +# eval '$SIG{$sig} = sub { print "\n!!! SIGNAL '.$sig.' !!!\n"; exit; }'; +# } + + if ($file) { + pop @hb; + pop @hb unless $flink; + nvtsend(@hh,@hb) or do { + warn "$0: server has closed the connection, reconnecting...\n"; + sleep 3; + goto FORMDATAPOST; # necessary: new $sid ==> new @hh + }; + + unless ($opt_d or $flink) { + + $t0 = $t2 = int(time); + $tt = $t0-1; + $t1 = 0; + $tc = 0; + + if ($opt_s) { + if ($opt_g) { + open $file,"gpg -e -r $to|" or die "$0: cannot run gpg - $!\n"; + } else { + open $file,'>&=STDIN' or die "$0: cannot open STDIN - $!\n"; + } + } elsif ($tar) { + if ($opt_g) { + open $file,"$tar|gpg -e -r $to|" or die "$0: cannot run tar&gpg - $!\n"; + } else { + open $file,"$tar|" or die "$0: cannot run tar - $!\n"; + } + if (-t STDOUT) { + $tpid = fork(); + if (defined $tpid and $tpid == 0) { + sleep 1; + if (open $tarlist,$tarlist) { + # print "\n$tar|\n"; system "ls -l $tarlist"; + while ($tarlist) { + while (<$tarlist>) { + print ' 'x(length($file)+40),"\r",$_; + } + sleep 1; + } + } + exit; + } + $SIG{CHLD} = 'IGNORE'; + } + if ($seek) { + print "Fast forward to byte $seek (resuming)\n"; + readahead($file,$seek); + } + } else { + if ($opt_g) { + my $fileq = $file; + $fileq =~ s/([^\w\-\@\#%,.=+~_:])/\\$1/g; + open $file,"gpg -e -r $to <$fileq|" or die "$0: cannot run gpg - $!\n"; + } else { + open $file,$file or die "$0: cannot read $file - $!\n"; + seek $file,$seek,0; + } + binmode $file; + } + + $bytes = 0; + autoflush $SH 0; + + print $rcamel[0] if ${'opt_+'}; + + while (my $b = read $file,$buf,$bs) { + print {$SH} $buf or &sigpipehandler; + $bytes += $b; + if ($filesize > 0 and $bytes+$seek > $filesize) { + die "$0: $file filesize has grown while uploading\n"; + } + $bt += $b; + $t2 = time; + if (${'opt_+'} and int($t2*10)>$tc) { + print $rcamel[$tc%2+1]; + $tc = int($t2*10); + } + if (not $opt_q and -t STDOUT and int($t2)>$t1) { + &sigpipehandler unless $SH->connected; + # smaller block size is better on slow links + $bs = 4096 if $t1 and $bs>4096 and $bytes/($t2-$t0)<65536; + if ($filesize > 0) { + $pct = sprintf "(%d%%)",int(($bytes+$seek)/$filesize*100); + } + if ($bytes>2*M and $bs>4096) { + printf STDERR "%s: %d MB of %d MB %s %d kB/s \r", + $opt_s||$opt_a||$file, + int(($bytes+$seek)/M), + int($filesize/M), + $pct, + int($bt/k/($t2-$tt)); + } else { + printf STDERR "%s: %d kB of %d MB %s %d kB/s \r", + $opt_s||$opt_a||$file, + int(($bytes+$seek)/k), + int($filesize/M), + $pct, + int($bt/k/($t2-$tt)); + } + $t1 = $t2; + # time window for transfer rate calculation + if ($t2-$tt>10) { + $bt = 0; + $tt = $t2; + } + } + last if $filesize > 0 and $bytes >= $fpsize; + sleep 1 while ($opt_m and $bytes/k/(time-$t0||1) > $opt_m); + } + close $file; # or die "$0: error while reading $file - $!\n"; + $tt = ($t2-$t0)||1; + + print $rcamel[2] if ${'opt_+'}; + + # terminate tar verbose output job + if ($tpid) { + sleep 2; + kill 9,$tpid; + unlink $tarlist; + } + + unless ($opt_q) { + if (not $chunksize and $bytes+$seek < $filesize) { + die "$0: $file filesize has shrunk while uploading\n"; + } + + if ($seek or $chunksize and $chunksize < $filesize) { + if ($fpsize>2*M) { + printf STDERR "%s: %d MB in %d s (%d kB/s)", + $opt_s||$opt_a||$file, + int($bytes/M), + $tt, + int($bytes/k/$tt); + if ($bytes+$seek == $filesize) { + printf STDERR ", total %d MB\n",int($filesize/M); + } else { + printf STDERR ", chunk #%d : %d MB\n", + $chunk,int(($bytes+$seek)/M); + } + } else { + printf STDERR "%s: %d kB in %d s (%d kB/s)", + $opt_s||$opt_a||$file, + int($bytes/k), + $tt, + int($bytes/k/$tt); + if ($bytes+$seek == $filesize) { + printf STDERR ", total %d kB\n",int($filesize/k); + } else { + printf STDERR ", chunk #%d : %d kB\n", + $chunk,int(($bytes+$seek)/k); + } + } + } else { + if ($bytes>2*M) { + printf STDERR "%s: %d MB in %d s (%d kB/s) \n", + $opt_s||$opt_a||$file, + int($bytes/M), + $tt, + int($bytes/k/$tt); + } else { + printf STDERR "%s: %d kB in %d s (%d kB/s) \n", + $opt_s||$opt_a||$file, + int($bytes/k), + $tt, + int($bytes/k/$tt); + } + } + + if (-t STDOUT and not ($opt_s or $opt_g)) { + print STDERR "waiting for server ok..." + } + } + } + + autoflush $SH 1; + print {$SH} "\r\n--$boundary--\r\n"; + + # special handling of streaming file because of stunnel tcp shutdown bug + if ($opt_s or $opt_g) { + close $SH; + sleep 1; + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + ($seek,$location) = query_file($server,$port,$P{to},$P{from},$sid, + $filename,$fileid); + if ($seek != $bytes) { + die "$0: streamed $bytes bytes but server received $seek bytes\n"; + } + return "X-Location: $location\n"; + } + + if ($flink) { + $bytes = -s $flink; + if ($bytes>2*M) { + printf STDERR "%s: %d MB\n",$flink,int($bytes/M); + } else { + printf STDERR "%s: %d kB\n",$flink,int($bytes/k); + } + } + } else { + autoflush $SH 1; + nvtsend(@hh,@hb); + } + + # SuSe: Can't locate object method "BINMODE" via package "IO::Socket::SSL::SSL_HANDLE" + # binmode $SH,':utf8'; + + if (not $opt_q and $file and -t STDOUT) { + print STDERR "\r \r"; + } + while (<$SH>) { + s/[\r\n]+//; + print "<-- $_\n" if $opt_v; + last if @r and $r[0] =~ / 204 / and /^$/ or /<\/html>/i; + push @r,decode_utf8($_); + } + + if ($file) { + close $SH; + undef $SH; + if ($proxy and $fpsize+$seek < $filesize) { + goto FORMDATAPOST; + } + } + + return @r; +} + + +sub randstring { + my $n = shift; + my @rc = ('A'..'Z','a'..'z',0..9 ); + my $rn = @rc; + my $rs; + + for (1..$n) { $rs .= $rc[int(rand($rn))] }; + return $rs; +} + + +sub zipsplit { + my $zipbase = shift; + my @files = @_; + my @zipfiles = (); + my $file; + my ($zsize,$size,$n); + + $zipbase =~ s/\.zip$//; + map { s/([^_\w\+\-\.])/\\$1/g } @files; + + open my $ff,"find @files|" or die "$0: cannot search for @_ - $!\n"; + @files = (); + + zipfile: for (;;) { + $n++; + if ($n eq 10) { + unlink @zipfiles; + die "$0: too many zip-archives\n"; + } + $zsize = 0; + while ($file = <$ff>) { + chomp $file; + # next if -l $file or not -f $file; + next unless -f $file; + $size = -s $file; + if ($size > 2147480000) { + unlink @zipfiles; + die "$0: $file too big for zip\n"; + } + if ($zsize + $size > 2147000000) { + push @zipfiles,zip($zipbase.'_'.$n.'.zip',@files); + @files = ($file); + next zipfile; + } else { + push @files,$file; + $zsize += $size; + } + } + close $ff; + last; + } + push @zipfiles,zip($zipbase.'_'.$n.'.zip',@files); + return @zipfiles; +} + + +sub zip { + no strict 'refs'; + my $zip = shift; + my $cmd; + local $_; + + unlink $zip; + # if ($opt_c) { $cmd = "zip -@ $zip" } + # else { $cmd = "zip -0 -@ $zip" } + $cmd = "zip -@ $zip"; + if (${'opt_#'}) { + ${'opt_#'} =~ s/#/ /g; + $cmd .= " -x ".${'opt_#'}; + } + print $cmd,"\n" if $opt_v; + open $cmd,"|$cmd" or die "$0: cannot create $zip - $!\n"; + foreach (@_) { + print {$cmd} $_."\n"; + print " $_\n" if $opt_v; + } + close $cmd or die "$0: zip failed - $!\n"; + + return $zip; +} + + +sub getline { + my $file = shift; + local $_; + + while (<$file>) { + chomp; + s/^#.*//; + s/\s+#.*//; + s/^\s+//; + s/\s+$//; + return $_ if length($_); + } + return ''; +} + + +sub query_file { + my ($server,$port,$to,$from,$id,$filename,$fileid) = @_; + my $seek = 0; + my $qfileid = ''; + my ($head,$location); + my ($response,$fexsrv); + local $_; + + $to =~ s/,.*//; + $to =~ s/:\w+=.*//; + $to = $AB{$to} if $AB{$to}; + $filename =~ s/([^_=:,;<>()+.\w\-])/'%'.uc(unpack("H2",$1))/ge; # urlencode + if ($skey) { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??SKEY=$id HTTP/1.1"; + } elsif ($gkey) { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??GKEY=$id HTTP/1.1"; + } else { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??ID=$id HTTP/1.1"; + } + sendheader("$server:$port",$head); + $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + $response = $_; + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $fexsrv = $_ if /^(Server: fexsrv|X-Features:)/; + last if /^\s*$/; + } + die "$0: no fexserver at $server:$port\n" unless $fexsrv; + die "$0: server response: $response"; + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^$/; + if (/^Content-Length:\s+(\d+)/) { $seek = $1 } + if (/^X-File-ID:\s+(.+)/) { $qfileid = $1 } + if (/^X-Features:\s+(.+)/) { $features = $1 } + if (/^X-Location:\s+(.+)/) { $location = $1 } + } + + # return true seek only if file is identified + $seek = 0 if $qfileid and $qfileid ne $fileid; + + return ($seek,$location); +} + + +sub edit_address_book { + my ($user) = @_; + my $alias; + my $ab = "$fexhome/ADDRESS_BOOK"; + my (%AB,@r); + local $_; + + die "$0: address book not available for subusers\n" if $skey; + die "$0: address book not available for group members\n" if $gkey; + + female_mode("edit your address book?") if $opt_F; + + %AB = query_address_book($server,$port,$user); + if ($AB{ADDRESS_BOOK} !~ /\w/) { + $AB{ADDRESS_BOOK} = + "# Format: alias e-mail-address # Comment\n". + "# Example:\n". + "framstag framstag\@rus.uni-stuttgart.de\n"; + } + open $ab,">$ab" or die "$0: cannot write to $ab - $!\n"; + print {$ab} $AB{ADDRESS_BOOK}; + close $ab; + + system $editor,$ab; + exit unless -s $ab; + + $opt_o = $opt_A; + + serverconnect($server,$port); + query_sid($server,$port); + + @r = formdatapost( + from => $user, + to => $user, + id => $sid, + file => $ab, + ); + + unlink $ab,$ab.'~'; +} + + +sub query_address_book { + my ($server,$port,$user) = @_; + my ($req,$alias,$address,$options,$comment,$cl,$ab,$b); + my %AB; + local $_; + + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port); + } + + $req = "GET $proxy_prefix/fop/$user/$user/ADDRESS_BOOK?ID=$sid HTTP/1.1"; + sendheader("$server:$port",$req); + $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + unless (/^HTTP.* 200/) { + if (/^HTTP.* 404/) { + while (<$SH>) { last if /^\r?\n/ } + return; + } else { + # s:HTTP/[\d\. ]+::; + # die "$0: server response: $_"; + close $SH; + undef $SH; + return (); + } + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^$/; + $cl = $1 if /^Content-Length: (\d+)/; + } + + if ($cl) { + while (<$SH>) { + $b += length; + $ab .= $_; + s/[\r\n]//g; + s/^\s+//; + s/\s+$//; + print "<-- $_\n" if $opt_v; + s/\s*#\s*(.*)//; + if ($_) { + $comment = $1||''; + ($alias,$address,$options) = split; + if ($address) { + if ($options) { $options =~ s/[()]//g } + else { $options = '' } + $AB{$alias} = $address; + $AB{$alias}->{options} = $options||''; + $AB{$alias}->{comment} = $comment||''; + if ($options and $options =~ /keep=(\d+)/i) { + $AB{$alias}->{keep} = $1; + } + if ($options and $options =~ /autodelete=(\w+)/i) { + $AB{$alias}->{autodelete} = $1; + } + } + } + last if $b >= $cl; + } + } + + $AB{ADDRESS_BOOK} = $ab; + + return %AB; +} + + +# sets global $sid $features $timeout # ugly hack! :-} +sub query_sid { + my ($server,$port) = @_; + my ($req,$fexsrv); + local $_; + + $sid = $id; + + if ($port eq 443) { + return if $features; # early return if we know enough + $req = "OPTIONS FEX HTTP/1.1"; + } elsif ($proxy) { + return if $features; # early return if we know enough + $req = "GET $proxy_prefix/SID HTTP/1.1"; + } else { + $req = "GET SID HTTP/1.1"; + } + + sendheader("$server:$port",$req,"User-Agent: $useragent"); + $_ = <$SH>; + unless (defined $_ and /\w/) { + print "\n" if $opt_v; + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + + if (/^HTTP.* [25]0[01] /) { + if (not $proxy and $port ne 443 and /^HTTP.* 201 (.+)/) { + $sid = 'MD5H:'.md5_hex($id.$1); + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $features = $1 if /^X-Features: (.+)/; + $timeout = $1 if /^X-Timeout: (\d+)/; + last if /^\n/; + } + } elsif (/^HTTP.* 301 /) { + while (<$SH>) { last if /Location/ } + die "$0: cannot use $server:$port because server has a redirection to\n".$_; + } else { + # no SID support - perhaps transparent web proxy? + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $fexsrv = $_ if /^(Server: fexsrv|X-Features:)/; + last if /^\s*$/; + } + die "$0: no fexserver at $server:$port\n" unless $fexsrv; + serverconnect($server,$port); + $sid = $id; + } + + # warn "proxy: $proxy\n"; + if ($proxy) { + serverconnect($server,$port); + $sid = $id; + } + +} + + +sub xxget { + my ($from,$id,$save) = @_; + my $bs = 4096; + my $xx = $save; + my ($url,$B,$b,$t0,$t1,$cl); + my ($ts,$tso); + local $_; + + $xx =~ s:.*/::; + $url = "$proxy_prefix/fop/$from/$from/$xx?ID=$id"; + + sendheader("$server:$port","GET $url HTTP/1.0","User-Agent: $useragent"); + http_response(); + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $cl = $1 if /^Content-Length:\s(\d+)/; + # $ft = $1 if /^X-File-Type:\s(.+)/; + last if /^$/; + } + + die "$0: no Content-Length in server-reply\n" unless $cl; + + open F,">$save" or die "$0: cannot write to $save - $!\n"; + binmode F; + + $t0 = $t1 = int(time); + $tso = ''; + + while ($b = read($SH,$_,$bs)) { + $B += $b; + print F; + if (int(time) > $t1) { + $t1 = int(time); + $ts = ts($B,$cl); + if ($ts ne $tso) { + print STDERR $ts,"\r"; + $tso = $ts; + } + } + sleep 1 while ($opt_m and $B/k/(time-$t0||1) > $opt_m); + } + + print STDERR ts($B,$cl),"\n"; + close F; +} + + +# transfer status +sub ts { + my ($b,$tb) = @_; + return sprintf("transferred: %d MB (%d%%)",int($b/M),int($b/$tb*100)); +} + + +sub sigpipehandler { + $SIG{ALRM} = sub { }; + if (fileno $SH) { + alarm(1); + @_ = <$SH>; + alarm(0); + kill 9,$tpid if $tpid; + if (@_ and $opt_v) { + die "\n$0: ($$) server error: @_\n"; + } + if (@_ and $_[0] =~ /^HTTP.* \d+ (.*)/) { + die "\n$0: server error: $1\n"; + } + } + $timeout *= 2; + warn "\n$0: connection to $server died\n"; + warn "retrying after $timeout seconds...\n"; + sleep $timeout; + if ($windoof) { exec $^X,$0,@_ARGV } + else { exec $_0,@_ARGV } + die $!; +} + + +sub checkrecipient { + my ($from,$to) = @_; + my @r; + local $_; + + @r = formdatapost( + from => $from, + to => $to, + id => $sid, + command => 'CHECKRECIPIENT', + ); + + $_ = shift @r or die "$0: no reply from server\n"; + + if (/ 2\d\d /) { + foreach (@r) { + last if /^$/; + if (s/X-(Recipient: .+)/$1\n/) { + s/autodelete=\w+/autodelete=$opt_D/ if $opt_D; + s/keep=\d+/keep=$opt_k/ if $opt_k; + print; + $frecipient ||= (split)[1]; + } + } + } else { + http_response($_,@r); + } +} + + +# get ID data from ID file +sub get_id { + my $idf = shift; + + $fexcgi = getline($idf) || die "$0: no FEX-URL in $idf\n"; + $from = getline($idf) || die "$0: no FROM in $idf\n"; + $id = getline($idf) || die "$0: no ID in $idf\n"; + if ($fexcgi =~ s/!([\w.-]+:\d+)(:(\d+))?//) { + $proxy = $1; + $chunksize = $3 || 0; + } + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "$0: illegal FEX-URL \"$fexcgi\" in $idf\n"; + } + unless ($from =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "$0: illegal FROM \"$from\" in $idf\n"; + } + $fexcgi =~ s:/+$::; +} + + +# for windows +sub inquire { + my ($file,$to); + for (;;) { + print "file to send: "; + chomp($file = ); + $file =~ s/^\"//; + $file =~ s/\"$//; + last if -e $file; + warn "$file does not exist\n"; + } + print "recipient (e-mail address): "; + chomp($to = ); + die $usage unless $to; + unless ($opt_n) { + print "comment: "; + chomp($opt_C = ); + } + @ARGV = ($file,$to); +} + + +sub shelldo { + if (system(@_) < 0) { die "failed: @_\n" } +} + + +# emulate seek on a pipe +sub readahead { + my $fh = shift; # filehandle + my $ba = shift; # bytes ahead + my $bs = 2**16; + my $s = 0; + my $n; + local $_; + + while ($s < $ba) { + $n = $ba-$s; + $n = $bs if $n > $bs; + $s += read $fh,$_,$n; + } +} + + +# fileid is inode and mtime +sub fileid { + my @s = stat(shift); + return @s ? $s[1].$s[9] : int(time); +} + + +# collect file meta data (filename, inode, mtime) +sub fmd { + my @files = @_; + my ($file,$dir); + my $fmd = ''; + + foreach $file (@files) { + if (not -l $file and -d $file) { + $dir = $file; + if (opendir $dir,$dir) { + while (defined ($file = readdir($dir))) { + next if $file eq '..'; + if ($file eq '.') { + $fmd .= $file.fileid($dir); + } else { + $fmd .= fmd("$dir/$file"); + } + } + closedir $dir; + } + } else { + $fmd .= $file.fileid($file); + } + } + + return $fmd; +} + + +# from MIME::Base64::Perl +sub decode_b64 { + local $_ = shift; + my $uu = ''; + my ($i,$l); + + tr|A-Za-z0-9+=/||cd; + s/=+$//; + tr|A-Za-z0-9+/| -_|; + return "" unless length; + + $l = (length)-60; + for ($i = 0; $i <= $l; $i += 60) { + $uu .= "M" . substr($_,$i,60); + } + $_ = substr($_,$i); + if (length) { + $uu .= chr(32+(length)*3/4) . $_; + } + return unpack("u",$uu); +} + + +sub female_mode { + local $_; + if (open my $tty,'/dev/tty') { + print "@_\n"; + print " [y] yes\n", + " [n] no\n", + " [p] perhaps - don't know\n", + "your choice: "; + $_ = <$tty> || ''; + close $tty; + if (/^y/i) { return } + if (/^n/i) { exit } + if (/^p/i) { int(rand(2)) ? return : exit } + female_mode(@_); + } +} + + +sub http_response { + local $_ = shift || <$SH>; + my @r = @_; + my $error; + + $_ = <$SH> unless $_; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r?\n//; + # CGI fatalsToBrowser + if (/^HTTP.* 500/) { + @r = <$SH> unless @r; + @r = () unless @r; + die "$0: server error: $_\n@r\n"; + } + unless (/^HTTP.* 200/) { + $error = $_; + $error =~ s/HTTP.[\s\d.]+//; + if ($opt_v) { + print "<-- $_"; + print "<-- $_" while <$SH>; + } + die "$0: server error: $error\n"; + } + + print "<-- $_\n" if $opt_v; + return $_; +} + + +sub ws { + local $_ = shift; + return split; +} + + +sub update { + my $cfb = '### common functions ###'; + my $cfc; + + local $/; + + open $0,$0 or die "cannot read $0 - $!\n"; + $_ = <$0>; + close $0; + s/.*\n$cfb\n//s; + $cfc = $_; + + foreach my $p (qw(fexget sexsend)) { + open $p,$p or die "cannot read $p - $!\n"; + $_ = <$p>; + close $p; + s/\n$cfb.*/\n$cfb\n$cfc/s; + system "vv -s $p"; + open $p,'>',$p or die "cannot write $p - $!\n"; + print {$p} $_; + close $p; + } + + exec "l $0 fexget sexsend"; + exit; +} + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/bin/fexsrv b/bin/fexsrv new file mode 100755 index 0000000..27e3318 --- /dev/null +++ b/bin/fexsrv @@ -0,0 +1,821 @@ +#!/usr/bin/perl -wT + +# fexsrv : web server for F*EX service +# +# Author: Ulli Horlacher +# + +use 5.008; +use Socket; +use IO::Handle; +use Fcntl qw':flock :seek'; + +# stunnel workaround +BEGIN { $SIG{CHLD} = "DEFAULT" } + +# use BSD::Resource; +# setrlimit(RLIMIT_CPU,999,999) or die "$0: $!\n"; + +# SSL remote address provided by stunnel +if (@ARGV and $ARGV[0] eq 'stunnel' and $ENV{REMOTE_HOST} =~ /(.+)/) { + $ssl_ra = $1; +} + +# KEEP_ALIVE <== callback from CGI +if ($ENV{KEEP_ALIVE}) { + $keep_alive = $ENV{KEEP_ALIVE}; +} else { + %ENV = (); # clean environment +} + +$ENV{HOME} = (getpwuid($<))[7] or die "$0: no HOME\n"; + +# fexsrv MUST be run with full path! +if ($0 =~ m:^(/.+)/bin/fexsrv:) { + $FEXHOME = $1; + $FEXHOME =~ s:/+:/:g; + $FEXHOME =~ s:/$::; + $ENV{FEXHOME} = $FEXHOME; +} + +foreach my $lib ( + $FEXHOME, + '/usr/local/fex', + '/usr/local/share/fex', + '/usr/share/fex', +) { + $ENV{FEXLIB} = $FEXLIB = $lib and last if -f "$lib/fex.pp"; + $ENV{FEXLIB} = $FEXLIB = "$lib/lib" and last if -f "$lib/lib/fex.pp"; +} + +# import from fex.pp +our ($hostname,$debug,$timeout,$max_error,$max_error_handler); +our ($spooldir,$logdir,$docdir,$xkeydir,$lockdir); +our ($force_https,$default_locale,$bs,$adlm); +our (@locales); + +# load common code (local config: $FEXHOME/lib/fex.ph) +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +chdir $spooldir or http_die("$0: $spooldir - $!\n"); + +our $log = "$logdir/fexsrv.log"; +our $error = 'F*EX ERROR'; +our $htmlsource; +our $hid = ''; # header ID +our @log; + +$0 = untaint($0); + +$ENV{GATEWAY_INTERFACE} = 'CGI/1.1'; +$ENV{SERVER_NAME} = $hostname; +$ENV{QUERY_STRING} = ''; +$ENV{HTTP_COOKIE} = ''; +$ENV{PATH_INFO} = ''; +$ENV{RANDOM} = randstring(8); +$ENV{FEATURES} = join(',',qw( + SID CHECKRECIPIENT GROUPS QUOTA FILEID MULTIPOST XKEY FILEQUERY FILESTREAM + JUP NOSTORE AXEL FEXMAIL FILELINK +)); + +$port = 0; + +# continue session? +if ($keep_alive) { + if ($ENV{HTTP_HOST} =~ /(.+):(.+)/) { + $hostname = $1; + $port = $2; + } else { + $hostname = $ENV{HTTP_HOST}; + if ($ENV{PROTO} eq 'https') { $port = 443 } + else { $port = 80 } + } + $ra = $ENV{REMOTE_ADDR}; + $rh = $ENV{REMOTE_HOST}; +} + +# new session +else { + my $iaddr; + + # HTTPS connect + if ($ssl_ra) { + $ENV{PROTO} = 'https'; + $ENV{REMOTE_ADDR} = $ra = $ssl_ra; + if ($ssl_ra =~ /\w:\w/) { + # ($rh) = `host $ssl_ra 2>/dev/null` =~ /name pointer (.+)\.$/; + $^W = 0; eval 'use Socket6'; $^W = 1; + http_error(503) if $@; + $iaddr = inet_pton(AF_INET6,$ssl_ra) and + $rh = gethostbyaddr($iaddr,AF_INET6); + } else { + $rh = gethostbyaddr(inet_aton($ra),AF_INET); + } + $rh ||= '-'; + $port = 443; + # print {$log} "X-SSL-Remote-Host: $ssl_ra\n"; + } + + # HTTP connect + else { + $ENV{PROTO} = 'http'; + my $sa = getpeername(STDIN) or die "$0: no network stream on STDIN\n"; + if (sockaddr_family($sa) == AF_INET) { + ($ENV{REMOTE_PORT},$iaddr) = sockaddr_in($sa); + $ENV{REMOTE_ADDR} = $ra = inet_ntoa($iaddr); + $rh = gethostbyaddr($iaddr,AF_INET); + ($port) = sockaddr_in(getsockname(STDIN)); + } elsif (sockaddr_family($sa) == AF_INET6) { + $^W = 0; eval 'use Socket6'; $^W = 1; + http_error(503) if $@; + ($ENV{REMOTE_PORT},$iaddr) = unpack_sockaddr_in6($sa); + $ENV{REMOTE_ADDR} = $ra = inet_ntop(AF_INET6, $iaddr); + $rh = gethostbyaddr($iaddr,AF_INET6); + ($port) = unpack_sockaddr_in6(getsockname(STDIN)); + } else { + die "$0: unknown IP version\n"; + } + $port = 80 unless $port; + } + + $ENV{REMOTE_HOST} = $rh || ''; + + $ENV{HTTP_HOST} = ($port == 80 or $port == 443) + ? $hostname : "$hostname:$port"; + +} + +if ($reverse_proxy_ip and $reverse_proxy_ip eq $ra) { + $ENV{FEATURES} =~ s/SID,//; +} + +if (@anonymous_upload and ipin($ra,@anonymous_upload)) { + $ENV{FEATURES} .= ',ANONYMOUS'; +} + +$| = 1; + +$SIG{CHLD} = "DEFAULT"; # stunnel workaround + +$SIG{ALRM} = sub { + # printf {$log} "\nTIMEOUT %s %s\n",isodate(time),$connect; + if (@log) { + debuglog('TIMEOUT',isodate(time)); + fexlog($connect,@log,"TIMEOUT"); + } + exit; +}; + +REQUEST: while (*STDIN) { + + if (defined $ENV{REQUESTCOUNT}) { $ENV{REQUESTCOUNT}++ } + else { $ENV{REQUESTCOUNT} = 0 } + + $connect = sprintf "%s:%s %s %s %s [%s_%s]", + $keep_alive ? 'CONTINUE' : 'CONNECT', + $port, + isodate(time), + $rh||'-', + $ra, + $$,$ENV{REQUESTCOUNT}; + $hid = sprintf("%s %s\n",$rh||'-',$ra); + + @header = @log = (); + $header = ''; + + # read complete HTTP header + while (defined ($_ = &getaline)) { + last if /^\s*$/; + $hl += length; + $header .= $_; + s/[\r\n]+$//; + # URL-encode non-printable chars + s/([\x00-\x08\x0E-\x1F\x7F-\x9F])/sprintf "%%%02X",ord($1)/ge; + s/%21/!/g; + if (@header and s/^\s+/ /) { + $header[-1] .= $_; + } else { + push @header,$_; + $header{$1} = $2 if /(.+)\s*:\s*(.+)/; + push @log,$_; + } + + if (/^(GET \/|X-Forwarded-For|User-Agent)/i) { + $hid .= $_."\n"; + } + + # reverse-proxy? + if ($reverse_proxy_ip and $reverse_proxy_ip eq $ra and + /^X-Forwarded-For: ([\d.]+)/ + ) { + $ENV{REMOTE_ADDR} = $ra = $1; + $ENV{REMOTE_HOST} = $rh = gethostbyaddr(inet_aton($ra),AF_INET) || ''; + $ENV{HTTP_HOST} = $hostname; + if ($ENV{PROTO} eq 'https') { $port = 443 } + else { $port = 80 } + } + } + + exit unless @header; + exit if $header =~ /^\s*$/; + + $ENV{HTTP_HEADER} = $header; + debuglog($header); + # http_die("
$header
"); + + $ENV{'HTTP_HEADER_LENGTH'} = $hl; + $ENV{REQUEST_URI} = $uri = ''; + $cgi = ''; + + # is it a HTTP-request at all? + $request = shift @header; + if ($request !~ /^(GET|HEAD|POST|OPTIONS).*HTTP\/\d\.\d$/i) { + fexlog($connect,$request,"DISCONNECT: no HTTP request"); + badlog("no HTTP request: $request"); + exit; + } + + if ($force_https and $port != 443 + and $request =~ /^(GET|HEAD|POST)\s+(.+)\s+(HTTP\/[\d\.]+$)/i) { + $request = $2; + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: https://$hostname$request", + "Content-Length: 0", + "" + ); + fexlog($connect,@log); + exit; + } + + $request =~ s{^(GET|HEAD|POST) https?://$hostname(:\d+)?}{$1 }i; + + if ($request =~ m"^(GET|HEAD) /fop/\w+/") { + # no header inquisition on regular fop request + $header_hook = ''; + } else { + &$header_hook($connect,$request,$ra) if $header_hook; + } + + unless ($keep_alive) { + if ($request =~ m:(HTTP/1.(\d)): and $2) { + $ENV{KEEP_ALIVE} = $keep_alive = $ra + } else { + $ENV{KEEP_ALIVE} = $keep_alive = ''; + } + } + + if ($request =~ /^OPTIONS FEX HTTP\/[\d\.]+$/i) { + fexlog($connect,@log); + nvt_print( + "HTTP/1.1 201 OK", + "X-Features: $ENV{FEATURES}", + "X-Timeout: $timeout", + '' + ); + next REQUEST if $keep_alive; + exit; + } + + if ($request =~ m:^GET /?SID HTTP/[\d\.]+$:i) { + if ($ENV{FEATURES} !~ /\bSID\b/) { + fexlog($connect,@log); + nvt_print( + "HTTP/1.1 501 Not Available", + "Server: fexsrv", + "X-Features: ".$ENV{FEATURES}, + "X-Timeout: ".$timeout, + 'Content-Length: 0', + '' + ); + } else { + $ENV{SID} = randstring(8); + fexlog($connect,@log); + nvt_print( + "HTTP/1.1 201 ".$ENV{SID}, + "Server: fexsrv", + "X-Features: ".$ENV{FEATURES}, + "X-SID: ".$ENV{SID}, + "X-Timeout: ".$timeout, + 'Content-Length: 0', + '' + ); + } + next REQUEST if $keep_alive; + exit; + } + + if ($request =~ /^(GET|HEAD|POST)\s+(.+)\s+(HTTP\/[\d\.]+$)/i) { + $ENV{REQUEST_METHOD} = uc($1); + $ENV{REQUEST_URI} = $uri = $cgi = $2; + $ENV{HTTP_VERSION} = $protocol = $3; + $ENV{QUERY_STRING} = $1 if $cgi =~ s/\?(.*)//; + $ENV{PATH_INFO} = $1 if $cgi =~ m:/.+?(/.+?)(\?|$):; + $ENV{KEEP_ALIVE} = $keep_alive = '' if $protocol =~ /1\.0/; + $ENV{REQUEST_URL} = "$ENV{PROTO}://$ENV{HTTP_HOST}$ENV{REQUEST_URI}"; + if ($uri =~ /<|%3c/i) { badchar("<") } + if ($uri =~ />|%3e/i) { badchar(">") } + if ($uri =~ /\||%7c/i) { badchar("|") } + if ($uri =~ /\\|%5c/i) { badchar("\\") } + } + + while ($_ = shift @header) { + + # header inquisition! + &$header_hook($connect,$_,$ra) if $header_hook; + + # mega stupid "Download Manager" FlashGet + if ($uri =~ m{^/fop/} and m{^Referer: https?://.*\Q$uri$}) { + fexlog($connect,@log,"NULL: FlashGet"); + debuglog("NULL: FlashGet"); + exec qw'cat /dev/zero' or sleep 30; + exit; + } + + if ($header =~ /\nRange:/ and /^User-Agent: (FDM)/) { + disconnect($1,"499 Download Manager $1 Not Supported",30); + } + + if (/^User-Agent: (Java\/[\d\.]+)/) { + disconnect($1,"499 User-Agent $1 Not Supported",30); + } + + if (/^Range:.*,/) { + disconnect("Range a,b","416 Requested Range Not Satisfiable",30); + } + if (/^Range:.*(\d+)-(\d+)/) { + if ($1 > $2) { + disconnect("Range a>b","416 Requested Range Not Satisfiable",0); + } + if (($header{'User-Agent'}||'') !~ /$adlm/ ) { + disconnect("Range a-b","416 Requested Range Not Satisfiable",30); + } + } + + if (/^Range:.*\d+-$/ and $hid) { + my $lock = untaint($lockdir.'/'.md5_hex($hid)); + if (open $lock,'+>>',$lock) { + if (flock($lock,LOCK_EX|LOCK_NB)) { + seek $lock,0,0; + truncate $lock,0; + print {$lock} $hid; + } else { + disconnect( + "multiple Range request", + "400 Multiple Requests Not Allowed", + 10, + ); + } + } + } + + # client signed int bug + if (/^Range:.*-\d+-/) { + disconnect("Range -a-","416 Requested Range Not Satisfiable",0); + } + +# if (/^Range:/ and $protocol =~ /1\.0/) { +# &$header_hook($connect,$_,$ra) while ($header_hook and $_ = shift @header); +# fexlog($connect,@log,"DISCONNECT: Range + HTTP/1.0"); +# debuglog("DISCONNECT: Range + HTTP/1.0"); +# http_error(416); +# exit; +# } + + if (/^Connection:\s*close/i) { + $ENV{KEEP_ALIVE} = $keep_alive = ''; + } + + # HTTP header ==> environment variables + if (/^([\w\-]+):\s*(.+)/s) { + $http_var = $1; + $http_val = $2; + $http_var =~ s/-/_/g; + $http_var = uc($http_var); + $http_val =~ s/^\s+//; + $http_val =~ s/\s+$//; + if ($http_var =~ /^X_(FEX_\w+|CONTENT_LENGTH)$/) { + $http_var = $1; + } else { + $http_val =~ s/\s+/ /g; + if ($http_var =~ /^HTTP_(HOST|VERSION)$/) { + $http_var = 'X-'.$http_var; + } elsif ($http_var !~ /^CONTENT_/) { + $http_var = 'HTTP_'.$http_var; + } + } + $ENV{$http_var} = $http_val; + } + } + + # multiline header inquisition + &$header_hook($connect,$header,$ra) if $header_hook; + + exit unless $cgi; + + # extra download request? (request http://fexserver//xkey) + if ($cgi =~ m{^//([^/]+)$}) { + my $xkey = $1; + my $dkey; + if ($xkey =~ /^afex_\d/) { + $dkey = readlink "$xkeydir/$xkey" and $dkey =~ s/^\.\.\///; + } else { + $dkey = readlink "$xkeydir/$xkey/dkey" and $dkey .= "/$xkey"; + } + if ($dkey) { + # xkey downloads are only one time possible - besides afex + if ($xkey !~ /^afex_\d/) { + unlink "$xkeydir/$xkey/xkey"; + unlink "$xkeydir/$xkey"; + } + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/fop/$dkey", + "Content-Length: 0", + "" + ); + fexlog($connect,@log); + exit; + } + fexlog($connect,@log); + http_error(404); + exit; + } + + # get locale + if (($ENV{QUERY_STRING} =~ /.*locale=([\w-]+)/ or + $ENV{HTTP_COOKIE} =~ /.*locale=([\w-]+)/) + and -d "$FEXHOME/locale/$1") { + $ENV{LOCALE} = $locale = $1; + } else { + $ENV{LOCALE} = $locale = $default_locale; + } + + # check for name based virtual host + $vhost = vhost($ENV{'HTTP_HOST'}); + + if ($debug) { + debuglog("ENV:\n"); + foreach $var (sort keys %ENV) { + debuglog(sprintf " %s = >%s<\n",$var,$ENV{$var}); + } + debuglog("\n"); + } + + # locale definitions in fex.ph? + if (@locales) { + if (@locales == 1) { + $locale = $locales[0]; + } elsif (not grep /^$locale$/,@locales) { + $locale = $default_locale; + } + } + + # prepare document file name + if ($ENV{REQUEST_METHOD} =~ /^GET|HEAD$/) { + $doc = untaint($uri); + $doc =~ s/%([\dA-F]{2})/unpack("a",pack("H2",$1))/ge; + $doc =~ m:/\.\./: and http_error(403); + $doc =~ s:^/+::; + $doc =~ s/\?.*//; + if ($locale and -e "$docdir/locale/$locale/$doc") { + $doc = "$docdir/locale/$locale/$doc"; + } else { + $doc = "$docdir/$doc"; + } + } + + # CGI or document request? + if ($cgi =~ s:^/+::) { + $cgi =~ s:/.*::; + unless ($cgi) { + my $login = "$FEXHOME/cgi-bin/login"; + if (-x $login) { + $cgi = untaint(readlink($login) || $login); + $cgi =~ s:.*/::; + } + } + + $ENV{SCRIPT_NAME} = $cgi; + + # locale CGIs? (vhost comes already with own FEXLIB) + if ($locale and $locale ne 'english' + and -f "$FEXHOME/locale/$locale/cgi-bin/$cgi") { + $ENV{SCRIPT_FILENAME} = $cgi = "$FEXHOME/locale/$locale/cgi-bin/$cgi"; + $ENV{FEXLIB} = $FEXLIB = "$FEXHOME/locale/$locale/lib" unless $vhost; + } else { + $ENV{SCRIPT_FILENAME} = $cgi = "$FEXHOME/cgi-bin/$cgi"; + $ENV{FEXLIB} = $FEXLIB = "$FEXHOME/lib" unless $vhost; + } + + $status = ''; + if (-x $cgi and -f $cgi) { + if (@forbidden_hosts and ipin($ra,@forbidden_hosts)) { + fexlog($connect,@log,"FORBIDDEN"); + http_error(403); + } + unlink "$logdir/.error/$ra"; + # push @log,"DEBUG: locale=$locale locales=(@locales)"; + fexlog($connect,@log,"EXEC $cgi"); + eval { local $^W = 0; exec $cgi }; + $status = "$! or bad interpreter"; + fexlog($connect,@log,"FAILED to exec $cgi : $status"); + http_error(555); + } else { + if (-f "$doc/.htindex") { + require "$FEXLIB/dop"; + fexlog($connect,@log); + + showindex($doc); + STDOUT->flush; + next REQUEST if $keep_alive; + exit; + } + if (-f "$doc/index.html") { + # force redirect if trailing / is missing + # this is mandatory for processing further HTTP request! + if ($doc !~ m{/$}) { + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: $ENV{REQUEST_URL}/", + "Content-Length: 0", + "" + ); + fexlog($connect,@log); + next REQUEST if $keep_alive; + exit; + } + $doc .= '/index.html'; + $doc =~ s:/+:/:g; + } + $doc =~ s/#.*//; # ignore HTML anchors (stupid msnbot) + + # special request for F*EX UNIX clients + if ($ENV{SCRIPT_NAME} eq 'xx.tar') { + bintar(qw'fexget fexsend xx zz ezz'); + } + if ($ENV{SCRIPT_NAME} eq 'sex.tar') { + bintar(qw'sexsend sexget sexxx'); + } + if ($ENV{SCRIPT_NAME} eq 'afex.tar') { + bintar(qw'afex asex fexget fexsend sexsend sexget'); + } + if ($ENV{SCRIPT_NAME} eq 'afs.tar') { + bintar(qw'afex asex fexget fexsend xx sexsend sexget sexxx zz ezz'); + } + # URL ends with ".html!" or ".html?!" + if ($doc =~ s/(\.html)!$/$1/ or + $doc =~ /\.html$/ and $ENV{'QUERY_STRING'} eq '!') + { $htmlsource = $doc } else { $htmlsource = '' } + + if (-f $doc + or $doc =~ /(.+)\.(tar|tgz|zip)$/ and lstat("$1.stream") + or $doc =~ /(.+)\.tgz$/ and -f "$1.tar" + or $doc =~ /(.+)\.gz$/ and -f $1) + { + unlink "$logdir/.error/$ra"; + delete $ENV{SCRIPT_FILENAME}; + $ENV{DOCUMENT_FILENAME} = $doc; + require "$FEXLIB/dop"; + fexlog($connect,@log); + dop($doc); + STDOUT->flush; + next REQUEST if $keep_alive; + exit; + } elsif ($uri eq '/bunny') { + fexlog($connect,@log); + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Content-Type: text/plain", + '', + '=:3', + ); + exit; + } elsif ($uri eq '/camel') { + fexlog($connect,@log); + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Content-Type: text/plain", + '', + ); + local $/; + print unpack('u',); + exit; + } elsif (-e $cgi) { + $status = 'not executable'; + } + + } + + } + + # neither document nor CGI ==> error + + if ($status) { + fexlog($connect,@log,"FAILED to exec $cgi : $status"); + http_error(666); + } else { + fexlog($connect,@log,"UNKNOWN URL"); + badlog($request); + http_error(404); + } + exit; +} + + +# read one text line unbuffered from STDIN +sub getaline { + my $line = ''; + my $c; + + alarm($timeout); + + # must use sysread to avoid perl line buffering + # (later exec would destroy line buffer) + while (sysread STDIN,$c,1) { + $line .= $c; + last if $c eq "\n"; + } + + alarm(0); + + return $line; +} + + +sub fexlog { + my @log = @_; + if (open $log,">>$log") { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + print {$log} "\n",join("\n",@log),"\n"; + close $log; + } else { + http_die("$0: cannot write to $log - $!\n"); + } +} + + + +sub badchar { + my $bc = shift; + + fexlog($connect,@log,"DISCONNECT: bad characters in URL"); + debuglog("DISCONNECT: bad characters in URL $uri"); + badlog($request); + http_die("\"$bc\" is not allowed in URL"); +} + + +sub bintar { + my $tmpdir = "$FEXHOME/tmp"; + my $fs = "$ENV{PROTO}://$ENV{HTTP_HOST}"; + + if (chdir "$FEXHOME/bin") { + fexlog($connect,@log); + chdir $fstb if $fstb; + mkdir $tmpdir; + foreach my $f (@_) { + copy($f,"$tmpdir/$f","s#fexserver = ''#fexserver = '$fs'#"); + chmod 0755,"$tmpdir/$f"; + } + chdir $tmpdir or http_die("internal error: $tmpdir - $!"); + my $tar = `tar cf - @_ 2>/dev/null`; + unlink @_; + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Content-Length: ".length($tar), + "Content-Type: application/x-tar", + '', + ); + print $tar; + exit; + } +} + + +sub http_error { + my $error = shift; + my $URL = $ENV{REQUEST_URL}||''; + my $URI = $ENV{REQUEST_URI}||''; + + if ($error eq 400) { + http_error_header("400 Bad Request"); + nvt_print("Your request $URL is not acceptable."); + } elsif ($error eq 403) { + http_error_header("403 Forbidden"); + nvt_print("You have no permission to request $URL"); + } elsif ($error eq 404) { + http_error_header("404 Not Found"); + nvt_print("The requested URI $URI was not found on this server."); + } elsif ($error eq 416) { + http_error_header("416 Requested Range Not Satisfiable"); + } elsif ($error eq 503) { + http_error_header("503 Service Unavailable"); + # nvt_print("No Perl ipv6 support on this server."); + } else { + http_error_header("555 Unknown Error"); + nvt_print("The requested URL $URL produced an internal error."); + } + nvt_print( + "
", + "
fexsrv at $hostname:$port
", + "", + ); + exit; +} + + +sub disconnect { + my $info = shift; + my $error = shift; + my $wait = shift||0; + + # &$header_hook($connect,$_,$ra) while ($header_hook and $_ = shift @header); + fexlog($connect,@log,"DISCONNECT: $info"); + debuglog("DISCONNECT: $info"); + errorlog("$ENV{REQUEST_URI} ==> $error"); + badlog("$ENV{REQUEST_URI} ==> $error ($info)"); + + sleep $wait; + nvt_print("HTTP/1.0 $error"); + exit; +} + + +sub http_error_header { + my $error = shift; + my $uri = $ENV{REQUEST_URI}; + + errorlog("$uri ==> $error") if $uri; + nvt_print( + "HTTP/1.1 $error", + "Connection: close", + "Content-Type: text/html; charset=iso-8859-1", + "", + '', + "", + "$error", + "", + "

$error

", + ); +} + + +sub badlog { + my $request = shift; + my @n; + my $ed = "$spooldir/.error"; + local $_; + + if (@ignore_error) { + foreach (@ignore_error) { + return if $request =~ /$_/; + } + } + + if ($ra and $max_error and $max_error_handler) { + mkdir($ed) unless -d $ed; + + if (open $ra,"+>>$ed/$ra") { + flock($ra,LOCK_EX); + seek $ra,0,SEEK_SET; + @n = <$ra>; + printf {$ra} "%s %s\n",isodate(time),$request; + close $ra; + &$max_error_handler($ra,@n) if scalar(@n) > $max_error; + } + } +} + + +__END__ +M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("PM)R(G+5P*("`@ +M("`@("`@("`@("`@("`@("`@("`@("]@8&`M+B`@(&!<("`@("Q=+B`@("`@ +M("`@("`@("`@("`@("`@("`L+BY?"B`@("`@("`@("`@("`@("`@("`@("`@ +M+&`@("`@(&`B+B`@72X@("`@(&`N("`@("`@("`@("`@("`@7U]?+BY>(&!? +M)V`B(B(*("`@("`@("`@("`@("`@("`@("`@("`I("`@("`@("`G+"TG+2T@ +M+B`@("!@+B`@("`@(%]?7RPN+2<@("XN("T@("`G("TP("Y?"B`@("`@("`@ +M("`@+"X@("`@("`@("`@?%]?+"Y?("!?("`N+5\@("!<("`\("Y@(B +# + +use Getopt::Std; +use File::Basename; +use Cwd 'abs_path'; + +# do not run as CGI! +exit if $ENV{SCRIPT_NAME}; + +unless ($ENV{FEXLIB}) { + if ($ENV{FEXHOME}) { + $ENV{FEXLIB} = $ENV{FEXHOME}.'/lib'; + } else { + $ENV{FEXLIB} = dirname(dirname(abs_path($0))).'/lib'; + } +} +$FEXLIB = $ENV{FEXLIB}; +die "$0: no FEXLIB\n" unless -f "$FEXLIB/fex.pp"; + +# program name +$0 =~ s:.*/::; + +# become effective user fex +unless ($<) { + if (my @pw = getpwnam('fex')) { + $) = $pw[3]; + $> = $pw[2]; + $ENV{HOME} = $pw[7]; + } else { + die "$0: no such user 'fex'\n"; + } +} + +# import from fex.pp +our ($FEXHOME,$hostname,$sendmail,$spooldir,$admin,$bcc); + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +die "$0: \$admin not configured in $FEXLIB/fex.ph\n" + if not $admin or $admin =~ /example.org/; + +$opt_h = 0; + +getopts('h') or usage(2); +usage(0) if $opt_h; + +$subject = "@ARGV"; +die usage(1) unless $subject; + +local $/; +$text = ; +die usage(1) unless $text; + +if (open my $sig,$ENV{HOME}.'/.signature') { + $text .= "\n-- \n" . <$sig>; + close $sig; +} + +local $/ = "\n"; + +chdir $spooldir or die "$0: $spooldir - $!\n"; + +# @users = grep { chomp;s:/@:: } glob("*/@"); +foreach $user (glob("*@*")) { + if (-f "$user/@" and (readlink "$user/\@NOTIFICATION"||'') !~ /no/i) { + push @users,$user; + } +} + +foreach $group (glob "*/\@GROUP/*") { + if (open $group,$group) { + while (<$group>) { + s/#.*//; + s/:.*\n//; + push @users,$_ if /@/; + } + close $group; + } +} + +foreach $subuser (glob "*/\@SUBUSER") { + if (open $subuser,$subuser) { + while (<$subuser>) { + s/#.*//; + s/:.*\n//; + push @users,$_ if /@/; + } + close $subuser; + } +} + +# @users = qw'framstag@fex'; +die "$0: no users found\n" unless @users or grep /@/,@users; +push @users,$bcc; +@users = uniq(@users); + +open $sendmail,'|-',$sendmail,@users or die "$0: $sendmail - $!\n"; + +print {$sendmail} + "From: $admin\n", + "To: fexusers\@$hostname\n", + "Subject: $subject\n", + "\n", + $text; + +close $sendmail or die "$0: $sendmail - $!\n"; +print "mail sent to:\n",map { "$_\n" } @users; +exit; + +sub uniq { + my %x; + grep !$x{$_}++,@_; +} + +sub usage { + print "usage: $0 \"SUBJECT\" < mail.text\n"; + exit shift; +} diff --git a/bin/l b/bin/l new file mode 100755 index 0000000..93c4aca --- /dev/null +++ b/bin/l @@ -0,0 +1,597 @@ +#!/usr/bin/perl -w +# +# l / ll / lf / llf - substitute of the classic ls command +# +# Author: Ulli Horlacher +# +# Copyright: GNU General Public License + +use Cwd qw'abs_path'; +use File::Basename; +use Getopt::Std; + +# the name of the game +$0 =~ s:.*/::; + +$ENV{LC_CTYPE} = 'C'; + +# unshift @ARGV,split /\s+/,$ENV{'l_opt'} if $ENV{'l_opt'}; + +@ARGV = grep { chomp } if "@ARGV" eq '-'; + +# parse CLI arguments +$opt_l = $opt_i = $opt_t = $opt_s = $opt_a = $opt_r = $opt_d = $opt_n = 0; +$opt_L = $opt_N = $opt_c = $opt_u = $opt_S = $opt_R = $opt_z = $opt_h = 0; +$opt_U = 0; +${'opt_*'} = ${'opt_?'} = 0; +$opt_m = $opt_f = $opt_F = $opt_D = ''; +&usage if !getopts('hdnlLNitcuarsUSRz*?m:f:D:F:') || $opt_h; +$opt_z = 1 unless $opt_R; +$opt_l = 1 if $0 eq 'll'; +$opt_l = $opt_i = $opt_a = $opt_S = 1 if $0 eq 'lll'; +if ($0 eq 'lf' or $0 eq 'llf') { + unless ($opt_F) { + $opt_F = shift; + unless (length $opt_F) { + print "find regexp: "; + chomp($opt_F = ||''); + } + } + $opt_l = $0 if $0 eq 'llf'; + $opt_F = '.' unless length $opt_F; + $opt_R = $opt_F; +} + +$postsort = $opt_t||$opt_s; +$postproc = $postsort||$opt_z; + +&examples if ${'opt_?'}; + +# mark for squeeze operation +$z = $opt_z ? "\0" : ''; + +# default sorting methode +if ($opt_U) { $lcsort = sub { return @_ } } +elsif ($opt_r) { $lcsort = sub { sort { lc $b cmp lc $a } @_ } } +else { $lcsort = sub { sort { lc $a cmp lc $b } @_ } } + +# default: list only files not beginning with a dot +unless ($opt_m) { + if ($opt_a) { $opt_m = '.' } + else { $opt_m = '^[^\.]' } +} + +$older = $newer = 0; + +if ($opt_D) { + if ($opt_D =~ /:(\d+)([mhd])/) { + $older = $1; + my $z = $2 || 's'; + if ($z =~ /m/) { $older *= 60 } + elsif ($z =~ /h/) { $older *= 60*60 } + elsif ($z =~ /d/) { $older *= 60*60*24 } + } elsif ($opt_D =~ /:(\d\d\d\d-\d\d-\d\d)$/) { + $older = $1; + } + if ($opt_D =~ /(\d+)([mhd]):/) { + $newer = $1; + my $z = $2 || 's'; + if ($z =~ /m/) { $newer *= 60 } + elsif ($z =~ /h/) { $newer *= 60*60 } + elsif ($z =~ /d/) { $newer *= 60*60*24 } + } elsif ($opt_D =~ /^(\d\d\d\d-\d\d-\d\d):/) { + $newer = $1; + } +} + +# preselect date field number +if ($opt_c) { $sdf = 'c' } +elsif ($opt_u) { $sdf = 'a' } +else { $sdf = 'm' } + +# any arguments? +if (@ARGV) { @ARGV = &$lcsort(@ARGV) } +else { @ARGV = &getfiles('.') } + +# build files list +&collect(@ARGV); + +# post process files list? +# remark: if no postprocessing, files list has been already printed in list() +if (@LIST && $postproc) { + + # on -t or -s option sort list on date or size + # and then strip of leading sorting pre-string + @LIST = grep { s/.{21}// } reverse sort @LIST if $postsort; + + # squeeze size field (= remove unnecessary spaces) + if ($opt_z and not $opt_f) { + $opt_z = '%'.$opt_z.'s '; + @LIST = grep { s/\0 *([,\d\.\-]+) /sprintf($opt_z,$1)/e } @LIST; + } + + @LIST = reverse @LIST if $opt_r; + + if (not ($opt_t or $opt_U) and grep /^d[rR-][wW-][xX-]/,@LIST) { + foreach (@LIST) { print if /^d/ } + foreach (@LIST) { print unless /^d/ } + } else { + print @LIST; + } +} + +# print statistics summary? +if ($opt_S && $SS) { + print "$SS file(s):"; + printf " r=%d (%s Bytes)",$SS{'-'},&d3($Ss) if $SS{'-'}; + delete $SS{'-'}; + foreach my $type (qw(l d c b p s ?)) { + printf " %s=%d",$type,$SS{$type} if $SS{$type}; + delete $SS{$type}; + } + foreach my $type (keys %SS) { printf " %s=%d",$type,$SS{$type} } + print "\n"; +} + +exit ($found ? 0 : 1); + + +# collect files and build file lists +# +# INPUT: filenames +# +# GLOBAL: @LIST +sub collect { + my @files = @_; + my $f; + + # loop over all argument files/directories + foreach $f (@files) { + + # skip jed and emacs backup files + # next if $f =~ /~$/ and not $opt_a and not $opt_l; + + # recursive? + if ($opt_R) { + + # list single file + if ($opt_L) { + unless (-e $f) { + warn "$0: dangling symlink $f\n"; + next; + } + $f = abs_path($f); + } + list($f); + + # traverse real subdirs + if (-d $f and not -l $f) { + $f =~ s:/*$:/:; + collect(getfiles($f)); + } + + } else { + + # suppress trailing / on -d option + $f =~ s:/$:: if $opt_d; + + # on trailing / list subdirs, too + if ($f =~ m:/$:) { &list(&getfiles($f)) } + elsif ($f eq '') { &list('/') } + else { + if ($opt_L) { + unless (-e $f) { + warn "$0: dangling symlink $f\n"; + next; + } + $f = abs_path($f); + } + list($f); + } + + } + } +} + + +# list file(s) +# +# INPUT: filenames +# +# GLOBAL: @LIST (filenames-list) +sub list { + my @files = @_; + my ($file,$line,$linkname,$inode,$links,$size,$mode,$uid,$gid,$date,%dates); + my ($day); + + foreach $file (@files) { + + next if $opt_F and not fmatch($file); + next if $opt_N and (not -f $file or -l $file); + + # get file information + # if ($opt_L and stat $file or not $opt_L and lstat $file) { + if (lstat $file) { + ($linkname,$inode,$links,$size,$mode,$uid,$gid,$date,%dates) = &info($file); + } elsif ($! eq "Permission denied") { + $linkname = $file; + $inode = $links = $size = $uid = $gid = '?'; + $mode = $opt_l ? '?---------' : '?---'; + $date = '????-??-?? ??:??:??'; + %dates = ('m' => 0, 'a' => 0, 'c' => 0); + } else { + warn "$0: ".quote($file)." - $!\n"; + next; + } + + $day = $date; + $day =~ s/\s.*//; + + if ($older) { + next if $older =~ /-/ and $day gt $older; + next if $older !~ /-/ and $dates{m} > time-$older; + } + if ($newer) { + next if $newer =~ /-/ and $day lt $newer; + next if $newer !~ /-/ and $dates{m} < time-$newer; + } + + if (defined $linkname) { + + # prepend sorting string + $line = ''; + $line = sprintf '%21s',$date if $opt_t; + $line = sprintf '%21s',$size if $opt_s; + + unless ($opt_n) { + $uid = substr($uid,0,8); + $gid = substr($gid,0,8); + } + + # user defined format? + if ($opt_f) { + foreach my $i (split '',$opt_f) { + if ($opt_n) { + $i =~ tr/AD/ad/; + if ($i eq 'm') { $line .= sprintf '%06o ', $mode } + elsif ($i eq 'u') { $line .= sprintf '%6d ', $uid } + elsif ($i eq 'g') { $line .= sprintf '%6d ', $gid } + elsif ($i eq 's') { $line .= sprintf "$z%16s ",$size } + elsif ($i eq 'l') { $line .= sprintf '%3s ', $links } + elsif ($i eq 'i') { $line .= sprintf '%14s ', $inode } + elsif ($i eq 'd') { $line .= sprintf '%10s ', $date } + elsif ($i eq 'a') { $line .= sprintf '%10s %10s %10s ', + $dates{'a'},$dates{'m'},$dates{'c'} } + } else { + if ($i eq 'm') { $line .= $mode.' ' } + elsif ($i eq 'u') { $line .= sprintf '%-8s ', $uid } + elsif ($i eq 'g') { $line .= sprintf '%-8s ', $gid } + elsif ($i eq 's') { $line .= sprintf "$z%19s ",$size } + elsif ($i eq 'l') { $line .= sprintf '%3s ', $links } + elsif ($i eq 'i') { $line .= sprintf '%14s ', $inode } + elsif ($i eq 'd') { $line .= $date.' ' } + elsif ($i eq 'D') { $line .= $date.' ' } + elsif ($i eq 'a') { $line .= &isodate($dates{'a'}).' '. + &isodate($dates{'m'}).' '. + &isodate($dates{'c'}).' ' } + elsif ($i eq 'A') { $line .= &isodate($dates{'a'}).' '. + &isodate($dates{'m'}).' '. + &isodate($dates{'c'}).' ' } + } + } + + # predefined formats + } else { + + if ($opt_n) { + if ($opt_l) { $line .= sprintf "%06o %6d %6d $z%15s %10d ", + $mode,$uid,$gid,$size,$date } + else { $line .= sprintf "%06o $z%15s %10d ", + $mode,$size,$date } + } else { + if ($opt_l) { $line .= sprintf "%s %-8s %-8s $z%19s %s ", + $mode,$uid,$gid,$size,$date } + else { $line .= sprintf "%s $z%19s %s ", + $mode,$size,substr($date,0,-3) } + } + + if ($opt_i) { $line .= sprintf '%3s %10s ',$links,$inode } + } + + $line .= $linkname."\n"; + + if ($postproc) { + push @LIST,$line; + } else { + $line =~ s/\0//; + print $line; + } + $found++; + + } else { + lstat $file; + warn "$0: cannot get dir-info for ".quote($file)." - $!\n"; + } + + } +} + +# get file information +# +# INPUT: file name +# +# OUTPUT: filename with linkname, inode, hard link count, size, mode string, +# UID, GID, isodate +sub info { + my $file = shift; + my ($linkname,$links,$mode,$bmode,$uid,$gid,$date,%dates,@stat); + my $size = '-'; + my $inode = '?'; + my @rwx = qw/--- --x -w- -wx r-- r-x rw- rwx/; + my $type; + + if ($opt_L) { @stat = stat $file } + else { @stat = lstat $file } + + if (@stat) { + + $inode = $stat[1]; + $bmode = $stat[2]; + $links = $stat[3]; + %dates = ('m' => $stat[9], + 'a' => $stat[8], + 'c' => $stat[10]); + + if ($opt_n) { + $uid = $stat[4]; + $gid = $stat[5]; + $date = $dates{$sdf}; + } else { + $uid = getpwuid($stat[4]) || $stat[4]; + $gid = getgrgid($stat[5]) || $stat[5]; + $date = &isodate($dates{$sdf}); + } + + if (-f _) { $type = '-'; $size = $stat[7]; } + elsif (!$opt_L && -l _) { $type = 'l'; } + elsif (-d _) { $type = 'd'; } + elsif (-c _) { $type = 'c'; $size = &nodes($stat[6]); } + elsif (-b _) { $type = 'b'; $size = &nodes($stat[6]); } + elsif (-p _) { $type = 'p'; } + elsif (-S _) { $type = 's'; } + else { $type = '?'; } + + if ($opt_n) { + $mode = $stat[2]; + $size = $stat[7] if $size eq '-'; + } else { + if ($opt_l) { + $mode = $rwx[$bmode & 7]; + $bmode >>= 3; + $mode = $rwx[$bmode & 7] . $mode; + $bmode >>= 3; + $mode = $rwx[$bmode & 7] . $mode; + substr($mode,2,1) =~ tr/-x/Ss/ if -u _; + substr($mode,5,1) =~ tr/-x/Ss/ if -g _; + substr($mode,8,1) =~ tr/-x/Tt/ if -k _; + $mode = $type.$mode; + } else { + # with short list display only effektive file access modes + $mode = $type + . (-r _ ? 'R' : '-') + . (-w _ ? 'W' : '-') + . (-x _ ? 'X' : '-'); + substr($mode,2,1) =~ tr/-x/Ss/ if -u _ or -g _; + substr($mode,3,1) =~ tr/-x/Tt/ if -k _; + } + } + + # fall back to ls command if perl lstat failed + } else { + if ($opt_L) { + return; + } else { + ($mode,$links,$uid,$gid,$size) = split /\s+/,`ls -ld $file 2>/dev/null`; + return undef unless defined $mode; + $type = substr($mode,0,1); + # for (my $i=0;$i<3;$i++) { push @dates,'????-??-?? ??:??:??' } + # $date = `gfind $dir -maxdepth 1 -name $file -printf '%Ty-%Tm-%Td %TT\n'`; + } + } + + # summarize statistics + if ($opt_S) { + $SS++; + $SS{$type}++; + $Ss += $size if $type eq '-'; + } + + $size = &d3($size); + + # determine longest size field + if ($opt_z) { + my $x = length $size; + $opt_z = $x if $x>$opt_z; + } + $linkname = ${'opt_*'} ? $file : quote($file) ; + if ($type eq 'l' and $opt_f !~ /n/) { + my $link = readlink($file); + if (defined $link) { + $linkname .= ' -> ' . (${'opt_*'} ? $link : quote($link)); + } + } + $mode =~ s/\+$//; + #$mode .= ' ' unless $mode =~ /\+$/; + + return ($linkname,$inode,$links,$size,$mode,$uid,$gid,$date,%dates); +} + + +# reformat integer into 3-digit doted format +# (when non-numerical mode is set) +# +# INPUT: integer or '-' +# +# OUTPUT: d3-string +sub d3 { + local $_ = shift; + if ($opt_n) { s/-/0/ } + else { while (s/(\d)(\d\d\d\b)/$1,$2/) {} } + return $_; +} + + +# get all files matching pattern $opt_m +# +# INPUT: directory to scan +# +# OUTPUT: files which match (sorted, directories first) +sub getfiles { + my $dir = shift; + my @files = (); + my @dirs = (); + my $f; + + if (opendir D,$dir) { + $dir = '' if $dir eq '.'; + while (defined($f = readdir D)) { + + # skip . and .. pseudo-subdirs + next if $f =~ m:(^|/)\.\.?/*$:; + # skip ONTAP snapshot dir + next if $f =~ m:(^|/)\.snapshot/*$:; + + + # skip jed and emacs backup files + # next if $f =~ /~$/ and not $opt_a and not $opt_l; + + if ($f =~ /$opt_m/) { + my $x = $dir.$f; + if (not -l $x and -d $x and not ($opt_R or $postsort or $opt_U)) { + push @dirs,$x; + } else { + push @files,$x; + } + } + } + closedir D; + unless ($postsort) { + @files = &$lcsort(@files); + @dirs = &$lcsort(@dirs); + } + } else { + warn "$0: cannot read $dir : $!\n"; + } + + return (@dirs,@files); +} + + +# reformat integer to string node +# +# INPUT: integer node +# +# OUTPUT: string node +sub nodes { + my $rdev = shift; + return sprintf("%03d,%03d", ($rdev >> 8) & 255, $rdev & 255); +} + + +# reformat timetick to ISO date string +# +# INPUT: timetick +# +# OUTPUT: ISO date string +sub isodate { + my @d = localtime shift; + return sprintf('%d-%02d-%02d %02d:%02d:%02d', + $d[5]+1900,$d[4]+1,$d[3],$d[2],$d[1],$d[0]); +} + + +# quote file name to printable name and escape shell meta chars +# +# INPUT: original file name +# +# OUTPUT: printable file name +sub quote { + local $_ = shift; + my $mc = '\'\[\]\\\\ `"$?&<>$*()|{};'; + + unless (defined $_) { + die "@_"; + @x = caller; + die "@x"; + } + if (s/[\000-\037\200-\237\241-\250]/?/g or /\'/) { + s/([$mc])/\\$1/g; + s/^~/\\~/; +# } elsif (/[$mc]/ or -d and /:/) { + } elsif (/[$mc]/) { + $_ = "'$_'"; + } + return $_; +} + + +sub fmatch { + my $file = shift; + my $link = readlink($file)||''; + + return $file if basename($file) =~ /$opt_F/i; + return $link if basename($link) =~ /$opt_F/i; +} + + +sub usage { + my $opts = '[-lastcuidnrzLRNS*] [-f format] [-D X:Y]'; + if ($0 ne 'lf') { + print "usage: $0 $opts [-F regexp] [file...]\n"; + } + $opts =~ s/R//; + print "usage: lf $opts regexp [directory...]\n"; + print <) { + next if /(^|\n)($ignore)/i; + s/[\x00-\x08\x0B-\x1F\x1F\x80-\x9F]/_/g; + s/^\n//; + foreach $weed (@weed) { + while (s/\n$weed.*\n/\n/i) {} + } + if (/^\n*(CONNECT|CONTINUE).*\s\[([\d_]+)\]/i) { $pid = $2 } + if (/\n(POST|GET)\s+\/(\w+)/i) { $cgi = $2 } + if (/Content-Length: (\d+)/i) { + $d = $1; + while ($d =~ s/(\d)(\d\d\d\b)/$1,$2/) {}; + s/Content-Length: \d+/Content-Length: $d/i; + } + s/[\s\n]*$/\n\n/; + print or exit; + $from = ''; + if (m:\nGET /fup/(\w{40,}):) { + $_ = decode_b64($1); + printf " FROM=\"%s\"\n\n",$1 if /from=([\w\@.-]+)/; + } elsif (m:\nGET /fop/(\w+)/:) { + $dkey = $1; + my $ddir = "$spooldir/.dkeys/$dkey"; + $_ = readlink $ddir or next; + (undef,$to,$from) = split('/'); + printf " FROM=\"%s\"\n",$from; + printf " TO=\"%s\"\n",$to; + $cgi = ''; + if ($comment = slurp("$ddir/comment")) { + printf " COMMENT=\"%s\"\n",decode_utf8($comment,0)||''; + } + if (not -f "$ddir/data" and $_ = slurp("$ddir/error")) { + s/\n.*//s; + print " ERROR=\"$_\"\n"; + } + elsif ($size = -s "$ddir/data") { + printf " SIZE=%s MB\n",int($size/1024/1024); + } + print "\n"; + } elsif (m:\nGET /fup.*skey=(\w+):) { + read_skey($1); + print "\n"; + } + } + sleep 1; + if ($debug and $pid and $cgi) { + &read_debug_log; + $pid = $cgi = ''; + }; +} + + +sub read_debug_log { + my (@log,$log); + local $/ = "\n"; + local $_; + local $^W; + # no warnings "all"; + + for (1..2) { + sleep 1; + @log = `ls -rt $logdir/.debug/*_${pid}.$cgi 2>/dev/null`; + if ($log = $log[-1] and open $log,$log) { + # binmode($log,":encoding(UTF-8)"); + while (<$log>) { + s/\r//; + if (/^Content-Disposition:.*name="FILE".*filename="(.+)"/i) { + print " FILE=\"$1\"\n"; + } elsif (/^Content-Disposition:.*name="(\w+)"/i) { + my $p = uc($1); + $_ = <$log>; + my $v = <$log>||''; + $v =~ s/[\r\n]+//; + printf " %s=\"%s\"\n",$p,decode_utf8($v,0)||$v if $v; + read_akey($v) if $p eq 'AKEY'; + read_skey($v) if $p eq 'SKEY'; + } elsif (/^(Param|Exp): (\w+=".+")/) { + print " $2\n"; + } + } + close $log; + print "\n"; + return; + } + } +} + +sub read_akey { + my $akey = "$spooldir/.akeys/" . shift; + if (my $user = readlink($akey)) { + $user =~ s:../::; + printf " USER=\"%s\"\n",$user; + } +} + + +sub read_skey { + my $skey = "$spooldir/.skeys/" . shift; + if (open $skey,$skey) { + while (<$skey>) { + printf " FROM=\"%s\"\n",$1 if /from=(.+)/; + printf " TO=\"%s\"\n",$1 if /to=(.+)/; + } + close $skey; + } +} diff --git a/bin/mksgkeys b/bin/mksgkeys new file mode 100755 index 0000000..6deec68 --- /dev/null +++ b/bin/mksgkeys @@ -0,0 +1,64 @@ +#!/usr/bin/perl -w + +# helper script to regenerate missing SKEYs and GKEYs + +use Digest::MD5 qw(md5_hex); + +@pw = getpwnam('fex'); +$spool = $pw[7].'/spool'; +chdir $spool or die "$spool - $!"; + +foreach $suf (glob "*/\@SUBUSER") { + if (-f $suf and open $suf,$suf) { + $to = $user = $suf; + $to =~ s:/.*::; + $user =~ s:/.*::; + while (<$suf>) { + chomp; + s/#.*//; + if (/(.+):(.+)/) { + $from = $1; + $id = $2; + $skey = md5_hex("$user:$from:$id"); + unless (-f ".skeys/$skey") { + if (open $skey,">.skeys/$skey") { + warn "creating $spool/.skeys/$skey\n"; + print {$skey} "from=$from\n"; + print {$skey} "to=$to\n"; + print {$skey} "id=$id\n"; + close $skey; + } + } + } + } + close $suf; + } +} + +foreach $guf (glob "*/\@GROUP/*") { + if (-f $guf and not -l $guf and open $guf,$guf) { + $group = $user = $guf; + $group =~ s:.*/::; + $user =~ s:/.*::; + while (<$guf>) { + chomp; + s/#.*//; + if (/(.+):(.+)/) { + $from = $1; + $id = $2; + $gkey = md5_hex("$user:$group:$from:$id"); + unless (-f ".gkeys/$gkey") { + if (open $gkey,">.gkeys/$gkey") { + warn "creating $spool/.gkeys/$gkey\n"; + print {$gkey} "from=$from\n"; + print {$gkey} "to=\@$group\n"; + print {$gkey} "user=$user\n"; + print {$gkey} "id=$id\n"; + close $gkey; + } + } + } + } + close $guf; + } +} diff --git a/bin/sexget b/bin/sexget new file mode 120000 index 0000000..73cf1eb --- /dev/null +++ b/bin/sexget @@ -0,0 +1 @@ +sexsend \ No newline at end of file diff --git a/bin/sexsend b/bin/sexsend new file mode 100755 index 0000000..7340e49 --- /dev/null +++ b/bin/sexsend @@ -0,0 +1,723 @@ +#!/usr/bin/perl -w + +# client for stream exchange of the FEX service +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +# sexsend / sexget / sexxx + +use Getopt::Std; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Digest::MD5 qw(md5_hex); # encypted ID / SID + +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +our $version = 20150120; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +$0 =~ s:.*/::; +$| = 1; + +# sexsend is default +$usage = + "usage: ... | $0 [options] [SEX-URL/]recipient [stream]\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -V show version\n". + " -t timeout timeout in s (waiting for recipient)\n". + "special: recipient may be \"public\" or \"anonymous\" or \".\"\n". + "see also: sexget, sexxx\n". + "example: tail -f /var/log/syslog | $0 fex.flupp.org/admin log\n"; + +if ($0 eq 'sexget' or $0 eq 'fuckme') { + $usage = + "usage: $0 [options] [[SEX-URL/]user:ID] [stream]\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -V show version\n". + "arguments: user:ID use this user & ID\n". + " (ID may be \"public\" or user:ID may be \"anonymous\")\n". + " stream name of the stream\n". + "see also: sexsend, sexxx\n". + "example: $0 log | grep kernel\n"; +} + +if ($0 eq 'sexxx') { + $usage = + "usage: $0 [-v] [-g] [-c] [-u [SEX-URL/]user] [-s stream] [files...]\n". + "usage: $0 [-v] [-g] [-u [SEX-URL/]user] [-s stream] | ...\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -q quiet mode\n". + " -c compress files\n". + " -u SEX-URL/user SEX-URL and user (default: use FEXID/FEXXX)\n". + " -s stream stream name (default: xx)\n". + "see also: sexsend, sexget\n". + "examples: $0 -s config /etc /usr/local/etc\n". + " $0 > backup.tar\n"; +} + +$fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/.fex'; +$user = $id = ''; +$type = $timeout = $stream = $mode = ''; +$idf = "$fexhome/id"; +$bs = $ENV{BS} || 2**16; # I/O blocksize + +# server URL, user and auth-ID +if ($FEXID = $ENV{FEXID}) { + $FEXID = decode_b64($FEXID) if $FEXID !~ /\s/; + ($fexcgi,$user,$id) = split(/\s+/,$FEXID); +} else { + if (open $idf,$idf) { + chomp($fexcgi = <$idf>) or die "$0: no FEX-URL in $idf\n"; + chomp($user = <$idf>) or die "$0: no FROM in $idf\n"; + chomp($id = <$idf>) or die "$0: no ID in $idf\n"; + close $idf; + despace($fexcgi,$user,$id); + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "$0: illegal FEX-URL \"$fexcgi\" in $idf\n"; + } + unless ($user =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "$0: illegal FROM \"$user\" in $idf\n"; + } + } +} + +$opt_h = $opt_v = $opt_V = $opt_q = 0; +$opt_u = $opt_s = $opt_c = $opt_t = ''; + +$_ = "$fexhome/config.pl"; require if -f; + +if ($0 eq 'sexxx') { + + # xx server URL, user and auth-ID + if ($FEXXX = $ENV{FEXXX}) { + $FEXXX = decode_b64($FEXXX) if $FEXXX !~ /\s/; + ($fexcgi,$user,$id) = split(/\s+/,$FEXXX); + } elsif (open $idf,$idf) { + while (<$idf>) { + if (/^\[xx\]/) { + chomp($fexcgi = <$idf>) or die "$0: no xx FEX-URL in $idf\n"; + chomp($user = <$idf>) or die "$0: no xx FROM in $idf\n"; + chomp($id = <$idf>) or die "$0: no xx ID in $idf\n"; + last; + } + } + close $idf; + } + + getopts('hgvcu:s:') or die $usage; + die $usage if $opt_h; + die $usage unless -t; + + if ($opt_c) { + $opt_c = 'z'; + $type = '&type=GZIP'; + } + + if ($opt_u) { + $fexcgi = $1 if $opt_u =~ s:(.+)/::; + $user = $opt_u; + } + + unless ($fexcgi) { + die "$0: no xx user found, use \"$0 -u SEX-URL/user\"\n"; + } + + unless ($user) { + die "$0: no xx user found, use \"$0 -u user\"\n"; + } + +} elsif ($0 eq 'sexget' or $0 eq 'fuckme') { + getopts('hgvVdu:') or die $usage; + die $usage if $opt_h; + + + if ($opt_V) { + print "Version: $version\n"; + exit unless @ARGV; + } + + if (not $opt_u and @ARGV and $ARGV[0] =~ m{^anonymous|/|:}) { + $opt_u = shift @ARGV; + } + + if ($opt_u) { + $fexcgi = $1 if $opt_u =~ s:(.+)/::; + ($user,$id) = split(':',$opt_u); + if ($user =~ /^anonymous/) { + $anonymous = $user; + } elsif (not $id) { + die $usage; + } + } + + unless ($fexcgi) { + die "$0: no SEX URL found, use \"$0 -u SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + + unless ($user) { + die "$0: no recipient found, use \"$0 -u SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + +} else { # sexsend + + $opt_g = 1; + getopts('hguvqVTt:') or die $usage; + die $usage if $opt_h; + + if ($opt_V) { + print "Version: $version\n"; + exit unless @ARGV; + } + + if ($opt_t and $opt_t =~ /^\d+$/) { + $timeout = "&timeout=$opt_t"; + } + + my $save_user = $user; + $user = shift or die $usage; + $fexcgi = $1 if $user =~ s:(.+)/::; + + if ($user =~ /^anonymous/) { + die "$0: need SEX-URL with anonymous SEX\n" unless $fexcgi; + $mode = 'anonymous'; + } elsif ($user eq 'public') { + unless ($id) { + die "$0: public SEX not possible without FEXID, set it with \"fexsend -I\"\n"; + } + $mode = $user; + $user = $save_user; + } elsif ($user eq '.') { + open $idf,$idf or die "$0: no $idf\n"; + $_ = <$idf>; + $user = <$idf>||''; + chomp $user; + } else { + unless ($fexcgi) { + die "$0: no SEX URL found, use \"$0 SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + } + +} + +&get_ssl_env; + +$fexcgi =~ s(^http://)()i; +$fexcgi =~ s(/fup.*)(); +$server = $fexcgi; + +if ($server =~ s(^https://)()i) { $port = 443 } +elsif ($server =~ /:(\d+)/) { $port = $1 } +else { $port = 80 } + +$server =~ s([:/].*)(); + +## set up tcp/ip connection +# $iaddr = gethostbyname($server) +# or die "$0: cannot find ip-address for $server $!\n"; +# socket(SH,PF_INET,SOCK_STREAM,getprotobyname('tcp')) or die "$0: socket $!\n"; +# connect(SH,sockaddr_in($port,$iaddr)) or die "$0: connect $!\n"; +# warn "connecting $server:$port user=$user\n"; +if ($port == 443) { + if ($opt_v and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); +} else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); +} + +die "cannot connect $server:$port - $!\n" unless $SH; +warn "TCPCONNECT to $server:$port\n" if $opt_v; + +# autoflush $SH 1; +autoflush STDERR; + +$SIG{PIPE} = \&sigpipehandler; + +if ($0 eq 'sexget' or $0 eq 'fuckme') { + $stream = "&stream=" . shift if @ARGV; + if ($anonymous) { + $cid = 'anonymous'; + } elsif ($id eq 'public') { + $cid = 'public'; + } else { + $cid = query_sid($server,$port,$id); + } + request("GET /sex?BS=$bs&user=$user&ID=$cid$stream HTTP/1.0"); + transfer($SH,STDOUT); + # print while sysread $SH,$_,$bs; + exit; +} + +if ($0 eq 'sexxx') { + $stream = "&stream=" . ($opt_s || 'xx'); + if (@ARGV) { + warn "streaming:\n"; + open my $tar,'-|','tar',"cv${opt_c}f",'-',@ARGV or die "$0: cannot run tar - $!\n"; + request("POST /sex?BS=$bs&user=$user$type$stream HTTP/1.0"); + transfer($tar,$SH); + # while (read $tar,$_,$bs) { syswrite $SH,$_ } + } else { + $cid = query_sid($server,$port,$id); + request("GET /sex?BS=$bs&user=$user&ID=$cid$stream HTTP/1.0"); + $opt_c = 'z' if $H{'CONTENT-TYPE'} =~ /gzip/i; + if (-t STDOUT) { + print "extracting from stream:\n"; + open $out,"|tar xv${opt_c}f -" or die "$0: cannot run tar - $!\n"; + } else { + if ($opt_c) { + open $out,"|gzip -d" or die "$0: cannot run gunzip - $!\n"; + } else { + $out = *STDOUT; + } + } + print {$out} $_ while sysread $SH,$_,$bs; + } + exit; +} + +# sexsend +$stream = "&stream=" . shift if @ARGV; + +if ($mode eq 'anonymous') { + unless ($opt_q) { + print "http://$server:$port/sex?user=$user&ID=anonymous$stream\n"; + printf "http://$server:$port/sex?%s\n", + encode_b64("user=$user&ID=anonymous$stream"); + } + $mode = "&mode=anonymous"; +} elsif ($mode eq 'public') { + die "$0: need user/ID when sending to public, set it with fexsend -I\n" unless $user and $id; + unless ($opt_q) { + print "http://$server:$port/sex?user=$user&ID=public$stream\n"; + printf "http://$server:$port/sex?%s\n", + encode_b64("user=$user&ID=public$stream"); + } + $cid = query_sid($server,$port,$id); + $mode = "&ID=$cid&mode=public"; +} else { + # $user = checkalias($user) unless $opt_d; +} + +request("POST /sex?BS=$bs&user=$user$mode$type$timeout$stream HTTP/1.0"); +print STDERR "==> (streaming ...)\n" if $opt_v; + +transfer(STDIN,$SH); + +exit; + + +sub transfer { + my $source = shift; + my $destination = shift; + my ($t0,$t1,$tt); + my ($B,$b,$bt); + + $t0 = $t2 = time; + $tt = $t0-1; + $t1 = 0; + + while ($b = sysread $source,$_,$bs) { + print {$destination} $_ or die "$0: link failure - $!\n"; + $B += $b; + $bt += $b; + $t2 = time; + if ($t2>$t1) { + if ($opt_g) { + if ($B>2*M) { + printf STDERR "%d MB %d kB/s \r", + int($B/M),int($bt/k/($t2-$tt)); + } else { + printf STDERR "%d kB %d kB/s \r", + int($B/k),int($bt/k/($t2-$tt)); + } + } + $t1 = $t2; + if ($t2-$tt>10) { + sleep 1; # be nice to bandwith + $bt = 0; + $tt = $t2; + } + } + } + + die "$0: no stream data\n" unless $B; + + $tt = (time-$t0)||1; + + if ($opt_v or $opt_g) { + if ($B>2097152) { + printf STDERR "transfered: %d MB in %d s with %d kB/s\n", + int($B/1048576),$tt,int($B/1024/$tt); + } elsif($B>2048) { + printf STDERR "transfered: %d kB in %d s with %d kB/s\n", + int($B/1024),$tt,int($B/1024/$tt); + } else { + printf STDERR "transfered: %d B in %d s with %d kB/s\n", + $B,$tt,int($B/1024/$tt); + } + } + +} + + +sub request { + my $req = shift; + + print STDERR "==> $req\n" if $opt_v; + syswrite $SH,"$req\r\n\r\n"; + for (;;) { + unless (defined($_ = &getline)) { + die "$0: server has closed the connection\n"; + } + if (/^HTTP\/[\d\.]+ 200/) { + print STDERR "<== $_" if $opt_v; + last; + } elsif (/^HTTP\/[\d\.]+ 199/) { + print STDERR "<== $_" if $opt_v; + } else { + if ($opt_v) { + print STDERR "<== $_"; + exit 3; + } else { + s:^HTTP/[ \d\.]+::; + s/\r//; + die "$0: server response: $_"; + } + } + } + while (defined($_ = &getline)) { + last if /^\s*$/; + $H{uc($1)} = $2 if /(.+):\s*(.+)/; + print STDERR "<== $_" if $opt_v; + } +} + +# check for (mutt) alias +sub checkalias { + my $to = shift; + if ($to !~ /@/ and open F,$ENV{HOME}.'/.mutt/aliases') { + while () { + next if /,/; + if (/^alias $to\s/i) { + chomp; + s/\s*#.*//; + s/\s+$//; + s/.*\s+//; + s///; + $to = $_; + warn "$0: found alias, using address $to\n"; + die unless $to; + last; + } + } + close F; + } + return $to; +} + +sub despace { + foreach (@_) { + s/^\s+//; + s/\s+$//; + } +} + +sub query_sid { + my ($server,$port,$id) = @_; + my $req; + local $_; + + $req = "GET SID HTTP/1.1"; + print STDERR "==> $req\n" if $opt_v; + syswrite $SH,"$req\r\n\r\n"; + $_ = &getline; + unless (defined $_ and /\w/) { + print STDERR "\n" if $opt_v; + die "$0: no response from server\n"; + } + s/\r//; + if (/^HTTP.* 201 (.+)/) { + print STDERR "<== $_" if $opt_v; + $id = 'MD5H:'.md5_hex($id.$1); + while (defined($_ = &getline)) { + s/\r//; + last if /^\n/; + print STDERR "<== $_" if $opt_v; + } + } else { + die "$0: $server does not support session ID\n"; + } + return $id; +} + +sub sigpipehandler { + local $_ = ''; + $SIG{ALRM} = sub { }; + alarm(1); + $_ = &getline||''; + if (/^HTTP.* \d+ (.*)/) { + if ($opt_v) { + die "\n$0: server error: @_\n"; + } else { + die "\n$0: server error: $1\n"; + } + } else { + die "\n$0: got SIGPIPE (server closed connection)\n"; + } +} + +# read one text line from $SH; +sub getline { + my $line = ''; + my $c; + + local $SIG{ALRM} = sub { die "$0: timeout while waiting for server reply\n" }; + alarm($opt_t||300); + + # must use sysread to avoid perl line buffering + while (sysread $SH,$c,1) { + $line .= $c; + last if $c eq "\n"; + } + + alarm(0); + + return $line; +} + +# from MIME::Base64::Perl +sub decode_b64 { + local $_ = shift; + my $uu = ''; + my ($i,$l); + + tr|A-Za-z0-9+=/||cd; + s/=+$//; + tr|A-Za-z0-9+/| -_|; + return "" unless length; + + $l = (length) - 60; + for ($i = 0; $i <= $l; $i += 60) { + $uu .= "M" . substr($_,$i,60); + } + $_ = substr($_,$i); + if (length) { + $uu .= chr(32 + (length)*3/4) . $_; + } + return unpack ("u",$uu); +} + + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/bin/sexxx b/bin/sexxx new file mode 120000 index 0000000..73cf1eb --- /dev/null +++ b/bin/sexxx @@ -0,0 +1 @@ +sexsend \ No newline at end of file diff --git a/bin/xx b/bin/xx new file mode 120000 index 0000000..e7f3ac4 --- /dev/null +++ b/bin/xx @@ -0,0 +1 @@ +fexsend \ No newline at end of file diff --git a/bin/zz b/bin/zz new file mode 100755 index 0000000..48a5a9f --- /dev/null +++ b/bin/zz @@ -0,0 +1,55 @@ +#!/bin/sh + +# to use zz with vim, write to your .vimrc: +# +# noremap zz> :w !zz +# noremap zz< :r !zz + +ZZ=${ZZ:-$HOME/.zz} + +if [ "X$*" = X-h -o "X$*" = X--help ]; then + exec cat<>$ZZ +fi + +if [ -t 0 ]; then + if [ x"$1"x = xx ]; then + exec cat -- $ZZ + elif [ x"$1"x = x..x ]; then + exec cat -- $ZZ~ + else + test -f $ZZ && mv $ZZ $ZZ~ + exec cat -- "$@" >$ZZ + fi +else + test -f $ZZ && mv $ZZ $ZZ~ + exec cat >$ZZ +fi diff --git a/cgi-bin/fac b/cgi-bin/fac new file mode 100755 index 0000000..1470b83 --- /dev/null +++ b/cgi-bin/fac @@ -0,0 +1,902 @@ +#!/usr/bin/perl -w + +# F*EX CGI for administration +# +# Author: Andre Hafner +# + +use CGI qw(:standard); +use CGI::Carp qw(fatalsToBrowser); + +$| = 1; + +# add fex lib +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "no \$FEXLIB\n" unless -d $FEXLIB; + +# import from fex.pp and fex.ph +our ($FEXHOME,$spooldir,$logdir,$docdir,$durl,$mdomain); +our ($bs,$hostname,$keep_default,$recipient_quota,$sender_quota,$autodelete); +our ($admin,$admin_pw,$admin_hosts); +our ($sendmail,$bcc); +our $error = 'FAC error'; + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or http_die("cannot load $FEXLIB/fex.pp - $!\n"); + +my @http_auth = (); +my $ra = $ENV{REMOTE_ADDR}||0; + +if (not @admin_hosts or not ipin($ra,@admin_hosts)) { + html_error($error,"Administration from your host ($ra) is not allowed."); +} + +html_error($error,"\$admin not configured in $FEXLIB/fex.ph\n") unless $admin; + +chdir $spooldir or http_die("$spooldir - $!"); +chomp($admin_pw = slurp("$admin/@")||''); +html_error($error,"no F*EX account for admin $admin\n") unless $admin_pw; + +# redirect to https if configured +if (0 and open my $x,'/etc/xinetd.d/fexs') { + while (<$x>) { + if (/^\s*disable\s*=\s*no/) { + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: https://$hostname$ENV{REQUEST_URI}", + 'Content-Length: 0', + '' + ); + exit; + } + } + close $x; +} + +# authentication +&require_akey; + +my $fup = $durl; +$fup =~ s:/fop:/fup:; + +my $http_client = $ENV{HTTP_USER_AGENT} || ''; + +# here is chosen which files to save with backup function +my @backup_files = qw( + htdocs/index.html + lib/fex.ph + lib/fup.pl + spool/*@*/@* +); + +# backup goes first +if (defined param("action") and param("action") eq "backup") { &backup } + +http_header('200 OK'); + +$_ = html_header("F*EX Admin Control for $hostname"); +s:

: (logout):; +print; + +my $nav_user = + li("Create new user") . "\n" . + li("Change user auth-ID") . "\n" . + li("Edit user restrictions file") . "\n" . + li("Delete existing user") . "\n" . + li("Manage disk quota") . "\n"; + +my $nav_log = + li("Get fup.log") . "\n" . + li("Get fop.log") . "\n" . + li("Get error.log") . "\n"; + +if (-f 'fexsrv.log') { + $nav_log = + li("Watch logfile") . "\n" . + li("Get fexsrv.log") . "\n" . + $nav_log; +} + +my $nav_backup = + li("Download backup
(config only)
") . "\n" . + li("Restore backup") . "\n"; + +my $nav_show = + li("List spooled files") . "\n" . + li("Show quotas (sender/recipient)") . "\n" . + li("Show server config") . "\n" . + li("Show user config") . "\n"; + +my $nav_edit = + li("Edit config") . "\n" . + li("Edit index.html") . "\n"; + +#print table({-border=>"0"},Tr({-valign=>"top"},[td([ul($nav_user), ul($nav_log), ul($nav_backup), ul($nav_other)])])), "\n"; +#print "\n", hr, "\n" ; +print table({-border=>"0"}, + th({},["manage user","show","log files","edit","backup"]), + Tr({-valign=>"top"},[td([ + ul($nav_user), + ul($nav_show), + ul($nav_log), + ul($nav_edit), + ul($nav_backup) +])])), "\n"; +print "
\n"; + +my @user_items = &userList; +if (my $action = param("action")) { + if ($action eq "create") { &createUserForm } + elsif ($action eq "change-auth") { &changeAuthForm } + elsif ($action eq "edit") { &editRestrictionsForm } + elsif ($action eq "delete") { &deleteUserForm } + elsif ($action eq "quota") { &changeQuotaForm } + elsif ($action eq "list") { &listFiles } + elsif ($action eq "showquota") { &showQuota } + elsif ($action eq "showconfig") { &showConfig } + elsif ($action eq "userconfig") { &userConfigForm } + elsif ($action eq "watch") { &watchLog } + elsif ($action eq "fexsrv.log") { &getlog("fexsrv.log") } + elsif ($action eq "fup.log") { &getlog("fup.log") } + elsif ($action eq "fop.log") { &getlog("fop.log") } + elsif ($action eq "error.log") { &getlog("error.log") } + elsif ($action eq "editconfig") { &editFile("$FEXLIB/fex.ph") } + elsif ($action eq "editindex") { &editFile("$docdir/index.html") } + elsif ($action eq "backup") { &backup } + elsif ($action eq "restore") { &restoreForm } + else { http_die("STOP TRYING TO CHEAT ME!\n") } +} + +if (defined param("createUser")) { + createUser(param("createUser"), param("authID")); + +} elsif (defined param("changeAuthUser")) { + if (param("changeAuthUser") =~ /^#.*/) { + &changeAuthForm; + } else { + changeUser(param("changeAuthUser"), param("authID")); + } + +} elsif (defined param("showUserConfig")) { + if (param("showUserConfig") =~ /^#.*/) { + &userConfigForm; + } else { + showUserConfig(param("showUserConfig")); + } + +} elsif (defined param("deleteUser")) { + if (param("deleteUser") =~ /^#.*/) { + &deleteUserForm; + } else { + deleteUser(param("deleteUser")); + } + +} elsif (defined param("userQuota")) { + if (param("userQuota") =~ /^#.*/) { + &changeQuotaForm; + } else { + if (defined param("remove quota")) { + $user = param("userQuota"); + deleteFiles("$spooldir/$user/\@QUOTA"); + } else { + alterQuota(param("userQuota"), param("recipientQuota"), param("senderQuota")); + } + } + +} elsif (defined param("editUser")) { + if (param("editUser") =~ /^#.*/) { + &editRestrictionsForm; + } else { + if (defined param("delete file")) { + $user = param("editUser"); + deleteFiles("$spooldir/$user/\@ALLOWED_RECIPIENTS"); + } else { + editUser(param("editUser")); + } + } + +} elsif (defined param("contentBox") && defined param("ar")) { + saveFile(param("contentBox"), param("ar")); + +} elsif (defined param("upload_archive")) { + restore(param("upload_archive")); +} + +print end_html(); +exit; + + +####### +# declaration of formular functions +####### + +# formular for creating new users +# required arguments: - +sub createUserForm { + my $nameRow = "\n" . td(["user:", textfield(-size=>80, -name=>"createUser")]); + my $authRow = "\n" . td(["auth-ID:", textfield(-size=>80, -name=>"authID")]); + print "\n", h3("Create new user"); + print "\n", start_form(-name=>"create", -method=>"POST"); + print "\n", table(Tr([$nameRow, $authRow])); + print "\n", submit('create user'), br; + print "\n", end_form; +} + +# formular for changing auth-id of an user +# required arguments: - +sub changeAuthForm { + my $nameRow = "\n" . td(["user:", popup_menu(-name=>"changeAuthUser", -values=>\@user_items)]); + my $authRow = "\n" . td(["new auth-ID:", textfield(-size=>80, -name=>"authID")]); + print "\n", h3("change auth-ID"); + print "\n", start_form(-name=>"change-auth", -method=>"POST"); + print "\n", table(Tr([$nameRow, $authRow])); + print "\n", submit('change'), br; + print "\n", end_form; +} + +# formular choosing user, whose config files shall be shown +# required arguments: - +sub userConfigForm { + my $nameRow = "\n". td(["user:", popup_menu(-name=>"showUserConfig", -values=>\@user_items)]); + print "\n", h3("Show user config files"); + print "\n", start_form(-name=>"showUserConfig", -method=>"POST"); + print "\n", table(Tr([$nameRow])); + print "\n", submit('show config files'), br; + print "\n", end_form; +} + +# formular for choosing user, whose restriction file shall be edited +# required arguments: - +sub editRestrictionsForm { + my $nameRow = "\n" . td(["user:", popup_menu(-name=>"editUser", -values=>\@user_items)]); + print "\n", h3("Edit user restriction file"); + print "\n", start_form(-name=>"edit", -method=>"POST"); + print "\n", table(Tr([$nameRow])); + print "\n", submit('edit file'); + print "\n", submit('delete file'), br; + print "\n", end_form; +} + +# formular for choosing user, who shall be removed +# required arguments: - +sub deleteUserForm { + my $nameRow = "\n". td(["user:", popup_menu(-name=>"deleteUser", -values=>\@user_items)]); + print "\n", h3("Delete existing user"); + print "\n", start_form(-name=>"deleteUser", -method=>"POST"); + print "\n", table(Tr([$nameRow])); + print "\n", submit('delete user'), br; + + print "\n", end_form; +} + +# formular for changing an user's quota file +# required arguments: - +sub changeQuotaForm { + my ($rquota,$squota) = ''; + $rquota = param("rquota") if defined param("rquota"); + $squota = param("squota") if defined param("squota"); + my $dropdownMenu; + if (defined param("user")) { + $dropdownMenu = "\n"; + } else { + $dropdownMenu = popup_menu(-name=>"userQuota", -values=>\@user_items); + } + my $nameRow = "\n" . td(["user:", $dropdownMenu]); + my $recipientRow = "\n" . td(["new quota for recipient:", textfield(-size=>20, -name=>"recipientQuota", -value=>$rquota). " MB (optional)"]); + my $senderRow = "\n" . td (["new quota for sender:", textfield(-size=>20, -name=>"senderQuota", -value=>$squota). " MB (optional)"]); + print "\n", h3("Manage disk quota"); + print "\n", start_form(-name=>"manageQuota", -method=>"POST"); + print "\n", table(Tr([$nameRow, $recipientRow, $senderRow])); + print "\n", submit('change quota'); + print "\n", submit('remove quota'), br; + print "\n", end_form; +} + +# formular for choosing backup file to restore +# required arguments: - +sub restoreForm { + print h2("restore config"); + print "please specify the backup-archive you want to restore:"; + print "\n", start_form(-name=>"restoreFile", -method=>"POST"); + print "\n", filefield(-name=>"upload_archive", -size=>"80"), br; + print "\n", submit('restore'); + print "\n", end_form; +} + + +####### +# declaration user functions +####### + +# function for creating new users +# required arguments: username, auth-id +sub createUser { + my ($user,$id) = @_; + my $idf; + + $id or http_die("not enough arguments in createUser"); + + $user = lc $user; + $user =~ s:/::g; + $user =~ s:^[.@]+::; + $user =~ s:@+$::; + + if ($user !~ /@/) { + if ($mdomain) { + $user .= '@'.$mdomain; + } else { + error("Missing domain part in user address"); + } + } + + unless (-d "$spooldir/$user") { + mkdir "$spooldir/$user",0755 + or http_die("cannot mkdir $spooldir/$user - $!\n"); + } + + $idf = "$spooldir/$user/@"; + + if (-f $idf) { + error("There is already an user $user!"); + } + + open $idf,'>',$idf or http_die("cannot write $idf - $!\n"); + print {$idf} $id,"\n"; + close $idf or http_die("cannot write $idf - $!\n"); + print "\n"; + printf "%s?from=%s&ID=%s
\n",$fup,$user,$id; + printf "%s/%s

\n",$fup,b64("from=$user&id=$id"); + print "\n"; + notifyUser($user,$id); + print "An information e-mail to $user has been sent.\n"; +} + +# function for changing an user's auth-ID +# required arguments: username, auth-id +sub changeUser { + my ($user,$id) = @_; + defined($id) or http_die("not enough arguments in changeUser.\n"); + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + my $idf = "$spooldir/$user/@"; + print "\n"; + print "$idf

"; + + open $idf,'>',$idf or http_die("cannot write $idf - $!\n"); + print {$idf} $id,"\n"; + close $idf or http_die("cannot write $idf - $!\n"); + printf "%s?from=%s&ID=%s
\n",$fup,$user,$id; + printf "%s/%s\n",$fup,b64("from=$user&id=$id"); + print "

\n"; + notifyUser($user,$id,"change-auth"); + print "An information e-mail to $user has been sent.\n"; +} + +# function for showing an user's config files +# required arguments: username +sub showUserConfig { + http_die("not enough arguments in showUserConfig!\n") unless (my $user = $_[0]); + + chdir "$spooldir/$user" or http_die("could not change directory $spooldir/$user - $!"); + print h2("Config files of $user"); + + foreach my $file (glob('.auto @* @GROUP/*')) { + if (-f $file and not -l $file and $file !~ /.*~$/) { + print h3($file), "\n"; + open $file,'<',$file or http_die("cannot open $file - $!"); + # print "
\n"; + dumpfile($file); + # print "
\n"; + close $file; + } + } +} + +# function for editing an user's recipient/sender restrictions +# required arguments: username +sub editUser { + http_die("not enough arguments in editUser.\n") unless (my $user = $_[0]); + my @content; + http_die("no user $user") unless -d "$spooldir/$user"; + my $ar = "$spooldir/$user/\@ALLOWED_RECIPIENTS"; + unless (-f $ar) { + print "yeah!"; + open F,">$ar" or http_die("cannot open $ar - $!"); + print F<) { + push @content, $_; + } + close $file or http_die("cannot write $file - $!\n"); + print "\nedit file:", br; + print "\n", start_form(-name=>"editRestrictions", -method=>"POST"); + print "\n", textarea(-name=>'contentBox', -default=>join('',@content), -rows=>10, -columns=>80), br; + print "\n", hidden(-name=>'ar', -default=>"$ar",); + print "\n", submit('save changes'); + print "\n", end_form; +} + +# function for deleting files +# required arguments: list of Files +sub deleteFiles { + http_die("not enough arguments in deleteFiles.\n") unless (my @files = @_); + + foreach (@files) { + if (-e $_) { + if (unlink $_) { + print "file has been deleted: $_\n", br; + } else { + print "file could not be deleted: $_ - $!\n", br; + } + } else { + print "file does not exists: $_\n", br; + } + } +} + +# function for saving a single file +# required arguments: content, location +sub saveFile { + http_die("not enough arguments in saveFile.\n") unless (my ($rf,$ar) = @_); + + if ($ar eq "$FEXLIB/fex.ph") { + open my $conf,">${ar}_new" or http_die("cannot open ${ar}_new - $!"); + print {$conf} $rf; + close $conf or http_die("cannot write $conf - $!\n");; + my $status = `perl -c $FEXLIB/fex.ph_new 2>&1`; + if ($status =~ /syntax OK/ ) { + unlink "${ar}_new"; + } else { + pq(qq( + 'No valid syntax in configuration file:' + '

' + '

$status
' + )); + &editFile("$FEXLIB/fex.ph_new"); + exit; + } + } + open my $file,">$ar" or http_die("cannot open $ar - $!"); + print {$file} $rf; + close $file or http_die("cannot write $file - $!\n");; + print "The following data has been saved:\n

\n"; + open $file,'<',$ar or http_die("cannot open $ar - $!"); + if ($ar =~ /\.html$/) { + print while <$file>; + } else { + print "

\n";
+	print while <$file>;
+    }
+    close $file or http_die("cannot write $file - $!\n");;
+}
+
+# function for deleting existing user
+# required arguments: username
+sub deleteUser {
+    http_die("not enough arguments in createUser.\n") unless (my $user = $_[0]);
+
+    $idf = "$spooldir/$user/\@";
+    http_die("no such user $user\n") unless -f $idf;
+    unlink $idf or http_die("cannot remove $idf - $!\n");
+    unlink "$spooldir/$user/\@ALLOWED_RECIPIENTS";
+    print "$user deleted\n";
+}
+
+# function for saving quota information for one single user
+# required arguments: username, recipient-quota, sender-quota
+sub alterQuota {
+    http_die("not enough arguments in createUser.\n") unless (my ($user,$rq,$sq) = @_);
+
+    $user .= '@'.$mdomain if $mdomain and $user !~ /@/;
+    unless (-d "$spooldir/$user") {
+        http_die("$user is not a regular F*EX user\n");
+    }
+
+    $rquota = $squota = '';
+    $qf = "$spooldir/$user/\@QUOTA";
+    if (open $qf,'<',$qf) {
+        while (<$qf>) {
+            s/#.*//;
+            $rquota = $1 if /recipient.*?(\d+)/i;
+            $squota = $1 if /sender.*?(\d+)/i;
+        }
+        close $qf or http_die("cannot write $qf - $!\n");
+    }
+
+    open $qf,'>',$qf or http_die("cannot open $qf - $!\n");
+    if(defined($rq) && $rq ne "") {
+        $rquota = $1 if $rq =~ /(\d+)/i;
+    }
+    if(defined($sq) && $sq ne "") {
+        $squota = $1 if $sq =~ /(\d+)/i;
+    }    
+    print {$qf} "recipient:$rquota\n" if $rquota =~ /\d/;
+    print {$qf} "sender:$squota\n" if $squota =~ /\d/;
+    close $qf or http_die("cannot write $qf - $!\n");
+
+    $rquota = $recipient_quota if $rquota !~ /\d/;
+    $squota = $sender_quota    if $squota !~ /\d/;
+    print h3("New quotas for $user");
+    print "recipient quota: $rquota MB\n", br;
+    print "sender quota:   $squota MB\n", br;
+}
+
+# function for listing f*exed files
+# required arguments: -
+sub listFiles {
+    print h3("List current files"),"\n";
+    my ($file,$dkey);
+    chdir $spooldir or http_die("$spooldir - $!\n");
+    print "\n";
+    foreach $file (glob "*/*/*") {
+        if (-s "$file/data" and  $dkey = readlink("$file/dkey") and -l ".dkeys/$dkey") {
+          ($to,$from,$file) = split "/",$file;
+          $file = html_quote($file);
+          print "$from --> $to : $durl/$dkey/$file
\n"; + } + } + print "
\n"; +} + +# function for watching the fex-logfile +# required arguments: - +sub watchLog { + if (-f 'fexsrv.log') { + print h2("polling fexsrv.log"),"\n"; + open my $log,"$FEXHOME/bin/logwatch|" + or http_die("cannot run $FEXHOME/bin/logwatch - $!\n"); + dumpfile($log); + } else { + print h2("no fexsrv.log"),"\n"; + } +} + +# function for showing logfiles +# required arguments: logfile-name +sub getlog { + my $log = shift or http_die("not enough arguments in getLog"); + + print h2("show $log"),"\n"; + if (open $log,"$logdir/$log") { + dumpfile($log); + close $log; + } else { + http_die("cannot open $logdir/$log - $!\n"); + } +} + +# function for creating a new backup file +# required arguments: - +sub backup { + my @d = localtime time; + my $date = sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); + my $backup = "backup/config-$date.tar"; + my $http_client = $ENV{HTTP_USER_AGENT} || ''; + my $size; + + my $home = $FEXHOME; + $home = $1 if $ENV{VHOST} and $ENV{VHOST} =~ /:(.+)/; + + chdir $home or http_die("$home - $!\n"); + + unless (-d "backup") { + mkdir "backup",0700 or http_die("cannot mkdir backup - $!\n"); + } + + system "tar -cf $backup @backup_files 2>/dev/null"; + + $size = -s $backup or http_die("backup file empty\n"); + + open $backup,'<',$backup or http_die("cannot open $backup - $!\n"); + + nvt_print( + 'HTTP/1.1 200 OK', + "Content-Length: $size", + "Content-Type: application/octet-stream; filename=fex-backup-$date.tar", + "Content-Disposition: attachment; filename=\"fex-backup-$date.tar\"", + "", + ); + + while (read($backup,my $b,$bs)) { + print $b or last; + } + + exit; +} + +# function for restoring an old configuration file +# required arguments: uploaded archive +sub restore { + http_die("not enough arguments in restore!\n") unless (my $archive_file = $_[0]); + my $restore = "backup.tar"; + + my $home = $FEXHOME; + $home = $1 if $ENV{VHOST} and $ENV{VHOST} =~ /:(.+)/; + + chdir $home or http_die("$home - $!\n"); + + open $restore,'>',$restore or http_die("cannot open $restore - $!"); + + my $data; + while(read $archive_file,$data,$bs) { + print {$restore} $data; + } + close $restore or http_die("cannot write $restore - $!"); + if (-s $restore) { + print "file upload successful, saving actual config in $home/backup/failsave.tar\n", br; + system "tar -cf $home/backup/failsave.tar @backup_files 2>/dev/null"; + print "starting restore:\n

\n";
+        system "tar -xvf $restore";
+        unlink $restore;
+    } else {
+	http_die("upload error - no file data received\n");
+    }
+}
+
+# function for editing a text-file
+# required arguments: filepath, filename
+sub editFile {
+    my $ar = shift;
+    my $file;
+    local $/;
+  
+    open $ar,'<',$ar or http_die("cannot open $ar - $!");
+    $file = <$ar>;
+    close $ar;
+
+    print start_form(-name=>"editFile", -method=>"POST"),"\n";
+    print textarea(-name=>'contentBox', -default=>$file, -rows=>26, -columns=>80), br,"\n";
+    print hidden(-name=>'ar', -default=>"$ar"),"\n";
+    print submit('save changes'),"\n";
+    print end_form(),"\n";
+}
+
+# function for showing all users' quotas
+# required arguments: -
+sub showQuota {
+    my @table_content;
+    my $table_head;
+
+    print h2("Show quotas (domain sorted, values in MB)");
+    foreach (@user_items) {
+	if (s/###\s*//g) {
+	    $table_head = th({}, ["\@$_","sender","sender (used)","recipient","recipient (used)"]);
+	    if (@table_content) {
+		print table({-border=>1},Tr([@table_content])), "\n

\n"; + @table_content = ''; + } + push @table_content, $table_head; + } else { + my $rquota = $recipient_quota; + my $squota = $sender_quota; + my $rquota_used = 0; + my $squota_used = 0; + my $user = $_; + ($squota,$squota_used) = check_sender_quota($user); + ($rquota,$rquota_used) = check_recipient_quota($user); + s/\@.*//; + push @table_content, + "$_". + "$squota". + "$squota_used". + "$rquota". + "$rquota_used"; + } + } + print table({-border=>1},Tr([@table_content])), "\n"; +} + +# function for showing fex-server configuration +# required arguments: - +sub showConfig { + print h3("Show config"); + print table({},Tr([ + td(["spooldir:", $spooldir ]), + td(["logdir:", $logdir ]), + td(["docdir:", $docdir ]), + td(["durl:", $durl ]), + td(["mdomain:", $mdomain||'' ]), + td(["autodelete:", $autodelete ]), + td(["keep:", $keep_default ]), + td(["recipient_quota:", $recipient_quota]), + td(["sender_quota:", $sender_quota ]), + td(["admin:", $admin ]) + ])); +} + +# require authentification +sub require_akey { + my $id; + my $rid; + my $action; + + $action = param("action"); + if ($action and $action eq 'logout') { + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: /fac", + 'Content-Length: 0', + "Set-Cookie: akey=; Max-Age=0; Discard", + '' + ); + &reexec; + } + + $rid = slurp("$admin/@") or html_error($error,"no F*EX account for $admin"); + chomp $rid; + + $id = param("id"); + + if ($id) { + # correct auth-ID? + if ($id eq $rid) { + $akey = md5_hex("$admin:$rid"); + return; + } + } elsif ($akey) { + # correct akey? + return if $akey eq md5_hex("$admin:$rid"); + } + + http_header('200 OK'); + print html_header("F*EX Admin Control for $hostname"); + + if ($akey) { + pq(qq( + '

' + ' wrong akey for $admin' + '

' + )); + } + + if ($id and $id ne $rid) { + pq(qq( + '

' + ' wrong auth-ID for $admin' + '

' + )); + } + + pq(qq( + '
' + ' auth-ID for $admin:' + ' ' + '
' + )); + exit; +} + + +# function for checking simple HTTP authentication +# (not used any more, replaced with require_akey) +sub require_auth { + if ($ENV{HTTP_AUTHORIZATION} and $ENV{HTTP_AUTHORIZATION} =~ /Basic\s+(.+)/) + { @http_auth = split(':',decode_b64($1)) } + if ( + @http_auth != 2 + or $http_auth[0] !~ /^(fexmaster|admin|\Q$admin\E)$/ + or $http_auth[1] ne $admin_pw + ) { + http_header( + '401 Authorization Required', + "WWW-Authenticate: Basic realm=$admin F*EX admin authentification", + 'Content-Length: 0', + ); + # control back to fexsrv for further HTTP handling + &reexec; + } +} + +# function for sending notification mails to an user +# required arguments: username, auth-id, message-type +sub notifyUser { + http_die("not enough arguments in createUser.\n") unless (my ($user,$id) = @_); + my $type = $_[2]; + my $message = 'A F*EX account has been created for you. Use'; + + if (defined($type) and $type eq "change-auth") { + $message = 'New auth-ID for your F*EX account has been set. Use' + } + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + open my $mail,'|-',$sendmail,'-f',$admin,$user,$bcc + or http_die("cannot start sendmail - $!\n"); + pq($mail,qq( + 'From: $admin' + 'To: $user' + 'Subject: your F*EX account on $hostname' + 'X-Mailer: F*EX' + '' + '$message' + '' + '$ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$user' + 'auth-ID: $id' + '' + 'See http://$ENV{HTTP_HOST}/index.html for more information about F*EX.' + '' + 'Questions? ==> F*EX admin: $admin' + )); + close $mail + or http_die("cannot send notification e-mail (sendmail error $!)\n"); +} + +# sort key is the (inverse) domain +# required arguments: list of usernames (e-mail addresses) +sub domainsort { +# http_die("not enough arguments in domainsort.\n") unless (my @d = @_); + my @d = @_; + local $_; + + foreach (@d) { + s/ //g; + s/^/ /; + s/\./,/ while /\..*@/; + s/@/@./; + $_ = join('.',reverse(split /\./)); + } + + @d = sort { lc $a cmp lc $b } @d; + + foreach (@d) { + $_ = join('.',reverse(split /\./)); + s/,/./g; + s/@\./@/; + } + + return @d; +} + +# function for creating a sorted list of all users +# required arguments: - +sub userList { + my @u; + my $d = ''; + + foreach (domainsort(grep { s:/@:: } glob('*@*/@'))) { + s/ //g; + /@(.+)/; + if ($1 ne $d) { + push @u,"### $1 ###"; + } + push @u,$_; + $d = $1; + } + return @u; +} + + +sub dumpfile { + my $file = shift; + + print "
\n";
+  while (<$file>) {
+    s/&/&/g;
+    s/\n";
+}
+
+
+sub error {
+    print join("\n",@_),"\n";
+    print end_html();
+    exit;
+}
diff --git a/cgi-bin/foc b/cgi-bin/foc
new file mode 100755
index 0000000..e5eea41
--- /dev/null
+++ b/cgi-bin/foc
@@ -0,0 +1,243 @@
+#!/usr/bin/perl -wT
+
+# FEX CGI for (user) operation control
+#
+# Author: Ulli Horlacher 
+#
+
+use CGI         qw(:standard);
+use CGI::Carp	qw(fatalsToBrowser);
+use Fcntl 	qw(:flock);
+use Digest::MD5	qw(md5_hex);
+
+$CGI::LIST_CONTEXT_WARN = 0;
+$CGI::LIST_CONTEXT_WARN = 0;
+
+# add fex lib
+($FEXLIB) = $ENV{FEXLIB} =~ /(.+)/;
+die "$0: no $FEXLIB\n" unless -d $FEXLIB;
+
+our ($FEXHOME,$mdomain,$nomail,$faillog);
+our $akey = '';
+
+# load common code, local config : $HOME/lib/fex.ph
+require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n";
+
+my $error = 'F*EX operation control ERROR';
+
+chdir $spooldir or die "$spooldir - $!\n";
+
+$akeydir = "$spooldir/.akeys"; 
+$user = $id = '';
+
+# look for CGI parameters
+foreach my $v (param) {
+  my $vv = param($v);
+  debuglog("Param: $v=\"$vv\"");
+  if ($v =~ /^akey$/i and $vv =~ /^(\w+)$/) { 
+    $akey = $1;
+  } elsif ($v =~ /^(from|user)$/i) {
+    $user = normalize_email($vv);
+    $user .= '@'.$mdomain if $mdomain and $user !~ /@/;
+  } elsif ($v =~ /^id$/i) {
+    $id = checkchars($vv);
+  }
+}
+
+if ($akey and not $user and not $id) {
+  if (open $akey,'<',"$akeydir/$akey/@" and $id = getline($akey)) {
+    close $akey;
+    $user = readlink "$akeydir/$akey"
+      or http_die("internal server error: no $akey symlink");
+    $user =~ s:.*/::;
+    $user = untaint($user);
+    if ($akey ne md5_hex("$user:$id")) {
+      $user = $id = '';
+    }
+  }
+}
+
+$head = "$ENV{SERVER_NAME} F*EX operation control";
+
+# display HTML form and request user data
+if ($user and $id) {
+  my $idf;
+  unless (open $idf,'<',"$user/@") {
+    faillog("user $from, id $id");
+    html_error($error,"wrong user or auth-ID");
+  }
+  &check_status($user);
+  if (-e "$user/\@CAPTIVE") { html_error($error,"captive user") }
+  $rid = getline($idf);
+  close $idf;
+  if ($id eq $rid) {
+    unless ($akey) {
+      $akey = untaint(md5_hex("$user:$id"));
+      unlink "$akeydir/$akey";
+      symlink "../$user","$akeydir/$akey";
+    }
+  } else {
+    faillog("user $from, id $id");
+    html_error($error,"wrong user or auth-ID");
+  }
+  unlink $faillog if $faillog;
+  http_header("200 OK");
+  print html_header($head);
+  # authorized login URL
+  my $url = "$ENV{PROTO}://$ENV{HTTP_HOST}/fup/".b64("from=$user&id=$id");
+  pq(qq(
+    '

for user $user

' + '' + )); + ($quota,$du) = check_sender_quota($user); + if ($quota) { + pq(qq( + + + )); + } + ($quota,$du) = check_recipient_quota($user); + if ($quota) { + pq(qq( + + + )); + } + pq(qq( + '
sender quota (used):$quota ($du) MB +
recipient quota (used):$quota ($du) MB +
' + '


' + '' + 'Retrieve a list of all your received files in F*EX spool.' + )); + pq(qq( + '


' + '

' + ' ' + ' ' + ' ' + ' Change your auth-ID to' + ' ' + ' ' + )); + if (-s "$user/\@ALLOWED_RECIPIENTS") { + # pq(qq( + # ' (You are a restricted user)'; + # '

' + # )); + # '


' + # '' + # 'Show download URLs of files you have sent.' + unless ($nomail) { + pq(qq( + '


' + '' + 'Resend notification e-mails for files you have sent.' + )); + } + } else { + pq(qq( + '


' + '' + 'Forward a copy of a file you already have uploaded to another recipient.' + '


' + '' + 'Redirect files you have uploaded to a wrong or misspelled recipient.' + )); + unless ($nomail) { + pq(qq( + '


' + '' + 'Resend notification e-mails for files you have sent.' + )); + } + pq(qq( + '


' + ' Create a subuser who can send you files. Enter his e-mail address:
' + ' ' + ' for only one upload
' + )); + if ($nomail) { + pq(qq( + ' ' + )); + } else { + pq(qq( + ' Comment to send with information e-mail:
' + '
' + ' ' + )); + } + pq(qq( + '


' + ' Manage your subusers and groups' + '


' + ' Edit your address book' + )); + pq(qq( + '


' + ' ' + ' Change the disclaimer to be sent with notification e-mail.' + )); + } + pq(qq( + '


' + ' ' + ' (De)activate e-mail encryption.' + )) if -s "$ENV{HOME}/.gnupg/pubring.gpg"; + if ((readlink "$user/\@NOTIFICATION"||'') =~ /short/i) { + pq(qq( + '


' + ' Get detailed notification e-mails (current setting: brief).' + )); + } else { + pq(qq( + '


' + ' Get brief notification e-mails (current setting: detailed).' + )); + } + if ((readlink "$user/\@REMINDER"||'') =~ /no/i) { + pq(qq( + '


' + ' Get reminder notification e-mails (current setting: no reminders).' + )); + } else { + pq(qq( + '


' + ' Get no reminder notification e-mails (current setting: send reminders).' + )); + } + if (-e "$user/\@MIME") { + pq(qq( + '


' + ' Save files after download (current setting: display).' + )); + } else { + pq(qq( + '


' + ' Display files when downloading with web browser (current setting: save).' + )); + } + pq(qq( + '


' + ' Back to fup (upload page)' + '

' + )); + print &logout; + print "\n"; + exit; +} + +my $login = -x "$FEXHOME/login" ? 'login' : 'fup'; +nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/$login", + 'Expires: 0', + 'Content-Length: 0', + '' +); +&reexec; diff --git a/cgi-bin/fop b/cgi-bin/fop new file mode 100755 index 0000000..4370fb6 --- /dev/null +++ b/cgi-bin/fop @@ -0,0 +1,1087 @@ +#!/usr/bin/perl -wT + +# F*EX CGI for download +# +# Author: Ulli Horlacher +# + +use CGI qw':standard'; +use CGI::Carp qw'fatalsToBrowser'; +use Fcntl qw':flock :seek'; +use Cwd qw'abs_path'; +use File::Basename; +use IO::Handle; +use Encode; + +# add fex lib +($FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +our $error = 'F*EX download ERROR'; +our $head = "$ENV{SERVER_NAME} F*EX download"; +# import from fex.pp +our ($spooldir,$tmpdir,$logdir,$skeydir,$dkeydir,$durl); +our ($bs,$fop_auth,$timeout,$keep_default); +our ($limited_download,$admin,$akey,$adlm,$amdl); +our (@file_link_dirs); + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +my $ra = $ENV{REMOTE_ADDR}||0; +if (@download_hosts and not ipin($ra,@download_hosts)) { + http_die( + "Downloads from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); +} + +&check_maint; + +# call localized fop if available +if ($0 !~ m{/locale/.*/fop} and my $lang = $ENV{HTTP_ACCEPT_LANGUAGE}) { + if ($lang =~ /^de/ and $0 =~ m{(.*)/cgi-bin/fop}) { + my $fop = "$1/locale/deutsch/cgi-bin/fop"; + exec $fop if -x $fop; + } +} + +my $log = "$logdir/fop.log"; + +chdir $spooldir or die "$spooldir - $!\n"; + +my $http_client = $ENV{HTTP_USER_AGENT} || ''; + +$file = $ENV{PATH_INFO} || ''; +http_die('no file name') unless $file; +$file =~ s:%3F:/?/:g; # escape '?' for URL-decoding +$file =~ s/%([\dA-F]{2})/unpack("a",pack("H2",$1))/ge; +$file =~ s:/\?/:%3F:g; # deescape '?' +$file =~ s:/\.\.:/__:g; +$file =~ s:^/+::; +$file = untaint($file); + +# secure mode with HTTP authorization? +if ($fop_auth) { + @http_auth = (); + if ($ENV{HTTP_AUTHORIZATION} and $ENV{HTTP_AUTHORIZATION} =~ /Basic\s+(.+)/) { + @http_auth = split(':',decode_b64($1)); + } + if (@http_auth != 2) { + &require_auth; + } + &check_auth($file,@http_auth); +} + +# download-URL-scheme /$dkey/$file ? +if ($file =~ m:^([^/]+)/[^/]+$:) { + $dkey = $1; + if ($link = readlink("$dkeydir/$dkey")) { + if ($link !~ s:^\.\./::) { + http_die("internal error on dkey for $link"); + } + $file = untaint($link); + } else { + http_die("no such file $file"); + } +} else { + # download-URL-scheme /$to/$from/$file + $file =~ s/\?.*//; + + if ($ENV{REQUEST_METHOD} eq 'GET' and $file =~ m:.+/(.+)/.+:) { + $from = lc $1; + if (-s "$from/\@ALLOWED_RECIPIENTS") { + http_die("$from is a restricted user"); + } + } + + # add mail-domain to addresses if necessary + if ($mdomain and $file =~ s:(.+)/(.+)/(.+):$3:) { + $to = lc $1; + $from = lc $2; + $to .= '@'.$hostname if $to eq 'anonymous'; + $from .= '@'.$hostname if $from eq 'anonymous'; + $to .= '@'.$mdomain if -d "$to\@$mdomain"; + $from .= '@'.$mdomain if -d "$from\@$mdomain"; + if ($ENV{REQUEST_METHOD} eq 'GET' and -s "$from/\@ALLOWED_RECIPIENTS") { + http_die("$from is a restricted user"); + } + $file = "$to/$from/$file"; + } +} + +if ($file and $file =~ m:(.+)/(.+)/.+:) { + $to = $1; + $from = $2; + # afex! + if ($from =~ s/^(anonymous).*/$1/) { + if (@anonymous_upload and ipin($ra,@anonymous_upload) or $dkey) { + $anonymous = $from; + } else { + http_header('403 Forbidden'); + print html_header($head), + "You have no permission to request the URI $ENV{REQUEST_URI}\n", + "\n"; + exit; + } + } +} else { + http_die("unknown query format"); +} + +$data = "$file/data"; + +# open $file,$file; print Digest::MD5->new->addfile($file)->hexdigest; + +# request with ?query-parameter ? +if ($qs = $ENV{QUERY_STRING}) { + + http_die("\"$1\" is not allowed in URL") if $qs =~ /([<>\%\'\"])/; + + # workaround for broken F*IX + $qs =~ s/&ID=skey:\w+//; + + # subuser with skey? + if ($qs =~ s/&*SKEY=([\w:]+)//i) { + $skey = $1; + # encrypted skey? + if ($skey =~ s/^MD5H:(.+)/$1/) { + # lookup real skey + foreach my $s (glob "$skeydir/*") { + $s =~ s:.*/::; + if ($skey eq md5_hex($s.$ENV{SID})) { + $skey = $s; + last; + } + } + } + if (open $skey,'<',"$skeydir/$skey") { + $from = $to = ''; + while (<$skey>) { + $from = lc($1) if /^from=(.+)/; + $to = lc($1) if /^to=(.+)/; + } + close $skey; + if ($from and $to) { + $file =~ s:.*/:$to/$from/:; + } else { + http_die("INTERNAL ERROR: missing data in $skeydir/$skey"); + } + } else { + debuglog("SKEY=$skey"); + http_die("wrong SKEY authentification"); + } + } + + # group member with gkey? + if ($qs =~ s/&*GKEY=([\w:]+)//i) { + $gkey = $1; + # encrypted gkey? + if ($gkey =~ s/^MD5H:(.+)/$1/) { + # lookup real gkey + foreach my $g (glob "$gkeydir/*") { + $g =~ s:.*/::; + if ($gkey eq md5_hex($g.$ENV{SID})) { + $gkey = $g; + last; + } + } + } + if (open $gkey,'<',"$gkeydir/$gkey") { + $from = $to = ''; + while (<$gkey>) { + $from = lc($1) if /^from=(.+)/; + $group = lc($1) if /^to=\@(.+)/; + } + close $gkey; + if ($from and $group and open $group,'<',"$from/\@GROUP/$group") { + while (<$group>) { + s/#.*//; + s/\s//g; + if (/(.+):/) { + my $to = $1; + $file =~ s:.*/:$to/$from/:; + last; + } + } + close $group; + } else { + http_die("INTERNAL ERROR: missing data in $gkeydir/$gkey"); + } + } else { + debuglog("GKEY=$gkey"); + http_die("wrong GKEY authentification"); + } + } + + # check for ID in query + elsif ($qs =~ s/\&*\bID=([^&]+)//i) { + $id = $1; + $fop_auth = 0; + + if ($id eq 'PUBLIC') { + http_header('403 Forbidden'); + exit; + } + + if ($file =~ m:^(.+)/(.+)/(.+):) { + $to = $1; + $from = $2; + $to =~ s/,+/,/g; + $to =~ s/\s//g; + $from =~ s/\s//g; + if ($mdomain and $from ne 'anonymous') { + $to .= '@'.$mdomain if $to !~ /@/; + $from .= '@'.$mdomain if $from !~ /@/; + } + $to = lc $to; + $from = lc $from; + } else { + http_die("unknown file query format"); + } + + # public or anonymous recipient? (needs no auth-ID for sender) + if ($anonymous or $id eq 'PUBLIC' and + @public_recipients and grep /^\Q$to\E$/i,@public_recipients) { + $rid = $id; + } else { + open my $idf,'<',"$from/@" or http_die("unknown user $from"); + $rid = getline($idf); + close $idf; + $rid = sidhash($rid,$id); + } + + unless ($id eq $rid) { + debuglog("real id=$rid, id sent by user=$id"); + http_die("wrong auth-ID"); + } + + # set akey link for HTTP sessions + # (need original id for consistant non-moving akey) + if (-d $akeydir and open $idf,'<',"$from/@" and my $id = getline($idf)) { + $akey = untaint(md5_hex("$from:$id")); + unlink "$akeydir/$akey"; + symlink "../$from","$akeydir/$akey"; + } + + my %to; + COLLECTTO: foreach my $to (split(',',$to)) { + if ($to !~ /.@./ and open my $AB,'<',"$from/\@ADDRESS_BOOK") { + while (<$AB>) { + s/\s*#.*//; + s/^\s+//; + next unless $_; + if (/^\s*([\S]+)\s+([\S]+)/) { + my ($alias,$address) = ($1,$2); + if ($to =~ /^\Q$alias\E$/i) { + foreach my $to (split(",",$address)) { + $to .= '@'.$mdomain if $mdomain and $to !~ /@/; + $to{$to} = lc $to; # ignore dupes + } + next COLLECTTO; + } + } + } + } elsif ($to =~ /^\@(.+)/) { + my $group = "$from/\@GROUP/$1"; + if (not -l $group and open $group) { + while (<$group>) { + s/#.*//; + s/\s//g; + if (/(.+\@[w.-]+):.+/) { + $to{$1} = lc $1; # ignore dupes + } + } + close $group; + } + } else { + $to .= '@'.$mdomain if $mdomain and $to !~ /.@./; + $to{$to} = lc $to; # ignore dupes + } + } + foreach $to (keys %to) { + # if (-e "$to/\@CAPTIVE") { http_die("$to is CAPTIVE") } + unless (-d $to or checkaddress($to)) { + http_die("$to is not a legal e-mail address"); + } + } + + } + + if ($qs =~ /\&?KEEP=(\d+)/i) { + $keep = $1; + $filename = filename($file); + check_captive($file); + if (-f $data) { + unlink "$file/keep"; + if (symlink $keep,"$file/keep") { + http_header('200 OK'); + print html_header($head), + "

set keep=$keep for $filename

\n", + "\n"; + } else { + http_header('599 internal error'); + print html_header($head), + "

$filename - $!

\n", + "\n"; + } + } else { + http_header('404 File not found'); + print html_header($head), + "

$filename not found

\n", + "\n"; + } + exit; + } elsif ($qs =~ s/\&?KEEP//i) { + check_captive($file); + $autodelete = 'NO'; + } + + if ($qs =~ s/\&?FILEID=(\w+)//i) { $fileid = $1 } + + if ($qs =~ s/\&?IGNOREWARNING//i) { $ignorewarning = 1 } + + if ($qs eq 'LIST') { + http_header('200 OK','Content-Type: text/plain'); + print "$file :\n"; + chdir $file and exec '/client/bin/l'; + exit; + } + + # copy file to yourself + if ($qs eq 'COPY') { + unless (-f "$file/data") { + http_die("File not found."); + } + ($to,$from,$file) = split('/',$file); + unless ("$to/@") { + # http_header('403 Forbidden'); + # print html_header($head), + # "You have no permission to copy a file.\n", + # "\n"; + http_die("You have no permission to copy a file."); + } + if (-s "$to/\@ALLOWED_RECIPIENTS") { + http_die("You are a restricted user."); + } + if (-e "$to/$to/$file/data") { + # http_header('409 File Exists'); + # print html_header($head), + # "File $file already exists in your outgoing spool.\n", + # "\n"; + http_die("File $file already exists in your outgoing spool."); + } + mkdirp("$to/$to/$file"); + link "$to/$from/$file/data","$to/$to/$file/data" + or http_die("cannot link to $to/$to/$file/data - $!\n"); + my $fkey = copy("$to/$from/$file/filename","$to/$to/$file/filename"); + open my $notify,'>',"$to/$to/$file/notify"; + close $notify; + my $dkey = randstring(8); + unlink "$to/$to/$file/dkey","$dkeydir/$dkey"; + symlink "../$to/$to/$file","$dkeydir/$dkey"; + symlink $dkey,"$to/$to/$file/dkey"; + http_header('200 OK',"Location: $durl/$dkey/$fkey"); + print html_header($head), + "File $file copied to yourself.\n", + "\n"; + exit; + } + + # ex and hopp? + if ($qs =~ s/(^|&)DELETE//i) { + if (unlink $data) { + $filename = filename($file); + if (open my $log,'>',"$file/error") { + printf {$log} "%s has been deleted by %s at %s\n", + $filename,$ENV{REMOTE_ADDR},isodate(time); + close $log; + } + if (open $log,'>>',$log) { + printf {$log} + "%s [%s_%s] %s %s deleted\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file); + close $log; + } + http_header('200 OK',"X-File: $file"); + print html_header($head), + "

$filename deleted

\n", + "\n"; + exit; + } else { + http_die("no such file"); + } + exit; + } + + # wipe out!? (for anonymous upload) + if ($qs =~ s/(^|&)PURGE//i) { + $filename = filename($file); + if (@anonymous_upload and ipin($ra,@anonymous_upload)) { + unlink "$dkeydir/$dkey" if $dkey; + if (rmrf($file)) { + if (open $log,'>>',$log) { + printf {$log} + "%s [%s_%s] %s %s purged\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file); + close $log; + } + http_header('200 OK',"X-File: $file"); + print html_header($head), + "

$filename purged

\n", + "\n"; + } else { + http_die("no such file"); + } + } else { + http_die("you are not allowed to purge $filename"); + } + exit; + } + + # request for file size? + if ($qs eq '?') { + sendsize($file); + # control back to fexsrv for further HTTP handling + &reexec; + } + + # fallback + if ($qs) { + http_die("unknown query format $qs"); + } + +} + +unless ($id and $rid and $id eq $rid or $dkey or $anonymous) { + http_die("wrong parameter $file"); +} + +unless ($to) { + http_die("internal error: unknown recipient"); +} + +unless ($from) { + http_die("internal error: unknown sender"); +} + +&check_status($from); + +# server based ip restrictions +if (@download_hosts and not ipin($ra,@download_hosts)) { + http_die( + "Downloads from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); +} + +# user based ip restrictions +unless (check_rhosts("$to/\@DOWNLOAD_HOSTS")) { + http_die("You are not allowed to download from IP $ra"); +} + +# file based ip restrictions +unless (check_rhosts("$file/restrictions")) { + http_die("Download of files from external user $from is restricted " + ."to internal hosts. Your IP $ra is not allowed."); +} + +# set time mark for this access +if ($file =~ m:(.+?)/:) { + my $user = $1; + my $time = untaint(time); + utime $time,$time,$user; +} + +# reget or range? +if ($range = $ENV{HTTP_RANGE}) { + $seek = $1 if $range =~ /^bytes=(\d+)-/i; + $stop = $1 if $range =~ /^bytes=\d*-(\d+)/i; +} else { + $seek = 0; + $stop = 0; +} + +if (not $autodelete or $autodelete ne 'NO') { + $autodelete = readlink "$file/autodelete" || 'YES'; +} + +if ($from and $file eq "$from/$from/ADDRESS_BOOK") { + if (open my $AB,'<',"$from/\@ADDRESS_BOOK") { + my $ab = ''; + while (<$AB>) { + s/^\s+//; + s/\s+$//; + s/[\r\n]//g; + $ab .= $_."\r\n"; + } + close $AB; + nvt_print( + 'HTTP/1.1 200 OK', + 'Content-Length: ' . length($ab), + 'Content-Type: text/plain', + '' + ); + print $ab; + } else { + nvt_print( + 'HTTP/1.1 404 No address book found', + 'Content-Length: 0', + '' + ); + } + # control back to fexsrv for further HTTP handling + &reexec; +} + +if (-f $data) { + # already downloaded? + if ($limited_download and $limited_download !~ /^n/i + and $from ne $to # fex to yourself is ok! + and $to !~ /$amdl/ # allowed multi download recipients + and $from !~ /^_?fexmail/ # fexmail is ok! + and $to !~ /^_?fexmail/ # fexmail is ok! + and $to !~ /^anonymous/ # anonymous fex is ok! + and $http_client !~ /$adlm/ # allowed download managers + and $file !~ /\/STDFEX$/ # xx is ok! + and (slurp("$file/comment")||'') !~ /^!\*!/ # multi download allow flag + and not($dkey and ($ENV{HTTP_COOKIE}||'') =~ /dkey=$dkey/) + and open $file,'<',"$file/download") + { + $_ = <$file> || ''; + close $file; + chomp; + if ($ra) { + # allow downloads from same ip + $_ = '' if $ra eq $_; + # allow downloads from sender ip + $_ = '' if (readlink("$file/ip")||'') eq $ra; + } + if ($_) { + s/(.+) ([\w.:]+)$/by $2 at $1/; + $file = filename($file); + http_die("$file has already been downloaded $_"); + } + } + $sb = sendfile($file,$seek,$stop); + shutdown(STDOUT,2); +} elsif (-l $data) { + # $file =~ s:.*/::; + http_die("$file has been withdrawn"); +} elsif (open $errf,'<',"$file/error" and $err = getline($errf)) { + fdlog($log,$file,0,0); + http_die($err); +} else { + fdlog($log,$file,0,0); + if ($file =~ /^anonymous.*afex_\d+\.tar$/) { + # should be extra handled... + } + http_die("no such file $file"); +} + +debuglog(sprintf("%s %s %d %d %d", + isodate(time),$file,$sb||0,$seek,-s $data||0)); + +if ($sb+$seek == -s $data) { + + # note successfull download + $download = "$file/download"; + if (open $download,'>>',$download) { + printf {$download} "%s %s\n",isodate(time),$ENV{REMOTE_ADDR}; + close $download; + } + + # delete file after grace period + if ($autodelete eq 'YES') { + $grace_time = 60 unless defined $grace_time; + for (;;) { + my $utime = (stat $data)[8] || 0; + my $dtime = (stat $download)[8] || 0; + exit if $utime > $dtime; + last if time > $dtime+$grace_time; + sleep 10; + } + unlink $data; + my $error = "$file/error"; + if (open $error,'>',$error) { + printf {$error} "%s has been autodeleted after download from %s at %s\n", + filename($file),$ENV{REMOTE_ADDR},isodate(time); + close $error; + } + } + +} + +exit; + + +sub sendfile { + my ($file,$seek,$stop) = @_; + my ($filename,$size,$total_size,$fileid,$filetype); + my ($data,$download,$header,$buf,$range,$s,$b,$t0); + my $type = ''; + + # swap to and from for special senders, see fup storage swap! + $file =~ s:^(_?anonymous_.*)/(anonymous.*)/:$2/$1/:; + $file =~ s:^(_?fexmail_.*)/(fexmail.*)/:$2/$1/:; + + $data = $file.'/data'; + $download = $file.'/download'; + $header = $file.'/header'; + + # fallback defaults, should be set later with better values + $filename = filename($file); + $total_size = -s $data || 0; + + # file link? + if (-l $data) { + unless (-f $data and -r $data) { + http_die("$file has been withdrawn"); + } + $data = abs_path($data); + my $fok; + foreach (@file_link_dirs) { + my $dir = abs_path($_); + $fok = $data if $data =~ /^\Q$dir\//; + } + unless ($fok) { + http_die("no permission to download $file"); + } + } else { + unless (-f $data and -r $data) { + http_die("$file has gone"); + } + } + + if ($ENV{REQUEST_METHOD} eq 'GET') { + debuglog("Exp: FROM=\"$from\"","Exp: TO=\"$to\""); + open $data,$data and flock($data,LOCK_EX|LOCK_NB); + # security check: must be regular file after abs_path() + if (-l $data) { + http_die("no permission to download $file"); + } + # HTTP Range download suckers are already rejected by fexsrv + unless ($range = $ENV{HTTP_RANGE}) { + # download lock + open $download,'>>',$download or die "$download - $!\n"; + if ($file =~ m:(.+?)/(.+?)/: and $1 ne $2) { + # only one concurrent download is allowed if sender <> recipient + flock($download,LOCK_EX|LOCK_NB) or + http_die("$file locked: a download is already in progress"); + } + } + $size = $total_size - $seek - ($stop ? $total_size-$stop-1 : 0); + } elsif ($ENV{REQUEST_METHOD} eq 'HEAD') { + $size = -s $data || 0; + } else { + http_die("unknown HTTP request method $ENV{REQUEST_METHOD}"); + } + + # read MIME entity header (what the client said) + if (open $header,'<',$header) { + while (<$header>) { + if (/^Content-Type: (.+)/i) { + $type = $1; + last; + } + } + close $header; + $type =~ s/\s//g; + } + + $fileid = readlink "$file/id" || ''; + + # determine own MIME entity header for download + my $mime = $file; + $mime =~ s:/.*:/\@MIME:; + my $mt = $ENV{FEXHOME}.'/etc/mime.types'; + if (($type =~ /x-mime/i or -e $mime) and open $mt,'<',$mt) { + $type = 'application/octet-stream'; + MIMETYPES: while (<$mt>) { + chomp; + s/#.*//; + s/^\s+//; + my ($mt,@ft) = split; + foreach my $ft (@ft) { + if ($filename =~ /\.\Q$ft\E$/i) { + $type = $mt; + last MIMETYPES; + } + } + } + close $mt; + } + # reset to default MIME type + else { $type = 'application/octet-stream' } + + # HTML is not allowed for security reasons! (embedded javascript, etc) + $type =~ s/html/plain/i; + + debuglog("download with $http_client"); + + if ($seek or $stop) { + if ($size < 0) { + http_header('416 Requested Range Not Satisfiable'); + exit; + } + if ($stop) { + $range = sprintf("bytes %s-%s/%s",$seek,$stop,$total_size); + } else { + $range = sprintf("bytes %s-%s/%s",$seek,$total_size-1,$total_size); + } + nvt_print( + 'HTTP/1.1 206 Partial Content', + "Content-Length: $size", + "Content-Range: $range", + "Content-Type: $type", + ); + if ($http_client !~ /MSIE/) { + nvt_print("Cache-Control: no-cache"); + if ($type eq 'application/octet-stream') { + nvt_print("Content-Disposition: attachment; filename=\"$filename\""); + } + } + nvt_print(''); + } else { + # another stupid IE bug-workaround + # http://drupal.org/node/163445 + # http://support.microsoft.com/kb/323308 + if ($http_client =~ /MSIE/) { + # $type = 'application/x-msdownload'; + if ($ignorewarning) { + $type .= "; filename=$filename"; + nvt_print( + 'HTTP/1.1 200 OK', + "Content-Length: $size", + "Content-Type: $type", +# "Pragma: no-cache", +# "Cache-Control: no-store", + "Content-Disposition: attachment; filename=\"$filename\"", + "Connection: close", + ); +# nvt_print('','HTTP/1.1 200 OK',"Content-Length: $size","Content-Type: $type"); exit; + } else { + http_header('200 OK'); + print html_header($head); + pq(qq( + '

Internet Explorer warning

' + 'Using Microsoft Internet Explorer for download will probably' + 'lead to problems, because it is not Internet compatible (RFC 2616).' + '

' + 'We recommend Firefox' + '

' + 'If you really want to continue with Internet Explorer, then' + '' + 'click here with your right mouse button and select "save as"' + '' + '

' + 'See also F*EX user FAQ.' + '' + )); + &reexec; + } + } else { + nvt_print( + 'HTTP/1.1 200 OK', + "Content-Length: $size", + "Content-Type: $type", + "Cache-Control: no-cache", + "Connection: close", + ); + if ($type eq 'application/octet-stream') { + nvt_print(qq'Content-Disposition: attachment; filename="$filename"'); + } + } + + nvt_print("X-Size: $total_size"); + nvt_print("X-File-ID: $fileid") if $fileid; + # if ((`file "$file/data" 2>/dev/null` || '') =~ m{.*/data:\s(.+)}) { + # nvt_print("X-File-Type: $1"); + # } + if ($dkey = $dkey||readlink "$file/dkey") { + my $ma = (readlink "$file/keep"||$keep_default)*60*60*24; + nvt_print("Set-Cookie: dkey=$dkey; Max-Age=$ma; Path=$ENV{REQUEST_URI}"); + } + nvt_print(''); + } + + if ($ENV{REQUEST_METHOD} eq 'HEAD') { + # control back to fexsrv for further HTTP handling + &reexec; + } + + if ($ENV{REQUEST_METHOD} eq 'GET') { + + if (@throttle) { + my $to = $file; + $to =~ s:/.*::; + foreach (@throttle) { + if (/(.+):(\d+)$/) { + my $throttle = $1; + my $limit = $2; + # throttle ip address? + if ($throttle =~ /^[\d.-]+$/) { + if (ipin($ra,$throttle)) { + $bwl = $limit; + last; + } + } + # throttle e-mail address? + else { + # allow wildcard *, but not regexps + $throttle =~ quotemeta $throttle; + $throttle =~ s/\*/.*/g; + if ($to =~ /$throttle$/) { + $bwl = $limit; + last; + } + } + } + } + } + + foreach my $sig (keys %SIG) { local $SIG{$sig} = \&sigexit } + local $SIG{ALRM} = sub { die "TIMEOUT\n" }; + + seek $data,$seek,0; + + $t0 = time; + $s = $b = 0; + + # sysread/syswrite because of speed + while ($s < $size and $b = sysread($data,$buf,$bs)) { + # last chunk for HTTP Range? + if ($stop and $s+$b > $size) { + $b = $size-$s; + $buf = substr($buf,0,$b) + } + $s += $b; + alarm($timeout*10); + syswrite STDOUT,$buf or last; # client still alive? + if ($bwl) { + alarm(0); + sleep 1 while $s/(time-$t0||1)/1024 > $bwl; + } + } + + close $data; + alarm(0); + + fdlog($log,$file,$s,$size); + } + close $download; + + return $s; +} + + +sub sendsize { + my ($path) = @_; + my ($file,$upload,$to,$from,$dkey); + my $size = 0; + local $_; + + $path =~ s:^/::; + ($to,$from,$file) = split('/',$path); + $to =~ s/,.*//; + $to = lc $to; + $from = lc $from; + + # swap to and from for special senders, see fup storage swap! + ($from,$to) = ($to,$from) if $from =~ /^(fexmail|anonymous)/; + + $to .= '@'.$hostname if $to eq 'anonymous'; + $from .= '@'.$hostname if $from eq 'anonymous'; + + $to .= '@'.$mdomain if -d "$to\@$mdomain"; + $from .= '@'.$mdomain if -d "$from\@$mdomain"; + + $file =~ s/%([A-F0-9]{2})/chr(hex($1))/ge; + $file = urlencode($file); + + if ($to eq '*' and $fileid) { + foreach my $fd (glob "*/$from/$file") { + if (-f "$fd/data" + and -l "$fd/id" and readlink "$fd/id" eq $fileid + and $dkey = readlink "$fd/dkey") { + $to = $fd; + $to =~ s:/.*::; + last; + } + } + } elsif ($to !~ /@/ and open my $AB,'<',"$from/\@ADDRESS_BOOK") { + while (<$AB>) { + s/\s*#.*//; + $_ = lc $_; + my ($alias,$address) = split; + if ($address) { + $address =~ s/,.*//; + $address .= '@'.$mdomain if $mdomain and $address !~ /@/; + if ($to eq $alias) { + $to = $address; + last; + } + } + } + close $AB; + } + + if (-f "$to/$from/$file/data") { + $dkey = readlink "$to/$from/$file/dkey"; + $fkey = slurp("$to/$from/$file/filename")||$file; + } + + $upload = -s "$to/$from/$file/upload" || -s "$to/$from/$file/data" || 0; + $size = readlink "$to/$from/$file/size" || 0; + $fileid = readlink "$to/$from/$file/id" || ''; + + nvt_print('HTTP/1.1 200 OK'); + nvt_print("Server: fexsrv"); + nvt_print("Content-Length: $upload"); + nvt_print("X-Original-Recipient: $to"); + if ($dkey and not -s "$from/\@ALLOWED_RECIPIENTS") { + nvt_print("X-DKEY: $dkey"); + nvt_print("X-Location: $durl/$dkey/$fkey") if $fkey; + } + nvt_print("X-Size: $size"); + nvt_print("X-File-ID: $fileid") if $fileid; + nvt_print("X-Features: $ENV{FEATURES}"); + nvt_print(''); +} + + +sub check_rhosts { + my $ipr = shift; + my @hosts; + local $_; + + if (open $ipr,$ipr) { + while (<$ipr>) { + chomp; + s/#.*//; + s/\s//g; + if ($_ eq '@LOCAL_RHOSTS') { + push @hosts,@local_rhosts if @local_rhosts; + } elsif (/\w/) { + push @hosts,$_; + } + } + close $ipr; + if (@hosts and not ipin($ra,@hosts)) { + return 0; + } + } + return 1; +} + + +sub require_auth { + http_header( + '401 Authorization Required', + 'WWW-Authenticate: Basic realm="'.$ENV{SERVER_NAME}.' F*EX download"', + 'Content-Length: 0', + ); + # control back to fexsrv for further HTTP handling + &reexec; +} + + +sub check_auth { + my ($path,$user,$auth) = @_; + my ($to,$from,$file,$dkey); + my ($id,$idf); + my ($subuser,$subid); + my $auth_ok = 0; + local $_; + + if ($path =~ m:(.+)/(.+)/(.+):) { + ($to,$from,$file) = ($1,$2,$3); + } elsif ($path =~ m:(.+)/(.+):) { + ($dkey,$file) = ($1,$2); + $path = readlink "$dkeydir/$dkey" or http_die('no such file'); + (undef,$to,$from,$file) = split('/',$path); + } else { + http_die("wrong URL format for download"); + } + + $to .= '@'.$mdomain if $mdomain and $to !~ /@/; + $from .= '@'.$mdomain if $mdomain and $from !~ /@/; + + $to = lc $to; + $from = lc $from; + + # auth user match to in download URL? + if ($to ne $user and "$to\@$mdomain" ne $user and $to ne "$user@$mdomain") { + debuglog("mismatch: to=$to, auth user=$user"); + &require_auth; + } + + # check for real user + if (open $idf,'<',"$to/@") { + $id = getline($idf); + close $idf; + unless ($id and $id eq $auth) { + debuglog("$user mismatch: id=$id, auth=$auth"); + &require_auth; + } + } + # check for sub user + elsif (open $idf,'<',"$from/\@SUBUSER") { + while (<$idf>) { + chomp; + s/#.*//; + ($subuser,$subid) = split ':'; + if ($subid and $subid eq $auth + and ($user eq $subuser + or $subuser eq '*@*' + or $subuser =~ /^\*\@(.+)/ and $user =~ /\@\Q$1\E$/i + or $subuser =~ /(.+)\@\*$/ and $user =~ /^\Q$1\E\@/i)) { + $auth_ok = 1; + last; + } + } + close $idf; + unless ($auth_ok) { + debuglog("no matching $user in $from/\@SUBUSER"); + &require_auth; + } + } else { + debuglog("no $to/@ and no $from/@"); + &require_auth; + } + +} + + +sub check_captive { + my $to = shift; + $to =~ s:/.*::; + $to .= '@'.$mdomain if $mdomain and -d "$to\@$mdomain"; + if (-e "$to/\@CAPTIVE") { + http_die("$to is CAPTIVE - no URL parameters allowed"); + } +} + + +sub sigexit { + my ($sig) = @_; + my $msg; + + $msg = @_ ? "@_" : '???'; + $msg =~ s/\n/ /g; + $msg =~ s/\s+$//; + + errorlog("$file caught SIGNAL $msg"); + + # sigpipe means: client has terminated + # this event will be handled further by sendfile(), do not terminate here + if ($sig ne 'PIPE') { + $SIG{__DIE__} = ''; + if ($sig eq 'DIE') { + shift; + die "$msg\n"; + } else { + die "SIGNAL $msg\n"; + } + } +} diff --git a/cgi-bin/fuc b/cgi-bin/fuc new file mode 100755 index 0000000..864a3de --- /dev/null +++ b/cgi-bin/fuc @@ -0,0 +1,1222 @@ +#!/usr/bin/perl -wT + +# FEX CGI for user control +# (subuser, groups, address book, one time upload key, auth-ID, etc) +# +# Author: Ulli Horlacher +# + +use CGI qw(:standard); +use CGI::Carp qw(fatalsToBrowser); +use Fcntl qw(:flock); +use Digest::MD5 qw(md5_hex); + +$CGI::LIST_CONTEXT_WARN = 0; +$CGI::LIST_CONTEXT_WARN = 0; + +# add fex lib +($FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +# import from fex.pp +our ($FEXHOME); +our ($mdomain,$admin,$hostname,$sendmail,$akeydir,$skeydir,$docdir,$durl,$bcc); +our ($nomail,$faillog); +our $akey = ''; + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +my ($CASE,$ESAC); + +my $error = 'F*EX user config ERROR'; +my $head = "$ENV{SERVER_NAME} F*EX user config"; + +my $fup = $durl; +$fup =~ s:/fop:/fup:; + +chdir $spooldir or die "$spooldir - $!\n"; + +my $user = my $id = my $nid = my $ssid = my $comment = ''; +my $notification = my $reminder = my $disclaimer = ''; +my $encryption = my $pubkey = my $mime = ''; + +$akey = ''; # delete akey cookie + +my $qs = $ENV{QUERY_STRING}; +if ($qs) { + if ($qs =~ /akey=(\w+)/i) { $akey = $1 } + if ($qs =~ /ab=load/) { $ab = 'load' } +} + +# look for CGI POST parameters +foreach my $v (param) { + my $vv = param($v); + debuglog("Param: $v=\"$vv\""); + if ($v =~ /^akey$/i) { + $akey = $1 if $vv =~ /^(\w+)$/; + next; + } + $CASE = + $v =~ /^user$/i ? $user = normalize_email($vv): + $v =~ /^subuser$/i ? $subuser = normalize_email($vv): + $v =~ /^otuser$/i ? $otuser = normalize_email($vv): + $v =~ /^notify$/i ? $notify = normalize_email($vv): + $v =~ /^notification$/i ? $notification = checkchars('parameter',$vv): + $v =~ /^disclaimer$/i ? $disclaimer = $vv: + $v =~ /^encryption$/i ? $encryption = checkchars('parameter',$vv): + $v =~ /^pubkey$/i ? $pubkey = $vv: + $v =~ /^reminder$/i ? $reminder = checkchars('parameter',$vv): + $v =~ /^mime$/i ? $mime = checkchars('parameter',$vv): + $v =~ /^comment$/i ? $comment = decode_utf8(normalize($vv)): + $v =~ /^id$/i ? $id = checkchars('auth-ID',$vv): + $v =~ /^nid$/i ? $nid = checkchars('auth-ID',$vv): + $v =~ /^ssid$/i ? $ssid = $vv: + $v =~ /^group$/i ? $group = checkchars('group',$vv): + $v =~ /^ab$/i ? $ab = $vv: + $v =~ /^gm$/i ? $gm = $vv: + $v =~ /^show$/i ? $tools = checkchars('parameter',$vv): + $ESAC; +} + +$group = lc $group if $group and $group ne 'NEW'; +$group = '' if $nomail; +$user .= '@'.$mdomain if $mdomain and $user !~ /@/; + +$nomail = $comment if $comment =~ /NOMAIL|!#!/; + +if ($akey) { + + # sid is not set with web browser + my $idf = "$akeydir/$akey/@"; + + if (open $akey,'<',$idf and $id = getline($akey)) { + close $akey; + $idf =~ /(.*)\/\@/; + $user = readlink $1 + or http_die("internal server error: no $akey symlink $1"); + $user =~ s:.*/::; + $user = untaint($user); + if ($akey ne md5_hex("$user:$id")) { + $user = $id = ''; + } + } +} + +&check_status($user) if $user; + +if ($user and $akey and $qs and $qs =~ /info=(.+?)&skey=(.+)/) { + $subuser = $1; + $skey = $2; + notify_subuser($user,$subuser,"$fup?skey=$skey",$comment); + http_header("200 OK"); + print html_header($head); + pq(qq( + 'An information e-mail has been sent to your subuser $subuser' + '

Go back' + '' + )); + exit; +} + + +if ($user and $id) { + if (-e "$user/\@CAPTIVE") { html_error($error,"captive user") } + unless (open $idf,'<',"$user/@") { + faillog("user $from, id $id"); + html_error($error,"wrong user or auth-ID"); + } + $rid = getline($idf); + close $idf; + if ($id eq $rid) { + unless ($akey) { + $akey = untaint(md5_hex("$user:$id")); + unlink "$akeydir/$akey"; + symlink "../$user","$akeydir/$akey"; + } + } else { + faillog("user $from, id $id"); + html_error($error,"wrong user or auth-ID"); + } +} else { + my $login = -x "$FEXHOME/login" ? 'login' : 'fup'; + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/$login", + 'Expires: 0', + 'Content-Length: 0', + '' + ); + &reexec; +} + +# empty POST? ==> back to foc +if ($ENV{REQUEST_METHOD} eq 'POST' and not + ($subuser or $notify or $nid or $ssid or $group or $ab or $gm or $tools + or $disclaimer or $encryption or $pubkey)) +{ + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/foc", + 'Expires: 0', + 'Content-Length: 0', + '' + ); + &reexec; +} + +unlink $faillog if $faillog; + +http_header("200 OK"); +print html_header($head); +# foreach $v (keys %ENV) { print $v,' = "',$ENV{$v},"\"
\n" }; + +if ($gm and not $group) { + pq(qq( + '

ERROR: no group name specified

' + '' + )); + exit; +} + +if ($tools) { + pq(qq( + 'To use one of the following F*EX clients you must configure them after' + 'download:' + '

' + '' + ' ' + ' ' + ' ' + ' ' + '
F*EX server:$ENV{PROTO}://$ENV{HTTP_HOST}
Proxy:(your web proxy address, may be empty)
User:$user
Auth-ID:$id
' + )); + if (open $tools,"$docdir/tools.html") { + while (<$tools>) { + while (/\$([\w_]+)\$/) { + my $var = $1; + my $env = $ENV{$var} || ''; + s/\$$var\$/$env/g; + }; + print; + } + } + exit; +} + +if ($group) { + &handle_group; +} + +# create one time upload key +if ($subuser and $otuser) { + $otuser = $subuser; + if ($otuser !~ /^[^@]+@[\w.-]+[a-z]$/) { + pq(qq( + '$otuser is not a valid e-mail address' + '

Go back' + '' + )); + exit; + } + my $okey = randstring(8); + my $okeyd = "$user/\@OKEY"; + mkdir $okeyd; + symlink $otuser,"$okeyd/$okey" + or http_die("cannot create OKEY $okeyd/$okey : $!\n"); + my $url = "$fup?to=$user&okey=$okey"; + pq(qq( + 'A one time upload URL for $otuser has been created:' + '

' + '$url' + )); + unless ($nomail) { + ¬ify_otuser($user,$otuser,$url,$comment); + pq(qq( + '

' + 'and an information e-mail has been sent to this address.' + '

' + )); + } + pq(qq( + 'back to F*EX operation control' + '' + )); + exit; +} + +# direct single subuser entry +if ($subuser and not $otuser) { + if (-f "$subuser/@") { + pq(qq( + '$subuser is already a registered F*EX full user' + '

Go back' + '' + )); + exit; + } + if ($subuser !~ /^[^@]+@[\w.-]+[a-z]$/) { + pq(qq( + '$subuser is not a valid e-mail address' + '

Go back' + '' + )); + exit; + } + $skey = ''; + if (open $idf,'<',"$user/\@SUBUSER") { + while (<$idf>) { + chomp; + if (/^\Q$subuser:/) { + $skey = md5_hex("$user:$_"); + last; + } + } + close $idf; + } + if ($skey) { + my $url = "$fup?skey=$skey"; + if ($nomail) { + pq(qq( + '$subuser is already your subuser and has access URL:' + '

' + '$url' + )); + } else { + pq(qq( + '$subuser' + 'is already your subuser and has access URL:' + '

' + '$url' + '

' + "Click on the subuser's e-mail address link to send him an" + "information e-mail by the F*EX server.

" + )); + } + } else { + my $sid = randstring(8); + my $skey = mkskey($user,$subuser,$sid); + $url = "$fup?skey=$skey"; + open $idf,'>>',"$user/\@SUBUSER" or die "$user/\@SUBUSER - $!\n"; + print {$idf} "$subuser:$sid\n"; + close $idf; + pq(qq( + 'Your subuser upload URL is:' + '

' + '$url' + )); + unless ($nomail) { + ¬ify_subuser($user,$subuser,$url,$comment); + pq(qq( + '

' + 'An information e-mail has been sent to $subuser' + )); + } + } + print "\n"; + exit; +} + +# modify addressbook +if ($user and $akey and defined $ab) { + if ($ab eq 'load') { + $ab = ''; + if (open $ab,'<',"$user/\@ADDRESS_BOOK") { + undef $/; + $_ = <$ab>; + s/\s*$/\n/; + close $ab; + $ab = html_quote($_); + } + my $rows = ($ab =~ tr/\n//) + 5; + pq(qq( + '

Edit address book

' + '' + ' ' + ' ' + '
Entry:aliase-mail address# optional comment
Example:Framstagframstag\@rus.uni-stuttgart.de# Ulli Horlacher
' + '
' + ' ' + '
' + ' ' + '
' + '

' + 'You may use these alias names as F*EX recipient addresses on ' + 'fup' + '

' + 'Alternatively you can fex a file ADDRESS_BOOK to yourself ' + '($user) containing your alias definitions.' + '

' + 'back to F*EX operation control' + '' + )); + } else { + $ab =~ s/[\r<>]//g; + $ab =~ s/\s*$/\n/; + + foreach (split(/\n/,$ab)) { + s/^\s+//; + s/\s+$//; + if (s/\s*(#.*)//) { $comment = $1 } + else { $comment = '' } + next if /^\s*$/; + @options = (); + push @options,$1 if s/(autodelete=\w+)//i; + push @options,$1 if s/(keep=\d+)//i; + s/[,\s]+$//; + if (s/([\S]+)\s+(\S+)//) { + $alias = $1; + $address = $2; + $options = join(',',@options); + push @abt,"$alias$address$options$comment\n"; + } else { + push @badalias,$_; + } + } + + if (@badalias) { + print "

ERROR: bad aliases:

\n
    "; + foreach my $ba (@badalias) { print "
  • $ba" } + pq(qq( + '
' + '

' + 'Not in format: alias e-mail-address' + '

' + 'Go back' + '' + )); + exit; + } + + open my $AB,'>',"$user/\@ADDRESS_BOOK" + or http_die("cannot open $user/\@ADDRESS_BOOK - $!\n"); + print {$AB} $ab; + close $AB; + pq(qq( + '

address book

' + '' + '' + '@abt' + '
aliase-mail addressoptionscomment
' + '

' + 'back to F*EX operation control' + '

' + 'back to fup (F*EX upload)' + '' + )); + } + exit; +} + +if ($user and $notification eq 'detailed') { + unlink "$user/\@NOTIFICATION"; + pq(qq( + '

Notification e-mails now come in detailed format.

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($user and $mime eq 'yes') { + open $mime,'>',"$user/\@MIME" or http_die("cannot write $user/\@MIME - $!\n"); + close $mime; + pq(qq( + '

Downloads will now be displayed (if possible).

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($user and $mime eq 'no') { + unlink "$user/\@MIME"; + pq(qq( + '

Downloads will now be saved.

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($user and $notification eq 'short') { + unlink "$user/\@NOTIFICATION"; + symlink "short","$user/\@NOTIFICATION"; + pq(qq( + '

Notification e-mails now come in short format.

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($user and $disclaimer) { + my $df = "$user/\@DISCLAIMER"; + if ($disclaimer =~ /^[\s\"]*DEFAULT[\s\"]*$/i) { + unlink $df; + pq(qq( + '

E-mail disclaimer reset to default.

' + '

' + 'back to F*EX operation control' + '' + )); + } elsif ($disclaimer eq 'CHANGE') { + $disclaimer = slurp($df) || ''; + $disclaimer =~ s/&/&/g; + $disclaimer =~ s/' + ' ' + '


' + ' Disclaimer to be sent with download notification e-mail:
' + '
' + ' ' + ' or ' + ' reset the disclaimer to default.' + '' + '' + )); + exit; + } else { + $disclaimer =~ s/^\s+//; + $disclaimer =~ s/\s+$/\n/; + open $df,'>',$df or http_die("cannot write $df - $!\n"); + print {$df} $disclaimer; + close $df; + $disclaimer =~ s/&/&/g; + $disclaimer =~ s/E-mail disclaimer changed to:' + '

'
+      '$disclaimer'
+      '
' + '

' + 'back to F*EX operation control' + '' + )); + } + + &reexec; +} + +if ($user and $pubkey) { + my $gf = "$user/\@GPG"; + my $pk; + local $/; + local $_; + + open $gf,">$gf.pk" or http_die("cannot write $gf - $!\n"); + print {$gf} <$pubkey>; + close $gf; + unlink $gf; + system "gpg --batch --no-default-keyring --keyring $gf --import". + "< $gf.pk >/dev/null 2>&1"; + if (`gpg --batch <$gf 2>/dev/null` =~ /^pub\s.*<\Q$user\E>/sm) { + $pk = `gpg --batch <$gf 2>&1`; + $pk =~ s/&/&/g; + $pk =~ s/E-mails to you will be encrypted with the PGP/GPG key:' + '

'
+      '$pk'
+      '
' + '

' + 'back to F*EX operation control' + '' + )); + unlink "$gf.pk","$gf~"; + } else { + $pk = `gpg --batch <$gf.pk 2>&1`; + $pk =~ s/&/&/g; + $pk =~ s/Your uploaded file does not contain a PGP/GPG public key for' + ' $user' + '

'
+      '$pk'
+      '
' + '

' + 'back' + '' + )); + } + &reexec; +} + +if ($user and $encryption) { + my $gf = "$user/\@GPG"; + + unless(-s "$ENV{HOME}/.gnupg/pubring.gpg") { + html_error($error,"no GPG support activated"); + } + + if ($encryption eq 'DELETE') { + unlink $gf; + pq(qq( + '

PGP/GPG key deleted.

' + '

E-mails to you will be sent not encrypted.

' + '

' + 'back to F*EX operation control' + '' + )); + } elsif ($encryption eq 'CHANGE') { + pq(qq( + '

' + ' ' + ' Select your PGP/GPG public key file(*):
' + ' ' + '

' + ' and ' + '

' + )); + if (-f $gf) { + my $g = `gpg < $gf`; + $g =~ s/' + 'delete your already uploaded public key:' + '
'
+        '$g'
+        '
' + '


' + '(*) To extract and verify your GPG public key use:' + '

'
+        'gpg -a --export $user > pubkey.gpg'
+        'gpg < pubkey.gpg'
+        '
' + )); + } + print "\n"; + exit; + } + + &reexec; +} + +if ($user and $reminder eq 'yes') { + unlink "$user/\@REMINDER"; + pq(qq( + '

You will now get reminder notification e-mails.

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($user and $reminder eq 'no') { + unlink "$user/\@REMINDER"; + symlink "no","$user/\@REMINDER"; + pq(qq( + '

You will now get no reminder notification e-mails.

' + '

' + 'back to F*EX operation control' + '' + )); + &reexec; +} + +if ($nid) { + $nid =~ s/^\s+//; + $nid =~ s/\s+$//; + + $nid = randstring(6) if $nid eq '?'; + + open $idf,'>',"$user/@" or die "$user/@ - $!\n"; + print {$idf} $nid,"\n"; + close $idf; + $akey = untaint(md5_hex("$user:$nid")); + unlink "$akeydir/$akey"; + symlink "../$user","$akeydir/$akey"; + + pq(qq( + '

new auth-ID "$nid" for $user saved

' + 'back to F*EX operation control' + '' + )); + exit; +} + +# empty subuser list POST +if (defined(param('ssid')) and $ssid =~ /^\s*$/) { + unlink "$user/\@SUBUSER"; + pq(qq( + '

All subusers deleted

\n
    ' + 'back to F*EX operation control' + '' + )); + exit; +} + +# update sub-users +if ($ssid) { + my ($subuser,$subid,$skey); + + # delete old skeys + if (open $idf,'<',"$user/\@SUBUSER") { + while (<$idf>) { + s/#.*//; + if (/(.+\@.+):(.+)/) { + ($subuser,$subid) = ($1,$2); + $skey = md5_hex("$user:$subuser:$subid"); + unlink "$skeydir/$skey"; + unlink "$subuser/\@MAINUSER/$user"; + } + } + close $idf; + } + + $ssid = strip($ssid); + + # collect (new) subusers + foreach (split("\n",$ssid)) { + s/#.*//; + s/\s//g; + if (/(.+\@[\w.-]+)/) { + $subuser = lc $1; + push @badaddress,$subuser unless checkaddress($subuser); + } + } + + if (@badaddress) { + print "

    ERROR: bad addresses:

    \n
      "; + foreach my $ba (@badaddress) { print "
    • $ba" } + pq(qq( + '
    ' + 'Go back' + '' + )); + exit; + } + + if ($ssid =~ /\S\@\w/) { + open $idf,'>',"$user/\@SUBUSER" or die "$user/\@SUBUSER - $!\n"; + print "Your subusers upload URLs are:

    \n"; + print "\n"; + foreach (split("\n",$ssid)) { + s/#.*//; + s/\s//g; + if (/(\S+\@[\w.-]+)/) { + $subuser = lc $1; + if (/:(.+)/) { $subid = $1 } + else { $subid = randstring(8) } + print {$idf} "$subuser:$subid\n"; + $skey = mkskey($user,$subuser,$subid); + print " \n"; + } + } + pq(qq( + "
    $subuser :", + "$fup?skey=$skey
    \n

    " + "You have to give these URLs to your subusers for fexing files to you." + "
    " + "Or click on the subuser's e-mail address link to send him an" + "information e-mail by the F*EX server.

    " + )); + } + print "back to F*EX operation control\n"; + print "\n"; + close $idf; + exit; +} + +if (open my $subuser,'<',"$user/\@SUBUSER") { + local $/; + $ssid = <$subuser> || ''; + close $subuser; +} + +# display HTML form and request user data +pq(qq( + '

    ' + ' ' +)); + +# pq(qq( +# ' ' +# ' ' +# ' Your F*EX account: $user:$id

    ' +# ' New auth-ID: ' +# ' (Remember your auth-ID when you change it!)' +# )); + +if (-s "$user/\@ALLOWED_RECIPIENTS") { + pq(qq( + '

    ' + ' ' + '

    ' + '' + )); + exit; +} + +if ($ssid) { + $ssid = html_quote(strip($ssid)); +} + +pq(qq( + '


    ' + ' Allow special senders (= subusers) to fex files to you:
    ' + '
    ' + ' ' + '' + '

    ' + '' + ' ' + ' ' + '
    This list has entries in format:<e-mail address>:<encryption-ID>
    Example:framstag\@rus.uni-stuttgart.de:schwuppdiwupp
    ' + '

    ' + 'These special senders may fex files only to you!
    ' + 'It is not necessary to add regular fex users to your list,' + 'because they already can fex.' + '

    ' + 'The encryption-ID is necessary to generate a unique upload URL for this subuser.
    ' + 'If you omit the encryption-ID a random one will be used.' +)); + +unless ($nomail) { + pq(qq( + '


    ' + '

    ' + 'Edit your F*EX groups:

    ' + '
      ' + )); + + foreach $group (glob "$user/\@GROUP/*") { + if (-f $group and not -l $group and $group !~ /~$/) { + $group =~ s:.*/::; + print "
    • \@$group\n"; + } + } + + pq(qq( + '
    • new group' + '
    ' + )); +} + +pq(qq( + '


    ' + 'back to F*EX operation control' + '' +)); + +exit; + + +sub strip { + local $_ = shift; + s/[ \t]+//g; + s/\s*[\r\n]+\s*/\n/g; + return $_; +} + +sub notify_otuser { + my ($user,$otuser,$url,$comment) = @_; + my $server = $hostname || $mdomain; + my $sf; + + return if $nomail; + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $sf = $sender_from ? $sender_from : $user; + open my $mail,'|-',$sendmail,'-f',$sf,$otuser,$bcc + or http_die("cannot start sendmail - $!\n"); + pq($mail,qq( + 'From: $sf ($user via F*EX service $server)' + 'To: $otuser' + 'Subject: Your upload URL' + 'X-Mailer: F*EX' + '' + 'This is an automatically generated e-mail.' + '' + 'Use' + '' + '$url' + '' + 'to upload one file to $user' + '' + '$comment' + '' + 'Questions? ==> F*EX admin: $admin' + )); + close $mail + or http_die("cannot send notification e-mail (sendmail error $!)\n"); +} + + +sub notify_subuser { + my ($user,$subuser,$url,$comment) = @_; + my $server = $hostname || $mdomain; + my $sf; + + return if $nomail; + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $sf = $sender_from ? $sender_from : $user; + open my $mail,'|-',$sendmail,'-f',$sf,$subuser,$user,$bcc + or http_die("cannot start sendmail - $!\n"); + pq($mail,qq( + 'From: $sf ($user via F*EX service $server)' + 'To: $subuser' + 'Cc: $user' + 'Subject: Your F*EX account on $server' + 'X-Mailer: F*EX' + '' + 'This is an automatically generated e-mail.' + '' + 'A F*EX (File EXchange) account has been created for you on $server' + 'Use' + '' + '$url' + '' + 'to upload files to $user' + '' + 'See http://$ENV{HTTP_HOST}/index.html for more information about F*EX.' + '' + '$comment' + '' + 'Questions? ==> F*EX admin: $admin' + )); + close $mail + or http_die("cannot send notification e-mail (sendmail error $!)\n"); +} + + +sub notify_groupmember { + my ($user,$gm,$group,$id,$url) = @_; + my $server = $hostname || $mdomain; + my $sf; + + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + $sf = $sender_from ? $sender_from : $user; + open my $mail,'|-',$sendmail,'-f',$sf,$gm,$user,$bcc + or http_die("cannot start sendmail - $!\n"); + pq($mail,qq( + 'From: $sf ($user via F*EX service $hostname)' + 'To: $gm' + 'Cc: $user' + 'Subject: Your F*EX account on $server' + 'X-Mailer: F*EX' + '' + 'A F*EX (File EXchange) account has been created for you on $server' + 'Use' + '' + '$url' + '' + 'to upload files to F*EX group "$group"' + '' + 'See http://$ENV{HTTP_HOST}/ for more information about F*EX.' + '' + 'Questions? ==> F*EX admin: $admin' + )); + close $mail + or http_die("cannot send notification e-mail (sendmail error $!)\n"); +} + + +sub mkskey { + my ($user,$subuser,$id) = @_; + my $skey = md5_hex("$user:$subuser:$id"); + + open my $skf,'>',"$skeydir/$skey" or die "$skeydir/$skey - $!\n"; + print {$skf} "from=$subuser\n", + "to=$user\n", + "id=$id\n"; + close $skf or die "$skeydir/$skey - $!\n"; + mkdirp("$subuser/\@MAINUSER"); + symlink $skey,"$subuser/\@MAINUSER/$user"; + return $skey; +} + + +sub mkgkey { + my ($user,$group,$gm,$id) = @_; + my $gkey = untaint(md5_hex("$user:$group:$gm:$id")); + + open my $gkf,'>',"$gkeydir/$gkey" or die "$gkeydir/$gkey - $!\n"; + print {$gkf} "from=$gm\n", + "to=\@$group\n", + "user=$user\n", + "id=$id\n"; + close $gkf or die "$gkeydir/$gkey - $!\n"; + return $gkey; +} + + +sub handle_group { + my ($gf,$gd,$gl,$gid,$gkey); + + $group =~ s/^@+//; + $group =~ s:[/&<>]::g; + + # $notify is group member + if ($notify) { + $gf = untaint("$notify/\@GROUP/$group"); + unless ($_ = readlink $gf) { + pq(qq( + '

    ERROR: cannot read $gf - $!

    ' + '' + )); + exit; + } + if (m{([^/]+\@[\w.-]+)/}) { + $user = lc $1; + } else { + pq(qq( + '

    INTERNAL ERROR: groupfile = $gf

    ' + '' + )); + exit; + } + if (open $gf,'<',$gf) { + while (<$gf>) { + if (/\Q$notify\E:(\S+)/i) { + $gid = $1; + last; + } + } + close $gf; + } else { + pq(qq( + '

    ERROR: cannot open $gf - $!

    ' + '' + )); + exit; + } + unless ($gid) { + pq(qq( + '

    ERROR: $notify not found in $gf

    ' + '' + )); + exit; + } + $gkey = untaint(md5_hex("$user:$group:$notify:$gid")); + notify_groupmember( + $user, + $notify, + $group, + $gid, +# "$ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$notify&to=\@$group" + "$fup?gkey=$gkey" + ); + pq(qq( + '

    Notification e-mail to $notify has been sent

    ' + '

    Go back' + '' + )); + exit; + } + + $gf = untaint("$user/\@GROUP/$group"); + + if (defined $gm) { + if ($gm =~ /\S/) { + foreach (split /\n/,$gm) { + s/#.*//; + s/\s//g; + next if /^\w+=./; + next if /^$/; + if (s/:.+//) { + if (/(.+@[\w\.-]+)/ and checkaddress($_)) { + push @gm,lc $1; + } else { + push @badaddress,$_; + } + } else { + push @badformat,$_; + } + } + if (@badformat) { + print "

    ERROR: lines not in format <e-mail address>:<encryption-ID>

    \n
      "; + foreach my $ba (@badformat) { print "
    • $ba" } + print "
    \n"; + } + if (@badaddress) { + print "

    ERROR: bad addresses:

    \n
      "; + foreach my $ba (@badaddress) { print "
    • $ba" } + print "
    \n"; + } + if (@badformat or @badaddress) { + pq(qq( + 'Go back' + '' + )); + exit; + } + $gd = "$user/\@GROUP"; + unless (-d $gd or mkdir $gd,0700) { + print "

    ERROR: cannot create $gd - $!

    \n"; + print "\n"; + exit; + } + if (-l $gf) { + if ($_ = readlink $gf and m{([^/]+\@[\w.-]+)/}) { + $user = $1; + pq(qq( + '

    ERROR: you are already in group \@$group owned by $user

    ' + 'Go back' + 'and enter another group name' + '' + )); + } else { + print "

    INTERNAL ERROR: $gf is a symlink. but not readable

    \n"; + print "\n"; + } + exit; + } + # delete old gkeys + if (open $gf,'<',$gf) { + # delete old group links and gkeys + while (<$gf>) { + s/#.*//; + if (/(.+\@.+):(.+)/) { + $gkey = untaint(md5_hex("$user:$group:$1:$2")); + unlink "$gkeydir/$gkey"; + unlink "$1/\@GROUP/$group" if -l "$1/\@GROUP/$group"; + } + } + close $gf; + } + # write new group file and gkeys + if (open $gf,'>',$gf) { + $gm =~ s/[\r\n]+/\n/g; + foreach (split /\n/,$gm) { + print {$gf} "$_\n"; + s/#.*//; + s/\s//g; + if (/^\s*([^\/]+):(.+)/) { + mkgkey(lc $user,$group,lc $1,$2); + } + } + close $gf; + } else { + print "

    ERROR: cannot write $gf - $!

    \n"; + print "\n"; + exit; + } + if (@gm) { + foreach $gm (@gm) { + next if $gm eq $user; + unless (-d $gm or mkdir $gm,0700) { + print "

    ERROR: cannot create $gm - $!

    \n"; + print "\n"; + exit; + } + $gd = "$gm/\@GROUP"; + unless (-d $gd or mkdir $gd,0700) { + print "

    ERROR: cannot create $gd - $!

    \n"; + print "\n"; + exit; + } + $gl = "$gm/\@GROUP/$group"; + unless (-l $gl or symlink "../../$user/\@GROUP/$group",$gl) { + print "

    ERROR: cannot create $gl - $!

    \n"; + print "\n"; + exit; + } + } + pq(qq( + '

    Group \@$group has members:

    ' + '
      ' + )); + foreach $gm (@gm) { + if ($gm ne $user) { + print "
    • $gm\n"; + } + } + pq(qq( + '
    ' + '(click address to send a notification e-mail to this user)' + )); + } else { + print "

    Group \@$group has no members

    \n"; + } + pq(qq( + '

    ' + 'back to F*EX operation control' + )); + print end_html(); + exit; + } else { + # no group members -> delete group file + unlink $gf; + } + } else { + $gm = ''; + pq(qq( + '

    Edit F*EX group

    ' + 'A F*EX group is similar to a mailing list, but for files:
    ' + 'When a member fexes a file to this list, ' + 'then all other members will receive it.' + '

    ' + '

    ' + ' ' + )); + if ($group eq 'NEW') { + pq(qq( + ' ' + ' New group name: (You MUST fill out this field!)' + ' ' + )); + } else { + if (open $gf,'<',$gf) { + local $/; + $gm = <$gf>||''; + } + close $gf; + pq(qq( + ' ' + ' F*EX group \@$group:' + )); + } + my $rows = ($gm =~ tr/\n//) + 5; + pq(qq( + '

    ' + ' ' + '
    ' + '

    ' + '' + ' ' + ' ' + '
    This list must have entries in format:<e-mail address>:<encryption-ID>
    Example:framstag\@rus.uni-stuttgart.de:schwuppdiwupp
    ' + '

    ' + 'The encryption-ID is necessary to generate a unique upload URL for this subuser.' + 'You can name any existing e-mail address.' + )); + if (open my $ab,'<',"$user/\@ADDRESS_BOOK") { + pq(qq( + "


    " + "

    Your address book:

    " + "
    "
    +      ));
    +      while (<$ab>) {
    +        s/#.*//;
    +        print "$1\n" if /([\S]+\@[\S]+)/;
    +      }
    +      close $ab;
    +      print "
    \n"; + } + print "\n"; + exit; + } +} diff --git a/cgi-bin/fup b/cgi-bin/fup new file mode 100755 index 0000000..d43cda0 --- /dev/null +++ b/cgi-bin/fup @@ -0,0 +1,3038 @@ +#!/usr/bin/perl -wT + +# F*EX CGI for upload +# +# Author: Ulli Horlacher +# +# Contribs: +# Sebastian Zaiser (upload status) +# + +use Encode; +use Fcntl qw':flock :seek :mode'; +use IO::Handle; +use Digest::MD5 qw'md5_hex'; +use CGI::Carp qw'fatalsToBrowser'; +use Cwd qw'abs_path'; + +use constant DS => 60*60*24; +use constant M => 1024*1024; + +# add fex lib +die "$0: no \$FEXLIB\n" unless $ENV{FEXLIB}; +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +$| = 1; + +our $debug; +our $ndata = 0; +our $error = 'F*EX upload ERROR'; +our $head = "$ENV{SERVER_NAME} F*EX upload"; +our $autodelete = 'YES'; +our $locale; + +# import from fex.ph +our (@locales,@throttle,$bcc,$keep_max,$nomail,$nostore,$overwrite); +our (@local_domains,@local_rdomains,@local_hosts,@local_rhosts,); +our (@registration_hosts,@demo,@file_link_dirs); + +# import from fex.pp +our ($FEXHOME); +our ($spooldir,$durl,$tmpdir,$logdir,$docdir,$hostname,$admin,$fra); +our ($keep_default,$recipient_quota,$sender_quota); +our ($sendmail,$mdomain,$fop_auth,$mail_auth,$faillog); +our ($dkeydir,$ukeydir,$akeydir,$skeydir,$gkeydir,$xkeydir); +our $akey = ''; +our $dkey = ''; +our $skey = ''; +our $gkey = ''; + +our $seek = 0; # already sent bytes (from previous upload) +our $filesize = 0; # total file size +our $fpsize = 0; # file part size (MIME-part) + +my $data; +my $boundary; +my $rb = 0; # read bytes, totally +my $rid = ''; # real ID +my @header; # HTTP entity header +my $fileid; # file ID +my $captive; +my $muser; # main user fur sub or group user + +# load common code, local config: $FEXLIB/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +# load fup local config +our ($info_1,$info_2,$info_login); + +$locale = $ENV{LOCALE} || 'english'; +foreach my $pl ( + "/var/lib/fex/locale/$locale/lib/fup.pl", + "$FEXLIB/fup.pl", +) { + if (-f $pl) { + require $pl or die "$0: cannot load $FEXLIB/fup.pl - $!\n"; + last; + } +} + +&check_camel unless $sid; + +chdir $spooldir or http_die("$spooldir - $!\n"); + +my $log = "$logdir/fup.log"; + +my $http_client = $ENV{HTTP_USER_AGENT} || ''; +my $cl = $ENV{X_CONTENT_LENGTH} || $ENV{CONTENT_LENGTH} || 0; + +$fra .= '/'.$ENV{HTTP_X_FORWARDED_FOR} if $ENV{HTTP_X_FORWARDED_FOR}; + +$from = $to = $id = $file = $fkey = $comment = $command = $bwlimit = ''; +$filename = $okey = $addto = $replyto = $submit = ''; +@to = (); +$data = ''; +$locale = untaint($ENV{LOCALE}||''); + +my $ra = $ENV{REMOTE_ADDR}||0; +if (@upload_hosts and not ipin($ra,@upload_hosts)) { + http_die( + "Uploads from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); +} + +&check_maint; + +&parse_request; # showstatus will not come back! + +if ($addto) { + my %to; + foreach $to (@to) { $to{$to} = 1 } + push @to,$addto unless $to{$addto}; + if ($submit and @to == 1) { $addto = '' } +} + +$to = join(',',@to); + +$uid = randstring(8) unless $uid; # upload ID + +# user requests for forgotten ID +$id_forgotten = $id if $id =~ /^"?\?"?$/; +if ($from and $id_forgotten and $mail_authid and not ($fop_auth or $nomail)) { + &check_status($from); + &id_forgotten; + exit; +} + +# public recipients? (needs no auth-ID for sender) +if ($to and $id and $id eq 'PUBLIC' and @public_recipients) { + + unless ($from) { + http_die("missing sender e-mail address"); + } + # must use $param{FROM} for checking because $from is expanded with $mdomain + unless (checkaddress(despace($param{FROM}))) { + http_die("$param{FROM} is not a valid e-mail address"); + } + foreach my $to (@to) { + unless (grep /^\Q$to\E$/i,@public_recipients) { + http_die("$to is not a valid recipient"); + } + } + $restricted = $public = $rid = $id; +} + +# anonymous upload from enabled IP? +if ($from =~ /^anonymous@/ and + @anonymous_upload and ipin($ra,@anonymous_upload)) { + $id = $rid = $anonymous = 'anonymous'; + if ($to =~ /^anonymous/) { + @to = ($to); + $autodelete{$to} = $autodelete = 'NO'; + } + $nomail = $anonymous; +} + +$comment = 'NOMAIL' if $nomail and not $comment; + +# one time token +if ($okey) { + $to = "@to" or http_die("no recipient specified"); + $from = readlink "$to/\@OKEY/$okey" + or http_die("no upload key \"$okey\" - ". + "request another one from $to"); + $from = untaint($from); +} + +&check_status($from) if $from; + +# look for regular sender ID +if ($id and $from and not ($public or $anonymous or $okey)) { + if (open $from,'<',"$from/\@") { + # chomp($rid = <$from> || ''); + $rid = getline($from); + close $from; + $rid = sidhash($rid,$id); + # set time mark for successfull access + if ($id eq $rid) { + my $time = untaint(time); + utime $time,$time,$from; + } + } else { + my $error = $!; + # if recipient (to) is specified, we have to look for subusers later, too + unless (@to) { + fuplog("ERROR: $spooldir/$from/\@ $error"); + debuglog("cannot open $spooldir/$from/\@ : $error"); + faillog("user $from, id $id"); + http_die("wrong user or auth-ID"); + } + } +} + +# check regular ID +if ($from and $id and not ($gkey or $skey or $public or $okey)) { + if ($rid and $rid eq $id) { + # set akey link for HTTP sessions + # (need original id for consistant non-moving akey) + if (-d $akeydir and open $idf,'<',"$from/@" and my $id = getline($idf)) { + $akey = untaint(md5_hex("$from:$id")); + mksymlink("$akeydir/$akey","../$from"); + # show URL from fexsend + if ($from eq $to and $comment eq '*') { + mksymlink("$akeydir/$akey","../$from"); + } + } + $captive = -e "$from/\@CAPTIVE"; + } else { + fuplog("ERROR: wrong auth-ID for $from"); + debuglog("id sent by user $from=$id, real id=$rid"); + faillog("user $from, id $id"); + http_die("Wrong user or auth-ID"); + } +} + +# forward a copy of a file to another recipient +if ($akey and $dkey and $command eq 'FORWARD') { + my $file = untaint(readlink "$dkeydir/$dkey"||''); + http_die("unknown dkey $dkey>") unless $file; + $file =~ s:^\.\./::; + forward($file); + exit; +} + +# modify file parameter +if ($akey and $dkey and $command eq 'MODIFY') { + my $file = untaint(readlink "$dkeydir/$dkey"||''); + http_die("unknown dkey $dkey") unless $file; + $file =~ s:^\.\./::; + modify($file); + exit; +} + +# copy file from incoming to outgoing spool +if ($akey and $dkey and $command eq 'COPY') { + unless ($file = readlink "$dkeydir/$dkey") { + http_die("No such file with DKEY=$dkey"); + } + if ($file =~ m:../(.+)/(.+)/(.+):) { + ($to,$from,$file) = ($1,$2,$3); + } else { + http_die("Bad DKEY $dkey -> $file"); + } + unless (-f "$to/$from/$file/data") { + http_die("File not found"); + } + if (-e "$to/$to/$file/data") { + http_die("File $file already exists in your outgoing spool") + if (readlink("$to/$to/$file/id")||$to) ne + (readlink("$to/$from/$file/id")||$from); + } else { + mkdirp("$to/$to/$file"); + link "$to/$from/$file/data","$to/$to/$file/data" + or http_die("cannot link to $to/$to/$file/data - $!\n"); + copy("$to/$from/$file/filename","$to/$to/$file/filename"); + copy("$to/$from/$file/id","$to/$to/$file/id"); + open $file,'>',"$to/$to/$file/notify"; + close $file; + open $file,'>',"$to/$to/$file/download"; + print {$file} "$to\n"; + close $file; + $dkey = randstring(8); + unlink "$to/$to/$file/dkey","$to/$to/$file/keep","$dkeydir/$dkey"; + symlink "../$to/$to/$file","$dkeydir/$dkey"; + symlink $dkey,"$to/$to/$file/dkey"; + } + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/rup?akey=$akey&oto=$to&file=$file", + 'Content-Length: 0', + '' + ); + &reexec; +} + +# delete file without download +if ($akey and $dkey and $command eq 'DELETE') { + $del = untaint(readlink "$dkeydir/$dkey"||''); + http_die("unknown dkey $dkey") unless $del; + $del =~ s:^\.\./::; + $filename = filename($del); + if (unlink("$del/data") or unlink("$del/upload")) { + if (open F,'>',"$del/error") { + printf F "%s has been deleted by %s at %s\n", + $filename,$ENV{REMOTE_ADDR},isodate(time); + close F; + } + # http_header('200 OK'); + # print html_header($head); + # print "

    $filename deleted

    \n"; + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/fup?akey=$akey&command=LISTRECEIVED", + 'Content-Length: 0', + "" + ); + &reexec; + } else { + my $s = $!; + http_header('404 Not Found'); + print html_header($head); + print "

    $filename not deleted ($s)

    \n"; + print "continue\n" if $akey; + print "\n"; + } + exit; +} + +# special commands +if (($from and $id and $rid eq $id or $gkey or $skey) and $command) { + + if ($command eq 'CHECKQUOTA') { + http_die("illegal command \"$command\"") if $public or $anonymous; + nvt_print('HTTP/1.1 204 OK'); + # nvt_print("X-SID: $ENV{SID}") if $ENV{SID}; + ($quota,$du) = check_sender_quota($muser||$from); + nvt_print("X-Sender-Quota: $quota $du") if $quota; + ($quota,$du) = check_recipient_quota($muser||$from); + nvt_print("X-Recipient-Quota: $quota $du") if $quota; + nvt_print(''); + exit; + } + + if ($command eq 'LISTSETTINGS') { + http_die("illegal command \"$command\"") if $public or $anonymous; + nvt_print('HTTP/1.1 204 OK'); + # nvt_print("X-SID: $ENV{SID}") if $ENV{SID}; + ($quota,$du) = check_sender_quota($muser||$from); + nvt_print("X-Sender-Quota: $quota $du") if $quota; + ($quota,$du) = check_recipient_quota($muser||$from); + nvt_print("X-Recipient-Quota: $quota $du") if $quota; + $autodelete = lc(readlink "$from/\@AUTODELETE" || $autodelete); + nvt_print("X-Autodelete: $autodelete"); + $keep = readlink "$from/\@KEEP" || $keep; + nvt_print("X-Default-Keep: $keep"); + $locale = readlink "$from/\@LOCALE" || $default_locale || 'english'; + nvt_print("X-Default-Locale: $locale"); + $mime = -e "$from/\@MIME" ? 'yes' : 'no'; + nvt_print("X-MIME: $mime"); + nvt_print(''); + exit; + } + + if ($command eq 'RENOTIFY') { + http_die("illegal command \"$command\"") if $public or $anonymous; + my $nfile = ''; + if ($dkey) { + # resend notification e-mail + $file = readlink("$dkeydir/$dkey") + or html_error($error,"illegal DKEY $dkey"); + $file =~ s:^../::; + $file = untaint($file); + unlink "$file/download"; # re-allow download from any ip address + notify_locale($dkey,'new'); + http_header( + '200 OK', + "X-Notify: $file", + ); + $nfile = $file; + } else { + http_header('200 OK'); + } + print html_header($head); + # list sent files + print "

    Files from $from, ", + "click on the file name to resend a notification e-mail:

    \n", + "
    \n";
    +    foreach $file (glob "*/$from/*") {
    +      next if $file =~ m:/STDFEX$:;
    +      next if $file =~ m:(.+?)/: and -l $1;
    +      $size = -s "$file/data";
    +      next unless $size;
    +      $size = int($size/M+0.5);
    +      $filename = $comment = '';
    +      my $rto = $file;
    +      $rto =~ s:/.*::;
    +      if ($dkey = readlink "$file/dkey") {
    +        if ($rto ne $to) {
    +          $to = $rto;
    +          print "\nto $to :\n";
    +        }
    +        if (open $file,'<',"$file/filename") {
    +          $filename = <$file>;
    +          close $file;
    +        }
    +        if ($filename and length $filename) { 
    +          $filename = html_quote($filename);
    +        } else { 
    +          $filename = '???';
    +        }
    +        if (open $file,'<',"$file/comment") {
    +          $comment = untaint(html_quote(getline($file)));
    +          close $file;
    +        }
    +        my $rkeep = untaint(readlink "$file/keep"||$keep_default)
    +                    - int((time-mtime("$file/filename"))/DS);
    +        if ($comment =~ /NOMAIL/ or 
    +           (readlink "$to/\@NOTIFICATION"||'') =~ /^no/i) {
    +          printf "%8s MB [%s d] %s/%s/%s\n",
    +                 $size,
    +                 $rkeep,
    +                 $durl,
    +                 $dkey,
    +                 urlencode(basename($file));
    +        } else {
    +          printf "%8s MB [%s d] %s%s %s\n",
    +                 $size,
    +                 $rkeep,
    +                 untaint("/fup?akey=$akey&dkey=$dkey&command=RENOTIFY"),
    +                 $filename,
    +                 $comment ? qq' "$comment"' : '',
    +                 $file eq $nfile ? 
    +                   " → notification e-mail has been resent" :
    +                   "";
    +        }
    +      }
    +    }
    +    pq(qq(
    +      '
    ' + '

    back to F*EX operation control' + '' + )); + exit; + } + + if ($command =~ /^LIST(RECEIVED)?$/) { + http_die("illegal command \"$command\"") if $public or $anonymous; + # list sent files + if ($to and $param{'TO'} eq '*') { + http_header('200 OK'); + print html_header($head); +# "(Format: [size] [rest keep time] [filename] [comment])

    \n", + print "

    Files from $from:

    \n", + "
    \n";
    +      foreach $file (glob "*/$from/*") {
    +        next if $file =~ m:/STDFEX$:;
    +        next if $file =~ m:(.+?)/: and -l $1;
    +        $size = -s "$file/data";
    +        next unless $size;
    +        $size = int($size/M+0.5);
    +        $filename = $comment = '';
    +        my $rto = $file;
    +        $rto =~ s:/.*::;
    +        if ($dkey = readlink "$file/dkey") {
    +          if ($rto ne $to) {
    +            $to = $rto;
    +            print "\nto $to :\n";
    +          }
    +          if (open $file,'<',"$file/filename") {
    +            $filename = <$file>;
    +            close $file;
    +          }
    +          if ($filename and length $filename) { 
    +            $filename = html_quote($filename);
    +          } else { 
    +            $filename = '???';
    +          }
    +          if (open $file,'<',"$file/comment") {
    +            $comment = untaint(html_quote(getline($file)));
    +            close $file;
    +          }
    +          my $rkeep = untaint(readlink "$file/keep"||$keep_default) 
    +                      - int((time-mtime("$file/filename"))/DS);
    +          printf "%8s MB [%s d] %s%s\n",
    +                 $size,
    +                 $rkeep,
    +                 untaint("/fup?akey=$akey&dkey=$dkey&command=FORWARD"),
    +                 $filename,
    +                 $comment?qq( "$comment"):'';
    +        }
    +      }
    +      pq(qq(
    +        '
    ' + '

    back to F*EX operation control' + '' + )); + } + # list received files + else { + $to = $from; + http_header('200 OK'); + print html_header($head); +# "(Format: [size] [rest keep time] [URL] [comment])

    \n", + print "

    Files for $to (*):

    \n", + "
    \n";
    +      foreach $from (glob "$to/*") {
    +        next if $from =~ /[A-Z]/;
    +        $from =~ s:.*/::;
    +        $url = '';
    +        foreach $file (glob "$to/$from/*") {
    +          next if $file =~ /\/STDFEX$/;
    +          $filename = $comment = '';
    +          $size = -s "$file/data";
    +          next unless $size;
    +          $size = int($size/M+0.5);
    +          if ($dkey = readlink "$file/dkey") {
    +            print "\nfrom $from :\n" unless $url;
    +            $file =~ m:.*/(.+):;
    +            $url = "$durl/$dkey/$1";
    +            unless (-l "$dkeydir/$dkey") {
    +              symlink untaint("../$file"),untaint("$dkeydir/$dkey");
    +            }
    +            if (open $file,'<',"$file/filename") {
    +              $filename = <$file>;
    +              close $file;
    +            }
    +            if ($filename and length $filename) { 
    +              $filename = html_quote($filename);
    +            } else { 
    +              $filename = '???';
    +            }
    +            if (open $file,'<',"$file/comment") {
    +              $comment = untaint(html_quote(getline($file)));
    +              $comment = ' "'.$comment.'"';
    +              close $file;
    +            }
    +            my $rkeep = untaint(readlink "$file/keep"||$keep_default) 
    +                        - int((time-mtime("$file/filename"))/DS);
    +            printf "[delete] ",
    +                   $akey,$dkey;
    +            printf "[forward] ",
    +                   $akey,$dkey;
    +            printf "%8s MB (%s d) %s%s\n",
    +                   $size,$rkeep,$url,$filename,$comment;
    +          }
    +        }
    +      }
    +      pq(qq(
    +        '
    ' + '(*) Files for other e-mail addresses you own will not be listed here!

    ' + 'back to F*EX operation control' + '' + )); + } + exit; + } + + if ($command eq 'LISTSENT') { + http_die("illegal command \"$command\"") if $public or $anonymous; + # show download URLs + http_header('200 OK'); + print html_header($head); + print "

    Download URLs of files you have sent\n"; + foreach $to (glob "*/$from") { + if (@files = glob "$to/*/data") { + $to =~ s:/.*::; + print "

    to $to :

    \n"; + print "
    \n";
    +        foreach $file (@files) {
    +          $file =~ s:/data::;
    +          next if $file =~ /\/STDFEX$/;
    +          $dkey = readlink "$file/dkey" or next;
    +          $file =~ s:.*/::;
    +          print "$ENV{PROTO}://$ENV{HTTP_HOST}/fop/$dkey/$file\n";
    +        }
    +        print "
    \n"; + } + } + pq(qq( + '
' + '

back to F*EX operation control' + '' + )); + exit; + } + + if ($command eq 'FOPLOG') { + http_die("illegal command \"$command\"") if $public or $anonymous; + if (open my $log,"$logdir/fop.log") { + http_header('200 OK'); + while (<$log>) { + next if /\/STDFEX\s/; + if (s:^([^/]+)/$from/:$1 :) { + if (s:(\d+)/(\d+)$:$1: and $1 and $1 == $2) { + s/ \[[\d_]+\]//; + print; + } + } + } + } + exit; + } + + if ($command eq 'RECEIVEDLOG') { + http_die("illegal command \"$command\"") if $public or $anonymous; + if (open my $fuplog,"$logdir/fup.log") { + http_header('200 OK'); + while (<$fuplog>) { + next if /\sSTDFEX\s/; + if (/\d+$/) { + my @F = split; + if ($F[5] eq $to) { + s/ \[[\d_]+\]//; + print; + } + } + } + } + exit; + } + + if ($command eq 'SENDLOG') { + http_die("illegal command \"$command\"") if $public or $anonymous; + if (open my $fuplog,"$logdir/fup.log") { + http_header('200 OK'); + while (<$fuplog>) { + next if /\sSTDFEX\s/; + if (/(\S+\@\S+)/ and $1 eq $from) { + s/ \[[\d_]+\]//; + print; + } + } + } + exit; + } + + if (@to and $command eq 'CHECKRECIPIENT') { + http_die("illegal command \"$command\"") if $public or $anonymous; + check_rr($from,@to); + nvt_print('HTTP/1.1 204 OK'); + nvt_print("X-SID: $sid") if $sid; + foreach my $to (@group?@group:@to) { + # my $options = sprintf "(autodelete=%s,keep=%s,locale=%s)", + # readlink "$to/\@LOCALE"||$locale||$locale{$to}||$default_locale; + my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)", + $autodelete{$to}||$autodelete, + $keep{$to}||$keep_default, + readlink("$to/\@LOCALE")||$default_locale, + readlink("$to/\@NOTIFICATION")||'full'; + nvt_print("X-Recipient: $to $options"); + } + nvt_print(''); + # control back to fexsrv for further HTTP handling + &reexec; + } + + if ($file and @to and $command eq 'DELETE') { + http_die("illegal command \"$command\"") if $public or $anonymous; + foreach (@group?@group:@to) { + my $to = $_; + $to =~ s/:\w+=.*//; # remove options from address + $del = "$to/$from/$fkey"; + # swap to and from for special senders, see fup storage swap! + $del = "$from/$to/$fkey" if $from =~ /^(fexmail|anonymous)/; + + $del =~ s:^/+::; + if ($del =~ /\/\./) { + http_die("illegal parameter $del"); + } + $del = untaint($del); + + if (unlink("$del/data") or unlink("$del/upload")) { + if (open F,'>',"$del/error") { + print F "$file has been deleted by $from\n"; + close F; + } + http_header('200 OK',"X-File: $del"); + print html_header($head); + print "

$file deleted

\n"; + } else { + http_header("404 Not Found"); + print html_header($head); + print "

$file not deleted

\n"; + } + if ($akey) { + printf "continue\n", + $akey,$to; + } + print "\n"; + } + exit; + } + +} + +# ip restrictions +if ($from and $id and $rid eq $id and open my $ipr,"$from/\@UPLOAD_HOSTS") { + my @hosts; + while (<$ipr>) { + chomp; + s/#.*//; + push @hosts,$_ if /\w/; + } + close $ipr; + unless (@hosts and ipin($ra,@hosts)) { + http_die("$from is not allowed to upload from IP $ra"); + } +} + +# quotas +if ($from and $id and $rid eq $id and @to and not $flink and not $seek) { + my ($quota,$du); + + # check sender quota + ($quota,$du) = check_sender_quota($muser||$from); + if ($quota and $du+$cl/M > $quota) { + http_die("you are overquota"); + } + + # check recipient quota + foreach my $to (@to) { + ($quota,$du) = check_recipient_quota($to); + if ($quota and $du+$cl/M > $quota) { + http_die("$to cannot receive files: is overquota"); + } + } + +} + +# check recipients restriction +if ($id and $id eq $rid and $from and @to and not $public) { + check_rr($from,@to); +} + +# on secure mode "fop authorization" also check if recipient(s) exists +# (= has a F*EX ID) +if (not $addto and $fop_auth and $id and $id eq $rid and $from and @to) { + my ($to_reg,$idf,$subuser); + foreach (@to) { + my $to = $_; + $to =~ s/:\w+=.*//; # remove options from address + $to_reg = 0; + # full user? + if (open $idf,'<',"$to/@") { + $to_reg = getline($idf); + close $idf; + } + # sub user? + elsif (open $idf,'<',"$from/\@SUBUSER") { + while (<$idf>) { + s/#.*//; + next unless /:/; + chomp; + ($subuser) = split ':'; + if ($subuser eq $to or $subuser eq '*@*' + or $subuser =~ /^\*\@(.+)/ and $to =~ /\@\Q$1\E$/i + or $subuser =~ /(.+)\@\*$/ and $to =~ /^\Q$1\E\@/i) { + $to_reg = $_; + last; + } + } + close $idf; + } + unless ($to_reg) { + http_die("recipient $to is not a registered F*EX full or sub user"); + } + } +} + +$to = join(',',@to); + +if ($to =~ /^@(.+)/) { + if ($nomail) { + http_die("server runs in NOMAIL mode - groups ($to) are not allowed"); + } + my $gf = "$from/\@GROUP/$1"; + if (open $gf,'<',$gf) { + while (<$gf>) { + s/#.*//; + push @group,$1 if /(.+@.+):/; + } + } + close $gf; + $group = $to; +} + +if ($redirect) { + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/$redirect?akey=$akey", + 'Content-Length: 0', + "" + ); + &reexec; +} + +if ($from and $id and $id eq $rid and $faillog) { + unlink $faillog; +} + +# display HTML form and request user data +unless ($file) { + + if ($test) { $cgi = $test } + else { $cgi = $ENV{SCRIPT_NAME} } + $cgi = 'fup'; + + # delete old cookies on logout referer + my @cookies; + if ($logout and my $cookie = $ENV{HTTP_COOKIE}) { + while ($cookie =~ s/(\w+key)=\w+//) { + push @cookies,"Set-Cookie: $1=; Max-Age=0; Discard"; + } + } + + # save default locale for this user + if (($akey or $skey or $gkey) and $from and -d $from) { + if (not $locale and ($ENV{HTTP_COOKIE}||'') =~ /\blocale=(\w+)/) { + $locale = $1; + } + mksymlink("$from/\@LOCALE",$locale) if $locale; + } + + http_header('200 OK',@cookies); + # print html_header($head,''); + print html_header($head); + + if ($http_client =~ /(Konqueror|w3m)/) { + pq(qq( + '


' + '

' + '

Your client seems to be "$1" which is incompatible with F*EX and will probably not work!

' + 'We recommend firefox.' + '
' + '


' + )); + } + + # default "fex yourself" setting? + if ($from and $id and $id eq $rid and not $addto + and not ($gkey or $skey or $okey or $public or $anonymous) + and (not @to or "@to" eq $from) + and -f "$from/\@FEXYOURSELF") + { + @to = ($from); + $nomail = 'fexyourself'; + } + + # ask for recipient address(es) + elsif ($from and $id and $id eq $rid and ($addto or not $submit or not @to) + and not ($gkey or $skey or $okey or $public or $anonymous)) + { + present_locales('/fup'); + + @ab = (""); + + # select menu from server address book + if (open my $ab,'<',"$from/\@ADDRESS_BOOK") { + while (<$ab>) { + s/#.*//g; + if (/(\S+)[=\s]+(\S+@[\w.-]+\S*)/) { + $_ = "$1 <$2>"; + s/,.*/,.../g; + push @ab,""; + } + } + close $ab; + } + + unless (@to) { + unless ($nomail) { + foreach (glob "$from/\@GROUP/*") { + if (-f and not -l) { + s:.*/::; + push @ab,"" unless /~$/; + } + } + } + } + + my $ab64 = b64("from=$from&id=$id"); +# '

' + ' ' + ' ' + ' ' + ' ' + ' ' + '
sender: $from
recipient(s):' + '
' + )); + if (grep /@/,@ab) { + pq(qq( + ' or select from your address book:' + ' ' + ' and' + ' ' + )); + } + pq(qq( + '
' + '

' + )); + my $rr = "$from/\@ALLOWED_RECIPIENTS"; + if (-s $rr and open $rr,'<',$rr) { + pq(qq( + 'You are a restricted user and may only fex to these recipients:

' + '

'
+      ));
+      while (<$rr>) {
+        chomp;
+        s/#.*//;
+        s/\s//g;
+        next unless $_;
+        if (/^\@LOCAL_RDOMAINS/) {
+          foreach my $rd (@local_rdomains) {
+            print "*\@$rd\n";
+          }
+        } else {
+          print "$_\n";
+        }
+      }
+      print "

\n"; + close $rr; + } + pq(qq( + ' ' + ' or ' + '

' + '

' + )); + if ($akey and -f "$from/\@" and not $captive ) { + pq(qq( + 'user config & operation control' + )); + } + + if ($from eq $admin ) { + pq(qq( + '

' + 'server config & admin control' + )); + } + + if (0 and -f "$docdir/FIX.jar") { + print "

\n"; + if ($public) { print "" } + elsif ($skey) { print "" } + elsif ($gkey) { print "" } + else { print "" } + print "Alternate Java client (for files > 2 GB or sending of more than one file)\n"; + } + print &logout; + if (-x "$FEXHOME/cgi-bin/login") { + print $info_login||$info_1; + } + print "\n"; + exit; + } + + # ask for filename + if ($from and ($id or $okey)) { + $to = $group if $group; + present_locales($ENV{REQUEST_URI}) if $skey or $gkey or $okey; + pq(qq( + '' + )); + pq(qq( + '

' + ' ' + ' ' + ' ' + )); + + if ($public) { + my $toh = join('
',@to); + pq(qq( + ' ' + ' ' + ' ' + ' ' + ' ' + )); + } elsif ($okey) { + pq(qq( + ' ' + ' ' + '
sender: $from
recipient:$toh
' + ' ' + ' ' + )); + } elsif ($skey) { + pq(qq( + ' ' + '
sender: $from
recipient:$to
' + ' ' + ' ' + )); + } elsif (@group) { + if ($gkey) { + pq(qq( + ' ' + )); + } + my $toh = "group $group:
    "; + my $toc = join(',',@group); + foreach my $gm (@group) { $toh .= "
  • $gm" } + $toh .= "
"; + pq(qq( + ' ' + '
sender: $from
recipient:$to
' + ' ' + ' ' + )); + } else { + my $toc = join(',',@to); + my $toh = join('
',@to); + pq(qq( + ' ' + '
sender:$from
recipient(s):' + ' $toh
' + ' ' + )); + if ($anonymous) { + pq(qq( + ' ' + )); + } else { + pq(qq( + ' ' + )); + } + } + + $autodelete = lc $autodelete; + $keep = $keep_default unless $keep; + my ($quota,$du) = check_sender_quota($muser||$from); + $quota = $quota + ? "" + : ''; + + $bwl = qq''; + $ktr = qq'$keep days'; + } else { + $ctr = qq''; + } + if ($captive) { + $ktr = qq'$keep days'; + } + + pq(qq( + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '
sender:$from
recipient:' + ' $toh
recipient(s):' + ' $toh
sender quota (used):$quota ($du) MB
kB/s'; + if (@throttle) { + foreach (@throttle) { + if (/\[?(.+?)\]?:(\d+)$/) { + my $throttle = $1; + my $limit = $2; + # throttle ip address? + if ($throttle =~ /^[\w:.-]+$/) { + if (ipin($ra,$throttle)) { + $bwl = qq' $limit kB/s'; + last; + } + } + # throttle e-mail address? + else { + # allow wildcard *, but not regexps + $throttle =~ quotemeta $throttle; + $throttle =~ s/\*/.*/g; + if ($from =~ /^$throttle$/i) { + $bwl = qq' $limit kB/s'; + last; + } + } + } + } + } + + $autodelete = $autodelete{$to} if $autodelete{$to}; + + my $adt = ''; + for ($autodelete) { + if (/yes/i) { $adt = 'delete file after download' } + elsif (/no/i) { $adt = 'do not delete file after download' } + elsif (/delay/i) { $adt = 'delete file after download with delay' } + elsif (/^\d+$/) { $adt = "delete file $autodelete days after download" } + } + + my $ctr = my $ktr = ''; + if ($nomail) { + $ctr = qq'' + .qq'no notification e-mail will be send'; + $ktr = qq' days
'; + $ktr = qq'$keep days
autodelete:$adt
keep:' + ' $ktr' + ' $quota' + '
bandwith limit:' + ' $bwl' + '
comment:' + ' $ctr' + '
file:' + ' ' + '
file size:
' + '

+ ' ' + '

' + '

' + )); + if ($akey and -f "$from/\@" and not $captive) { + print "

\n", + "user config & operation control\n"; + } + if ($from eq $admin ) { + pq(qq( + '

' + 'server config & admin control' + )); + } + if (0 and -f "$docdir/FIX.jar" and not $okey) { + print "

\n"; + if ($public) { print "" } + elsif ($skey) { print "" } + elsif ($gkey) { print "" } + else { print "" } + print "Alternate Java client (for files > 2 GB or sending of more than one file)\n"; + } + print &logout; + print $info_2; + # printf "


%s
\n",$ENV{HTTP_HEADER}; + print "\n"; + exit; + } + + present_locales('/fup'); + + if ($ENV{REQUEST_METHOD} eq 'POST') { + pq(qq( + '

' + ' You have to fill out this form completely to continue.' + '

' + )); + } + + pq(qq( + '
' + ' ' + ' ' + ' ' + '
sender:' + '
auth-ID:' + '
' + )); + if ($mail_authid and not ($fop_auth or $nomail)) { +# pq(qq( +# 'If you enter "?" as your auth-ID then it will be sent by e-mail to you.' +# '

' +# )); + pq(qq( + ' ' + ' I have lost my auth-ID! Send it to me by e-mail! ' + ' (you must fill out sender field above)' + )); + } + pq(qq( + '

' + )); + if (not $nomail and ( + @local_domains and @local_hosts and ipin($ra,@local_hosts) + or @local_rdomains and @local_rhosts and + (not @registration_hosts or ipin($ra,@registration_hosts)) + or @demo + )) { + pq(qq( + 'You can register yourself ' + 'if you do not have a F*EX account yet.

' + )); + } + if (@anonymous_upload and ipin($ra,@anonymous_upload)) { + my $a = 'anonymous_'.int(rand(999999)); + pq(qq( + 'You may also use anonymous upload' + )); + } + # if (-f "$docdir/sup.html") { + # pq(qq( + # '
' + # 'You may also use simple upload' + # )); + # } + print "

\n"; + + print $info_1; + + if ($debug and $debug>1) { + print "
\n
\n";
+    foreach $v (sort keys %ENV) {
+      print "$v = $ENV{$v}\n";
+    }
+    print "
\n"; + } + + print "\n"; + exit; +} + +# from sup.html +if ($from and $file and not @to) { + check_rr($from,$from); + @to = ($from); + $sup = 'fexyourself'; +} + +# all these variables should be defined here, but just to be sure... +http_die("no file specified") unless $file; +http_die("no sender specified") unless $from; +http_die("no recipient specified") unless @to; +unless ($okey and -l "$to/\@OKEY/$okey") { + http_die("no auth-ID specified") unless $id; + unless ($rid eq $id or $gkey or $skey) { + faillog("user $from, id $id"); + http_die("wrong auth-ID specified"); + } +} + +&check_status($from); + +if (@throttle) { + foreach (@throttle) { + if (/(.+):(\d+)$/) { + my $throttle = $1; + my $limit = $2; + if (not $bwlimit or $limit < $bwlimit) { + # throttle ip address? + if ($throttle =~ /^[\d.-]+$/) { + if (ipin($ra,$throttle)) { + $bwlimit = $limit; + last; + } + } + # throttle e-mail address? + else { + # allow wildcard *, but not regexps + $throttle =~ quotemeta $throttle; + $throttle =~ s/\*/.*/g; + if ($from =~ /^$throttle$/i) { + $bwlimit = $limit; + last; + } + } + } + } + } +} + +# address rewriting for storage (swap sender and recipient), see also fop! +if (not ($skey or $gkey) and $from =~ /^(anonymous|fexmail)/) { + ($from,@to) = ("@to",$from); +} + +if (not $anonymous and $overwrite =~ /^n/i) { + foreach $to (@to) { + if (-f "$to/$from/$fkey/data") { + http_die("$file already exists for $to"); + } + } +} + +# additional last check +foreach $to (@to) { + checkaddress($to) or + http_die("$to is not a valid e-mail address"); +} + +$to = join(',',@to); + +# file overwriting for anonymous is only possible if his client has the +# download cookie - else request purging +if ($anonymous and not $seek and my $dkey = readlink "$to/$from/$fkey/dkey") { + if ($overwrite =~ /^n/i) { + http_die("$file already exists for $to"); + } + if ($ENV{HTTP_COOKIE} !~ /$dkey/) { + my $purge = "/fop/$dkey/$dkey?purge"; + # http_die("$file already exists $dkey:$ENV{HTTP_COOKIE}:"); + http_die("$file already exists - purge it?!"); + } +} + +if (@group) { + @to = @group; + $comment = "[$group] $comment"; +} elsif ($public) { + $comment .= ' (public upload)'; +} + +# file data still waits on STDIN ... get it now! +&get_file; + +if ($to eq $from and $file eq 'ADDRESS_BOOK') { + unlink "$from/\@ADDRESS_BOOK"; + rename "$from/$from/ADDRESS_BOOK/upload","$from/\@ADDRESS_BOOK" + or http_die("cannot save $from/\@ADDRESS_BOOK - $!\n"); + http_header('200 OK'); + print html_header($head); + print "address book updated", + "\n"; + exit; +} + +# finalize upload +unless ($nostore) { + foreach (@group?@group:@to) { + my $to = $_; + $to =~ s/:\w+=.*//; # remove options from address + $filed = "$to/$from/$fkey"; + $save = "$filed/data"; + $upload = "$filed/upload"; + $download = "$filed/download"; + $dkey{$to} = readlink "$filed/dkey"; + $overwrite{$to}++ if -f $save and not -f $download; + unlink $save,$download; + rename $upload,$save or http_die("cannot rename $upload to $save - $!\n"); + + # log dkey + my $dlog = "$logdir/dkey.log"; + if (open $dlog,'>>',$dlog) { + flock $dlog,LOCK_EX; + seek $dlog,0,SEEK_END; + printf {$dlog} "%s %s %s %s %s\n", + isodate(time),$dkey{$to},$from,$to,$fkey; + close $dlog; + } + + # send notification e-mails if necessary + if (not $nomail and (readlink "$to/\@NOTIFICATION"||'') !~ /^no/i + and ($comment or not $overwrite{$to})) { + notify_locale($dkey{$to},'new'); + debuglog("notify $filed [$filename] '$comment'"); + } + } +} + +# send HTTP status +$HTTP_HEADER = 'HTTP/1.1 200 OK'; +if ($nostore) { + nvt_print($HTTP_HEADER,'Content-Type: text/html',''); + exit if $http_client =~ /^fexsend/; +} elsif ($file eq 'STDFEX') { + nvt_print($HTTP_HEADER,''); + exit; +} else { + nvt_print($HTTP_HEADER); + if ($xkey and not $restricted) { + my $x = "$durl//$xkey"; + $x =~ s:/fop::; + nvt_print("X-Location: $x"); + } + if ($anonymous) { + my $dkey = $dkey{$to}; + my $cookie = $dkey; + $cookie = $1 if $ENV{HTTP_COOKIE} =~ /anonymous=([\w:]+)/; + $cookie .= ':'.$dkey if $cookie !~ /$dkey/; + nvt_print("Set-Cookie: anonymous=$cookie"); + $keep{$to} = readlink("$to/\@KEEP")||$keep_default; + } + foreach (@group?@group:@to) { + my $to = $_; + $to =~ s/:\w+=.*//; # remove options from address + my $file = "$to/$from/$fkey"; + my $options = sprintf "(autodelete=%s,keep=%s,locale=%s,notification=%s)", + readlink("$file/autodelete")||$autodelete, + readlink("$file/keep")||readlink("$to/\@KEEP")||$keep_default, + readlink("$to/\@LOCALE")||readlink("$file/locale")||$default_locale, + readlink("$to/\@NOTIFICATION")||'full'; + nvt_print("X-Recipient: $to $options"); + nvt_print("X-Location: $durl/$dkey{$to}/$fkey") unless $restricted; + } + if ($http_client =~ /^(fexsend|schwuppdiwupp)/) { + nvt_print(''); + exit; + } else { + nvt_print('Content-Type: text/html',''); + } +} + +# send HTML report +print html_header($head); + +if ($nostore) { + printf "%s (%s MB) received\n",$file,$ndata/M; +} elsif (not $restricted and ($anonymous or $from eq $to)) { + my $size = $ndata<2*1024 ? sprintf "%s B",$ndata: + $ndata<2*M ? sprintf "%s kB",int($ndata/1024): + sprintf "%s MB",int($ndata/M); + pq(qq( + '$file ($size) received and saved

' + 'Download URL for copy & paste:' + '

$durl/$dkey{$to}/$fkey

' + 'Link is valid for $keep{$to} days!

' + )); +} else { + if ($ndata<2*1024) { + print "$file ($ndata B) received and saved

\n"; + if (not $boring and not $seek) { + print "Ehh... $ndata BYTES?! You are kidding?

\n"; + } + } elsif ($ndata<2*M) { + $ndata = int($ndata/1024); + print "$file ($ndata kB) received and saved

\n"; + if ($ndata<1024 and not ($boring or $seek)) { + print "Using F*EX for less than 1 MB: ", + "ever heard of MIME e-mail? ☺

\n"; + } + } else { + $ndata = int($ndata/M); + print "$file ($ndata MB) received and saved

\n"; + } + print "

    \n"; + foreach $to (@to) { + print "
  • "; + if ($nomail or $nomail{$to}) { + if ($restricted) { + rmrf("$to/$from/$fkey"); + print "$file removed because you are a restricted user ". + "and recipient $to cannot receive e-mail

    \n"; + } else { + pq(qq( + '$to cannot receive e-mail →' + '

    ' + ' No notification e-mail has been sent to $to!' + '

    ' + 'Download URL for copy & paste:' + )); + if ($xkey) { + my $x = "$durl{$to}//$xkey"; + $x =~ s:/fop::; + print "

    $x

    \n"; + } else { + print "

    $durl/$dkey{$to}/$fkey

    \n"; + print "Link is valid for $keep{$to} days!

    \n"; + } + } + } elsif ($overwrite{$to} and not $comment) { + print "(old $file for $to overwritten)

    \n" + } else { + print "$to notified

    \n" + } + } + print "

\n"; +} + +if ($okey) { + unlink "$to/\@OKEY/$okey"; +} elsif (not $anonymous and not $sup) { + print ""; + print "send another file\n"; + if ($http_client !~ /fexsend/ and $http_client =~ /Linux/i) { + print qq'

Hi Linux-user, try fexsend! ☺

\n'; + } + print &logout; +} + +print "\n"; +exit; + + +# parse GET and POST requests +sub parse_request { + my %to; + my ($to,$dkey); + my ($x,$k,$v); + my $qs = $ENV{QUERY_STRING}; + local $_; + + # get JUP parameters from environment (HTTP headers) + while (($k,$v) = each %ENV) { + if ($k =~ s/^FEX_//) { + setparam($k,$v); + } + } + + # decode base64 PATH_INFO to QUERY_STRING + if ($ENV{PATH_INFO} =~ m:^/(\w+=*)$:) { + if ($qs) { + $qs = sprintf("%s&%s",decode_b64($1),$qs); + } else { + $qs = decode_b64($1); + } + } + + # parse HTTP QUERY_STRING (parameter=value pairs) + if ($qs) { + foreach (split '&',$qs) { + if (s/^(\w+)=//) { + my $x = $1; + # decode URL-encoding + s/%([a-f0-9]{2})/chr(hex($1))/gie; + setparam($x,$_); + } + } + } + + # HTTP redirect does not work correctly with opera! + # ==> locale handling is now done by fexsrv + if (0 and $locale) { + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/fup", + "Set-Cookie: locale=$locale", + 'Expires: 0', + 'Content-Length: 0', + '' + ); + &reexec; + } + + if ($showstatus) { + &showstatus; + exit; + } + + # check for akey, gkey and skey (from HTTP GET) + &check_keys; + + if ($ENV{REQUEST_METHOD} eq 'POST' and $cl) { + foreach $sig (keys %SIG) { + if ($sig !~ /^(CHLD|CLD)$/) { + $SIG{$sig} = \&sigexit; + } + } + $SIG{PIPE} = 'IGNORE' if $ENV{PROTO} eq 'https'; # stunnel workaround + $SIG{__DIE__} = \&sigdie; + http_die("invalid Content-Length header \"$cl\"") if $cl !~ /^-?\d+$/; + debuglog($0); + debuglog(sprintf("awaiting %d bytes from %s %s", + $cl,$ENV{REMOTE_ADDR}||'',$ENV{REMOTE_HOST}||''),"\n"); + + &check_space($cl) if $cl > 0; + + $SIG{ALRM} = sub { die "TIMEOUT\n" }; + alarm($timeout); + binmode(STDIN,':raw'); + + if (defined($ENV{FEX_FILENAME})) { + # JUP via HTTP header + $file = $param{'FILE'} = $ENV{FEX_FILENAME}; + $fileid = $ENV{FEX_FILEID} || 0; + $fpsize = $ENV{X_CONTENT_LENGTH} || 0; + $boundary = ''; + } elsif ($contentlength) { + # JUP via URL parameter + $fpsize = $contentlength; + $boundary = ''; + } else { + # FUP + if ($ENV{CONTENT_TYPE} =~ /boundary=\"?([\w\-\+\/_]+)/) { + $boundary = $1; + } else { + http_die("malformed HTTP POST (no boundary found)"); + } + + READPOST: while (&nvt_read) { + # the file itself - *must* be last part of POST! + if (/^Content-Disposition:\s*form-data;\s*name="file";\s*filename="(.+)"/i) { + push @header,$_; + $file = $param{'FILE'} = $1; + while (&nvt_read) { + last if /^\s*$/; + $fileid = $1 if /^X-File-ID:\s*(.+)/; + $fpsize = $1 if /^Content-Length:\s*(\d+)/; + $flink = $1 if /^Content-Location:\s*(\/.+)/; + push @header,$_; + } + # STDIN is now at begin of file, will be read later with get_file() + last; + } + # all other parameters + if (/^Content-Disposition:\s*form-data;\s*name="([a-z]\w*)"/i) { + my $x = $1; + nvt_skip_to('^\s*$'); + &nvt_read; + setparam($x,$_); + NEXTPART: while (&nvt_read) { + last READPOST if /^--\Q$boundary--/; + last NEXTPART if /^--\Q$boundary/; + } + } + } + } + + if (length($file)) { + $file =~ s/%(\d+)/chr($1)/ge; + $file = untaint(strip_path(normalize($file))); + $file =~ s/[\\\/<>]/_/g; # filter out dangerous chars + $file =~ s/^\|//; # filter out dangerous chars + $file =~ s/\|$//; # filter out dangerous chars + $filename = $file; + $fkey = urlencode($file); + } + + # check for akey, gkey and skey (from HTTP POST) + &check_keys; + + } + + if ($from) { + $from .= '@'.$mdomain if $mdomain and $from !~ /@/; + if ($from ne 'anonymous' and not checkaddress($from)) { + http_die("$from is not a valid e-mail address"); + } + $from = untaint($from); + } + + # collect multiple addresses and check for aliases (not group) + if (@to and "@to" !~ /^@[\w-]+$/ + and not ($gkey or $addto or $command =~ /^LIST(RECEIVED)?$/)) + { + + # read address book + if ($from and open my $AB,'<',"$from/\@ADDRESS_BOOK") { + my ($alias,$address,$autodelete,$locale,$keep); + while (<$AB>) { + s/#.*//; + $_ = lc $_; + if (s/^\s*(\S+)[=\s]+(\S+)//) { + ($alias,$address) = ($1,$2); + $autodelete = $locale = $keep = ''; + $autodelete = $1 if /autodelete=(\w+)/; + $locale = $1 if /locale=(\w+)/; + $keep = $1 if /keep=(\d+)/; + foreach my $address (split(",",$address)) { + $address .= '@'.$mdomain if $mdomain and $address !~ /@/; + push @{$ab{$alias}},$address; + $autodelete{$alias} = $autodelete; + $keep{$alias} = $keep; + $locale{$alias} = $locale; + } + } + } + close $AB; + } + + # look for recipient's options and eliminate dupes + %to = (); + foreach (@to) { + my $to = $_; + # address book alias? + if ($ab{$to}) { + foreach (@{$ab{$to}}) { + my $address = $_; + $address .= '@'.$mdomain if $mdomain and $address !~ /@/; + $to{$address} = $address; # ignore dupes + if ($specific{'autodelete'}) { + $autodelete{$address} = $specific{'autodelete'}; + } elsif ($autodelete{$to}) { + $autodelete{$address} = $autodelete{$to}; + } else { + $autodelete{$address} = readlink "$address/\@AUTODELETE" + || $autodelete; + } + if ($_ = readlink "$address/\@LOCALE") { + $locale{$address} = $_; + } elsif ($locale{$to}) { + $locale{$address} = $locale{$to}; + } else { + $locale{$address} = $locale ; + } + unless ($locale{$address}) { + $locale{$address} = $default_locale || 'english'; + } + if ($specific{'keep'}) { $keep{$address} = $specific{'keep'} } + elsif ($keep{$to}) { $keep{$address} = $keep{$to} } + } + } else { + $to = expand($to); + $to{$to} = $to; # ignore dupes + unless ($autodelete{$to}) { + $autodelete{$to} = readlink "$to/\@AUTODELETE" || $autodelete; + } + $autodelete{$to} = $specific{'autodelete'} if $specific{'autodelete'}; + $keep{$to} = $keep_default; + $keep{$to} = $keep if $keep; + $keep{$to} = untaint(readlink "$to/\@KEEP") if -l "$to/\@KEEP"; + $keep{$to} = $specific{'keep'} if $specific{'keep'}; + # recipient specific parameters + $keep{$to} = $1 if $to =~ /:keep=(\d+)/i; + $autodelete{$to} = $1 if $to =~ /:autodelete=(\w+)/i; + } + if (-e "$to/\@CAPTIVE") { + my $v; + $v = readlink "$to/\@AUTODELETE" and $autodelete{$to} = $v; + $v = readlink "$to/\@KEEP" and $keep{$to} = $v; + } + } + @to = keys %to; + + if (scalar(@to) == 1) { + $to = "@to"; + $keep = $keep{$to} if $keep{$to}; + $autodelete = $autodelete{$to} if $autodelete{$to}; + } + + # check recipients and eliminate dupes + %to = (); + foreach $to (@to) { + if ($to eq 'anonymous') { + $to{$to} = $to; + } else { + if ($to =~ /^@(.+)/) { + http_die("You cannot send to more than one group") if @to > 1; + http_die("Group $to does not exist") unless -f "$from/\@GROUP/$1"; + } else { + $to .= '@'.$mdomain if $mdomain and $to !~ /@/; + if (checkaddress($to)) { + $to{$to} = untaint($to); + } else { + http_die("$to is not a valid e-mail address"); + } + } + } + } + @to = values %to; + } + + foreach $to (@to) { + unless (checkforbidden($to)) { + http_die("$to is not allowed"); + } + } +} + + +# show the status progress bar +sub showstatus { + my $wclose; + my ($upload,$data,$sfile,$ukey,$file); + my ($nsize,$tsize); + my ($t0,$t1,$t2,$tt,$ts,$tm); + my ($osize,$percent,$npercent); + local $_; + + $wclose = '

close'."\n". + ''."\n"; + $ukey = "$ukeydir/$uid"; + $upload = "$ukey/upload"; + $data = "$ukey/data"; + $sfile = "$ukey/size"; + for (1..$timeout) { + sleep 1; + $tsize = readlink $sfile and last; + # upload error? + # remark: stupid Internet Explorer *needs* the error represented in this + # asynchronous popup window, because it cannot display the error in the + # main window on HTTP POST! + if (-f $ukey and open $ukey,'<',$ukey or + -f "$ukey/error" and open $ukey,'<',"$ukey/error") { + undef $/; + unlink $ukey; + html_error($error,<$ukey> || 'unknown'); + } + } + # unlink $sfile; + + if (defined $tsize and $tsize == 0) { + print "\n"; + exit; + } + unless ($tsize) { + html_error($error, + "no file data received - does your file exist or is it >2GB?") + } + html_error($error,"file size unknown") unless $tsize =~ /^\d+$/; + + http_header('200 OK'); + if (open $ukey,'<',"$ukey/filename") { + local $/; + $file = <$ukey>; + close $ukey; + } + http_die("no filename?!") unless $file; + + my $ssize = $tsize; + if ($ssize<2097152) { + $ssize = sprintf "%d kB",int($ssize/1024); + } else { + $ssize = sprintf "%d MB",int($ssize/1048576); + } + + pq(qq( + "" + "

" + "

Upload Status for
$file ($ssize)

" + '' + "
" + "" + "
" + "
" + "
" + )); + + # wait for upload file + for (1..9) { + last if -f $upload or -f $data; + sleep 1; + } + unless (-f $upload or -f $data) { + print "

ERROR: no upload received

\n"; + print $wclose; + exit; + } + + $SIG{ALRM} = sub { die "TIMEOUT in showstatus: no (more) data received\n" }; + alarm($timeout*2); + + $t0 = $t1 = time; + $osize = $percent = $npercent = 0; + + for ($percent = 0; $percent<100; sleep(1)) { + $t2 = time; + $nsize = -s $upload; + if (defined $nsize) { + if ($nsize<$osize) { + print "

ABORTED

\n"; + print $wclose; + exit; + } + if ($nsize>$osize) { + alarm($timeout*2); + $osize = $nsize; + } + $npercent = int($nsize*100/$tsize); + $showsize = calcsize($tsize,$nsize); + } else { + $npercent = 100; + $showsize = calcsize($tsize,$tsize); + } + # hint: for ISDN (or even slower) links, 5 s tcp delay is minimum + # so, updating more often is contra-productive + if ($t2>$t1+5 or $npercent>$percent) { + $percent = $npercent; + $t1 = $t2; + $tm = int(($t2-$t0)/60); + $ts = $t2-$t0-$tm*60; + $tt = sprintf("%d:%02d",$tm,$ts); + pq(qq( + "" + )) or last; + } + } + + alarm(0); + if ($npercent == 100) { + print "

file successfully transferred

\n"; + } else { + print "

file transfer aborted

\n"; + } + pq(qq( + "" + )); + print $wclose; + unlink $ukey; + exit; +} + + +# get file from post request +sub get_file { + my ($to,$filed,$upload,$nupload,$speed,$download); + my ($b,$n,$uss); + my $dkey; + my ($fh,$filesize); + my ($t0,$tt); + my $fb = 0; # file bytes + my $ebl = 0; # end boundary length + + # FUP, not JUP + if ($boundary) { + $ebl = length($boundary)+8; # 8: 2 * CRLF + 2 * "--" + } + + unless ($nostore) { + + # download already in progress? + foreach $to (@to) { + $to =~ s/:\w+=.*//; # remove options from address + $filed = "$to/$from/$fkey"; + $download = "$filed/download"; + if (-f $download and open $download,'>>',$download) { + flock($download,LOCK_EX|LOCK_NB) or + http_die("$filed locked: a download is currently in progress"); + } + } + + # prepare upload + foreach $to (@to) { + $to =~ s/:\w+=.*//; # remove options from address + $filed = "$to/$from/$fkey"; + $nupload = "$filed/upload"; # upload for next recipient + mkdirp($filed); + + # upload already prepared (for first recipient)? + if ($upload) { + # link upload for next recipient + unless ($upload eq $nupload or + -r $upload and -r $nupload and + (stat $upload)[1] == (stat $nupload)[1]) + { + unlink $nupload; + link $upload,$nupload; + } + } + + # first recipient => create upload + else { + $upload = $nupload; + unlink "$ukeydir/$uid"; + if ($flink) { + if ($seek) { + http_die("cannot resume on link upload"); + } + &nvt_read and $flink = $_; + if ($flink !~ /^\//) { + http_die("no file link name ($flink)"); + } + $flink = abs_path($flink); + my $fok; + foreach (@file_link_dirs) { + my $dir = abs_path($_); + $fok = $flink if $flink =~ /^\Q$dir\//; + } + unless ($fok) { + http_die("$flink not allowed for linking"); + } + my @s = stat($flink); + unless (@s and ($s[2] & S_IROTH) and -r $flink) { + http_die("cannot read $flink"); + } + unless (-f $flink and not -l $flink) { + http_die("$flink is not a regular file"); + } + # http_die("DEBUG: flink = $flink"); + &nvt_read; + &nvt_read if /^$/; + unless (/^--\Q$boundary--/) { + http_die("found no MIME end boundary in upload ($_)"); + } + unlink $upload; + symlink untaint($flink),$upload; + } else { + unlink $upload if -l $upload; + open $upload,'>>',$upload or http_die("cannot write $upload - $!"); + flock($upload,LOCK_EX|LOCK_NB) or + http_die("$file locked: a transfer is already in progress"); + unless ($seek) { + seek $upload,0,0; + truncate $upload,0; + } + # already uploaded file data size + $uss = -s $upload; + # provide upload ID symlink for showstatus + symlink "../$filed","$ukeydir/$uid"; + } + } + + unlink "$filed/autodelete", + "$filed/error", + "$filed/restrictions", + "$filed/locale", + "$filed/keep", + "$filed/header", + "$filed/id", + "$filed/ip", + "$filed/speed", + "$filed/replyto", + "$filed/useragent", + "$filed/comment", + "$filed/notify"; + unlink "$filed/size" unless $seek; + + # showstatus needs file name and size + # fexsend needs full file size (+$seek) + $fh = "$filed/filename"; + open $fh,'>',$fh or die "cannot write $fh - $!\n"; + print {$fh} $filename; + close $fh; + if ($::filesize > 0 or $cl > 0) { + if ($::filesize > 0) { $filesize = $fpsize || $::filesize } + else { $filesize = $cl-$rb-$ebl+$seek } + # new file + unless ($seek) { + if ($::filesize > 0) { + # total file size as reported by POST + mksymlink("$filed/size",$::filesize) + or die "cannot write $filed/size - $!\n"; + } else { + # file size as counted + mksymlink("$filed/size",$filesize) + or die "cannot write $filed/size - $!\n"; + } + } + } + + $autodelete{$to} = $autodelete unless $autodelete{$to}; + if ($autodelete{$to} =~ /^(DELAY|NO|\d+)$/i) { + mksymlink("$filed/autodelete",$autodelete{$to}); + } + + if (my $keep = $keep{$to} || $::keep) { + mksymlink("$filed/keep",$keep); + } + mksymlink("$filed/id",$fileid) if $fileid; + mksymlink("$filed/ip",$ra) if $ra; + if ($http_client and open $http_client,'>',"$filed/useragent") { + print {$http_client} $http_client,"\n"; + close $http_client; + } + if ($_ = readlink "$to/\@LOCALE") { + # mksymlink("$filed/locale",$_); + } elsif ($locale{$to}) { + mksymlink("$filed/locale",$locale{$to}); + } elsif ($locale and $locale ne $default_locale) { + mksymlink("$filed/locale",$locale); + } + if ($replyto and $replyto =~ /.@./) { + mksymlink("$filed/replyto",$replyto); + } + + my $arh = "$from/\@ALLOWED_RHOSTS"; + if (-s $arh) { + copy($arh,"$filed/restrictions"); + } + + if (@header and open $fh,'>',"$filed/header") { + print {$fh} join("\n",@header),"\n"; + close $fh; + } + + if ((readlink "$to/\@NOTIFICATION"||'') =~ /^no/i) { + $nomail{$to} = 'NOTIFICATION'; + } + + if ($nomail) { + open $fh,'>',"$filed/notify" and close $fh; + } + if ($comment) { + if (open $fh,'>',"$filed/comment") { + print {$fh} encode_utf8($comment); + close $fh; + } + } + + # provide download ID key + unless ($dkey = readlink("$filed/dkey") and -l "$dkeydir/$dkey") { + $dkey = randstring(8); + unlink "$dkeydir/$dkey"; + symlink "../$filed","$dkeydir/$dkey" + or http_die("cannot symlink $dkeydir/$dkey ($!)"); + unlink "$filed/dkey"; + symlink $dkey,"$filed/dkey"; + } + + } + + # extra download (XKEY)? + if ($anonymous and $fkey =~ /^afex_\d/ or + $from eq "@to" and $comment =~ s:^//(.*)$:NOMAIL:) + { + $xkey = $1||$fkey; + $nomail = $comment; + my $x = "$xkeydir/$xkey"; + unless (-l $x and readlink($x) eq "../$from/$from/$fkey") { + if (-e $x) { + http_die("extra download key $xkey already exists"); + } + symlink "../$from/$from/$fkey",$x + or http_die("cannot symlink $x - $!\n"); + unlink "$x/xkey"; + symlink $xkey,"$x/xkey"; + } + } + + } + + # file link? + if ($flink) { + # upload link has been already created, no data to read any more + $to = join(',',@to); + fuplog($to,$fkey,0); + debuglog("upload link successfull, dkey=$dkey"); + } + + # regular file + else { + + # at last, read (real) file data + $t0 = time(); + + # streaming data? + if ($cl == -1) { + alarm($timeout*2); + # read until EOF, including MIME end boundary + while ($n = read(STDIN,$_,$bs)) { + $rb += $n; + $fb += $n; + syswrite $upload,$_ unless $nostore; + alarm($timeout*2); + } + # size of transferred file, without end boundary + $ndata = untaint($fb-$ebl); + } + + # normal file with known file size + else { + + if ($fpsize) { + debuglog(sprintf("still awaiting %d+%d = %d bytes", + $fpsize,$ebl,$fpsize+$ebl)); + $cl = $rb+$fpsize+$ebl; # recalculate CONTENT_LENGTH + } else { + if ($::filesize) { + $cl = $rb+$::filesize+$ebl; # recalculate CONTENT_LENGTH + } + debuglog(sprintf("still awaiting %d-%d = %d bytes", + $cl,$rb,$cl-$rb)); + } + # read until end boundary, not EOF + while ($rb < $cl-$ebl) { + $b = $cl-$ebl-$rb; + $b = $bs if $b > $bs; + # max wait for 1 kB/s, but at least 10 s + # $timeout = $b/1024; + # $timeout = 10 if $timeout < 10; + alarm($timeout); + if ($n = read(STDIN,$_,$b)) { + $rb += $n; + $fb += $n; + # syswrite is much faster than print + syswrite $upload,$_ unless $nostore; + if ($bwlimit) { + alarm(0); + $tt = (time-$t0) || 1; + while ($rb/$tt/1024 > $bwlimit) { + sleep 1; + $tt = time-$t0; + } + } + # debuglog($_); + } else { + last; + } + } + # read end boundary - F*IX is broken! + if ($ebl and $http_client !~ /F\*IX/) { + $_ = ; + $_ = ||''; + unless (/^--\Q$boundary--/) { + http_die("found no MIME end boundary in upload ($_)"); + } + } + $rb += $ebl; + $ndata = untaint($fb); + } + + alarm(0); + + unless ($nostore) { + close $upload; # or die "cannot close $upload - $!\n";; + + # throuput in kB/s + $tt = (time-$t0) || 1; + mksymlink("$filed/speed",int($fb/1024/$tt)); + + unless ($ndata) { + http_die( + "No file data received!". + " File name correct?". + " File too big (browser-limit: 2 GB!)?" + ); + } + + $to = join(',',@to); + + # streaming upload? + if ($cl == -1) { + + open $upload,'<',$upload or http_die("internal error - cannot read upload"); + seek $upload,$ndata+2,0; + $_ = <$upload>||''; + unless (/^--\Q$boundary--/) { + http_die("found no MIME end boundary in upload ($_)"); + } + close $upload; + truncate $upload,$ndata; + + } else { + + # truncate boundary string + # truncate $upload,$ndata+$uss if -s $upload > $ndata+$uss; + + # incomplete? + if ($cl != $rb) { + fuplog($to,$fkey,$ndata,'(aborted)'); + if ($fpsize) { + http_die("read $rb bytes, but Content-Length announces $fpsize bytes"); + } else { + http_die("read $rb bytes, but CONTENT_LENGTH announces $cl bytes"); + } + } + + # multipost, not complete + if ($::filesize > -s $upload) { + http_header('206 Partial OK'); + exit; + } + + # save error? + if (-s $upload > ($::filesize||$filesize)) { + fuplog($to,$fkey,$ndata,'(write error: upload > filesize)'); + http_die("internal server error while writing file data"); + } + + } + fuplog($to,$fkey,$ndata); + debuglog("upload successfull, dkey=$dkey"); + } + } +} + + +# check recipients restriction +sub check_rr { + my $from = shift; + my @to = @_; + my $rr = "$from/\@ALLOWED_RECIPIENTS"; + my ($allowed,$to,$ar,$rd); + + if (-s $rr and open $rr,'<',$rr) { + + $restricted = $rr; + + foreach (@to) { + my $to = $_; + $allowed = 0; + seek $rr,0,0; + while (<$rr>) { + chomp; + s/#.*//; + s/\s//g; + + if (/^\@LOCAL_RDOMAINS/) { + $ar = '(@'; + foreach (@local_rdomains) { + my $rd = $_; + # allow wildcard *, but not regexps + $rd =~ s/\./\\./g; + $rd =~ s/\*/[\\w.-]+/g; + $ar .= '|[^\@]+\@' . $rd; + } + $ar .= ')'; + } else { + # allow wildcard *, but not regexps + $ar = quotemeta $_; + $ar =~ s/\\\*/[^@]*/g; + } + + if ($to =~ /^$ar$/i) { + $allowed = 1; + last; + } + + } + + unless ($allowed) { + fuplog("ERROR: $from not allowed to fex to $to"); + debuglog("$to not in $spooldir/$from/\@ALLOWED_RECIPIENTS"); + http_die("You ($from) are not allowed to fex to $to"); + } + } + + close $rr; + } +} + + +# add domain to user if necessary +sub expand { + my @users = @_; + my @ua; + + foreach (@users) { + my $u = $_; + if ($u =~ /^anonymous(_\d+)?$/) { + $u = "$u\@$hostname"; + } + if ($u eq 'nettest') { + if ($mdomain and -d "$u\@$mdomain") { + $u .= "\@$mdomain" + } elsif (-d "$u\@$hostname") { + $u .= "\@$hostname" + } + } + if ($u =~ /@/) { push @ua,$u } + elsif ($mdomain) { push @ua,"$u\@$mdomain" } + elsif (-d "$u\@$hostname") { push @ua,"$u\@$hostname" } + else { push @ua,$u } + } + + return wantarray ? @ua : join(',',@ua); +} + + +# forward-copy (bounce) an already uploaded file +sub forward { + my $file = shift; + my ($nfile,$to,$AB); + my ($filename); + my (%to); + + http_die("no file data for $file") unless -f "$file/data"; + + if (@to) { + + # check recipients restriction + check_rr($from,@to); + + # read aliases from address book + if (open $AB,'<',"$from/\@ADDRESS_BOOK") { + while (<$AB>) { + s/#.*//; + $_ = lc $_; + if (s/^\s*(\S+)[=\s]+(\S+)//) { + my ($alias,$address) = ($1,$2); + foreach my $address (split(",",$address)) { + $address .= '@'.$mdomain if $mdomain and $address !~ /@/; + push @{$ab{$alias}},$address; + } + } + } + close $AB; + } + + # collect addresses + foreach (@to) { + my $to = $_; + if ($ab{$to}) { + foreach my $address (@{$ab{$to}}) { + $to{$address} = $address; + } + } else { + $to .= '@'.$mdomain if $mdomain and $to !~ /@/; + $to{$to} = $to; + } + } + + http_header('200 OK'); + print html_header($head); + + @to = keys %to; + + foreach (@to) { + my $to = $_; + $to =~ s/:\w+=.*//; # remove options from address + $nfile = $file; + $nfile =~ s:.*?/:$to/:; + next if $nfile eq $file; + mkdirp($nfile); + http_die("cannot create directory $nfile") unless -d $nfile; + unlink "$nfile/data", + "$nfile/upload", + "$nfile/download", + "$nfile/autodelete", + "$nfile/error", + "$nfile/restrictions", + "$nfile/keep", + "$nfile/header", + "$nfile/id", + "$nfile/speed", + "$nfile/comment", + "$nfile/replyto", + "$nfile/notify"; + if ($comment) { + open $comment,'>',"$nfile/comment"; + print {$comment} $comment; + close $comment; + } + if ($autodelete =~ /^(DELAY|NO|\d+)$/i) { + symlink($autodelete,"$nfile/autodelete"); + } + symlink($keep||$keep_default, "$nfile/keep"); + copy("$file/id", "$nfile/id"); + copy("$file/ip", "$nfile/ip"); + copy("$file/speed", "$nfile/speed"); + copy("$file/replyto", "$nfile/replyto"); + $filename = copy("$file/filename", "$nfile/filename"); + link "$file/data", "$nfile/data" + or die http_die("cannot create $nfile/data - $!"); + unless ($dkey = readlink("$nfile/dkey") and -l "$dkeydir/$dkey") { + $dkey = randstring(8); + unlink "$dkeydir/$dkey"; + symlink "../$nfile","$dkeydir/$dkey" + or http_die("cannot symlink $dkeydir/$dkey"); + unlink "$nfile/dkey"; + symlink $dkey,"$nfile/dkey" + or http_die("cannot create $nfile/dkey - $!"); + } + + if ($nomail or $nomail{$to}) { + if ($filename) { + my $url = "$durl/$dkey/".normalize_filename($filename); + pq(qq( + 'Download-URL for $to:
' + '$url' + '

' + )); + } + } else { + notify_locale($dkey,'new'); + fuplog($to,urlencode($filename),"(forwarded)"); + if ($filename) { + pq(qq( + 'File "$filename" copy-forwarded to $to and notified.' + '

' + )); + } + } + } + pq(qq( + 'back to F*EX operation control' + '' + )); + } else { + $filename = filename($file); + http_header('200 OK'); + print html_header($head); + pq(qq( + '

' + ' ' + ' ' + ' ' + ' forward a copy of "$filename" to:
' + ' ' + '
' + '' + )); + } +} + + +# modify file parameter +sub modify { + my $file = shift; + my $filename = filename($file); + my $dkey = readlink "$file/$dkey"; + my $to; + my @parameter; + + http_die("no file data for $file") unless -f "$file/data"; + + $to = $file; + $to =~ s:/.*::; + if ($specific{'keep'}) { + mksymlink("$file/keep",$keep); + utime time,time,"$file/filename"; + push @parameter,'KEEP'; + } + if ($specific{'autodelete'}) { + mksymlink("$file/autodelete",$autodelete); + push @parameter,'AUTODELETE'; + } + if ($comment) { + if (open $comment,'>',"$file/comment") { + print {$comment} $comment; + close $comment; + } + notify_locale($dkey,'new'); + push @parameter,'COMMENT'; + } + http_header('200 OK'); + print "Parameter ".join(',',@parameter)." modified for $filename for $to\n"; +} + + +sub calcsize { + my ($tsize,$nsize) = @_; + if ($tsize<2097152) { + return sprintf "%d kB",int($nsize/1024); + } else { + return sprintf "%d MB",int($nsize/1048576); + } +} + + +# read one line from STDIN (net socket) and assign it to $_ +# returns number of read bytes +sub nvt_read { + my $len = 0; + + if (defined ($_ = )) { + debuglog($_); + $len = length; + $rb += $len; + s/\r?\n//; + } + return $len; +} + + +# read forward to given pattern +sub nvt_skip_to { + my $pattern = shift; + + while (&nvt_read) { return if /$pattern/ } +} + + +# set parameter variables +sub setparam { + my ($v,$vv) = @_; + my ($idf,$to); + + $v = uc(despace($v)); + +# if ($vv =~ /([<>])/) { +# http_die(sprintf("\"&#%s;\" is not allowed in parameter $v",ord($1))); +# } + + $param{$v} = $vv; + if ($v eq 'LOGOUT') { + $logout = $v; + # skey and gkey are persistant! + $akey = $1 if $ENV{QUERY_STRING} =~ /AKEY:(\w+)/i; + unlink "$akeydir/$akey"; + $login = $FEXHOME.'/cgi-bin/login'; + if (-x $login) { + $login = readlink $login || 'login'; + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/$login", + 'Content-Length: 0', + "" + ); + &reexec; + } + } elsif ($v eq 'LOCALE' and $vv =~ /^(\w+)$/) { + $locale = $1; + } elsif ($v eq 'REDIRECT' and $vv =~ /^([\w?=]+)$/) { + $redirect = $1; + } elsif (($v eq 'KEY' or $v eq 'SKEY') and $vv =~ /^([\w:]+)$/) { + $skey = $1; + $restricted = $v; + } elsif ($v eq 'GKEY' and $vv =~ /^([\w:]+)$/) { + $gkey = $1 unless $nomail; + $restricted = $v; + } elsif ($v eq 'DKEY' and $vv =~ /^(\w+)$/) { + $dkey = $1; + } elsif ($v eq 'AKEY' and $vv =~ /^(\w+)$/) { + $akey = $1; + } elsif ($v eq 'FROM' or $v eq 'USER') { + $from = normalize_email($vv); + $from = untaint(expand($from)); + checkchars('from address',$from); + checkaddress($from) or http_die("FROM $from is no legal e-mail address"); + } elsif ($v eq 'REPLYTO') { + $replyto = normalize_email($vv); + checkchars('replyto address',$replyto); + checkaddress($replyto) or + http_die("REPLYTO $replyto is no legal e-mail address"); + } elsif ($v eq 'ADDTO') { + $vv =~ s/\s.*//; + $addto = normalize_email($vv); + } elsif ($v eq 'SUBMIT') { + $submit = decode_utf8(normalize($vv)); + } elsif ($v eq 'FEXYOURSELF') { + $submit = $vv; + @to = ($from); + } elsif ($v eq 'TO') { + # extract AUTODELETE and KEEP options + if ($vv =~ s/[\s,]+AUTODELETE=(\w+)//i) { + $specific{'autodelete'} = $autodelete = uc($1); + } + if ($vv =~ s/[\s,]+KEEP=(\d+)//i) { + $keep = $1; + $keep = $keep_max if $keep_max and $keep > $keep_max; + $specific{'keep'} = $keep; + } + $to = normalize(lc($vv)); + $to =~ s/[\n\s;,]+/,/g; + if ($from) { + if ($to eq '.') { + $to = $from; + } + if ($to eq '//') { + $to = $from; + $comment = '//'; + } + } + checkchars('to address',$to); + push @to,split(',',$to); + } elsif ($v eq 'ID') { + $id = despace($vv); + checkchars('auth-ID',$id); + } elsif ($v eq 'TCE') { + $test = despace($vv); + } elsif ($v eq 'OKEY' and $vv =~ /^(\w+)$/) { + $okey = $1; + $restricted = $v; + } elsif ($v eq 'FILEID' and $vv =~ /^(\w+)$/) { + $fileid = $1; + } elsif ($v eq 'CONTENTLENGTH' and $vv =~ /^(\d+)$/) { + $contentlength = $1; + } elsif ($v eq 'FILE' or $v eq 'FILENAME') { + $file = strip_path(normalize($vv)); + } elsif ($v eq 'UID' and $vv =~ /^(\w+)$/) { + $uid = $1; + } elsif ($v eq 'ID_FORGOTTEN') { + $id_forgotten = $vv; + } elsif ($v eq 'SHOWSTATUS' and $vv =~ /^(\w+)$/) { + $showstatus = $uid = $1; + } elsif ($v eq 'COMMENT') { + $comment = decode_utf8(normalize($vv)); + $comment =~ s/^\s*!\.!/!SHORTMAIL!/; + $comment =~ s/^!#!/!NOMAIL!/; + $comment =~ s/^!-!/!NOSTORE!/; + $nomail = $comment if $comment =~ /NOMAIL/; + $nostore = $nomail = $comment if $comment =~ /NOSTORE/; + $bcc .= " $from" if $comment =~ s/\s*!bcc!?\s*//i; + # backward compatibility + foreach my $cmd (qw( + DELETE LIST CHECKQUOTA CHECKRECIPIENT RECEIVEDLOG SENDLOG FOPLOG FORWARD + )) { $command = $comment if $comment eq $cmd } + } elsif ($v eq 'COMMAND') { + $command = normalize($vv); + } elsif ($v eq 'BWLIMIT' and $vv =~ /^(\d+)$/) { + $bwlimit = $1; + } elsif ($v eq 'SEEK' and $vv =~ /^(\d+)$/) { + $seek = $1; + } elsif ($v eq 'FILESIZE' and $vv =~ /^(\d+)$/) { + $filesize = $1; # complete filesize! + &check_space($filesize-$seek); + } elsif ($v eq 'AUTODELETE' and $vv =~ /^(\w+)$/) { + $specific{'autodelete'} = $autodelete = uc($1); + } elsif ($v eq 'KEEP' and $vv =~ /^(\d+)$/) { + $keep = $1; + $keep = $keep_max if $keep_max and $keep > $keep_max; + $specific{'keep'} = $keep; + } elsif ($v eq 'TIMEOUT' and $vv =~ /^(\d+)$/) { + $specific{'timeout'} = $timeout = $1; + } +} + + +sub id_forgotten { + my ($id,$to,$subuser,$gm,$skey,$gkey,$url,$fup); + + return if $nomail; + + $fup = $durl; + $fup =~ s:/fop:/fup:; + + # full user + if (open $from,'<',"$from/\@") { + $id = getline($from); + close $from; + } + if ($id) { + $url = "$fup/".b64("from=$from&id=$id"); + mail_forgotten($from,qqq(qq( + 'Your reqested F*EX auth-ID for $fup?from=$from is:' + '$id' + '' + 'Or use:' + '$url' + ))); + exit; + } + + # sub user + foreach my $skey (glob("$skeydir/*")) { + if (-f $skey and open $skey,'<',$skey) { + while (<$skey>) { + $_ = lc; + if (/^(\w+)=(.+)/) { + $subuser = $2 if $1 eq 'from'; + $to = $2 if $1 eq 'to'; + } + } + close $skey; + } + if ($from and $to and $from eq $subuser) { + $skey =~ s:.*/::; + mail_forgotten($subuser,qqq(qq( + 'Your reqested F*EX login is:' + '' + '$fup?skey=$skey' + ))); + exit; + } + } + + # group user + foreach my $gkey (glob("$gkeydir/*")) { + if (-f $gkey and open $gkey,'<',$gkey) { + while (<$gkey>) { + $_ = lc; + if (/^(\w+)=(.+)/) { + $gm = $2 if $1 eq 'from'; + $to = $2 if $1 eq 'to'; + } + } + close $gkey; + } + if ($gm and $to and $from eq $gm) { + $gkey =~ s:.*/::; + mail_forgotten($gm,qqq(qq( + 'Your reqested F*EX login is:' + '' + '$fup?gkey=$gkey' + ))); + exit; + } + } + http_die("$from is not a F*EX user on this server"); +} + + +sub mail_forgotten { + my $user = shift; + my @msg = @_; + local *P; + + return if $nomail; + + open P,'|-',$sendmail,$user,$bcc or http_die("cannot start sendmail - $!\n"); + pq(P,qq( + 'From: $admin' + 'To: $user' + 'Subject: F*EX service $hostname' + 'X-Mailer: F*EX' + '' + )); + print P @msg; + close P or http_die("cannot send mail - $!\n"); + http_header('200 OK'); + print html_header($head); + print "

Mail has been sent to you ($from)

\n"; + print "\n"; +} + + +# lookup akey, skey and gkey (full and sub user and group) +sub check_keys { + + # only one key can be valid + $akey = $gkey = '' if $skey; + $akey = $skey = '' if $gkey; + + if ($skey) { + # encrypted SKEY? + if ($skey =~ s/^MD5H:(.+)/$1/) { + # search real SKEY + foreach my $s (glob "$skeydir/*") { + $s =~ s:.*/::; + if ($skey eq md5_hex($s.$sid)) { + $skey = $s; + last; + } + } + } + if (open $skey,'<',"$skeydir/$skey") { + $akey = $gkey = ''; + while (<$skey>) { + if (/^(\w+)=(.+)/) { + $from = $2 if lc($1) eq 'from'; + @to = ($muser = $2) if lc($1) eq 'to'; + $rid = $id = $2 if lc($1) eq 'id'; + } + } + close $skey; + } else { + # $skey = ''; + http_die("invalid SKEY $skey"); + } + } + + if ($gkey) { + # encrypted GKEY? + if ($gkey =~ s/^MD5H:(.+)/$1/) { + # search real GKEY + foreach my $g (glob "$gkeydir/*") { + $g =~ s:.*/::; + if ($gkey eq md5_hex($g.$sid)) { + $gkey = $g; + last; + } + } + } + if (open $gkey,'<',"$gkeydir/$gkey") { + $akey = $skey = ''; + while (<$gkey>) { + if (/^(\w+)=(.+)/) { + $from = $2 if lc($1) eq 'from'; + $to = $muser = $2 if lc($1) eq 'to'; + $rid = $id = $2 if lc($1) eq 'id'; + # $user = $2 if lc($1) eq 'user'; + } + } + close $gkey; + @to = ($to); + } else { + # $gkey = ''; + http_die("invalid GKEY $gkey"); + } + } + + if ($akey and not $id) { + my $idf; + + # sid is not set with web browser + # akey with sid is set with schwuppdiwupp & co + $idf = "$akeydir/$akey/@"; + + if (open $idf,'<',$idf and $id = getline($idf)) { + close $idf; + $from = readlink "$akeydir/$akey" + or http_die("internal server error: no $akey symlink"); + $from =~ s:.*/::; + $from = untaint($from); + if ($akey ne md5_hex("$from:$id")) { + $from = $id = ''; + } + } else { + $akey = ''; + } + } + +} + + +# check if there is enough space on spool +sub check_space { + my $req = shift; + my ($df,$free,$uprq); + local *P; + + if (open $df,"df -k $spooldir|") { + while (<$df>) { + if (/^.+?\s+\d+\s+\d+\s+(\d+)/ and $req/1024 > $1) { + $free = int($1/1024); + $uprq = int($req/M); + if (not $nomail and open P,"|$sendmail -t") { + pq(P,qq( + 'From: $admin' + 'To: $admin' + 'Subject: F*EX spool out of space' + '' + 'F*EX spool $spooldir on $ENV{SERVER_NAME} is out of space.' + '' + 'Current free space: $free MB' + 'Upload request: $uprq MB' + )); + close P; + } + debuglog("aborting because not enough free space in spool ($free MB)"); + http_die("not enough free space for this upload"); + } + } + close $df; + } +} + + +# global substitution as a function like in gawk +sub gsub { + local $_ = shift; + my ($p,$r) = @_; + s/$p/$r/g; + return $_; +} + + +# standard log +sub fuplog { + my $msg = "@_"; + + $msg =~ s/\n/ /g; + $msg =~ s/\s+$//; + + if (open $log,'>>',$log) { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + printf {$log} "%s [%s_%s] %s (%s) %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$from,$fra,$msg; + close $log; + } +} + + +sub sigdie { + local $_ = shift; + chomp; + sigexit('DIE',$_); +} + + +sub sigexit { + my ($sig) = @_; + my $msg; + my $to = join(',',@to); + + $SIG{__DIE__} = 'DEFAULT'; + foreach (keys %SIG) { $SIG{$_} = 'DEFAULT' } + + $msg = @_ ? "@_" : '???'; + $msg =~ s/\n/ /g; + $msg =~ s/\s+$//; + + if (open $log,'>>',$log) { + printf {$log} + "%s %s (%s) %s %s caught SIGNAL %s %s\n", + isodate(time), + $from||'-', + $fra||'-', + $to||'-', + encode_Q($file||'-'), + $msg, + $rb?"(after $rb bytes)":""; + close $log; + } + if ($sig eq 'DIE') { + shift; + die "$msg\n"; + } else { + die "SIGNAL $msg\n"; + } +} + + +sub mtime { + my @s = lstat shift; + return @s ? $s[9] : undef; +} + + +sub present_locales { + my $url = shift; + my @locales = @::locales; # from fex.ph + my ($locale,$lang); + + if ($url =~ /\?/) { + $url .= "&"; + $url =~ s/locale=\w+&//g; + } else { + $url .= "?"; + } + + if (@locales) { + map { $_ = "$FEXHOME/locale/$_" } @locales; + } else { + @locales = glob "$FEXHOME/locale/*"; + } + + if (@locales > 1) { + print "

"; + foreach (@locales) { + $locale = $_; + if (-x "$locale/cgi-bin/fup") { + $lang = "$locale/lang.html"; + $locale =~ s:.*/::; + if (open $lang,'<',$lang and $lang = getline($lang)) { + close $lang; + } else { + $lang = $locale; + } + print "$lang "; + } + } + print "

\n"; + } +} + + +sub check_camel { + my ($logo,$camel); + local $/; + + if (open $logo,"$docdir/logo.jpg") { + $camel = md5_hex(<$logo>) eq 'ad8a95bba8dd1a61d70bd38611bc2059'; + } + if ($camel and open $logo,"$docdir/action-fex-camel.gif") { + $camel = md5_hex(<$logo>) eq '1f3d7acc70377496f95c5adddaf4ca7b'; + } + http_die("Missing camel") unless $camel; +} diff --git a/cgi-bin/fur b/cgi-bin/fur new file mode 100755 index 0000000..3d91f55 --- /dev/null +++ b/cgi-bin/fur @@ -0,0 +1,416 @@ +#!/usr/bin/perl -wT + +# FEX CGI for user registration +# +# Author: Ulli Horlacher +# + +use CGI qw(:standard); +use CGI::Carp qw(fatalsToBrowser); +use Fcntl qw(:flock :seek :mode); + +$CGI::LIST_CONTEXT_WARN = 0; +$CGI::LIST_CONTEXT_WARN = 0; + +# import from fex.ph +our (@local_hosts,@local_domains,@local_rhosts,@local_rdomains); +our (@registration_hosts,@registration_domains); +our ($usage_conditions); + +# import from fex.pp +our ($mdomain,$logdir,$spooldir,$fra,$hostname,$sendmail,$admin,$bcc); + +our $error = "F*EX user registration ERROR"; + +my $ra = $ENV{REMOTE_ADDR}||0; + +my ($CASE,$ESAC); + +# add fex lib +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +# load common code, local config: $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +my $log = "$logdir/fur.log"; +my $head = "$ENV{SERVER_NAME} F*EX user registration"; + +chdir $spooldir or die "$spooldir - $!\n"; + +my $user = my $id = my $verify = ''; + +&check_maint; + +unless (@local_domains or @local_rdomains) { + html_error($error, + "No domains for registrations are defined.", + "Contact $ENV{SERVER_ADMIN} for details." + ); +} + +# look for CGI parameters +foreach my $v (param) { + my $vv = despace(param($v)); + debuglog("Param: $v=\"$vv\""); + $CASE = + $v =~ /^user$/i ? $user = normalize_address($vv): + $v =~ /^exuser$/i ? $exuser = normalize_address($vv): + $v =~ /^demouser$/i ? $demouser = normalize_address($vv): + $v =~ /^verify$/i ? $verify = lc(checkchars('URL-parameter',$vv)): + $v =~ /^confirm$/i ? $confirm = checkchars('URL-parameter',$vv): + $v =~ /^domain$/i ? $domain = lc(checkchars('URL-parameter',$vv)): + $ESAC; +} + +if ($confirm) { + if ($confirm =~ /^(\w+)$/i) { + $confirm = $1; + } else { + http_die("illegal registration key"); + } + open $confirm,"<.reg/$confirm" or http_die("no registration key $confirm"); + $user = untaint(getline($confirm)); + $id = getline($confirm); + close $confirm; + # unlink ".reg/$confirm"; + unless ($user and $id) { + http_die("no registration data for key $confirm"); + } + unless (-f "$user/.auto") { + http_die("registration expired"); + } + # if (-f "$user/@") { http_die("$user is already activated") } + open $user,'>',"$user/@" or http_die("open $user/@ - $!\n"); + print {$user} $id,"\n"; + close $user or http_die("close $user/@ - $!\n"); + + http_header("200 OK"); + print html_header($head); + my $url = "$ENV{PROTO}://$ENV{HTTP_HOST}/fup/" . b64("from=$user&id=$id"); + pq(qq( + '

Your registration was successful. Your new F*EX account is:

' + '

' + '$url' + '

' + '(bookmark this URL!)' + '

' + 'or you can use:' + '

' + ' + ' ' + ' ' + ' ' + '
URL:$ENV{PROTO}://$ENV{HTTP_HOST}/fup/
Sender:$user
auth-ID:$id
+ '' + )); + furlog("confirm: account $user created"); + exit; +} + + +unless ($user or $exuser or $demouser) { + http_header("200 OK"); + print html_header($head); + pq(qq( + '

' + )); + + if (@local_domains and @local_hosts and ipin($ra,@local_hosts)) { + $reg = $ra; + if (grep(/\*/,@local_domains)) { + pq(qq( + ' new user (may send to internal or external users):
' + ' ' + '

' + ' allowed domains are:' + '

'
+      ));
+      foreach my $ld (@local_domains) {
+        print "  $ld\n";
+      }
+      print "
\n"; + } else { + if ($mdomain and not grep /^\Q$mdomain\E$/i,@local_domains) { + unshift @local_domains,$mdomain; + } + my @mydomains = map { "\t\n" } @local_domains; + pq(qq( + ' new user (may send to internal or external users):
' + ' \@' + )); + } + } + + if (@local_rdomains and @local_rhosts and + (not @registration_hosts or ipin($ra,@registration_hosts))) { + print "

or

\n" if $reg; + $reg = $ra; + pq(qq( + ' new external user (may send only to internal users):
' + ' ' + '

' + )); + } + + if (@demo) { + print "

or

\n" if $reg; + $reg = $ra; + local $_ = sprintf "with %d MB quota and %d day%s account life time", + @demo,$demo[1]>1 ? 's' : ''; + pq(qq( + ' new demo user ($_):
' + ' ' + '

' + )); + } + + if ($reg) { + pq(qq( + '

' + ' you must enter your e-mail address and ' + '

' + '

' + )); + if (@local_rdomains) { + pq(qq( + '


' + 'internal domains are:' + '

'
+      ));
+      foreach my $lrd (@local_rdomains) {
+        print "  $lrd\n";
+      }
+    }
+    pq(qq(
+      '
' + '


' + 'User types overview' + '' + )); + } else { + html_error($error, + "Registrations from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } + exit; +} + +if ($exuser) { + unless (@local_rdomains) { + http_die("no \@local_rdomains"); + } + if (@registration_hosts and not ipin($ra,@registration_hosts)) { + html_error($error, + "Registrations from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } + if ($exuser =~ /\@(.+)/) { + my $exd = $1; + if (@registration_domains and + not grep /^\Q$exd\E$/i,@registration_domains) { + html_error($error, + "Your domain $exd is not allowed for registration.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } + } else { + html_error($error,"$exuser is not an email address"); + } + $user = $exuser; +} elsif ($demouser) { + $user = $demouser; +} elsif ($user) { + unless (@local_domains) { + html_error($error, + "No local domains for registration are defined.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } + my $mydomains = join('|',@local_domains); + $mydomains =~ s/\./\\./g; + $mydomains =~ s/\*/.*/g; + $mydomains .= "|$mdomain" if $mdomain; + $user .= '@'.$domain if $domain and $user !~ /@/; + # $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + + unless (@local_hosts and ipin($ra,@local_hosts)) { + html_error($error, + "Registrations from your host ($ra) are not allowed.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } + if ("@local_domains" ne "*" and $user !~ /\@($mydomains)$/i) { + html_error($error, + "Illegal domain for username.", + "Contact $ENV{SERVER_ADMIN} for details." + ); + } +} else { + html_error($error,"No user type found."); +} + +unless (checkforbidden($user)) { + html_error($error,"$user is not allowed"); +} +unless (checkaddress($user)) { + html_error($error,"$user is not a valid e-mail address"); +} +$user = untaint($user); + +if (-f "$user/@") { + html_error( + $error, + "you are already registered". + " (I have lost my auth-ID)" + ); +} + +unless (-d $user) { + mkdir $user,0770 or http_die("mkdir $user - $!\n"); +} + +if ($exuser) { + my $rf; + # recipients e-mail address restrictions + $rf = "$exuser/\@ALLOWED_RECIPIENTS"; + open $rf,'>',$rf or http_die("cannot write $rf - $!\n"); + print {$rf} "\@LOCAL_RDOMAINS\n"; + print {$rf} "# See also file \@ALLOWED_RHOSTS\n"; + close $rf; + # recipients ip restrictions + $rf = "$exuser/\@ALLOWED_RHOSTS"; + open $rf,'>',$rf or http_die("cannot write $rf - $!\n"); + print {$rf} "\@LOCAL_RHOSTS\n"; + close $rf; + if (open $user,'>',"$user/.auto") { + print {$user} "fur:external\n"; + close $user; + } +} elsif ($demouser) { + my $quota = "$demouser/\@QUOTA"; + open $quota,'>',$quota or http_die("cannot write $quota - $!\n"); + printf {$quota} "recipient:%d\n",$demo[0]; + printf {$quota} "sender:%d\n",$demo[0]; + close $quota; + if (open $user,'>',"$user/.auto") { + print {$user} "fur:demo\n"; + close $user; + } + open $demouser,'>',"$demouser/.demo" and close $demouser; +} else { + if (open $user,'>',"$user/.auto") { + print {$user} "fur:internal\n"; + close $user; + } +} + +$id = randstring(6); + +if ("@local_domains" eq "*") { + open $id,'>',"$user/@" or http_die("open $user/@ - $!\n"); + print {$id} $id,"\n"; + close $id or http_die("close $user/@ - $!\n"); + http_header("200 OK"); + print html_header($head); + $uid = "from=$user&id=$id"; + $b64 = b64($uid); + pq(qq( + 'Account created:' + '

'
+    '$ENV{PROTO}://$ENV{HTTP_HOST}/fup?$uid'
+    '$ENV{PROTO}://$ENV{HTTP_HOST}/fup/$b64'
+    '
' + '' + )); + exit; +} + +# from fexsend +if ($verify eq 'no') { + open $id,'>',"$user/@" or http_die("open $user/@ - $!\n"); + print {$id} $id,"\n"; + close $id or http_die("close $user/@ - $!\n"); + http_header("200 OK",'Content-Type: text/plain'); + print "$ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$user&ID=$id\n"; + furlog("direct: account $user created"); + if ($bcc and open my $mail,"|$sendmail '$bcc' 2>>$log") { + pq($mail,qq( + 'From: fex' + 'To: $bcc' + 'Subject: F*EX user registration' + '' + '$user has been auto-registrated with verify=no' + )); + close $mail; + } else { + furlog("ERROR: cannot run sendmail - $!\n"); + } + exit; +} + +unless (-d '.reg') { + mkdir '.reg',0770 or http_die("mkdir .reg - $!\n"); +} +$reg = randstring(8); +open $reg,'>',".reg/$reg" or http_die("open .reg/$reg - $!\n"); +print {$reg} $user,"\n",$id,"\n"; +close $reg or http_die("close .reg/$reg - $!\n"); + +open my $mail,'|-',$sendmail,$user,$bcc + or http_die("cannot start sendmail - $!\n"); +pq($mail,qq( + 'From: $admin' + 'To: $user' + 'Subject: F*EX user registration request' + '' + 'To activate your new F*EX account go to this URL:' + '' + '$ENV{PROTO}://$ENV{HTTP_HOST}/fur?confirm=$reg' + '' +)); +if ($usage_conditions and open $usage_conditions,$usage_conditions) { + print {$mail} "The conditions of usage are:\n\n"; + print {$mail} $_ while <$usage_conditions>; + close $usage_conditions; +} +close $mail or http_die("cannot send mail - $!\n"); + +http_header("200 OK"); +print html_header($head); +print "confirmation e-mail has been sent to $user\n"; +print "\n"; +furlog("confirmation request mailed to $user"); +exit; + + +# standard log +sub furlog { + my $msg = "@_"; + + $msg =~ s/\n/ /g; + $msg =~ s/\s+$//; + + if (open $log,'>>',$log) { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + printf {$log} "%s [%s_%s] %s %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; + close $log; + } +} + +sub normalize_address { + my $a = shift; + + $a = lc(normalize(despace($a))); + checkchars('address',$a); + $a =~ s:/:_:g; + $a =~ s:^\.:_:; + return untaint($a); +} diff --git a/cgi-bin/pup b/cgi-bin/pup new file mode 100755 index 0000000..4ddac70 --- /dev/null +++ b/cgi-bin/pup @@ -0,0 +1,198 @@ +#!/usr/bin/perl -wT + +# F*EX CGI for public upload +# +# Author: Ulli Horlacher +# + +use CGI::Carp qw(fatalsToBrowser); + +# add fex lib +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +$| = 1; + +our $error = 'F*EX public upload ERROR'; +our $head = "$ENV{SERVER_NAME} F*EX public upload"; +our $locale = ''; + +# import from fex.ph +our (@public_recipients); + +# import from fex.pp +our ($FEXHOME); + +# load common code, local config: $FEXLIB/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +$from = $to = ''; + +chdir $spooldir or http_die("$spooldir - $!\n"); + +&check_maint; + +my $qs = $ENV{QUERY_STRING}; +(my $multi) = $qs =~ s/(^|&)multi//; + +# parse HTTP QUERY_STRING (parameter=value pairs) +if ($qs) { + foreach (split '&',$qs) { + if (s/^(\w+)=//) { + my $x = $1; + # decode URL-encoding + s/%([a-f0-9]{2})/chr(hex($1))/gie; + if (/([<>\'\`\"\000-\040])/) { + http_die(sprintf( + "\"&#%s;\" is not allowed in URL parameter", + ord($1) + )); + } + setparam($x,$_); + } + } +} + +# parse HTTP POST body +if ($ENV{REQUEST_METHOD} eq 'POST') { + if ($ENV{CONTENT_TYPE} =~ /boundary=\"?([\w\-\+\/_]+)/) { + $boundary = $1; + } else { + http_die("malformed HTTP POST (no boundary found)"); + } + + binmode(STDIN,':raw'); + + READPOST: while (&nvt_read) { + if (/^Content-Disposition:\s*form-data;\s*name="([a-z]\w*)"/i) { + my $x = $1; + while (&nvt_read) { last if /^\s*$/ } + &nvt_read; + setparam($x,$_); + NEXTPART: while (&nvt_read) { + last READPOST if /^--\Q$boundary--/; + last NEXTPART if /^--\Q$boundary/; + } + } + } +} + +unless (@public_recipients) { + html_error($error,"No public recipients defined by administrator"); +} + +if ($to and not grep /^\Q$to\E$/i,@public_recipients) { + html_error($error,"$to is not a public recipient"); +} + +if ($to and $from and checkaddress($from)) { + nvt_print( + "HTTP/1.1 302 Found", + "Location: $ENV{PROTO}://$ENV{HTTP_HOST}/fup?from=$from&to=$to&id=PUBLIC", + 'Content-Length: 0', + "" + ); + exec($FEXHOME.'/bin/fexsrv') if $ENV{KEEP_ALIVE}; + exit; +} + +http_header('200 ok'); +print html_header($head); + +my @locales; +foreach my $locale (glob "$FEXHOME/locale/*") { + if (-f "$locale/cgi-bin/pup") { + my $langf = "$locale/lang.html"; + $locale =~ s:.*/::; + $lang = $locale; + if (open $langf,'<',$langf) { + $lang = getline($langf); + close $langf; + } + push @locales,"$lang"; + } +} +print "

@locales

\n" if @locales > 1; + + +pq(qq( + '
' + ' ' + ' ' + ' ' +)); + +if ($from) { + pq(qq( + ' ' + ' ' + )); +} else { + pq(qq( + ' ' + )); +} + +if ($to) { + pq(qq( + ' ' + ' ' + )); +} else { + if ($multi) { + foreach my $pr (@public_recipients) { + push @pr,qq() + ."$pr
"; + } + pq(qq( + ' ' + )); + } else { + foreach my $pr (@public_recipients) { + push @pr,""; + } + pq(qq( + ' ' + )); + } +} + +pq(qq( + '
your e-mail address:$from
your e-mail address:
recipient:$to
recipient:@pr
recipient:
' + '

' + ' ' + '

' +)); + + +# set parameter variables +sub setparam { + my ($v,$vv) = @_; + + $v = uc(despace($v)); + if ($v eq 'LOCALE' and $vv =~ /^(\w+)$/) { + $locale = $1; + } elsif ($v eq 'FROM') { + $from = normalize_email($vv); + } elsif ($v eq 'TO') { + $to = normalize_email($vv); + } +} + + +# read one line from STDIN (net socket) and assign it to $_ +# returns number of read bytes +sub nvt_read { + my $len = 0; + + if (defined ($_ = )) { + debuglog($_); + $len = length; + s/\r?\n//; + } + return $len; +} diff --git a/cgi-bin/rup b/cgi-bin/rup new file mode 100755 index 0000000..10a78b6 --- /dev/null +++ b/cgi-bin/rup @@ -0,0 +1,250 @@ +#!/usr/bin/perl -wT + +# FEX CGI for redirect uploaded files +# +# Author: Ulli Horlacher +# + +use Fcntl qw(:flock :seek :mode); +use CGI qw(:standard); +use CGI::Carp qw(fatalsToBrowser); +use Fcntl qw(:flock); +use Digest::MD5 qw(md5_hex); + +# add fex lib +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +our ($keep_default,$dkeydir,$akeydir,$mdomain,$logdir,$fra); +our $akey = ''; + +# load common code, local config : $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +our $error = 'F*EX redirect ERROR'; + +chdir $spooldir or die "$spooldir - $!\n"; + +my $log = "$logdir/rup.log"; + +$from = $id = $oto = $nto = $file = ''; + +# look for CGI parameters +foreach my $v (param) { + $vv = param($v); + $vv =~ s/[<>\'\`\"\000-\037]//g; + if ($v =~ /^akey$/i and $vv =~ /^(\w+)$/) { + $akey = $1; + } elsif ($v =~ /^(from|user)$/i) { + $from = normalize_address($vv); + $from .= '@'.$mdomain if $mdomain and $from !~ /@/; + } elsif ($v =~ /^id$/i) { + $id = despace($vv); + } elsif ($v =~ /^file$/i) { + $vv =~ s:/:_:g; + $file = untaint(normalize($vv)); + } elsif ($v =~ /^oto$/i) { + $oto = normalize_address($vv); + $oto .= '@'.$mdomain if $mdomain and $oto !~ /@/; + } elsif ($v =~ /^nto$/i) { + $nto = normalize_address($vv); + } +} + +if ($akey and not $from) { + if (open $akey,'<',"$akeydir/$akey/@" and $id = getline($akey)) { + close $akey; + $from = readlink "$akeydir/$akey"; + $from =~ s:.*/::; + $from = untaint($from); + if ($akey ne md5_hex("$from:$id")) { + $from = $id = ''; + } + } +} + +if ($from and -s "$from/\@ALLOWED_RECIPIENTS") { + http_die("You are a restricted user"); +} + +if ($from and $id) { + open F,'<',"$from/@" or http_die("wrong user or auth-ID"); + chomp($rid = ); + close F; + http_die("wrong user or auth-ID") if $id ne $rid; + unless ($akey) { + $akey = untaint(md5_hex("$from:$id")); + unlink "$akeydir/$akey"; + symlink "../$from","$akeydir/$akey"; + } +} else { + http_die("wrong user or auth-ID"); +} + +if ($oto and not glob("$oto/$from/*")) { + http_die("$oto has no no files in spool from you ($from)"); +} + +# display HTML form and request user data +unless ($from and $id and $file and $oto and $nto) { + $head = "$ENV{SERVER_NAME} F*EX redirect"; + http_header("200 OK"); + print html_header($head); + pq(qq( + '
' + ' ' + )); + if ($akey) { + print "\n"; + } else { + pq(qq( + ' ' + ' ' + )); + } + if ($oto) { + pq(qq( + ' ' + ' ' + )); + } else { + pq(qq( + ' ' + )); + } + if ($from and $oto) { + pq(qq( + ' ' + ' \n"; + } + pq(qq( + '
sender:' + '
auth-ID:' + '
old (wrong) recipient:$oto
old (wrong) recipient:' + '
new recipient:' + '
filename:
' + '

' + ' ' + '

' +

+ 'back to F*EX operation control' + '' + )); + exit; +} + +if ($nto) { + + # read aliases from address book + if (open my $AB,'<',"$from/\@ADDRESS_BOOK") { + while (<$AB>) { + s/#.*//; + $_ = lc $_; + if (s/^\s*(\S+)[=\s]+(\S+)//) { + my ($alias,$address) = ($1,$2); + if ($nto eq $alias) { + $nto = $address; + last; + } + } + } + close $AB; + } + + $nto .= '@'.$mdomain if $mdomain and $nto !~ /@/ and $nto =~ /\w/; + checkaddress($nto) or http_die("$nto is not a valid e-mail address"); +} else { + http_die("no new recipient given"); +} + +if ($oto and $nto and $oto eq $nto) { + http_die("new recipient must be other than old recipient"); +} + +$fkey = urlencode($file); +unless (-s "$oto/$from/$fkey/data") { + http_die("no upload data found for $file for $oto"); +} + +if (not -e "$oto/$from/$fkey/data") { + if (my $download = slurp("$oto/$from/$fkey/download")) { + chomp $download; + http_die("$file already downloaded by $download"); + } + http_die("$file has gone"); +} + +mkdirp("$nto/$from"); +rmrf("$nto/$from/$fkey"); + +if (rename "$oto/$from/$fkey","$nto/$from/$fkey") { + mkdirp("$oto/$from/$fkey"); + if (open $fkey,'>',"$oto/$from/$fkey/error") { + print {$fkey} "$from has removed $file\n"; + close $fkey; + } + unlink "$nto/$from/$fkey/dkey"; + unlink "$nto/$from/$fkey/notify"; + unlink "$nto/$from/$fkey/error"; + unlink "$nto/$from/$fkey/download"; + if (slurp("$oto/$from/$fkey/$comment") =~ 'NOMAIL') { + unlink "$nto/$from/$fkey/comment"; + } + $dkey = randstring(8); + symlink $dkey,"$nto/$from/$fkey/dkey"; + symlink "../$nto/$from/$fkey","$dkeydir/$dkey"; + $filename = filename("$nto/$from/$fkey") || $fkey; + notify_locale($dkey,'new'); + ruplog("$oto/$from/$fkey ==> $nto"); + http_header("200 OK"); + print html_header('F*EX redirect'); + pq(qq( + '

F*EX redirect

' + 'notification of file upload \"$filename\" sent to $nto' + '

' + 'back to F*EX operation control' + '' + )); +} else { + http_die("redirect $nto/$from/$fkey failed : $!") +} + +exit; + + +sub normalize_address { + local $_ = shift; + s/[<>;,\s\|\/\'\`\"\000-\037]//g; + $_ = untaint($_); +} + + +# standard log +sub ruplog { + my $msg = "@_"; + + $msg =~ s/\n/ /g; + $msg =~ s/\s+$//; + + if (open $log,'>>',$log) { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + printf {$log} "%s [%s_%s] (%s) %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg; + close $log; + } +} diff --git a/cgi-bin/sex b/cgi-bin/sex new file mode 100755 index 0000000..d483ebe --- /dev/null +++ b/cgi-bin/sex @@ -0,0 +1,236 @@ +#!/usr/bin/perl -wT + +# CGI for stream exchange +# +# Author: Ulli Horlacher + +use Fcntl qw':flock :seek :mode'; +use POSIX qw'mkfifo'; +use Digest::MD5 qw'md5_hex'; + +# add fex lib +(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; +die "$0: no $FEXLIB\n" unless -d $FEXLIB; + +$| = 1; + +# import from fex.pp +our ($tmpdir,$logdir,$timeout,$fra,$bs); + +# load common code, local config: $HOME/lib/fex.ph +require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + +chdir $spooldir or error(500,"$spooldir - $!"); + +my $debuglog = "$tmpdir/sex.log"; +my $ra = $ENV{REMOTE_ADDR}||0; +$fra .= '/'.$ENV{HTTP_X_FORWARDED_FOR} if $ENV{HTTP_X_FORWARDED_FOR}; +$timeout *= 10; + +# normal / public : +# in normal mode the recipient needs authentification, not the sender +# in public mode the sender needs authentification, not the recipient + +$user = $id = $pmode = $type = ''; +$stream = 'STDSTR'; +$mode = $ENV{REQUEST_METHOD} eq 'POST' ? 'PUSH' : 'POP'; + +# parse HTTP QUERY_STRING +if (my $qs = $ENV{QUERY_STRING}) { + $qs = decode_b64($qs) if $qs =~ /^\w+=*$/; + foreach (split '&',$qs) { setparam(split '=',"$_=") }; +} + +unless ($user) { error(400,"Missing user") } +if ($mdomain and $user !~ /@/) { $user .= '@'.$mdomain } +if ($user =~ /^anonymous/) { + if (@anonymous_upload and ipin($ra,@anonymous_upload)) { + mkdirp($user); + } else { + error(403,"Forbidden"); + } +} else { + unless (-f "$user/@") { error(404,"Unknown user $user") } +} +chdir $user or error(500,"$user - $!"); + +$stream = "STREAM/$stream"; + +if ($mode eq 'PUSH') { + if ($pmode eq 'PUBLIC') { + &authentificate; + $stream =~ s:/STDSTR:/PUBLIC:; + } + mkdirp($stream); + my $fifo = "$stream/fifo"; + unless (-p $fifo) { + mkfifo($fifo,0600) or error(503,"Cannot create $fifo : $!"); + } + + sexlog($mode); + + my $lock = "$stream/lock"; + open $lock,'>>',$lock or error(503,"Cannot open $lock : $!"); + flock $lock,LOCK_EX|LOCK_NB or error(409,"$stream already in use"); + + chmod 0600,$fifo; + unlink "$stream/mode"; + unlink "$stream/type"; + symlink $pmode,"$stream/mode" if $pmode; + symlink $type, "$stream/type" if $type; + + $SIG{PIPE} = sub { + sleep 1; + rmrf($stream); + exit; + }; + $SIG{ALRM} = sub { + syswrite STDOUT,"."; + exit if $!; + $ALARM = 1; + }; + syswrite STDOUT,"HTTP/1.9 199 Hold on"; + for (my $i=0;$i<$timeout;$i++) { + alarm(1); + $ALARM = 0; + # will hang until $stream is opend for reading by another process + open $fifo,'>',$fifo and last; + unless ($ALARM) { error(503,"Cannot open $fifo : $!") } + } + alarm(0); + syswrite STDOUT,"\r\n"; + + unless (fileno $fifo) { + rmrf($stream); + error(504,"Timeout"); + } + + header('200 OK'); + + $B = 0; + $shutdown = sub { sexlog($B); rmrf($stream); exit; }; + $SIG{PIPE} = sub { sleep 1; &$shutdown; }; + # syswrite $fifo,$data if $data; + while ($b = sysread(STDIN,$_,$bs)) { + $B += $b; + syswrite $fifo,$_ or die $!; + } + + &$shutdown; +} +elsif ($mode eq 'POP') { + $stream =~ s:/STDSTR:/PUBLIC: if $id eq 'public'; + unless ($id eq 'public' and (readlink "$stream/mode"||'') eq 'PUBLIC' + or $user =~ /^anonymous/) { + &authentificate; + } + error(503,"No $stream for $user") unless -d $stream; + $type = readlink "$stream/type" || ''; + $SIG{ALRM} = sub { error(504,"Timeout") }; + alarm($timeout); + my $fifo = "$stream/fifo"; + if (-e $fifo and not -r $fifo) { error(503,"$stream already in use") } + open $fifo,'<',$fifo or error(503,"Cannot open $fifo : $!"); + chmod 0,$fifo; + alarm(0); + header('200 OK',$type); + sexlog($mode); + + while (sysread($fifo,$_,$bs)) { + syswrite STDOUT,$_ or die $!; + } + exit; + +} +else { + error(405,"Unknown Request"); +} + +exit; + + +sub setparam { + my ($v,$vv) = @_; + + $v = uc(despace($v)); + $vv = untaint(normalize($vv)); + # $param{$v} = $vv; + if ($v eq 'USER') { $user = lc(despace($vv)) } + elsif ($v eq 'ID') { $id = despace($vv) } + elsif ($v eq 'MODE') { $pmode = uc(despace($vv)) } + elsif ($v eq 'TYPE') { $type = uc(despace($vv)) } + elsif ($v eq 'STREAM') { $stream = normalize_filename($vv) } + elsif ($v eq 'BS' and $vv =~ /(\d+)/) { $bs = $1 } + elsif ($v eq 'TIMEOUT' and $vv =~ /(\d+)/) { $timeout = $1 } + elsif ($v eq 'ANONYMOUS') { $id = $user ='anonymous'; $stream = $vv; } +} + +sub sexlog { + if (open my $log,'>>',"$logdir/sex.log") { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + printf {$log} "%s [%s_%s] %s (%s) %s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$user,$fra,"@_"; + close $log; + } +} + +sub sigdie { + local $_ = shift; + chomp; + sigexit('DIE',$_); +} + +sub sigexit { + my ($sig) = @_; + if (open my $log,'>>',"$logdir/sex.log") { + printf {$log} "%s %s (%s) caught SIGNAL %s\n", + isodate(time),$user||'-',$fra||'-',"@_"; + close $log; + } + if ($sig eq 'DIE') { + shift; + die "@_\n"; + } else { + die "SIGNAL @_\n"; + } +} + +sub error { + nvt_print("HTTP/1.1 @_"); + exit; +} + +sub header { + my ($status,$type) = @_; + + return if $HTTP_HEADER; + $HTTP_HEADER = $status; + + nvt_print("HTTP/1.1 $status"); + if ($mode eq 'POP') { + nvt_print("Server: sexsrv"); + if ($type eq 'GZIP') { + nvt_print("Content-Type: application/gzip"); + } else { + nvt_print("Content-Type: application/binary"); + } + nvt_print("Expires: 0"); + nvt_print("Cache-Control: no-cache"); + nvt_print("Connection: close"); + } + nvt_print(""); +} + +sub authentificate { + my $rid; + + error(400,"Missing auth-ID") unless $id; + open $id,'<','@' or error(401,"$user/@ - $!"); + chomp($rid = <$id>||''); + close $id; + if ($rid and $sid and $id =~ /^(MD5H:)/) { + $rid = $1 . md5_hex($rid.$sid); + } + error(401,"Wrong auth-ID") if $rid ne $id; +} diff --git a/doc/Changes b/doc/Changes new file mode 100644 index 0000000..6074da1 --- /dev/null +++ b/doc/Changes @@ -0,0 +1,805 @@ +2015-01-17 new fex.ph config variable $mail_authid (default yes) +2015-01-16 fixed bug no notfication for still existing file (overwrite) +2015-01-15 fixed bug no locale reminder notfication + fixed bug wrong result for recipients with NOTIFICATION=no +2015-01-13 fexsend: added option -N resend notification email + resending notification email deletes download ip restriction + fup: fixed bug sending to groups broken +2015-01-10 fexsend: added option -S show server/user settings + fup: added command LISTSETTINGS +2015-01-09 foc: added save-or-display (MIME) option for download +2015-01-04 fexsend: fixed bug dies too early on multiple files and one + file has been already transfered +2014-12-25 fexget,fexsend,sexsend: use default SSL_cipher_list + DEFAULT:!3DES:!MD5 +2014-12-24 fexget,fexsend,sexsend: evaluate environment variables SSLVERIFY + SSLVERSION SSLCAPATH SSLCAFILE SSLCIPHERLIST + fexget,fexsend,sexsend: use TLS, not SSL +2014-12-23 fexsend: $HOME/.fex/config with $opt_* and %alias variables + fexget: $HOME/.fex/config with $opt_* and %autoview variables +2014-12-19 fur: fixed bug race condition with fex_cleanup (external->internal) +2014-12-17 install/update: fixed bug some spool files are owned by user root +2014-12-16 fexsrv: fixed bug handling of User-Agent FDM +2014-12-09 added l ll lf to distribution + fexwall: also mail to sub and group users +2014-12-03 fup: remove file after upload if restricted user has set NOMAIL + fup: fixed bug wrong message "user notified" if NOMAIL +2014-12-02 fup: also check recipient restrictions on command CHECKRECIPIENT +2014-11-24 fexget: autoview gif jpg png tif after download +2014-11-20 count unfinished upload size into quota, too + fixed bug wrong quota calculation on SysV UNIX like Solaris +2014-11-18 fexsend: added environment variables SSLVERIFY SSLCAPATH SSLCAFILE +2014-11-18 dop: added HTTP basic authentication for htdoc directory with + .htauth file +2014-11-14 ignore @forbidden_recipients if $SPOOL/$USER exists + (admin has created user) +2014-11-11 fup: fixed bug groups from other users in address book selection + fup: added useragent to $SPOOL/$TO/$FROM/$FILE/ +2014-11-10 fup: present locales in recipient query form, too +2014-11-07 FAQ: added text anchor URLs +2014-11-03 added missing fexget fexsend sexget sexsend for tools.html +2014-10-23 fexsend: on multiple recipients check only the first for resume +2014-10-14 fac: added option -L (list files detailed) +2014-10-01 fex_cleanup: fixed bug wrong default spool for virtual hosts +2014-09-19 sex: added transfered bytes to sex.log +2014-09-17 fup: fixed bug no locales presentation +2014-09-14 fex_cleanup: send new release notification to $admin +2014-09-11 dop: exclude .* and *~ from stream files +2014-09-01 fup: upload status bar waits longer, until $timeout +2014-08-27 fex_cleanup: use wget for new release dedection +2014-08-18 fexsend: workaround for stunnel bug (options -s and -g) + fex_cleanup,fexsend: always restrict permissions on fexsend id-file +2014-08-16 fac: added options -P and -E (more examples) +2014-08-15 install: fixed bug wrong owner in spool + fex_cleanup: do not terminate on error, but print warning +2014-08-13 fexsrv,fexsend,fexget: reenabled IPv6 support +2014-08-10 fac: added option -/ to set new admin +2014-08-08 moved $admin_pw from fex.ph to auth-ID for user $admin + fex_cleanup: fixed bug in notify_newrelease + fac(CGI): switched from HTTP basic authorization to auth-ID/akey + fexsend: always use CHECKRECIPIENT, not only for aliases +2014-08-07 dop: generate on-the-fly gzipped documents if requested +2014-08-06 fixed bug install script dysfunctional (permission, hostname) +2014-07-25 reenabled vhost support +2014-07-13 dop: in directory index, list only files which are readable by + group or other +2014-07-10 fup: fixed bug wildcards not working in @forbidden_recipients +2014-06-25 fup,fop: sender can download the files he has sent, too, + if he uses the same ip for upload and download +2014-06-19 fac(CGI): @admin_hosts is now mandatory in fex.ph +2014-06-12 fur: reallow registration of internal and external users from + the same ip range +2014-06-05 new fex.ph config variable @forbidden_hosts +2014-06-03 fuc: fixed bug cannot edit and save groups +2014-05-26 fuc: ignore akey cookie to prevent cross-site request forgery +2014-05-26 fup,foc,fuc,rup,pup: better parameter filtering to prevent + cross-site scripting attacks +2014-05-25 fup: fixed bug insecure dependency when forwarding a file + to a user which has set a default keep value +2014-05-23 fexget: fixed bug download fails on big file and slow disk +2014-05-12 set Reply-To in notification emails for @remote_domains +2014-05-03 fup: fixed bug wrong (old) keep time on forword-copy (bounce) +2014-04-10 fexsend: added "exclude from archive" option -# +2014-03-28 fexsend: do not copy "NOMAIL" comment in forward +2014-03-28 fexget: fixed bug server timeout because of storage check +2014-03-07 new fex.ph config variable $disclaimer to be appended to every email +2014-03-05 added bin/fexwall and doc/newfeatures +2014-03-04 fuc,foc: added PGP/GPG email encryption option +2014-02-26 fex.pp: fixed bug $keep_default ignored +2014-02-13 fur,fex.ph: config variable @local_domains may contain wildcard * + in domain names +2014-01-03 fexget: checks storage capacity before download +2013-11-26 dop: substitute $variable$ in HTML document only if there is a + corresponding environment variable +2013-10-15 fac: fixed bug wrong output with option -l +2013-10-14 fexget: use archive name as default extraction directory +2013-10-09 fixed bug afex URL for only one download availably +2013-10-07 fup: fixed bug no download links on multiple NOMAIL recipients +2013-09-23 fexsend: fixed bug option -c sends uncompressed file +2013-09-19 sub and group users have the same quota amount like their main user +2013-09-18 fixed bug permission denied for locale htdocs + anonymous user now with hostname domain instead of mail domain +2013-09-17 dop: set locale cookie, too +2013-09-15 foc: added "Change the disclaimer" option +2013-09-12 fup: expand domainless address with server hostname if such a user + exists (needed for fbm/nettest) +2013-09-09 new FAQ design (questions first, then Q+A) +2013-09-04 fac: modify $hostname when vhost fex.ph is created + fuc: recognize comment=NOMAIL +2013-08-26 fexsend: always show download URL if recipient is "." +2013-08-20 fup,fop: fixed bug no DELETE and RESUME for fexmail and anonymous + users (because of storage swap) +2013-08-18 sexsend: fixed bug data corruption when using https + fop,fup: fixed bug bad file locking when using multiple recipients + fexsend: fixed bug hangs on server error when sending archive +2013-08-17 fixed bug $sender_from ignored + fup,foc: added notification email resending on user request +2013-08-16 fac: fixed bug wrong output order for option -l +2013-08-14 fop: fixed bug no multiple downloads for fexmail + fac: added option -M for resending notification emails +2013-08-09 afex: fixed bug ID for input +2013-08-06 fexsrv: always includes "Server: fexsrv" in HTTP reply + fexsend: terminates if no fexsrv HTTP reply +2013-07-28 dop: added .htaccessfrom support +2013-07-27 fex.ph,dop: security enhancement: + static documents must be in @doc_dirs + dop: documents with leading . are not allowed +2013-07-25 fexsend: added option -= to upload a file with another name +2013-07-21 fixed bug environment variables are cut at newline +2013-07-18 fup,fexsend: use header Content-Location instead of Content-Type for + file linking +2013-07-15 fup: modifying keep references actual time, not upload date + fexsend: fixed bug no feedback on option -x -k (modify keep) +2013-07-13 fup: fixed bug user specific keep and autodelete defaults are ignored +2013-07-12 fup,fop: added file link support + fexsend: added option -/ for file linking +2013-07-09 fexget: added option -P proxy:port +2013-06-28 new all-in-one FAQ +2013-06-27 fup: to/from storage swap for fexmail and anonymous users + fup: anonymous recipient with random number +2013-06-26 fop: allow multiple downloads from same ip + fup,fac: extended "fex yourself" support + added sup.html +2013-06-22 fop,fexsend: Location output for fexmail for already transfered files +2013-06-19 fexget: fixed bug cannot download MIME file +2013-06-15 fex.ph: new config variable $notify_newrelease checks + fex.rus.uni-stuttgart.de for new release and sends mail +2013-06-12 fac(CGI): fixed bug wrong spooldir for virtual server +2013-06-11 fex.ph: new config variable $usage_conditions for registrations mails + fop: fixed bug fexmail download possible only once +2013-06-10 fac: added option -D to disable a user + (with hooks in fop,fop.fuc,foc,fur) +2013-06-03 fuc: fixed bug user can modify his auth-ID to an illegal value +2013-05-30 install: force creation of $admin_pw + fex_cleanup: fixed bug wrong fexadmin fexid for reactivation emails +2013-05-25 added afex and asex to distribution +2013-05-23 dop: fixed bug no output on file.stream +2013-05-22 install script installs as user fex (and not as root) +2013-05-19 security patch: config variable @local_rhosts restricts download of + files from new external users to specific ip ranges + use and syntax in notification email header + added support for $max_fail_handler() +2013-05-18 fac: fixed bug option -rd does not work + fac: added option -R +2013-05-16 fop: fexmail support (multiple downloads allowed) +2013-05-09 fup: fixed bug anonymous only works if $mdomain is defined + fop: fixed bug anonymous only works if recipient host is in + @anonymous_upload list +2013-05-07 fup: fixed bug multiple Location HTTP headers generate an error with + some web browsers +2013-05-03 added support for axel download accelerator (multiple HTTP Range) +2013-05-02 add X-FEX-File-ID header to notification emails +2013-04-23 dop: fixed bug HTTP 301 redirection timeout on symlinks +2013-04-05 fexsend: fixed bug server timeout when sending huge ZIPs +2013-02-20 fac: added -m maintenance mode +2013-02-17 fup: fixed bug stored comment in spool not in UTF8 + fop: fixed bug file deletion also deletes fop.log +2013-02-16 fur,fex.ph: allow "*" for local domains self registration + fex.ph: new config variable @registration_hosts + fex.ph: new config variable @admin_hosts +2013-02-11 fur: fixed bug insecure dependency with exuser +2013-01-31 receiving of reminder emails is user configurable +2013-01-24 fup: decode UTF8 comment +2013-01-07 added X-Frame-Options header to prevent clickjacking +2012-12-26 fup,fexsend: added replyto option +2012-12-21 dop: download manager prevention: + no concurrent downloads from same client with HTTP Range +2012-12-17 fop: fixed bug ip based download restriction +2012-12-16 added name based virtual host server +2012-12-15 fexsrv: HTTP error logging to error.log +2012-12-07 fex.ph: added optional config variable @durl +2012-12-04 new feature forward a file from incoming spool +2012-11-21 fac: show more user information +2012-11-20 added CAPTIVE user mode +2012-11-19 fup: with comment NOSTORE file will not be stored ==> benchmarking +2012-11-14 fexsend: fixed bug gkey and skey URL recipients not working +2012-11-12 fexsend: 7z archives without compression +2012-11-08 fop: fixed bug cannot use "?" in file name with fexsend +2012-11-07 fixed security bug restricted user can redirect files +2012-11-06 fup: show download-URL after upload if sender = recipient + fup,fop,fac: added user up/download IP restriction by admin +2012-11-05 added HTTP Strict Transport Security if $force_https is enabled + fixed bug afex accessible via xkey from everywhere +2012-11-02 fup: fixed bug one time upload URL gives "no recipient specified" + error +2012-11-01 fup: fixed bug public upload always gives error +2012-10-16 fop,fup: added afex support + fup: accept recipients . and // +2012-10-15 sex,sexsend: added anonymous mode (no auth-ID necessary) +2012-10-14 fop,fup: added support for fexsend anonymous mode +2012-10-11 fex.ph: added optional config variable $overwrite +2012-10-10 fup: anonymous upload with non-anonymous recipient +2012-09-30 fup: fixed bug groups not working any more (NOMAIL) +2012-09-19 fup: logout functions respects login CGI (or symlink) + foc: detailed/brief notification mail configuration +2012-09-18 fexsend: added options -. and -n + fup: added shortmail option in comment +2012-09-17 added mailmode configuration option in fex.ph + fup: shows download-URL if NOMAIL +2012-09-15 sex: public URL parameter may be in base64 format, too +2012-09-10 dop: added more security checks +2012-09-01 dop: added streaming document output +2012-08-30 sex: fixed bug second receiving client corrupts the stream +2012-08-26 Changed licence from AGPL to Perl Artistic +2012-08-21 schwuppdiwupp: error handling on network failures for Windows + schwuppdiwupp: removed Tk::FileSelect for Windows +2012-07-11 fop: fixed bug no multiple downloads for anonymous uploads +2012-07-10 fixed French, Spanish and Czech localization (code syntax) bugs +2012-07-09 fup: anonymous upload with modifyable keep option and multiple + downloads +2012-07-05 fexsrv: added camel easteregg +2012-07-02 fup: added optional anonymous upload with fex.ph variable + @anonymous_upload + fup: fixed bug throttle 0 configuration is ignored +2012-07-01 fexsend: optional argument '@' as files/recipients separator + fexsend: fixed bug notification email for recipient '.' +2012-06-21 dop: inside HTML documents: #include "file" +2012-06-06 fexget: new option -+ +2012-06-05 fexsend: new option -+ +2012-06-01 fup: show transfered size instead of total size in status window +2012-05-04 fexsrv: added bunny easteregg +2012-05-02 fexsrv: allow HTTP 1.0 with Range header (wget!) + fexsrv: disallow negative value in Range (client signed int bug) +2012-04-26 Changed licence from GPL to AGPL +2012-04-07 foc: check new address book for syntax errors +2012-04-06 foc: added comment field for new subuser information +2012-04-04 removed F*IX because of too many bugs and no maintainer any more +2012-03-05 fup: fixed bug shell wildcards in recipient address are expanded to + known users from spool + fex.ph: added optional config variable @locales +2012-03-01 dop: delivers MIME type text/plain if "?!" is appended to URL +2012-02-20 foc: show auth-ID after click on link +2012-02-07 fop: MIME-type text/html is no longer possible for security reasons +2012-02-04 added optional french localization +2012-02-03 fixed bug 0.0.0.0 not recognized as ip address + fex.ph: added optional config variable $keep_max +2012-02-02 HTTP parameter filtering to prevent cross-site scripting attacks +2012-02-01 config variable @throttle may also contains ip addresses +2012-01-25 pup: locale selection in native language, default autodelete=no + fup: "send another file" with same keep and autodelete parameters +2012-01-17 fixed bug reactivation.txt in czech instead english +2012-01-06 fup: fixed bug show wrong remaining keep days +2012-01-02 fup.pl: fixed bug bad FAQ link +2011-12-31 fex_cleanup: fixed bug notification emails not localized +2011-12-30 fup: additional dkey.log +2011-12-05 fup: respect @throttle config for all clients +2011-11-29 dop: delivers text files (scripts!) without x-bit as "text/plain" +2011-11-15 fup: fixed bug with $autodelete = $NUMBER; +2011-11-08 fac: added option -S statistics +2011-11-02 fup: show remaining keep time in files listing +2011-10-28 fup: fixed bug uninitialized value when using copy-forward +2011-10-13 fup: FILESIZE hack for firefox 7 to support uploads > 4 GB +2011-10-05 fup: fixed bug wrong sender quota calculation +2011-10-03 fex.ph: added configuration variables @upload_hosts @download_hosts +2011-09-30 fexsend: added option -g for sending encrypted files +2011-09-21 fexsrv: use $default_locale if client sends illegal locale cookie +2011-09-20 fex.ph: added optional config variable $boring for unhumorous mode +2011-09-19 fur: $USER/.auto contains additional info about account creation +2011-09-07 fac(CGI): fixed bug infinitve loop in watch logfile +2011-09-06 fup,fac,fur: new additional login URL type: + http://FEXSERVER/fup/B64ID + fup: show "or select from address book" only if there are entries +2011-09-05 fexsrv: fixed bug locale cookie not fetched on http://cgi?parameter +2011-09-01 rup: fixed bug cannot find files (no more SID in akeys directory) +2011-08-30 fex.ph: new config variable @forbidden_recipients +2011-08-29 fexsend: accept file number for delete option -d, too + dop: fixed bug no text document output if external file command is + non-GNU +2011-08-26 added one time upload OKEY +2011-08-13 fex_cleanup: fixed bug comment missing in reminder email +2011-08-11 dop: #if ... #else ... #elseif ... #endif inside HTML documents + dop: show HTML sourcecode if "!" is appended to URL +2011-08-10 fex_cleanup: delete obsolete users, too, via fex.ph $account_expire + new FAQ design (with Javascript/CSS) +2011-08-09 fup: show error on invalid SKEY or GKEY + fuc: fixed bug subuser and groupuser not lowercase forced + address book may also contain option locale= +2011-08-08 fex_cleanup: auto-expire user accounts with fex.ph variable + $account_expire + fexsend,fup: allow forward with locale + dop: extra security check: files from lib and spool are not allowed +2011-08-07 fup: subusers and groupusers can also select a locale + fup: if user selects a locale login, save it as default locale + (does not affect fexsend and schwuppdiwupp) + notification emails come in default locale +2011-08-03 fexsend: fixed bug uninitialized value when using chunked mode + fexsend: added undocumented option -F female mode +2011-07-31 fexsend: added option -s streaming data + fup: accept streaming data +2011-07-30 fexsend: -a tar archives no longer use a intermediate transferfile, + but send via pipe (streaming) + fexsend: fixed bug no resume on -a archives + fexsend: always ask server if file already has been uploaded + fup: more information on F*EX clients download and configuration +2011-07-27 fup: if comment contains "!bcc!" then sender will get a bcc + of notification email +2011-07-26 fexget: added option -X do not extract archive file + fexget: added option -a get all files + fexsrv: fixed bug uninitialized value when using a reverse proxy + fex_cleanup: fixed bug notify reminder email not localized +2011-07-22 fac(CGI): fixed bug displaying < and & in logfiles + fac(CGI): added getting error.log + fop: allow multiple downloads from any client if sender = recipient +2011-07-16 added doc/reverse_proxy +2011-07-14 added optional czech localization +2011-07-01 FAQ.html reformated +2011-06-30 translate install job 20 times faster +2011-06-27 added robots.txt to disallow web robots indexing +2011-06-22 fup: disable HTML code in file listing (filename & comment) +2011-06-21 added optional italian localization +2011-06-17 fixed bug $bcc is ignored +2011-06-16 fexsend,fexget: better reverse proxy support + (always send Host header) + added optional galician localization +2011-06-15 fup: fixed bug always keep_default days in notification email +2011-06-14 fexsend: transparent proxy detection (and support) + fixed bug $docdir ignored +2011-06-10 fex.ph: new config variable $bcc for notification emails +2011-06-09 set Reply-To in all notification emails + fup: fixed security bug everyone can upload files with empty auth-ID +2011-06-05 fup: fixed bug insecure dependency in printf on "forward file" +2011-06-03 fup,fop: added throttle bandwith limit option (fex.ph) +2011-06-02 fup: added bandwith limit option +2011-06-01 added PID and request-number to the logs + fex_cleanup: fixed bug no expire with AUTODELETE=NO +2011-05-31 support for FEXLIB /usr/local/share/fex/lib /usr/share/fex/lib +2011-05-30 fup,fexsend: added option -x to modify file parameters +2011-05-29 fup,fexsend: forward files with new comment and keep time + rup: add mdomain to addresses without domain +2011-05-18 fup: fixed bug restricted users can forward files to anybody +2011-05-17 fixed bug access problems with AKEYs: now use SID instead of SIP +2011-05-11 added helper script mksgkeys (regenerates missing SKEYs and GKEYs) +2011-05-10 fex_cleanup: cleanup ADDRESS_BOOK file upload + fex.ph,fex_cleanup: AUTODELETE=NUMBER ==> + delete file on next NUMBER day after download +2011-05-09 fac,fup: added user specific autodelete default + fac,fex_cleanup: added user specific keep default +2011-04-27 fexsend: fixed bug archiv.zip not working on Windows + dop: added index function for htdoc directory with .htindex file +2011-04-25 fexsend: better proxy support (non-persistent connections) +2011-04-24 xx: better ESXi support (heuristic guessing of tar format) +2011-04-22 sexsend: base64 support for $FEXID and $FEXXX +2011-04-01 fexsend: continue without SID if SID is not available +2011-03-26 fexsrv: deactivate header_hook (inquisition) if request is a + regular fop request +2011-03-18 fexsend: base64 support for $FEXID and $FEXXX +2011-03-09 fexget,fexsend: fixed bug no file listing for https +2011-03-04 removed "use Switch" because of warnings with perl 5.12 +2011-02-28 sexsend: added option -g show transfer rate +2011-02-24 dop: evaluate <> inside html documents +2011-02-21 fexsend,fup: added option fexsend -U show authorized (login) URL +2011-02-18 do not modify download URL protocol if $dkey is set in fex.ph + fac(CGI): fixed bug uninitialized value $server + URLs in notification emails are derived from config variable $durl +2011-02-17 fup: fixed bug access denied with SKEY +2011-02-08 fup,fop,fuc: fixed bug access problems with sip in AKEYs + fup: fixed bug no notification email for multiple recipients +2011-02-07 fexsend,fop: do not send same file (filename and mtime) twice +2011-02-06 fup: fixed bug no notification email after first failed upload +2011-01-31 schwuppdiwupp: added ISO-8859-1 support +2011-01-30 schwuppdiwupp: added running camel +2011-01-28 schwuppdiwupp: added chunksize to proxy options + schwuppdiwupp: fixed bug timeout when using address book + fexsend: fixed bug chunksize 0 +2011-01-27 schwuppdiwupp: added advanced preferences Proxy and TMPDIR +2011-01-26 fex_cleanup: fixed bug uninitialized value in debuglog + fex_cleanup: added option -v + fexsend,fexget,sexsend: added option -V show version + schwuppdiwupp: added drag&drop support for windows + schwuppdiwupp: added 7zG support +2011-01-25 fuc: fixed bug cannot delete all subusers + schwuppdiwupp: fixed bug 7-zip not found + schwuppdiwupp: added drive letters in directory selection +2011-01-24 fop: IE bug workaround to store *.exe files +2011-01-18 schwuppdiwupp: added tar, zip and 7z container +2011-01-17 fexsend: fixed bug option -l not working with https URL +2011-01-16 fup: added 7zip hint in notification emails +2011-01-13 schwuppdiwupp: fixed bug no transfer at all when comment is set +2011-01-12 rup: added logging + rup: wrong recipient cannot download file, but will get an error + fac(CGI): fixed bug $server not declared +2011-01-07 fexget: keep file permission in overwrite mode +2011-01-04 fex_cleanup: fixed bug autodelete after partial download +2010-12-26 fex_cleanup: fixed bug too early expire for forwarded files +2010-12-10 new config variable @public_recipients for new CGI pup + (public upload) - upload without auth-ID +2010-12-09 fex.ph,fur: new config variable @local_rdomain for self- + registration of restricted external-to-internal users +2010-12-08 fup,foc: no access to foc for restricted users +2010-12-02 fup: if there is a cgi-bin/login it will be called on "logout" +2010-11-24 fex.ph: new config variable $default_locale + dop: auto-expires every document (to prevent browser caching) +2010-11-16 fexsrv: better error handling if CGI is not executable +2010-11-09 new SKEYs and GKEYs, because old ones could be not unique + access for subuser only with SKEY + access for groupuser only with GKEY +2010-11-07 fup,fuc: added GKEY + fexsend: SKEY or GKEY URLs can be recipients, too +2010-11-04 fexget: added (hidden) option -K +2010-11-03 fexsend: fixed bug proxy usage failed +2010-11-02 fop: fixed bug corrupted download with Internet Explorer +2010-10-25 fop,fup: better locking: no uploading is possible while a + download is in progress for the same file +2010-10-24 fix,fop: fixed bug subuser not working (SKEY problem) + xx: added locking +2010-10-23 xx,fop: added xx :slot option (multiple storage slots) +2010-10-20 fup,fop,fexsend: fexsend for subuser with SKEY +2010-10-19 fup: expires *KEY cookies on logout +2010-10-12 fup: fixed bug wrong interpretation of SKEY parameter+cookie +2010-10-05 fexend,fup: support of http reverse proxy +2010-09-27 fup: fixed bug missing Content-Type in upload status report +2010-09-20 fexsrv: IPv6 http support +2010-09-15 fac(CGI): fixed bug cannot delete and (re)create user + fac(CGI): fixed bug cannot create user who was a recipient +2010-09-12 fexsend,fop: fixed bug resuming upload does not work with alias + fup: fixed bug resuming upload handles autodelete and keep + parameters incorrectly +2010-09-07 fac(CGI): fixed bug not working if there is no user at all +2010-09-05 fop: extra parameter keep=days +2010-08-31 install: fixed bug wrong ownership for spool files +2010-08-25 perl 5.8 required + fexget: -s can write to named pipe or character special file +2010-08-21 fop: $limited_download checks dkey cookie instead of client IP +2009-08-20 removed mma +2010-08-18 fex_cleanup: fixed bug not expiring +2010-08-17 fac: fixed bug accept users without domain + install: fixed bug empty $admin_pw +2010-08-15 fex.ph: optional fix address $sender_from (instead of F*EX user) in + notification email From +2010-08-14 added optional spanish localization +2010-08-12 fup: speedup 90% + fop: speedup 20% + fop: better fexget compatibility + (close connection after file delivery) +2010-08-11 fop: fixed IE download bug (missing header separating line) + fop: fixed 1 min delay bug on AUTODELETE=YES +2010-08-08 sex: support for compressed streams + sex,sexsend: removed unneccesary text mode (option -t) + sex,sexsend: speedup factor 5 + added sexxx +2010-08-06 sex: fixed various bugs in client and server + fac(CGI): fixed bug AKEY not working +2010-08-03 xx: no user inquiry for postprocessing if output is a pipe +2010-08-02 added optional german localization +2010-07-31 separated subusers in extra file $SPOOL/$USER/@SUBUSER +2010-07-25 fop: log also aborted downloads +2010-07-23 added fac CGI +2010-07-18 fexsrv,fup,fexsend: extra XKEY download with short // URL + fexsend: fixed bug CHECKRECIPIENT not working +2010-07-16 added cookie support (for AKEY and SKEY) + fup: fixed bug showstatus window too small for close button +2010-07-13 schwuppdiwupp: added CHECKRECIPIENT +2010-07-12 fop,xx: allow several concurrent downloads of STDFEX +2010-07-10 fop: workaround for stupid IE download bug +2010-07-03 fex.ph,fex.pp: new config variable @remote_domains +2010-07-01 fexsrv,fex.ph: new config variable $force_https +2010-06-29 fop: new config variable $limited_download with default NO + => allow multiple downloads through proxy farm (varying IPs) + fop: note every successful download in spool file "download" +2010-06-25 fexget: fixed bug download status info update too often +2010-06-23 fur: better sendmail clone compatibility: + use space instead of comma as address separator +2010-06-19 fexget: new option -o overwrite mode + fexget: use ./$file.tmp for downloading instead of $HOME/.fex/tmp/ +2010-06-16 schwuppdiwupp: edit and select address book entries +2010-06-15 rup: fixed bug case sensitive recipient address +2010-06-12 fop: send X-File-ID on HEAD request, too + fexget: added support of X-File-ID +2010-06-11 schwuppdiwupp: (chunked) multi-POST for proxy with 4 GB limit + schwuppdiwupp: X-File-ID support +2010-06-08 fup,fexsend: (chunked) multi-POST for proxy with 4 GB limit +2010-06-06 fup,fop,fexsend: protocol extension X-File-ID (contains mtime + of file) is the successor of X-Size for more + reliable resume function +2010-06-02 schwuppdiwupp: added proxy support +2010-05-31 fexsend: fixed bug windows path elements in filename +2010-05-30 better server proxy support: + AKEY and SKEY no longer rely on client ip +2010-05-29 fexsend: added proxy support +2010-05-28 fur: allow registration confirmation more than once +2010-05-27 fexsend: added option -b bounce (copy-forward) +2010-05-26 fup,foc: added copy-forward feature +2010-05-20 fexsend: fixed bug uninitialized value with option -@ + fur: fixed bug $main::admin not declared +2010-05-17 fexsend: added option -H for hints + fexsend: added option -A for edit server address book +2010-05-16 fexsend: added HTTPS proxy support + fup: fixed bug uninitialized value (line 1059) +2010-05-13 fup: fixed bug ignored KEEP and AUTODELETE options for groups +2010-05-12 fup: fixed bug ignored autodelete option from ADDRESSBOOK +2010-04-30 fup: fixed bug uninitialized value with CHECKRECIPIENT + fexsend: no SID for https +2010-04-28 fup: fixed bug case sensitiv group addresses +2010-04-27 fexsend: fixed bug ignored server address book options + fexsend: displays recipients and options before starting post + fup: fixed bug ignored server address book autodelete option +2010-04-26 fexsrv: log all HTTP headers (no more ignore list) +2010-04-25 fexsrv: accept HTTP header with continuation lines +2010-04-22 fex.pp: added htdocs/header.html support + fex.ph: added variable @H1_extra organization link and logo +2010-04-20 fexsrv,fexsend: HTTP header X-Timeout (info server->client) + fexsrv: logging with locking +2010-04-19 fexsend: removed broken option -A and replaced it with more + flexible feature "." for recipient address + fexsend: fixed bug dies if sender is subuser (ADDRESS_BOOK error) + fup: fixed bug no COMMENT in notification email + dop: fixed bug error output with non GNU file command +2010-04-17 fexsend,fexget: added option -i for alternative accounts or servers +2010-04-12 fexsend: new verbose output format --> <-- +2010-04-11 fexsend: added option -Q quota query +2010-04-09 fup,fac: added quota support +2010-03-25 fup: fixed bug "Insecure dependency" when using AKEY parameter + (eg: sending a second file) + fup_template.html: fixed bug upload status window always shows + "ERROR: no file data received" +2010-03-24 fexsend: fixed bug dies if there is no server address book +2010-03-22 FIX.jar: fixed bug interpret HTTP response "200 OK" as error. +2010-03-20 fup,fop: set mtime on user directory for last successfull access +2010-03-19 fexsend: fixed bug abort on short address if there is no server + address book + fex_cleanup: better cleanup for dkeys directory +2010-03-18 fup: fixed bug cannot DELETE with group recipient +2010-03-17 fup: fixed bug wrong success message on aborted uploads + fop: fixed bug cannot handle @group names +2010-03-16 fup,fuc: fixed bug mixed case in F*EX group names and addresses +2010-03-14 fex.pp: do not send notification emails on empty files + fup,fuc: added F*EX groups +2010-03-12 fup,fop: fixed bug case sensitiv FROM and TO addresses +2010-03-05 fup: fixed bug aliases are not accepted with fop_auth +2010-03-04 fexsrv: use CGI login if it exists as start-page +2010-02-26 fexsend: first check server address book, then mutt aliases + fop: do not terminate session after ADDRESSBOOK request +2010-02-18 fexget: fixed bug always append existing file, ask for overwriting +2010-02-08 fexsrv: fixed bug uninitialized value in substitution (line 229) + fex.pp: better qmail compatibility (space separated addresses) +2010-02-07 fac: fixed bug uninitialized $EDITOR environment variable +2009-12-28 fup,fop,fexsend: protocol extension X-Size for more reliable + resume function (checks size of file) +2009-12-09 FIX.jar: can send more than one file (in zip archive) +2009-12-04 fex_cleanup: fixed bug send unnecessary reminder on AUTODELETE=NO +2009-11-26 fexsend,fexget,fup: added -z option for logfile inquiry +2009-11-13 fup,fuc: keep and autodelete options in server address book +2009-11-12 fexsrv: support for HTTP/1.0 persistant connections (for proxys) + PID:SID in fexsrv.log CONNECT string (debugging help) +2009-11-06 added error.log +2009-11-03 fex_cleanup: also cleanup $SPOOL/.reg directory +2009-10-23 fup: added X-FEX-Filesize header in notification email +2009-10-18 fup: also test if $FROM is a valid email address +2009-10-11 fex_cleanup: fixed bug no cleanup at all on AUTODELETE=NO +2009-09-25 fex.pp: added X-Mailer in sent mails to please stupid spamfilter at + hotmail or gmail +2009-09-02 fur,fex.pp: fixed bug not removing quote chars in qqq strings +2009-08-28 rup: fixed bug UTF-8 file names +2009-08-25 FIX.jar: accepts parameters TO, AKEY and SKEY (for subusers) +2009-08-24 fex_cleanup: fixed bug warning unitialized variable +2009-08-17 fex_cleanup: fixed bug typo mitime --> mtime +2009-08-12 fup: fixed bug "send another file" for subusers +2009-08-10 fexsend: fixed bug timeout on big archives +2009-07-27 to and from addresses in spool are now always localpart@domain, + install contains automatic spool converter + fup: fixed bug short aliases address list mismatch +2009-07-24 fup,fex_cleanup: fixed bug delete all files for multiple + recipients after any download + fexget: fixed bug delete local file before download +2009-07-20 fup: added autodelete and keep hack for HTML form +2009-07-18 fup: fixed bug leading . in file directory name + fup: added CHECKRECIPIENT support + fup: code cleanup, new 3-stage user interface + fexsend: added CHECKRECIPIENT feature +2009-07-17 fexget: fixed bug wrong UTF8 handling +2009-07-16 fop: fixed bug sending wrong file size if TO or FROM has + uppercase chars ==> resuming upload did not work +2009-07-11 fup: can select more than one address from address book +2009-07-08 fup,fex.pp: fixed bug wrong download URLs +2009-07-07 new spool directory layout $TO/$FROM/urlencode($FILENAME) + fup: be more restrictive in accepting (illegal) parameters values + fup,fuc: subuser access key name is now SKEY (KEY is depreciated) + rup: new HTML layout, fixed bug in file select box +2009-07-06 fup: substitute all control characters in file name and comment + with "_" +2009-07-02 better install script, guesses IP +2009-06-29 changed spool directory layout + $TO/$FROM/$FILE --> $TO/$FROM/md5h($FILENAME) + to avoid filename collisions +2009-06-28 added mailman authorization mma + better address-book integration in fup +2009-06-26 FIX.jar: fixed several bugs, now working with Windows Vista, too +2009-06-25 added fup_template.html as an example for customizing upload page +2009-06-22 fup,fexsend,fexget: LIST also shows COMMENT +2009-06-10 default timeout 10 s --> 30 s +2009-06-01 fexsend: show transfer status on STDERR (also for xx) +2009-05-31 fexsend,fexget: show transfer rate (kB/s) +2009-05-29 fexsend: auto-reconnect after SIGPIPE (link failure, etc) +2009-05-26 fexsrv: ignore HTML anchors in GET requests (from stupid msnbot) +2009-05-17 fup: check if there is enough free space in spool +2009-04-07 new perl based install; requires server IP for xinetd binding +2009-03-25 fexget: fixed bug saving failed if on other partition then FEXHOME + fexget: fixed bug calculated wrong transfer rate + fexget: changed default answers to more secure values +2009-03-24 fexsend: new option -l for listing sent files + fup: support for listing sent files + fex.pp: default charset is now UTF-8 in HTTP reply +2009-03-16 fur: fixed bug no lower case transformation for user and domain +2009-03-05 fop: fixed bug no parallel download possible on multiple recipients +2009-03-03 dop: send Last-Modified HTTP header (java needs it) +2009-02-27 fuc: send information emails to sub-users by click-on-address +2009-02-22 fop: fixed bug download failed without FROM parameter +2009-02-20 test for /usr/lib/sendmail and /usr/sbin/sendmail +2009-02-18 fop: fixed bug file size query for alias recipient + fexget: added option -a to get address-book from server +2009-02-17 fup,fuc: better linking +2009-02-14 fup: first send notification emails, then send HTTP 200 OK to client + fup: accept ADDRESS_BOOK as upload +2009-02-13 fup,foc,fuc: added ADDRESS_BOOK support + added fix and FIX.jar (Java applet client) +2009-02-11 fop: fixed bug file size request with multiple $to gives always 0 + (no upload resume possible with multiple recipients) + fop: check for valid recipient address (in file path) + ==> early abort possible when client uses illegal address for + upload (resume-HEAD-request) +2009-02-10 fur: catch errors from sendmail(clone) and save them to $log +2009-02-09 fexsrv: fixed bug wrong log sequence in debug files +2009-02-04 fup: fixed bug cannot delete files by web interface +2009-02-03 fexsrv: fixed bug wrong download URL by HTTP_HOST from client request +2009-01-31 fexsrv: fixed bug handling of missing trailing / in doc requests +2009-01-30 rup: fixed bug wrong download URL in notification email +2009-01-26 fexsend: archive format 7z and zip with default compression + fup,fuc,foc,rup: link to F*EX start page in top header +2009-01-21 fuc: URL for subusers with KEY parameter + fup.fuc,foc: fixed bug wrong AKEY lookup +2009-01-20 fexsrv: better handling of URLs with trailing / (==> index.html) + fop: fixed bug endless loop with fop_auth mode +2009-01-13 fup,fop: support for MIME-file types + fexsend: added option -M for MIME-file to be displayed in webbrowser + on download +2009-01-04 fup: increase minimum timeout to 10 s +2008-12-26 fup: do not allow re-upload (overwrite) if file is in download + process +2008-12-23 sexsend,sexget: added HTTPS/SSL support +2008-12-21 fup: fixed bug removing old autodelete and error files failed +2008-12-20 added logwatch +2008-12-18 fexget: fixed bug responsiveness on slow links + fexget: fixed bug save file name for archives +2008-12-12 fexget: better responsiveness on slow links (modem, ISDN) + fup: added warning for incompatible clients (konqueror, etc) +2008-12-11 fexsend: allow comments in ID file +2008-12-03 fup,fex.pp: fixed bug UTF-8 subject in notfication email +2008-12-02 fexsend: better responsiveness on slow links (modem, ISDN) + fop: send UTF-8 filename in HTTP header Content-Disposition + fexget: save original filename (parse HTTP header) +2008-11-28 fexserv: added special FlashGet (download sucker) brake + html error messages now with HTTP_HOST und server-time info +2008-11-27 added htdocs/version and htdocs/tools.html + added fexsend, fexget, sexsend, sexget to htdocs/download + dop: fixed bug symlink of symlink leads to hangup + fop: teergrub download managers and other suckers +2008-11-26 fop: with URL parameter ?KEEP file can be downloaded more than once + fexget: added option -k for keep on server +2008-11-24 fex_cleanup: fixed bug $autodelete not defined + fexget: added HTTPS/SSL support +2008-11-22 fexsrv: reject requests with IP hostnames in HTTP Host header +2008-11-21 fex.ph,fop: $autodelete="DELAY" allows file download many times + (but only from same IP and until next fex_cleanup run) + fup,fop: fixed bug options keep and delete autodelay do not + work with spool on NFS +2008-11-20 fexsend: added HTTPS/SSL support + fex.ph: added config variable $autodelete + fup: fixed bug subuser cannot send files +2008-11-19 use md5-hash of $from:$id instead of URL parameters FROM=$from&ID=$id + fac: set correct exit status +2008-11-16 fup: fixed bug DELETE not working + install: do not overwrite lib/fup.pl (perhaps contains site config) +2008-11-15 fex_cleanup: clean up $SPOOL/.ukeys/, too +2008-11-14 fup: show "user config" link only after authorization +2008-11-13 foc,fuc,fup: quick sub-user creation with auto-notification. +2008-11-10 fexget: fixed bug query <> instead of +2008-10-29 fup: do not require HTTP authorization if request already + contains ID (methode used by xx) +2008-10-28 fex.pp: fixed bug $warning not defined + fup: fixed bug do not allow subuser in fop_auth mode +2008-10-27 install: do not overwrite existing htdoc/index.html + fup: fixed bug resend (SEEK) leads to HTTP error 666 +2008-10-26 fexsrv: accept HTTP request with absolute URLs (http://...), too +2008-10-23 fexsrv: fixed bug continue connect logfile entry +2008-10-17 fexsrv: fixed bug keep_alive with HTTP/1.0 + fexsrv: fixed bug wrong warning in debug mode with empty line +2008-10-07 fexsrv: moved TIMEOUT message to debug.log +2008-10-06 dop: fixed bug opening file (did not deliver any file!) + dop: implemented HTTP keep-alive (delivering more than one + document per session) +2008-10-04 if config variable $fop_auth is set, download requires + authentication and upload is restricted to registered users +2008-10-02 dop: declare exectuable scripts as application/octet-stream + fup: added link to Windows client schwuppdiwupp.exe +2008-09-29 write upload speed to upload directory +2008-09-17 fac: fixed bug locating FEXLIB +2008-09-12 fup: added config lib/fup.pl +2008-09-05 fexsend: added rudimentary windows support +2008-09-03 dop: redirect on relative non-parent symlinks +2008-08-31 added fur (F*EX User (auto-) Registration) +2008-08-25 will die when no hostname is available +2008-08-21 added fexsend to htdocs/download + fup: added ID mail sendback option +2008-08-20 fac: added -l option +2008-08-19 fexsrv: fixed bug SSL handling +2008-08-15 fup,fuc,fexsrv: dynamic protocol detection (HTTP/HTTPS) +2008-08-14 fup: fixed bug login possible with wrong login data (but no upload) +2008-08-13 fup: showstatus terminates immediately when empty file was uploaded + fup: showstatus shows error message on illegal recipient address + or when no file was uploaded + (nececessary for stupid Internet Explorer!) +2008-08-11 splitted debugfiles with time stamp in filename + fex_cleanup: clean up aborted uploads, .ukeys/ and .debug/, too + fexsend,fexget: allow more than one file (with all options) +2008-08-08 fup: eliminate superfluous newlines in logfile on error handling + changed bareword filehandles to indirect filehandles +2008-08-06 fup: decode %NUMBERs in file names from POST +2008-08-02 fexsend: bug fix -A option and argument handling +2008-08-01 fup: regular users can change the recipient in the upload form, + sub users can not +2008-07-31 fup: fixed bug internet explorer not showing upload status window + fup: fixed bug with id / special id / real id mixup + fuc: nearly complete rewrite, better user interface +2008-07-30 fup: fixed bug when account is a symlink + fup: fixed bug in authentication of subusers +2008-07-03 fop: workaround for Internet Explorer download bug +2008-07-02 fup,fop: switched default charset from ISO-8859-1 to UTF-8 + fup: uid for showstatus synchronization +2008-06-21 fexget: downloading without wget, file number as argument +2008-06-20 fexget,fop: added DELETE option + fexsend: send more files in one run +2008-05-30 added missing sex to distribution + fexsend: added -A archiv to yourself option +2008-05-28 fup: fixed bug in LIST and DELETE commands +2008-05-27 fexsrv: correct HTTP redirect on missing trailing / in URL +2008-05-26 sex,sexsend: better public mode +2008-05-24 sex,sexsend: added text mode option +2008-05-23 added missing foc and rup to distribution +2008-05-20 fexsend: fixed bug in list parsing (-l option) + dop: fixed bug in file type determining on symbolic links +2008-05-15 fexsrv,dop: fixed bug in HTTP keep_alive multi-requests +2008-05-02 fexsrv,dop: support for HTTP keep_alive multi-requests + fexsrv: more robust header parsing (ignore superfluous spaces) +2008-04-28 added support for HTTP keep_alive + fexsrv: added SID (session ID) support + fexsend: encrypt ID with MD5 and SID +2008-04-20 added foc and rup + fop: return apropriate error message when file has been (auto)deleted + or is expired; error message is kept 3*keep_default days +2008-04-19 install: do not overwrite old fex.ph, but create fex.ph_new instead +2008-04-18 fup: fixed bug filename with path in notification email +2008-04-16 fexsrv,fop,dop: implemented HTTP HEAD +2008-04-14 renamed cgilaunch to fexsrv + fup: do not send notify-mail if file already exists (overwrite mode) + fup: do not accept file if authentication fails + fup,fop,fexsend: new secure download URL scheme with random dkey +2008-04-11 fup: fixed bug in upload bar with 8-bit file names + fex_cleanup: fixed bug not removing aborted uploads +2008-04-10 added F*EX camel logo +2008-04-09 added dop (generic document output) + install: better infos +2008-04-08 renamed confusing ID to auth-ID (request by chris@citecs.de) + fuc: fixed bug with more than 1 sub-user +2008-04-07 fup: readded keep parameter (code got lost sometime?) + fup: added sender restriction (ALLOWED_RECIPIENTS) + fac: added restriction option -r and delete user option -d +2008-04-06 fup: use Net::DNS instead of external host command + fup: more debuglog, fixed wrong error messages + added doc/concept doc/FAQ +2008-04-02 install: better error handling (patch by chris@citecs.de) + more docs and improved logging +2008-04-01 cgilaunch: fixed bug in determing REMOTE_HOST when using stunnel + fexget: added -s streaming option + sex,sexsend: added public mode +2008-03-31 changed project name to F*EX because of name collision with + http://freshmeat.net/projects/fex/ + added sex, sexsend and sexget to distribution +2008-03-28 xx: changed syntax, now compatible to zz + added zz to distribution +2008-03-27 fup: fixed bug in mail address verification +2008-03-24 fup,fexsend: show transfer rate in kB if filesize < 2 MB + fup: code-cleanup, more comments + fex.pp: umask 077 +2008-03-23 fup: fixed bug in using multiple recipients +2008-03-22 first public release +2006-11-?? first code diff --git a/doc/Contribs b/doc/Contribs new file mode 100644 index 0000000..9dc8d78 --- /dev/null +++ b/doc/Contribs @@ -0,0 +1,62 @@ +Beate Herrmann : + - artwork + +Sebastian Zaiser : + - upload status window + +Bernd Strehhuber : + - dynamic protocol detection + +Kurt Jaeger : + - ipv6 support + +Andre Hafner : + - web admin interface fac + - VM + +Martin Lauer : + - FAQ Javascript Code + +Dominik Greibl : + - java client F*IX + +Sebastian Roth : + - many bugfixes and extensions (zip, proxy-support, etc) for F*IX + +Daniel Dieckmann + - fexget proxy support + +Kilian Krause + - Debian package maintainer + - SSL security enhancements + - annoying, but useful requests ;-) + +Hanno Hirsch : + - bug hunting + +Nicola Fioravanti (http://revshell.com): + - Penetration tests and security debugging + +Waldemar Bronsch : + - German localization + +Tobias Gunkel : + - German localization + +Hans-Georg Bickel : + - Swabian localization + +Francisco Ruiz : + - Spanish localization + +Anton Meixome : + - Galician localization + +Vanni Piagno : + - Italian localization + +Michal Simunek : + - Czech localization + +Jean-Baptiste Denis : + - French localization diff --git a/doc/IPv6 b/doc/IPv6 new file mode 100644 index 0000000..3861b17 --- /dev/null +++ b/doc/IPv6 @@ -0,0 +1,17 @@ +To enable IPv6 on the server you need: + + - The Perl module Socket6 + You can install it on Debian or Ubuntu with: + apt-get install libsocket6-perl + + - Add to /etc/xinetd.d/fex the line: + flags = IPv6 + and remove the "bind" option line. + Restart xinetd. + + +To enable IPv6 for fexsend, fexget and sexsend you need: + + - The Perl module Net::INET6Glue::INET_is_INET6 + You can install it on Debian or Ubuntu with: + apt-get install libnet-inet6glue-perl diff --git a/doc/Licence b/doc/Licence new file mode 100644 index 0000000..4108934 --- /dev/null +++ b/doc/Licence @@ -0,0 +1,120 @@ +F*EX (Frams' Fast File EXchange) is a service to send big (large, huge, +giant, ...) files from a user A to a user B via internet. + +Copyright (C) 2006-2014 Ullrich Horlacher + +YOU ARE NOT ALLOWED TO USE THIS SOFTWARE FOR MILITARY PURPOSES OR WITHIN +MILITARY ORGANIZATIONS! THIS INCLUDES ALSO MILITARY RESEARCH AND +EDUCATION, PARAMILITARY AND TERRORISTIC ORGANIZATIONS! + +This program is free software: you can redistribute it and/or modify it +under the terms of the Perl Artistic Licence: + +"Package" refers to the collection of files distributed by the Copyright +Holder, and derivatives of that collection of files created through +textual modification. + +"Standard Version" refers to such a Package if it has not been modified, +or has been modified in accordance with the wishes of the Copyright Holder +as specified below. + +"Copyright Holder" is whoever is named in the copyright or copyrights for +the package. + +"You" is you, if you're thinking about copying or distributing this +Package. + +"Reasonable copying fee" is whatever you can justify on the basis of media +cost, duplication charges, time of people involved, and so on. (You will +not be required to justify it to the Copyright Holder, but only to the +computing community at large as a market that must bear the fee.) + +"Freely Available" means that no fee is charged for the item itself, +though there may be fees involved in handling the item. It also means that +recipients of the item may redistribute it under the same conditions they +received it. + +1. You may make and give away verbatim copies of the source form of the + Standard Version of this Package without restriction, provided that you + duplicate all of the original copyright notices and associated + disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications + derived from the Public Domain or from the Copyright Holder. A Package + modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided + that you insert a prominent notice in each changed file stating how and + when you changed that file, and provided that you do at least ONE of + the following: + +a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site + such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + +b) use the modified Package only within your corporation or organization. + +c) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or + executable form, provided that you do at least ONE of the following: + +a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + +b) accompany the distribution with the machine-readable source of the + Package with your modifications. + +c) give non-standard executables non-standard names, and clearly document + the differences in manual pages (or equivalent), together with + instructions on where to get the Standard Version. + +d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this + Package. You may charge any fee you choose for support of this Package. + You may not charge a fee for this Package itself. However, you may + distribute this Package in aggregate with other (possibly commercial) + programs as part of a larger (possibly commercial) software + distribution provided that you do not advertise this Package as a + product of your own. You may embed this Package's interpreter within an + executable of yours (by linking); this shall be construed as a mere + form of aggregation, provided that the complete Standard Version of the + interpreter is so embedded. + +6. The scripts and library files supplied as input to or produced as + output from the programs of this Package do not automatically fall + under the copyright of this Package, but belong to whoever generated + them, and may be sold commercially, and may be aggregated with this + Package. If such scripts or library files are aggregated with this + Package via the so-called "undump" or "unexec" methods of producing a + binary executable image, then distribution of such an image shall + neither be construed as a distribution of this Package nor shall it + fall under the restrictions of Paragraphs 3 and 4, provided that you do + not represent such an executable image as a Standard Version of this + Package. + +7. C subroutines (or comparably compiled subroutines in other languages) + supplied by you and linked into this Package in order to emulate + subroutines and variables of the language defined by this Package shall + not be considered part of this Package, but are the equivalent of input + as in Paragraph 6, provided these subroutines do not change the + language in any way that would cause it to fail the regression tests + for the language. + +8. Aggregation of this Package with a commercial distribution is always + permitted provided that the use of this Package is embedded; that is, + when no overt attempt is made to make this Package's interfaces visible + to the end user of the commercial distribution. Such use shall not be + construed as a distribution of this Package. + +9. The name of the Copyright Holder may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/doc/SEX b/doc/SEX new file mode 100644 index 0000000..b7a4a7d --- /dev/null +++ b/doc/SEX @@ -0,0 +1,119 @@ +SEX is a F*EX companion: Stream EXchange + +You can imagine SEX as network wide UNIX pipes with a relay between. This +can be usefull for piping data from A to B where A and B cannot establish +a direct connection, but both can connect by HTTP to the SEX-server. SEX +is a synchronous service in conjuction to F*EX which is asynchronous. + +For seamless integration into the UNIX tool chain, there are the +shell-tools sexsend and sexget. + +Using web browsers for sexing will not work, because they cannot handle +streams in a pipe. So far, there are only the UNIX clients. Feel free to +implement other clients for other operating systems :-) + +Authentication is the same as with F*EX. + +Example: + +root@lanldap:/var/log: tail -f syslog | sexsend framstag@rus.uni-stuttgart.de + +framstag@blubb:/tmp: sexget | grep ldap + + +If you need encryption, then use the standard UNIX toolbox and add a +appropriate program to the pipe, for example: openssl bf + + +Tips for using SEX for file exchange: + +I have a lot of (administrative) accounts on even more hosts, where I have +to exchange a lot or big files. These hosts often cannot make direct +tcp-connects to each other, because of IP-filters, firewalls or missing +server software. Only outgoing connections are possible. + +Therefore NFS, ssh or even ftp are no option. + +Since today my solution was F*EX: + +1) on source host send the files within a container to the F*EX-server: + + fexsend -a container.tar file1 file2 ... . + +2) read or copy the FEXURL with mouse + +3) on destination host get container.tar from F*EX-server and extract it: + + fexget FEXURL + tar xvf container.tar + rm container.tar + + +Backdraws: + +- a lot of manually work +- creation of container.tar needs (a lot of) time +- container.tar needs (too much) disk space on source and destination host + and on the F*EX-Server + + +Small solution: + +Usage of xx (wrapper for fexsend) eliminates manually handling of +container.tar. But it will be still created, only automatically. +The ressource problems are still there. + + +The new sexy solution: + +I use SEX (Stream EXchange) instead of FEX (File EXchange)! + +There is no more a temporary container.tar, but the files are transfered +as a stream with the new client sexxx! + +An example (*): + +On the source host: + + root@obertux:~/bin# sexxx . + streaming: + ./ + ./autopatch + ./subsys + ./pwsync + ./cspread + ./fspread + ./spread + ./iptconf + ./esxbackup + ./esxlist + ./getxx + ./rscreen + + +On the destination host: + + framstag@flupp:/tmp: sexxx + extracting from stream: + drwxr-xr-x root/root 0 2010-08-06 12:48 ./ + -rwxr-xr-x framstag/users 170 2010-01-20 13:26 ./autopatch + -rwxr-xr-x root/root 336 2006-02-02 15:15 ./subsys + -rwxr-xr-x root/root 278 2010-01-18 23:38 ./pwsync + lrwxrwxrwx root/root 0 2009-11-03 15:49 ./cspread -> spread + lrwxrwxrwx root/root 0 2009-11-03 15:49 ./fspread -> spread + -rwxr-xr-x root/root 10354 2010-02-12 14:49 ./spread + -rwxr-xr-x root/root 1380 2010-01-14 08:54 ./iptconf + -rwxr-xr-x root/root 116 2010-05-04 18:36 ./esxbackup + -rwxr-xr-x root/root 344 2010-05-06 13:33 ./esxlist + -rwxr-xr-x root/root 93 2010-08-06 12:32 ./getxx + -rwxr-xr-x 1000/users 173 2009-11-26 13:40 ./rscreen + + +Now I can transfer any files from a new installed (VM) server to my +admin workstation behin a firewall. Or the other direction. + + +(*) The example above has only a few kB, but one can use sexxx for many GB + or even TB! + On my VMs I get a throughput of 90 MB/s. + diff --git a/doc/SSL b/doc/SSL new file mode 100644 index 0000000..fccd448 --- /dev/null +++ b/doc/SSL @@ -0,0 +1,61 @@ +# http://www.stunnel.org/faq/certs.html + +# execute this as root! + +mkdir /home/fex/etc +cd /home/fex/etc/ + +openssl req -new -x509 -days 9999 -nodes -out stunnel.pem -keyout stunnel.pem +# see http://www.infodrom.org/Debian/tips/stunnel.html +dd if=/dev/urandom count=2 | openssl dhparam -rand - 1024 >> stunnel.pem +openssl x509 -text -in stunnel.pem +chmod 600 stunnel.pem + +cat <stunnel.conf +cert = /home/fex/etc/stunnel.pem +sslVersion = all +TIMEOUTclose = 1 +exec = perl +execargs = perl -T /home/fex/bin/fexsrv stunnel +EOD + +case $(lsb_release -a 2>/dev/null) in + *CentOS*) echo 'fips = no' >>stunnel.conf;; +esac + +chown -R fex . + +stunnel=$(which stunnel4) +if [ -z "$stunnel" ]; then + echo "no stunnel found" >&2 +else + + cat </etc/xinetd.d/fexs +# default: on +# description: fex web server with SSL +# note: only possible on port 443! +service fexs +{ + socket_type = stream + wait = no + type = unlisted + protocol = tcp + port = 443 + cps = 5 10 + user = fex + groups = yes + server = $stunnel + server_args = /home/fex/etc/stunnel.conf + nice = 0 + disable = no +} +EOD + + /etc/init.d/xinetd restart + echo 'To enforce https, add to fex.ph:' + echo '$force_https = 1;' + +fi + +# Hint: on some systems stunnel works not well with xinetd +# you can also run stunnel without xinetd, in server daemon mode diff --git a/doc/concept b/doc/concept new file mode 100644 index 0000000..ead5387 --- /dev/null +++ b/doc/concept @@ -0,0 +1,697 @@ +F*EX (Frams' Fast File EXchange) is a service to send big (large, huge, giant, +...) files from a user A to a user B, anywhere on the internet. + +The sender uploads the file to the F*EX-server and the recipient automatically +gets a notification email with a download-URL. + +Main features of F*EX + + * file transfer of virtually unlimited file size + * recipient and sender only need an email program and a web browser - of any + kind, they do not have to install any software + * RESEND and REGET for resuming after link failures at last sent byte + * auto-notification of recipient + * auto-deletion after download + * auto-deletion after expiration date (default: 5 days) + * full-users can create one time upload URLs for foreign users + * full-users can create subusers, who can send only to this full-user + * full-users can create groups, an analogy to mailing lists, but for files + * self registration possible for internal and external users + * maintenance-free: no admin interaction necessary + * sending to multiple recipients needs storage on the server only once + * quotas for sending and receiving + * F*EX is a HTTP web-service and needs no firewall-tunnels + * support for (personal or public) streams, too (SEX : Stream EXchange) + * for real UNIX users, there are the shell programs fexsend and fexget to + avoid annoying web browser usage and for full scripting support + * adminstration by CLI or Web + * about 10 times faster than apache + * authentification modules for LDAP, RADIUS, POP, mailman + * server based user address books + * (reverse) proxy support + * "public upload" similar to "anonymous ftp" possible + * "anonymous upload" without registration for enabled IP addresses possible + * localization for many languages + * authentification by local user database, RADIUS, LDAP, mailman or POP + * user and admin can throttle bandwith usage + * admin can restrict access based on email or IP addresses + * server available for UNIX and Windows hosts + * protocol and source-code free available + +The end user normally uses F*EX with his web browser and the URLs +http://YOURFEXSERVER/fup (file upload) and http://YOURFEXSERVER/fop (file +download). + + +F*EX is not an anonymous service (exception: "public upload" and +"anonymous upload", see later). +The admin must register the user with his email address and auth-ID +string (low security password). This task can be done either with the CLI +program "fac" (F*EX admin control) or http://YOURFEXSERVER/fac + +Alternativly the users can register theirselves with http://YOURFEXSERVER/fur +(F*EX user registration), if the admin allows them to do so. This is done by +setting the variables @local_domains and @local_hosts in FEXHOME/lib/fex.ph +Example: + + @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255); + @local_domains = qw(rus.uni-stuttgart.de flupp.org); + +You can also use wildcard "*" in a domain, for example: + + @local_domains = qw(uni-stuttgart.de *.uni-stuttgart.de); + +Then all subdomains are allowed. + + +In addition the administrator can allow external users to fex (only) to +internal users. The F*EX functioning scheme is close related to email +where any external user can send email to an internal user. This is also +possible with F*EX. These users are then called "restricted users". The +administrator has to define via configuration variable @local_rdomains +the local recipient domains. For example: + +@local_rdomains = qw(YOURDOMAIN *.YOURDOMAIN OTHERDOMAIN); + + +F*EX full users can create one time upload URLs with +http://YOURFEXSERVER/fuc + +With such a URL a foreign user can send this F*EX full user a single file. + +F*EX full users can theirselves register "subusers" with +http://YOURFEXSERVER/fuc + +Subusers can only fex to their full-user, not to any others, and they +cannot create other subusers. + + +F*EX full users also can create groups, an analogy to mailing lists, but +for files: every member of a group can send files to the group address. + + +The administrator can set with fac the CAPTIVE flag for a full user. Then +he cannot change anymore his default settings (KEEP, AUTODELETE, etc) + + +The F*EX user is the same as the "sender" in the fup CGI and the "from" +parameter in the F*EX URL. + +The (confusing) naming scheme is historically based :-) + + +The recipient (normally) does not need any registration. He authenticates +himself with his unique download-URL which he gets in the notification +email. + + +You do not need to build F*EX URLs manually, they are generated by the +F*EX programs. + + +A F*EX session is based on unique URL parameters or POST variables (FROM, +TO, ID, etc). For security reasons the URL parameters FROM and ID become a +MD5-hashed access key link (AKEY for regular users, SKEY for subusers, +GKEY for groupusers), generated by the CGIs, to prevent that a third +person could easily read these parameters from the user webbrowser URL +address field. AKEY and SKEY are used as optional cookies, too, for +extending the session life. + +A SKEY is made of md5_hex("$mainuser:$subuser:$subuserid") +A GKEY is made of md5_hex("$mainuser:$groupname:$groupuser:$groupuserid") + +Note: the AKEY, SKEY and GKEY always can be stolen by a network sniffer! +If you need true security, then you have to use https (SSL) instead of +http! + +After download the file will be deleted after a grace time of 1 minute. +This grace time allows a recipient to get the file again if he had +problems in saving it. + +With the fexsend client the sender can change this behavior: + +option -D means "delay autodelete": do not delete the the file directly +after download, but with the nightly fex_cleanup cronjob. More downloads +are possible only from the same client (identified by cookie or ip +address). + +option -K means "keep file": do not delete the file after download, but +only after expiration date (normally 5 days). More downloads are possible +only from the same client (identified by cookie or ip address). + + +If you fex a file to yourself (sender = recipient), then the resulting +download link is valid for any client and can be downloaded everywhere +and more than once (until expiration date). + +If you want "delay autodelete" to be the default behaviour for all users +and each transfer then set + $autodelete = 'DELAY'; # or 'NO' for no autodelete +in FEXHOME/lib/fex.ph + +In addition, you can add to the "Recipient(s)" field of the fup CGI: +":autodelete=delay" or ":autodelete=no" or ":keep=x" (where x is the number +of days). Example: +Recipient(s): framstag@rus.uni-stuttgart.de:keep=10 + +These options are also possible in the server address book (see CGI fuc). + +If you need more security, then set in fex.ph: +$fop_auth = 'yes'; +$force_https = 'yes'; + +With $fop_auth upload is restricted to registered users and download +requires (HTTP) authorization. The credentials are the F*EX user email +and auth-ID. +See extra documentation SSL for using https. + +If you want to have encrypted emails, then you need a GPG public key for +the user fex. Create it with "gpg --gen-key" (use fex@YOURFEXSERVER as the +user or the $bcc address from fex.ph if you have set it, see below). Next, +the user has to upload his public key via webinterface "user config & +operation control" and "Manage e-mail encryption". + +"Public upload" is a feature similar to anonymous ftp: the sender does not +to be registered, but may send only to predefined recipients via +http://YOURFEXSERVER/pup + +The administrator has to define via configuration variable +@public_recipients the email addresses for which anyone can upload files +without registration (auth-ID is not necessary). For example: + +@public_recipients = qw(fexmaster@YOURDOMAIN bunny@OTHERDOMAIN); + +With "anonymous upload" one can use F*EX without registration or +authentication. The administrator has to define via configuration variable +@anonymous_upload for which IP addresses this feature is available. + +The administrator can globally forbid certain recipient address via fex.ph +configuration (example): + +@forbidden_recipients = qw(nobody@* *@microsoft.com); + +The administrator can also forbid a user to fex to any recipient address, +but the allowed ones with: fac -r USER + + +By standard installation the base directory FEXHOME is the same as the +login HOME of user fex, but you can move it if you want. FEXHOME is +determined by the full path of fexsrv as configured in +/etc/xinetd.d/fex . Change this when you move FEXHOME! + +You can also add (name based) virtual hosts with fac. + +Do not give write permission to any other user to any file in FEXHOME or +below! + + +FEXHOME contains: + + spool/ spool directory and user data + htdocs/ directory for generic download files + bin/ directory for programs + cgi-bin/ directory for CGI programs + lib/ directory for library and config files + doc/ additional documentation + locale/ alternative language installation + + +Files in spool: + + cleanup.log log of daily cleanup cronjob + dkey.log log of download keys + dop.log log of HTTP document output + error.log log of errors + fexsrv.log log of all HTTP requests + fop.log log of file downloads + fup.log log of file uploads + fur.log log of user self registrations + sex.log log of stream exchanges + $user/@ regular user auth-ID + $user/@SUBUSER subuser addresses and IDs + $user/@ALLOWED_RECIPIENTS recipients restrictions for this user + $user/@ALLOWED_RHOSTS recipient's hosts restrictions + $user/@UPLOAD_HOSTS upload hosts restrictions + $user/@DOWNLOAD_HOSTS download hosts restrictions + $user/@ADDRESS_BOOK users recipient address book + $user/@GROUP directory of F*EX user groups + $user/@OKEY directory with one time upload keys + $user/@QUOTA sender and recipient quotas + $user/@AUTODELETE autodelete default + $user/@KEEP keep default + $user/@LOCALE locale default + $user/@CAPTIVE user must not change his settings + $user/@FEXYOURSELF user can only fex to himself via + web interface + $to/$from/$file/upload file data in upload progress + $to/$from/$file/filename original file name + $to/$from/$file/size original file size + $to/$from/$file/useragent HTTP header User-Agent + $to/$from/$file/data file data after complete upload + $to/$from/$file/keep keep time (autoexpire) in days + $to/$from/$file/autodelete autodelete option: YES NO or DELAY + $to/$from/$file/comment comment in notification email + $to/$from/$file/id file ID (optional) + $to/$from/$file/ip sender ip address + $to/$from/$file/notify reminder notify flag + $to/$from/$file/error error message if file has gone + $to/$from/$file/download log of successful downloads + $to/$from/$file/restrictions IP based download restrictions + (see $user/@ALLOWED_RHOSTS) + $to/$from/$file/dkey download key + $to/$from/$file/locale locale + +As you see, the first directory sometimes means sender and sometimes means +recipient! It depends on the case of usage (up/download). + +BEWARE: for the special senders fexmail and anonymous $to and $from are +swapped (by fup and fop)! This is to prevent overcrowding of the toplevel +spool directory with _fexmail_$RANDOM and _anonymous_$RANDOM recipients. + + +A registered full F*EX user is identified by the file $spooldir/$from/@ +Only if this file contains his auth-ID this user is able to send files to +others. Otherwise he is just an unpriviledged recipient. + +You can customize the upload CGI fup by editing FEXHOME/lib/fup.pl + +Additional directories in spool: + + .dkeys/ download keys lookup directory + .ukeys/ upload keys lookup directory + .akeys/ authentication keys lookup directory + .skeys/ subuser keys lookup directory + .gkeys/ groupuser keys lookup directory + .xkeys/ extra download keys lookup directory + .debug/ directory for debug output (optional) + .reg/ temporary data for user selfregistration + +The upload keys (UKEY) are necessary to synchronize the file upload by +HTTP POST with the javascript upload status bar which is an asynchronous +HTTP GET. The GET process needs to know the corresponding POST process. +This is done via UKEY, a unique upload identifier. + +The download key (DKEY) is a unique identifier for - guess what - +downloading. It also prevents an attacker to get the file, because only +the recipient knows the DKEY as part of the download URL from the +notification email. + +XKEY is an optional extra download key to have a short download URL in +shape http://YOURFEXSERVER//XKEY +The XKEY always starts with // and is provided as a COMMENT by the client. +Example: fexsend schwuppdiwupp.jpg // +The user has to realize that such URLs have very low security. + +If you need to trace a F*EX request, then set + $debug = 1; +in fex.ph and look in ~/spool/.debug/ for the correspondening files. + +The user fex also gets a Bcc of all sent notification emails. This is a +help for debugging purposes. If you want these Bcc mails to another +address then set in fex.ph: + + $bcc = 'other@address'; + +The sender also get a Bcc if he put the string "!bcc!" in the comment +field. + +If you have users within another domain with its own MTA and those users +want to fex each other, then their MTA probably will reject the +notification email. To prevent this problem you can set in fex.ph +@remote_domains = qw(other_domain1 other_domain2 ...); +In this case "From: $admin" will be used in the notification emails. + +F*EX comes with its own web server: fexsrv +Standard web servers like apache have been proven problematic, either in +speed or because of a 2-GB-limit. + +It is not possible to use the F*EX CGIs with an alternative web server, +because the F*EX CGIs need special fexsrv features. + +xinetd starts fexsrv for every new connection, which then executes the +CGIs fup (file upload), fop (file output), fuc (fex user control), foc +(fex operation control), fac (fex admin control), fur (fex user +registration) and sex (stream exchange). + + +SEX has the opposite authorization model of FEX: The sender does not +need any registration. He can send a stream to any registered SEX user, +who must identify himself with his auth-ID. This is because a stream does +not cost resources when it is not bound to a recipient. It will block +otherwise. The client programs for sexing are sexsend and sexget. You can +call them also fuckyou and fuckme :-) + + +With the F*EX client fexsend you can have a streaming file transfer with +spooling: on client side there is no temporary buffer file (archive), but +the data is sent directly to the F*EX server. This saves time and disk +space on the client. + +Example for a streaming archive upload: + + fexsend -a music+video.tar *mp3 *avi webmaster@flupp.org + +Example for a streaming data upload: + + fpg fex /var/log/* | fexsend -s logs fexmaster@flupp.org + +The data streaming is implemented via a HTTP extension: the header +Content-Length is given -1 which means: unknown length, read until EOF. + +For streaming receiving you can use "fexget -s-" or "wget -O-". + + +fexsrv also can do generic document output (via dop) like a normal web +server. For this, your files must be under FEXHOME/htdocs and they must +not have the same name as the CGIs under FEXHOME/cgi-bin, because the CGIs +have priority. + +For security reasons, documents to be delivered by dop: +- the file must be readable by group or world +- the file must be in FEXHOME/htdocs or a directory specified by @doc_dirs +- the filename must not start with a "." +- the filename must not contain a "@" +- the filename must not end with "~" + +To enable HTTP basic authentication, write your access token to a file +named .htauth which will protect all files in this directory. An user will +be prompted for this password by his web browser. + +To restrict the access to specific client IP addresses, put these IPs into +a file named .htaccessfrom which will protect all files below this +directory. You can name single IPs, also as IP ranges (example: +129.69.0.0-129.69.255.255) + +dop is not a regular CGI program (like fup or fop), but a sub-program of +fexsrv. + +*.html files may contain $VARIABLES$ which will be substituted with the +value of the corresponding environment variable. See example +$SERVER_ADMIN$ in FEXHOME/htdocs/index.html + +*.html files may contain <> (even multiline) which will be +evaluated. See example FEXHOME/htdocs/dynamic.html +This perl-code must not contain '>>' strings itself! +Pay attention: do not place security relevant data inside << >> because it +will be delivered to the client if the URL ends with '!'! See example: +http://fex.rus.uni-stuttgart.de/index.html +http://fex.rus.uni-stuttgart.de/index.html! + +If you want to hide your code, then you have to write a CGI script and +place it into the cgi-bin directory. Files there will never be delivered +by dop. You also can do "chmod o-r file.html" to prevent source code +delivery. + +*.html files may contain conditional blocks: + +#if (perl-expression) + HTML... +#elseif (perl-expression) + HTML... +#else + HTML... +#endif + +which will be evaluated at run-time (#else and #elseif are optional). + +*.html files may contain: +#include "FILE" +which means: load FILE from current directory at this place in code. + +dop also can display a directory listing if this directory contains a file +named .htindex +To restrict the listing to specific files, put a matching regular +expression into .htindex +Example: echo 'pdf$' > /home/fex/htdocs/doc/.htindex + +dop can output gzipped files on-the-fly as a streaming document. For +example: you have /fex/home/htdocs/big.file but a client requests +http://YOURFEXSERVER/big.file.gz then a corresponding big.file.gz will be +delivered. + +dop can also output tar, tgz or zip archives on-the-fly as a streaming +document. Just create a symbolic link with files (or directories) you want +in this archive and enclose them with ":". The symlink name must end with +".stream". Example: + +http://fex.rus.uni-stuttgart.de:8080/download/sex.tar + +fex@fex:~/htdocs/download: ls -l sex* +lrwxrwxrwx 1 fex fex 7 2011-01-26 11:46 sexget -> sexsend +-rwxr-xr-x 1 fex fex 12110 2012-08-22 09:55 sexsend +lrwxrwxrwx 1 fex fex 22 2012-09-01 12:13 sex.stream -> :sexsend:sexget:sexxx: +lrwxrwxrwx 1 fex fex 7 2012-09-01 11:28 sexxx -> sexsend + +It is also possible to create this stream file as a regular file. Then the +content must be the file names you want in the streaming archive. + +Note: you may only use relative paths and without "../" elements. + +Note: Files beginning with a . or ending with ~ will not be included in +the download stream. + +cronjob fex_cleanup is run once a day and deletes expired uploads, removes +inactive accounts and does some other spool houskeeping. See: crontab -l + +To detect inactive users you can put in fex.ph: +$account_expire = "365:notify"; + +This sends an email to $admin when an user is inactive for 365 days. + +Or to delete inactive users you can put in fex.ph: +$account_expire = "365:delete"; + +This deletes user accounts automatically which have been inactive for 365 +days. + +Of course you can use any number of days. + +Inactive users will get an account reactivation request before. + +The address book may contain the optional parameters autodelete and +keep. Address book example entry: + +flupp framstag@flupp.org keep=99 autodelete=no + +BUT: these address book parameters are only accepted when using the +fexsend or schwuppdiwupp client! They will be ignored when using a +webbrowser! + +Nevertheless you may add autodelete and keep parameters using a +webbrowser, but then they are valid for ALL addresses in the "Recipient" +field! + +The clients fexsend and schwuppdiwupp can MD5-encrypt the auth-ID together +with a session-ID. The session-ID itself is provided by the server after +an initial "GET SID" HTTP request. This is not possible through a proxy, +because most proxies do not support persistant tcp sessions. + +See fex-client_2.pdf for the F*EX protocol specification. + +To understand and trace the F*EX protocol you can use fexsend with the -v +option. + +Example (--> means send to server, <-- means receive from server): + +framstag@fex:~: fexsend -v X.png framstag@flupp.org +ID data from /home/framstag/.fex/id: http://fex.rus.uni-stuttgart.de framstag@rus.uni-stuttgart.de XXXX +Server/User: http://fex.rus.uni-stuttgart.de/framstag@rus.uni-stuttgart.de +TCPCONNECT to fex.rus.uni-stuttgart.de +--> GET SID HTTP/1.1 +--> +<-- HTTP/1.1 201 8p2Y2qa2 +<-- X-Features: SID,CHECKRECIPIENT,GROUPS,QUOTA,FILEID,MULTIPOST,XKEY +<-- X-SID: 8p2Y2qa2 +<-- X-Timeout: 30 +<-- Content-Length: 0 +<-- +--> HEAD /fop/framstag@flupp.org/framstag@fex.rus.uni-stuttgart.de/X.png??ID=MD5H:226e896d0adab86892957aa8158b37ba HTTP/1.1 +--> +<-- HTTP/1.1 200 OK +<-- Content-Length: 0 +<-- X-Size: 0 +<-- X-Features: SID,CHECKRECIPIENT,GROUPS,QUOTA,FILEID,MULTIPOST,XKEY +<-- +--> POST /fup HTTP/1.1 +--> Host: fex.rus.uni-stuttgart.de +--> User-Agent: fexsend (Ubuntu 8.04.4 LTS) +--> Content-Length: 149935162 +--> Content-Type: multipart/form-data; boundary=JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> Content-Disposition: form-data; name="FROM" +--> +--> framstag@fex.rus.uni-stuttgart.de +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> Content-Disposition: form-data; name="TO" +--> +--> framstag@flupp.org +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> Content-Disposition: form-data; name="ID" +--> +--> MD5H:226e896d0adab86892957aa8158b37ba +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> Content-Disposition: form-data; name="FILESIZE" +--> +--> 149934400 +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs +--> Content-Disposition: form-data; name="FILE"; filename="X.png" +--> Content-Type: application/octet-stream +--> Content-Length: 149934400 +--> X-File-ID: 1283077463 +--> +--> (file content) +--> --JhUOtQ3sgV5ZcHJzrTny523nBFqgUNvSAOUHoRMTdZfGpAjs-- +<-- Location: http://fex.rus.uni-stuttgart.de/fop/CoVhikzk/X.png +<-- X-Recipient: framstag@flupp.org (autodelete=YES,keep=5) +<-- + +Comment on the HEAD request above: +The client fexsend sends it to request whether the file has been sent +before and if it was successful or not. On the later case, the server +would reply how many bytes has already been received and the client then +can send only the missing part. Normally the answer to the HEAD request is +0 (see above), which means: nothing of this file has been received so far. + +But this is only half of the truth :-) +I have omitted in the example above the requests CHECKRECIPIENT and +GET ADDRESS_BOOK, to keep it simple in the first run. +CHECKRECIPIENT is a HTTP POST request to check whether the recpient's +email address is valid to the server. +GET ADDRESS_BOOK is a HTTP GET request to check if the recipient with a +short address (= address without @) is an alias in the senders server +address book. +Please use "fexsend -v" by yourself to see the whole protocol dialoge. + +Many HTTP proxies have a POST limit, which is often at 2 GB, but sometimes +lower. To overcome this limitation a F*EX client (like fexsend) may +include in the POST the HTTP MIME part "filesize" which indicates the full +file size. All incoming file POSTs with this file name will be appended +until the full file size is reached. Of course the client has to POST all +parts of this file, in the correct order, in asking the server how many +bytes has already been received. Example: + +framstag@fex:/tmp: fexsend -vP wwwproxy.uni-stuttgart.de.de:8080:1024 2GB.tmp . +ID data from /home/framstag/.fex/id: http://fex.rus.uni-stuttgart.de:8080 framstag@rus.uni-stuttgart.de xxxxxx +Server/User: http://fex.rus.uni-stuttgart.de:8080/framstag@rus.uni-stuttgart.de +TCPCONNECT to wwwproxy.uni-stuttgart.de.de:8080 +--> HEAD http://fex.rus.uni-stuttgart.de:8080/fop/framstag@rus.uni-stuttgart.de/framstag@rus.uni-stuttgart.de/2GB.tmp??&ID=xxxxxx HTTP/1.1 +--> +<-- HTTP/1.1 200 OK +<-- X-Size: 0 +<-- Content-Length: 0 +<-- Proxy-Connection: Keep-Alive +<-- Connection: Keep-Alive +<-- Date: Tue, 08 Jun 2010 15:04:13 GMT +<-- +TCPCONNECT to wwwproxy.uni-stuttgart.de.de:8080 +--> POST http://fex.rus.uni-stuttgart.de:8080/fup HTTP/1.1 +--> Host: fex.rus.uni-stuttgart.de:8080 +--> User-Agent: fexsend (Ubuntu 8.04.4 LTS) +--> Content-Length: 1073677143 +--> Content-Type: multipart/form-data; boundary=gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="FROM" +--> +--> framstag@rus.uni-stuttgart.de +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="TO" +--> +--> framstag@rus.uni-stuttgart.de +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="ID" +--> +--> xxxxxx +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="COMMENT" +--> +--> NOMAIL +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="FILESIZE" +--> +--> 2147483748 +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK +--> Content-Disposition: form-data; name="FILE"; filename="2GB.tmp" +--> Content-Type: application/octet-stream +--> Content-Length: 1073676288 +--> X-File-ID: 1275549886 +--> +--> (file content) +--> --gqhqeU7FCHMl4ohxJ5knK1y9rF75xYTvabPvZTeWnAhaoDsK-- +2GB.tmp : 1023 MB in 73 s (14363 kB/s), chunk #1 : 1023 MB +<-- HTTP/1.1 206 Partial OK +<-- X-Message: Partial OK +<-- Server: fexsrv +<-- Expires: 0 +<-- Cache-Control: no-cache +<-- Content-Type: text/html; charset=UTF-8 +<-- Connection: close +<-- Date: Tue, 08 Jun 2010 15:05:29 GMT +<-- +TCPCONNECT to wwwproxy.uni-stuttgart.de.de:8080 +--> HEAD http://fex.rus.uni-stuttgart.de:8080/fop/framstag@rus.uni-stuttgart.de/framstag@rus.uni-stuttgart.de/2GB.tmp??&ID=xxxxxx HTTP/1.1 +--> +<-- HTTP/1.1 200 OK +<-- X-Size: 2147483748 +<-- X-File-ID: 1275549886 +<-- Content-Length: 1073676288 +<-- Proxy-Connection: Keep-Alive +<-- Connection: Keep-Alive +<-- Date: Tue, 08 Jun 2010 15:05:29 GMT +<-- +TCPCONNECT to wwwproxy.uni-stuttgart.de.de:8080 +--> POST http://fex.rus.uni-stuttgart.de:8080/fup HTTP/1.1 +--> Host: fex.rus.uni-stuttgart.de:8080 +--> User-Agent: fexsend (Ubuntu 8.04.4 LTS) +--> Content-Length: 1073677254 +--> Content-Type: multipart/form-data; boundary=LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="FROM" +--> +--> framstag@rus.uni-stuttgart.de +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="TO" +--> +--> framstag@rus.uni-stuttgart.de +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="ID" +--> +--> xxxxxx +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="COMMENT" +--> +--> NOMAIL +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="SEEK" +--> +--> 1073676288 +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="FILESIZE" +--> +--> 2147483748 +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw +--> Content-Disposition: form-data; name="FILE"; filename="2GB.tmp" +--> Content-Type: application/octet-stream +--> Content-Length: 1073676288 +--> X-File-ID: 1275549886 +--> +--> (file content) +--> --LofreCkx1GmgWNCHZ9exBQoQhiEF7pXSaPp2KUQVPlnarPAw-- +2GB.tmp : 0 MB in 1 s (128 kB/s), total 2048 MB + + +The default character set for F*EX is UTF-8, because most clients seem to +use it. The problem is, it is nowhere defined which character set HTTP +uses itself. + +Important for programmers: The perl variables of the F*EX CGI's (fup, fop, +etc) have their UTF-8 flag turned off. This means, they contain UTF-8 data +in binary representation. + + +I have additional authentication modules for RADIUS, LDAP, mailman and +POP. Please email me if you are interested. + +framstag@rus.uni-stuttgart.de diff --git a/doc/debugging b/doc/debugging new file mode 100644 index 0000000..d81dfe2 --- /dev/null +++ b/doc/debugging @@ -0,0 +1,16 @@ +If your F*EX installation does not work as expected then first look in: + +$FEXHOME/spool/fexsrv.log (log from fexsrv) +$FEXHOME/spool/fup.log (log from fup CGI) +$FEXHOME/spool/fop.log (log from fop CGI) + +If this does not help, set in $FEXHOME/lib/fex.ph : + +$debug = 1; + +then you will get in $FEXHOME/spool/.debug/ for each download a log file +with detailed debugging output. + +If this does not help at all, contact me :-) +framstag@rus.uni-stuttgart.de + diff --git a/doc/fex-client_1.pdf b/doc/fex-client_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a574738d85b7ce923df89b46f470e13ca797f415 GIT binary patch literal 9406 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 literal 0 HcmV?d00001 diff --git a/doc/installation b/doc/installation new file mode 100644 index 0000000..0e63e12 --- /dev/null +++ b/doc/installation @@ -0,0 +1,92 @@ +Prerequisites: +============== + +To install the F*EX server, you need a UNIX system with perl, xinetd and +/usr/lib/sendmail (either original or a clone like postfix or exim). +Your perl must have the following standard core modules: + +CGI +CGI::Carp +Digest::MD5 +Encode +Fcntl +File::Basename +Getopt::Std +IO::Handle +POSIX + +Optional are the non-standard perl modules: + +Net::DNS (for better domain error handling) +Socket6 (for ipv6 support) +Net::INET6Glue (for ipv6 support) +IO::Socket::INET6 (for ipv6 support) + +On Debian or Ubuntu Linux simply execute as root: + + apt-get install xinetd perl-modules libnet-dns-perl libnet-inet6glue-perl + test -x /usr/lib/sendmail || apt-get install postfix + +Do not forget to open port 80 on your firewalls and routers for incoming +connections! + +To install F*EX, simply run "./install", then edit lib/fex.ph and set your +local config. If you want to upgrade from a previous F*EX version, you +also can run "./install", no old config files will be overwritten. Also +index.html is kept. + +Alternativly use "./install -p 8888" to install F*EX on port 8888 instead +on default port 80. + +Run "./install" again for installing optional localizations (languages). + +If the install-script does not work for you (no xinetd, no GNU tools, etc) +here is what is to be done manually for installing: + +echo "fex 80/tcp" >> /etc/services +echo "fex stream tcp nowait fex /home/fex/bin/fexsrv fexsrv" >> /etc/inetd.conf +# restart inetd or reboot +useradd -s /bin/bash -c "File EXchange" -m fex +cd FEXSOURCEDIR +chown -R fex . +su - fex +cd FEXSOURCEDIR +rsync -av bin cgi-bin lib etc htdocs doc $HOME +cd $HOME +mkdir spool +chmod 700 spool +vi lib/fex.ph +# set your config +crontab -e + 3 3 * * * exec /home/fex/bin/fex_cleanup + +Hints: +====== + +F*EX runs with its own uid (default: fex), which will be created by the +install script. + +F*EX uses a directory (FEXHOME) containing anything needed to run fex. +Default is FEXHOME=/home/fex, the home directory of the "fex" user. + +If you want fex to be installed elsewhere create a new "fex" user account +BEFORE running ./install, e.g.: + +adduser --system --group \ + --gecos "File EXchange" \ + --home /srv/fex \ + --shell /bin/bash \ + fex +./install + +If you run F*EX behind a HTTP reverse proxy, then write to lib/fex.ph : + $reverse_proxy_ip = 'internal-IP.address.of.proxy'; + $durl = 'http://your.proxy.with.domain/fop'; +Be aware that most proxies have a 2 GB file size limit (signed int 32 bit bug)! +Of course you have to configure your reverse proxy correctly, especially +the URL rewrite rules. See the manual of your reverse proxy. + +If you want to use https, you need the stunnel package. See file SSL for +more information. + +On problems contact the author: framstag@rus.uni-stuttgart.de diff --git a/doc/new b/doc/new new file mode 100644 index 0000000..de4bd97 --- /dev/null +++ b/doc/new @@ -0,0 +1,7 @@ +New release on http://fex.rus.uni-stuttgart.de/fex.html + +Important changes: + +- workaround for upload problem with chaching proxies + +- some small bug fixes diff --git a/doc/newfeatures b/doc/newfeatures new file mode 100644 index 0000000..d28f95a --- /dev/null +++ b/doc/newfeatures @@ -0,0 +1,47 @@ +New features for users +---------------------- + +2015-01-12: + +- user configuration: save-or-display (MIME) for download + +- fexsend has new option -S show server/user settings + +- fexsend has new option -N resend notification email + + +2014-12-24: + +- the CLI clients respect the environment variables SSLVERIFY SSLVERSION + SSLCAPATH SSLCAFILE SSLCIPHERLIST to enhance HTTPS security + +- new $HOME/.fex/config for the CLI clients, you can set there the variables + $opt_* %autoview %alias + see "fexsend -H" and "fexget -H" for details + +- fexget autoviews images after download + + +2014-08-06: + +- you as the sender can download the file, too, without auto-deleting it + + +2014-03-05: + +- email enryption option: you can upload your PGP/GPG public key + via "user config & operation control" and "Manage e-mail encryption" + +- fexget checks local storage capacity before download + +- new FAQ http://fex.rus.uni-stuttgart.de/FAQ/ + +- notification e-mail resend option via "user config & operation control" + + +2013-08-05: + +- allow multiple downloads from same ip + +- fexget proxy support + diff --git a/doc/reverse_proxy b/doc/reverse_proxy new file mode 100644 index 0000000..05c740d --- /dev/null +++ b/doc/reverse_proxy @@ -0,0 +1,32 @@ +You can prosecute F*EX behind a reverse proxy, but then you are limited to +the capabilities of this proxy. For example, if you use apache, then you +have a 2 GB upload limitation and a throughput penality. + +Example for apache reverse proxy: + +On http://tandem-fahren.de:80 there is an apache +On http://tandem-fahren.de:488 there is a F*EX server +tandem-fahren.de has ip address 78.46.33.142 + +If you want to contact the F*EX server via alias URL +http://tandem-fahren.de/fex/ then you have to put in httpd.conf: + + Redirect /fex /fex/ + ProxyRequests Off + ProxyPass /fex/ http://tandem-fahren.de:488/ + + ProxyPassReverse http://tandem-fahren.de:488/ + SetOutputFilter proxy-html + ProxyHTMLExtended On + ProxyHTMLURLMap http://tandem-fahren.de:488/ /fex/ + ProxyHTMLURLMap / /fex/ + ProxyHTMLURLMap /fex/fex/fex/ /fex/ + + +And write to lib/fex.ph : + $hostname = 'tandem-fahren.de'; + $reverse_proxy_ip = '78.46.33.142'; + $durl = 'http://tandem-fahren.de/fex/fop'; + + +See also: http://8d.no/fexproxy.html diff --git a/doc/version b/doc/version new file mode 100644 index 0000000..733bf4c --- /dev/null +++ b/doc/version @@ -0,0 +1 @@ +fex-20150120 diff --git a/doc/xx b/doc/xx new file mode 100644 index 0000000..3a99684 --- /dev/null +++ b/doc/xx @@ -0,0 +1,99 @@ +With xx you have a network wide shell based clip board for files and +STDIN/STDOUT: easy data exchange between different accounts on different +hosts. + + usage: send file(s): xx file... + or: send STDIN: xx - + or: send pipe: ... | xx + or: get file(s) or STDIN: xx + or: get file(s) quickly: xx -- + + +Pipe example: + + framstag@tandem:~: uname -a | xx + /home/framstag/.fex/tmp/STDFEX : 0 kB in 1 s (0 kB/s) + + + framstag@fex:~: xx + transfered: 0 MB (100%) + Linux tandem 2.6.24-28-server #1 SMP Wed Aug 18 22:01:20 UTC 2010 i686 GNU/Linux + + +File transfer example: + + framstag@tandem:~: xx /boot/ + making tar transfer file /home/framstag/.fex/tmp/STDFEX : + /boot/ + /boot/initrd.img-2.6.24-27-generic + /boot/vmlinuz-2.6.24-28-generic + (...) + /boot/System.map-2.6.24-27-generic + /home/framstag/.fex/tmp/STDFEX : 34 MB in 2 s (17605 kB/s) + + + framstag@fex:/tmp: xx + transfered: 34 MB (100%) + Files in transfer-container: + + drwxr-xr-x root/root 0 2010-10-20 07:37 boot/ + -rw-r--r-- root/root 7905085 2010-05-25 15:38 boot/initrd.img-2.6.24-27-generic + -rw-r--r-- root/root 1927544 2010-10-16 20:38 boot/vmlinuz-2.6.24-28-generic + (...) + -rw-r--r-- root/root 906803 2010-03-24 14:33 boot/System.map-2.6.24-27-generic + + Extract these files? + + +One problem are shared system accounts like root where different persons +use them: xx (like fexsend and fexget) uses $HOME/.fex/id which contains +personal data. + +But you can put the ID authorization in the environment variable FEXID. + +fexsend on your local account gives you a string for "cut and paste", example: + + framstag@moep:~: fexsend -I + export FEXID='fex.rus.uni-stuttgart.de:8080 framstag jmBhf9ht' + history -d $(history 1);history -d $(history 1) + +You then copy these two lines with your mouse into the root account: + + root@tandem:~# export FEXID'=fex.rus.uni-stuttgart.de:8080 framstag jmBhf9ht' + root@tandem:~# history -d $(history 1);history -d $(history 1) + +(The second line deletes these two lines from the bash history) + +Now you can use xx (or fexsend and fexget) as normal. Example: + + root@tandem:~# grep sshd /var/log/daemon | xx + transfered: 265 kB in 1 s (265 kB/s) + + framstag@moep:~: xx | wc -l + 434279 + + +After logging out from root@tandem the F*EX authorization data has gone. + + +Internal details: + +The intermediate transfer file container is $HOME/.fex/tmp/STDFEX + +When transfering files tar/gzip format is used, whereas STDIN (pipe) will +be transfered uncompressed. Tip: If you want to transfer files uncompress, +then use: tar cvf - your files... | xx + +With default usage only one "storage slot" is available: STDFEX +But you can use as many "storage slots" as you want by using "xx :TAG" +Examples: + + uname -a | xx + + grep sshd /var/log/daemon | xx :log + + xx :log | grep obertux + + xx :config /boot /etc /root + + xx :config -- diff --git a/etc/mime.types b/etc/mime.types new file mode 100644 index 0000000..328d9c8 --- /dev/null +++ b/etc/mime.types @@ -0,0 +1,36 @@ +application/ogg ogg ogx +application/pdf pdf +application/postscript ps ai eps +application/x-dvi dvi +audio/basic au snd +audio/mpeg mpga mpega mp2 mp3 m4a +audio/ogg oga spx +audio/x-ms-wma wma +audio/x-wav wav +image/gif gif +image/jpeg jpeg jpg jpe +image/pcx pcx +image/png png +image/svg+xml svg svgz +image/tiff tiff tif +image/x-ms-bmp bmp +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd +text/plain asc txt text pot +video/3gpp 3gp +video/dl dl +video/dv dif dv +video/fli fli +video/gl gl +video/mpeg mpeg mpg mpe +video/mp4 mp4 +video/ogg ogv +video/quicktime qt mov +video/x-msvideo avi +video/x-sgi-movie movie diff --git a/etc/xinetd_fex b/etc/xinetd_fex new file mode 100644 index 0000000..c25a3db --- /dev/null +++ b/etc/xinetd_fex @@ -0,0 +1,20 @@ +# default: on +# description: F*EX web server +# +service fex +{ + socket_type = stream + wait = no + type = unlisted + protocol = tcp + bind = ADDRESS + port = PORT + cps = 10 2 + user = fex + groups = yes + server = FEXHOME/bin/fexsrv + nice = 0 + disable = no +} +# configuration for https/SSL see /home/fex/doc/SSL +# configuration for IPv6 see /home/fex/doc/IPv6 diff --git a/htdocs/FAQ/FAQ.html b/htdocs/FAQ/FAQ.html new file mode 120000 index 0000000..64233a9 --- /dev/null +++ b/htdocs/FAQ/FAQ.html @@ -0,0 +1 @@ +index.html \ No newline at end of file diff --git a/htdocs/FAQ/admin.faq b/htdocs/FAQ/admin.faq new file mode 100644 index 0000000..35b8b3c --- /dev/null +++ b/htdocs/FAQ/admin.faq @@ -0,0 +1,156 @@ +Q: I cannot install a web server like fexsrv, because I have no root permissions. Is there a pure-CGI-version of F*EX which runs with an apache web server? +A: F*EX is hard bound to fexsrv for several reasons (performance, file size limit, session concept, etc) and cannot be run as CGI under apache. But you might have a look at + + * http://gpl.univ-avignon.fr/filez/ + * http://freshmeat.net/projects/eventh/ + * http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (German only!) + + which implement a file exchange as pure CGIs, but with a 2 GB file size limit, which F*EX does not have. + +Q: I have already a webserver (apache) running. How can I install F*EX in parallel? +A: You have to use a different port or ip for F*EX, because you cannot run two services on the same ip:port combination. + For example port 88, use "./install -p 88" + For another ip you can create a new virtual interface or use a virtual machine. + See the documentation of your UNIX. + +Q: Ok, I have installed F*EX. What now? +A: Become user fex and create some users with fac, example: +

+     /home/fex/bin/fac -u memyselfandi@my.do.main secret-auth-id
+   
+ Then log in using the web interface: http://YOURFEXSERVER/ + + ... and join the F*EX mailing list! ☺ + https://listserv.uni-stuttgart.de/mailman/listinfo/fex + +Q: What is /home/fex/bin/fac and /home/fex/cgi-bin/fac ? +A: fac stands for F*EX Admin Control + + /home/fex/bin/fac is the (full) CLI version + + /home/fex/cgi-bin/fac is the (restricted) web version. You have to call it with your webbrowser: + http://YOURFEXSERVER/fac + +Q: F*EX is not working at all! I cannot connect to it with my web browser! +A: Check your routing, ipfilters and firewall setup. + Also check if xinetd is running. If it is linked with tcp-wrapper, configure it correctly (hosts.allow). + F*EX needs port 80/tcp for HTTP and optionally port 443/tcp for HTTPS. + +Q: What is the difference between all these user types (full, sub, group, external, ...)? +A: See http://fex.rus.uni-stuttgart.de/users.html + +Q: How can I integrate F*EX in the existing user management at my site? +A: F*EX has several authentification modules: local, RADIUS, LDAP, mailman and POP. + For the last 4 please contact + +Q: Can I make an alias address for an user? +A: F*EX users are defined by a directory in the spool. Therefore execute: + + + cd /home/fex/spool + ln -s user@do.main alias@other.address + + + Now the user is known as user@do.main and alias@other.address + +Q: I want that all my local users can use F*EX. How? +A: Let them register themselves with http://YOURFEXSERVER/fur + + You have to edit /home/fex/lib/fex.ph and set (example): +
+     @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+     @local_domains = qw(flupp.org ulm.sub.net);
+   
+ Or you can allow anonymous upload for your LAN users with fex.ph variable @anonymous_upload + Example: +
+     @anonymous_upload = qw(10.10.100.0-10.10.200.255 129.69.1.11);
+   
+ (Of course you have to use your real local hosts/networks!) + +Q: I want that external users can fex to my local users. How? +A: Let them register themselves with http://YOURFEXSERVER/fur + + You have to edit /home/fex/lib/fex.ph and set (example): +
+     # your local receiving domains
+     @local_rdomains = qw(flupp.org *.flupp.org);
+     	     
+     # your local receiving hosts
+     @local_rhosts = qw(127.0.0.1 129.69.0.0-129.69.255.255 176.9.84.26);
+   
+ + Or you can manually create a restricted external user with (example): +
+     /home/fex/bin/fac -u framstag@rus.uni-stuttgart.de hoppla
+     /home/fex/bin/fac -R framstag@rus.uni-stuttgart.de
+   
+ +Q: How can I change user settings like quota, restrictions or keep time? +A: Use /home/fex/bin/fac + +Q: How can I delete or temporarly disable a user? +A: Use /home/fex/bin/fac + +Q: I have BIG files already on the fexserver host. Can I upload just a + link instead of the whole file? +A: Set in fex.ph: + + + @file_link_dirs = qw(/directory/with/big/files); + +

+ and use: +

+ + fexsend -/ /directory/with/big/files/BIG.file recipient@wherever + + +Q: I want the Bcc mails to fex (admin user) to be sent to another address. +A: Set variable $bcc in /home/fex/lib/fex.ph + +Q: I need more security! How can I enable (https) encryption? +A: Read doc/SSL and also look for "fop_auth" in doc/concept + (doc is a local directory in your installation or online http://fex.rus.uni-stuttgart.de/doc/) + For email encryption see http://fex.rus.uni-stuttgart.de/gpg.html + +Q: I need a corporate identity look. How can I configure F*EX in this way? +A: * See variable @H1_extra in /home/fex/lib/fex.ph and you can add HTML code to /home/fex/htdocs/header.html + * See /home/fex/htdocs/fup_template.html, modify it to your needs and use it as your start-page. + * Contact http://www.nepustil.net/ if you need more customization. + +Q: F*EX is too complicated for my tie users. I need a simplified upload form. +A: See /home/fex/htdocs/fup_template.html and /home/fex/htdocs/sup.html + or use public upload, see http://fex.rus.uni-stuttgart.de/usecases/foreign.html + +Q: F*EX is still too complicated! I need something more simplified. +A: Try http://fex.rus.uni-stuttgart.de/fstools/woos.html or use F*EX mail (see next question). + +Q: Can I integrate F*EX in my users MUAs (thunderbird, outlook, etc)? +A: See http://fex.rus.uni-stuttgart.de/usecases/BIGMAIL.html + +Q: Can I get a localized version in my native languange? +A: With your help, yes. Please contact + +Q: I need ACLs for group access, a file browser and integration in my + native file system. +A: This is beyond the scope of F*EX, which is designed for efficient file transfer only. + +Q: Feature/design XY is missing. +A: Contact the author + +Q: How can I get fup as start page? +A: Execute: + + + cd /home/fex/cgi-bin + ln -s fup login + + +Q: How can I use my own local FAQ? +A: Put your FAQ into file /home/fex/htdocs/FAQ/local.faq and execute: + + + cd /home/fex/htdocs/FAQ + ln -sf local.html index.html + diff --git a/htdocs/FAQ/admin.html b/htdocs/FAQ/admin.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/admin.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##

+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/FAQ/all.html b/htdocs/FAQ/all.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/all.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/FAQ/faq.pl b/htdocs/FAQ/faq.pl new file mode 100644 index 0000000..6cadd49 --- /dev/null +++ b/htdocs/FAQ/faq.pl @@ -0,0 +1,142 @@ +package FAQ; + +my ($faq,$var,$env,$q,$a,$c,$s,$t,$n); +my (@faq,%Q,%A,@s); +my @sections = qw'Meta User Admin Misc'; + +@faq = ($faq) = $ENV{PATH_INFO} =~ /(\w+).html/; +@faq = map {lc} @sections if $faq eq 'all'; + +print "\n"; + +print '

F*EX '; +printf "Frequently Asked Questions: %s

\n",ucfirst($faq); + +if ($faq ne 'local') { + print "

Sections: "; + foreach $s (@sections,'All') { + if ($s =~ /$faq/i) { + print "$s\n"; + } else { + printf "[%s]\n",lc($s),$s; + } + } + print "

\n"; +} + +print "


\n"; +print "\n"; + +foreach my $faq (@faq) { + open $faq,"$faq.faq" or next; + local $/ = "Q:"; + local $_ = <$faq>; + while (<$faq>) { + chomp; + while (/\$([\w_]+)\$/) { + $var = $1; + $env = $ENV{$var} || ''; + # s/\$$var\$/$env<\/code>/g; + s/\$$var\$/$env/g; + }; + ($q,$a) = split /A:\s*/; + $q =~ s/[\s\n]+$//; + $q =~ s/^\s+//; + $q =~ s! (/\w[\S]+/[\S]+)! $1!g; + $a =~ s/[\s\n]+$/\n/; + $a =~ s/^\s+//; + while ($a =~ s/^(\s*)\*/$1
    \n$1
  • /m) { + while ($a =~ s/(
  • .*\n\s*)\*/$1
  • /g) {} + $a =~ s:(.*\n)(\s*)(
  • [^\n]+\n):$1$2$3$2
\n:s + } + $a =~ s/\n\n/\n

\n/g; + $a =~ s/([^>\n\\])\n/$1
\n/g; + $a =~ s/

(.+?)<\/pre>/pre($1)/ges;
+    $a =~ s/\\\n/\n/g;
+#    $a =~ s/^\s*
\s*//mg; + $a =~ s/<([^\s<>\@]+\@[\w.-]+)>/<$1><\/a>/g; + $a =~ s! (/\w[\S]+/[\S]+)! $1!g; + $a =~ s!(https?://[\w-]+\.[^\s<>()]+)![$1]!g or + $a =~ s!(https?://[^\s<>()]+)!$1!g; + push @{$Q{$faq}},$q; + push @{$A{$faq}},$a; + } + close $faq; +} + +print "
\n"; + +foreach $s (sections($faq)) { + + $c = lc $s; + $s = '' if $s eq 'Local'; + $t = ''; + $t = $s if $faq eq 'all'; + + for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) { + $q = ${Q{$c}[$n]}; + $qa = anchor($q); + printf ''."\n", + $t,$n+1,$s,$n+1,$qa,$q; + } +} + +print "
'. + ''. + '%s Q%d:'. + '%s
\n"; +print "


\n"; + +foreach $s (sections($faq)) { + + $c = lc $s; + $s = '' if $s eq 'Local'; + $t = ''; + $t = $s if $faq eq 'all'; + + for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) { + $q = ${Q{$c}[$n]}; + $qa = anchor($q); + print "

\n"; + print "\n"; + printf "\n", + $t,$n+1,$s,$n+1,$qa,$q; + printf "\n", + $s,$n+1,${A{$c}[$n]}; + print "
". + "%s Q%d:". + "". + "%s
%s A%d:\n%s
\n"; + print "[↑ Questions]\n"; + } +} + +print "

\n";
+print "\n" x 99;
+print "
\n"; + + +sub sections { + my $faq = shift; + if ($faq eq 'all') { + return @sections; + } else { + return ucfirst($faq); + } +} + +sub pre { + local $_ = shift; + s/
//g; + s/\s+$//; + return "
$_
\n"; +} + +sub anchor { + local $_ = shift; + s/<.+?>//g; + s/\(.+?\)//g; + s/\W/_/g; + s/_+$//; + return $_; +} diff --git a/htdocs/FAQ/index.html b/htdocs/FAQ/index.html new file mode 120000 index 0000000..1dadbb5 --- /dev/null +++ b/htdocs/FAQ/index.html @@ -0,0 +1 @@ +meta.html \ No newline at end of file diff --git a/htdocs/FAQ/local.faq b/htdocs/FAQ/local.faq new file mode 100644 index 0000000..dbb1324 --- /dev/null +++ b/htdocs/FAQ/local.faq @@ -0,0 +1,7 @@ +Q: How can I use my own local FAQ? +A: Put your FAQ into file /home/fex/htdocs/FAQ/local.faq and execute: + + + cd /home/fex/htdocs/FAQ + ln -sf local.html index.html + diff --git a/htdocs/FAQ/local.html b/htdocs/FAQ/local.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/local.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/FAQ/meta.faq b/htdocs/FAQ/meta.faq new file mode 100644 index 0000000..2bda920 --- /dev/null +++ b/htdocs/FAQ/meta.faq @@ -0,0 +1,83 @@ +Q: What is so special about F*EX? +A: See feature list http://fex.rus.uni-stuttgart.de/features.html + and use cases http://fex.rus.uni-stuttgart.de/usecases/ + +Q: Why not use one of the commercial services like DropLoad, ALLPeers, YouSendIt, etc? +A: * They have a file size limit of 2 GB or even less. + * Their security and privacy status is unknown (ever heard of "Snowden & NSA"?). + * They are not open source based. + * There are no UNIX (CLI) clients for them. + * They need java, active-X, flash or other evil plugins. + * It is unknown how long they will exist - DropLoad and ALLPeers already have terminated their business. + +Q: Why name "F*EX" and not shortly "FEX"? +A: At publication time there was already an (older) program named "FEX" listed on freshmeat.net. + +Q: Who is the author? +A: The main author is Ulli Horlacher
+ But there are also a lot of contributors. + +Q: Why a camel as the logo? +A: The logo was inspired by the Perl camel, but it is based on a Steiff plush camel, which rides with us on our racing tandem. + The logo was drawn by my stoker Beate. + http://fex.rus.uni-stuttgart.de/Vortrag/tosa.html + +Q: What do I need to install F*EX? +A: A UNIX or Windows server with a DNS entry, smtp for outgoing email and one open and free incoming tcp port. + You must have administrative rights (UNIX: root) on this server and a basic understanding of UNIX and networking. + +Q: What means DNS and smtp? What is a tcp port? +A: Do not install F*EX. It is beyond your horizon. + +Q: Does F*EX support IPv6? +A: Yes. + +Q: Can I run F*EX on Windows? +A: On client side all operating systems are supported, even Windows. + If you want to run a F*EX server on Windows, then see http://fex.rus.uni-stuttgart.de/fexwix.html + +Q: Where can I get the F*EX sources? +A: F*EX server for UNIX: http://fex.rus.uni-stuttgart.de/fex.html + +Q: I do not want to install a F*EX server of my own, but where can I use it? +A: Contact http://www.nepustil.net/ for F*EX hosting. + +Q: The F*EX server is all in Perl?! Isn't Perl too slow for this job? +A: fex.rus.uni-stuttgart.de runs on an office PC and F*EX is able to handle uploads with more than 300 MB/s. + Try this with an ordinary webserver like Apache! + +Q: Which licence does F*EX have? And why? +A: Perl Artistic free software with a special anti-military clause: + http://fex.rus.uni-stuttgart.de/doc/Licence + "I want peace on earth and goodwill towards men" + http://www.youtube.com/watch?v=JHU0HinVhYc + +Q: Is there a F*EX mailing list? +A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex + +Q: Where can I get commercial support for F*EX? +A: Contact http://www.nepustil.net/ + +Q: Who else is using F*EX? +A: For example: + * German Aerospace Center http://fex.dlr.de + * European Commission Institute for Energy and Transport http://fex.jrc.nl + * High Performance Computing Center Stuttgart http://fex.hlrs.de + * Swiss National Supercomputing Centre http://fex.cscs.ch + * Centre National de la Recherche Scientifique (French National Center for Scientific Research) http://bigfiles.cnrs-gif.fr + * Institut Pasteur http://dl.pasteur.fr + * Palo Alto Research Center (Xerox PARC) http://parcftp.parc.com + * Baden-Württembergs extended LAN http://fex.belwue.de + * Deutsche Kinemathek Museum für Film und Fernsehen http://upload.deutsche-kinemathek.de + +Q: Is F*EX secure? +A: F*EX is written in Perl which does not have common security problems with buffer overruns, segmentation faults, heap and stack corruption. + F*EX does not use an extra web server or a (SQL) database, so no typical web attacks are possible. + F*EX was analysed by security company revshell.com and labeled as "secure". + F*EX comes with source code, so everybody can verify it. + +Q: Feature/design XY is missing. +A: Contact the author + +Q: I have more/other questions than in this document! +A: Ask the author diff --git a/htdocs/FAQ/meta.html b/htdocs/FAQ/meta.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/meta.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/FAQ/misc.faq b/htdocs/FAQ/misc.faq new file mode 100644 index 0000000..ddd5251 --- /dev/null +++ b/htdocs/FAQ/misc.faq @@ -0,0 +1,17 @@ +Q: F*EX is great! Can I join the developing team? What needs to be done? +A: Contact the author + + Requested features are: +
    +
  • testers for MacOS, AIX and other UNIXes +
  • a new maintainer for the Java client F*IX +
  • an Android or iOS client +
  • a F*EX plugin for thunderbird or outlook + see thunderbird's filelink + https://support.mozillamessaging.com/en-US/kb/filelink-large-attachments + https://developer.mozilla.org/en/Thunderbird/Filelink_Providers +
  • more (other) languange support (japanese, bavarian, klingon ...) +
+ +Q: Can I donate something for F*EX? +A: If you have a pet animal, fex a cute video of it to the author diff --git a/htdocs/FAQ/misc.html b/htdocs/FAQ/misc.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/misc.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/FAQ/user.faq b/htdocs/FAQ/user.faq new file mode 100644 index 0000000..5c62df9 --- /dev/null +++ b/htdocs/FAQ/user.faq @@ -0,0 +1,136 @@ +Q: What is the "auth-ID"? +A: The auth-ID is an internal identification which authentificates the user. It will be first generated by the admin or the automatic registration process and can later be modified by you, the user. Think of some kind of a low security password. + +Q: What is the difference between all these user types (full, sub, group, external, ...)? +A: See http://fex.rus.uni-stuttgart.de/users.html + +Q: I have uploaded a HUGE file but misspelled my recipient's address. Now I have got an error bounce email. Must I re-upload the HUGE file? +A: No, it is not necessary. You can redirect the file with "user config & operation control" + +Q: I have uploaded a HUGE file but forgot another recipient. Must I re-upload the HUGE file? +A: No, it is not necessary. You can forward-copy the file with "user config & operation control" + +Q: Can I use an HTTP proxy? +A: Yes, but pay attention: + Some HTTP proxies like privoxy delay the upload progress bar! + You may want to disable proxying $SERVER_NAME$ if you run into this problem. + +Q: My recipient has lost the notification email with the download-URL. What can I do? +A: You can resend the notification email via "user config & operation control" + +Q: Why should I use a special F*EX client? +A: When you are using F*EX with your webbrowser, you are limited to its restrictions. + With a special F*EX client http://$HTTP_HOST$/tools.html you can + + * resume an aborted transfer + * send several files or even whole directory trees at once + * stream files + * transfer files via command line + * use an Internet clipboard http://fex.rus.uni-stuttgart.de/usecases/xx.html + * do much more :-) + +Q: How can I upload several files at once? +A: Put your files in an archive file (ZIP). Your web browser cannot do that. + Or you can use a F*EX client, see http://$HTTP_HOST$/tools.html + +Q: I cannot upload files > 2 GB with my web browser!? +A: Many web browsers have bugs in their HTML-FORM implementation. The limit mostly is 2 GB, sometimes 4 GB. + Firefox and Google Chrome have no limitation. + But remember: No web browser is able to resume an interrupted upload. You need a special F*EX client like fexsend or schwuppdiwupp for resuming, see http://$HTTP_HOST$/tools.html + +Q: I need to send a file bigger than my quota allows. What can I do? +A: Simply ask $SERVER_ADMIN$ to raise your quota. + +Q: Why is the upload status window empty and I cannot see the progress bar? +A: Most probably you are using a (enforced) web proxy, which cannot handle dynamic HTML pages. + A workaround is using Google Chrome, which shows the upload status by itself. + +Q: My download was aborted before it was finished. Can I resume the download? +A: F*EX supports resuming at download, but your client also has to support this feature. + Firefox e.g. is missing this HTTP feature, you need an other client like opera, wget or fexget. + +Q: My upload was aborted before it was finished. Can I resume the upload? +A: F*EX supports resuming at upload, but your client also has to support it. + No web browser has this feature, you need a special F*EX client like fexsend or schwuppdiwupp, + see http://$HTTP_HOST$/tools.html + +Q: Can I integrate F*EX in my mail program (thunderbird, outlook, etc)? +A: Yes, if your mail admin has set up a "fexmail" smtp relay. + http://fex.rus.uni-stuttgart.de/usecases/BIGMAIL.html + +Q: Can I use a download manager/accelerator? +A: Generally, no, because they suck: they are not RFC compliant and produce a LOT of unnecessary server load. + But there is one exception: axel http://axel.alioth.debian.org/ + +Q: When I hit [ESC] in firefox the upload is canceled. Why? +A: This is a built-in feature of firefox: ESC terminates the current operation. + Simple solution: do not hit ESC in Firefox. + Complex solution: ask the Firefox developers to add keyboard configuration. + +Q: Sending as a F*EX user is easy, but how to receive files from others, outside? +A: Register them as your subusers, create a F*EX group or a one-time upload key with "user config & operation control" + See also http://fex.rus.uni-stuttgart.de/usecases/foreign.html + +Q: Sometimes I can download a file more than once, especially when I repeat it quickly. Is the autodelete feature buggy? +A: The F*EX server has a grace time of 1 minute after first sucessfully download in which the file is still available. This is necessary because of some stupid "download managers" which request the file several times at once. Otherwise they would report an error to the user. + + Your fexmaster has set AUTODELETE=DELAY as default, which means that the autodelete cleanup process is called once a day. + + Power users (use the source, Luke!) can set a "do not delete after download" flag. + +Q: I have uploaded a file to a list of recipients. Will the file be deleted after the first recipient has dowloaded it? +A: No. Every recipient gets his own copy of the file which is independant from the others. + +Q: The default keep time is too short for me (sender), I need more. How can I set it? +A: Use fexsend, ask $SERVER_ADMIN$ or read the source code :-) + +Q: The default keep time is too short for me (recipient), I need more. How can I set it? +A: Ask $SERVER_ADMIN$ to raise your default KEEP value. + +Q: I forgot to download a file. Now it is expired. How can I obtain it nevertheless? +A: An expired file is definitively deleted. Even the admin cannot restore it. + You must re-request it from the sender. + +Q: I have sent a second file with the same name, but the recpient has not received a second notification email. Why? +A: A file with the same name to the same recpient overwrites the first one if it is still there (no download so far). + A second notification email of the same file(name) is not suggestive. + +Q: How can I sent a more compact notification email? +A: Let your comment start with "!.!", then the notification email will contain only download-URL, size and comment. + +Q: How can I suppress the automatic notification email? +A: Use "!#!" as comment, then no notification email will be sent. + Of course you then have to inform the recipient manually. + +Q: Can I get a copy of the notification email? +A: Add "!bcc!" to the comment field on upload. + +Q: Can I get a notification email on download? +A: No. + Such a feature is in conflict with German and European privacy laws and will not be implemented. + With email you also have no acknowledgement of receipt. + +Q: Can I have encrypted emails? +A: See http://fex.rus.uni-stuttgart.de/gpg.html + +Q: I cannot download files with Internet Explorer, it tells me "Cannot open Internet site". What shall I do? +A: Use Firefox or any other Internet-compatible web browser, that Internet Explorer is not. + This is one of the many bugs of Internet Explorer. + See also http://support.microsoft.com/kb/323308 + +Q: I cannot login with Internet Explorer, it tells me "This page can't be displayed". What shall I do? +A: Use Firefox or any other Internet-compatible web browser, that Internet Explorer is not. + This is one of the many bugs of Internet Explorer. + +Q: I have recived a "file.7z". How can I extract it on my Mac? +A: For example with "Stuffit Expander": + https://itunes.apple.com/us/app/stuffit-expander/id405580712?mt=12 + http://my.smithmicro.com/stuffit-expander-mac-download.html + +Q: How can I prevent the fexsend error SSL3_GET_SERVER_CERTIFICATE:certificate verify failed? +A: Set the environment variable SSLVERIFY=0 + + Rationale: + Your openssl library cannot resolve the SSL certification path. + With SSLVERIFY=0 you tell openssl to ignore certification verification. + Yes, this is a crude workaround :-} diff --git a/htdocs/FAQ/user.html b/htdocs/FAQ/user.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/htdocs/FAQ/user.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/htdocs/Licence b/htdocs/Licence new file mode 100644 index 0000000..4108934 --- /dev/null +++ b/htdocs/Licence @@ -0,0 +1,120 @@ +F*EX (Frams' Fast File EXchange) is a service to send big (large, huge, +giant, ...) files from a user A to a user B via internet. + +Copyright (C) 2006-2014 Ullrich Horlacher + +YOU ARE NOT ALLOWED TO USE THIS SOFTWARE FOR MILITARY PURPOSES OR WITHIN +MILITARY ORGANIZATIONS! THIS INCLUDES ALSO MILITARY RESEARCH AND +EDUCATION, PARAMILITARY AND TERRORISTIC ORGANIZATIONS! + +This program is free software: you can redistribute it and/or modify it +under the terms of the Perl Artistic Licence: + +"Package" refers to the collection of files distributed by the Copyright +Holder, and derivatives of that collection of files created through +textual modification. + +"Standard Version" refers to such a Package if it has not been modified, +or has been modified in accordance with the wishes of the Copyright Holder +as specified below. + +"Copyright Holder" is whoever is named in the copyright or copyrights for +the package. + +"You" is you, if you're thinking about copying or distributing this +Package. + +"Reasonable copying fee" is whatever you can justify on the basis of media +cost, duplication charges, time of people involved, and so on. (You will +not be required to justify it to the Copyright Holder, but only to the +computing community at large as a market that must bear the fee.) + +"Freely Available" means that no fee is charged for the item itself, +though there may be fees involved in handling the item. It also means that +recipients of the item may redistribute it under the same conditions they +received it. + +1. You may make and give away verbatim copies of the source form of the + Standard Version of this Package without restriction, provided that you + duplicate all of the original copyright notices and associated + disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications + derived from the Public Domain or from the Copyright Holder. A Package + modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided + that you insert a prominent notice in each changed file stating how and + when you changed that file, and provided that you do at least ONE of + the following: + +a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site + such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + +b) use the modified Package only within your corporation or organization. + +c) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or + executable form, provided that you do at least ONE of the following: + +a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + +b) accompany the distribution with the machine-readable source of the + Package with your modifications. + +c) give non-standard executables non-standard names, and clearly document + the differences in manual pages (or equivalent), together with + instructions on where to get the Standard Version. + +d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this + Package. You may charge any fee you choose for support of this Package. + You may not charge a fee for this Package itself. However, you may + distribute this Package in aggregate with other (possibly commercial) + programs as part of a larger (possibly commercial) software + distribution provided that you do not advertise this Package as a + product of your own. You may embed this Package's interpreter within an + executable of yours (by linking); this shall be construed as a mere + form of aggregation, provided that the complete Standard Version of the + interpreter is so embedded. + +6. The scripts and library files supplied as input to or produced as + output from the programs of this Package do not automatically fall + under the copyright of this Package, but belong to whoever generated + them, and may be sold commercially, and may be aggregated with this + Package. If such scripts or library files are aggregated with this + Package via the so-called "undump" or "unexec" methods of producing a + binary executable image, then distribution of such an image shall + neither be construed as a distribution of this Package nor shall it + fall under the restrictions of Paragraphs 3 and 4, provided that you do + not represent such an executable image as a Standard Version of this + Package. + +7. C subroutines (or comparably compiled subroutines in other languages) + supplied by you and linked into this Package in order to emulate + subroutines and variables of the language defined by this Package shall + not be considered part of this Package, but are the equivalent of input + as in Paragraph 6, provided these subroutines do not change the + language in any way that would cause it to fail the regression tests + for the language. + +8. Aggregation of this Package with a commercial distribution is always + permitted provided that the use of this Package is embedded; that is, + when no overt attempt is made to make this Package's interfaces visible + to the end user of the commercial distribution. Such use shall not be + construed as a distribution of this Package. + +9. The name of the Copyright Holder may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. diff --git a/htdocs/SEX.html b/htdocs/SEX.html new file mode 100644 index 0000000..81b83ad --- /dev/null +++ b/htdocs/SEX.html @@ -0,0 +1,64 @@ + +Stream EXchange + +
+

Stream EXchange (SEX)

+ +You can imagine SEX as network wide UNIX pipes with a relay between or as +network based FIFOs.
+This can be useful for piping data from A to B where +A and B cannot establish a direct connection, but both can connect to the +SEX-server by HTTP.
+SEX is a synchronous service in conjuction to F*EX +which is asynchronous. +

+For seamless integration into the UNIX tool chain, there are the +shell-tools sexsend and sexget. +

+Using web browsers for sexing will not work, because they cannot handle +streams in a pipe. So far, there are only the UNIX clients. Feel free to +implement other clients for other operating systems :-) +

+Authentication is the same as with F*EX. +

+Example: +

+

+  root@lanldap:/var/log: tail -f syslog | sexsend framstag@rus.uni-stuttgart.de
+
+  framstag@blubb:/tmp: sexget | grep ldap
+
+

+If you need encryption, then use the standard UNIX toolbox and add an +appropriate program to the pipe, for example: openssl bf + +

public SEX

+The recipient of regular SEX must be a registered F*EX user.
+But you can also offer streams to non-registered user.
+This is called "public SEX", example: +

+

+  framstag@flupp: cal | sexsend public
+  http://fex.rus.uni-stuttgart.de/sex?user=framstag@rus.uni-stuttgart.de&ID=public
+  http://fex.rus.uni-stuttgart.de/sex?dXNlcj1mcmFtc3RhZ0BydXMudW5pLXN0dXR0Z2FydC5kZSZJRD1wdWJsaWM=
+
+

+sexsend then displays two URLs onder which one can get the stream. + +

SEX - all inclusive

+To transfer files by streaming you can use xx-rated SEX: +

+

+  root@vms2:/data/VM# sexxx flupp
+  streaming:
+  flupp/
+  flupp/vmware.log
+  flupp/flupp.nvram
+  flupp/flupp.vmxf
+  flupp/flupp.vmx
+  flupp/flupp.vmdk
+  4976 MB 11640 kB/s
+
+ + + diff --git a/htdocs/action-fex-camel.gif b/htdocs/action-fex-camel.gif new file mode 100644 index 0000000000000000000000000000000000000000..c9fcc284c9ec5ffe3c5bc99463562e2599647b60 GIT binary patch literal 33666 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 +# +# Perl Artistic Licence + +use 5.006; +use strict qw'vars subs'; +use Config; +use POSIX; +use Encode; +use Getopt::Std; +use File::Basename; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Time::HiRes 'time'; +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +$| = 1; + +our $SH; +our ($fexhome,$idf,$tmpdir,$windoof,$useragent); +our ($xv,%autoview); +our $bs = 2**16; # blocksize for tcp-reading and writing file +our $version = 20150120; +our $CTYPE = 'ISO-8859-1'; +our $fexsend = $ENV{FEXSEND} || 'fexsend'; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +# inquire default character set +# cannot use "use I18N::Langinfo" because of no windows support! +eval { + local $^W = 0; + require I18N::Langinfo; + I18N::Langinfo->import(qw'langinfo CODESET'); + $CTYPE = langinfo(CODESET()); +}; + +if ($Config{osname} =~ /^mswin/i) { + $windoof = $Config{osname}; + $ENV{HOME} = $ENV{USERPROFILE}; + $fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/fex'; + $tmpdir = $ENV{FEXTMP} || $ENV{TMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $useragent = sprintf("fexget-$version (%s %s)", + $Config{osname},$Config{archname}); + $SSL{SSL_verify_mode} = 0; + chdir $ENV{USERPROFILE}.'\Desktop'; + # open XX,'>XXXXXX';close XX; +} else { + $0 =~ s:(.*)/:: and $ENV{PATH} .= ":$1"; + $fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/.fex'; + $tmpdir = $ENV{FEXTMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $_ = `(lsb_release -d||uname -a)2>/dev/null`||''; + chomp; + s/^Description:\s+//; + $useragent = "fexget-$version ($_)"; +} + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +my $usage = < 'my_prefered_image_viewer', + '\.(avi|mp4|mov)' => 'vlc -f', + '\.pdf' => 'evince', +); + +For HTTPS you can set the environment variables: +SSLVERIFY=1 # activate server identity verification +SSLVERSION=TLSv1 # this is the default +SSLCAPATH=/etc/ssl/certs # path to trusted (root) certificates +SSLCAFILE=/etc/ssl/cert.pem # file with trusted (root) certificates +SSLCIPHERLIST=HIGH:!3DES # see http://www.openssl.org/docs/apps/ciphers.html + +You can set these environment variables also in $HOME/.fex/config.pl, as well as +the $opt_* variables, e.g.: + +$ENV{SSLVERSION} = 'TLSv1'; +${'opt_+'} = 1; +$opt_m = 200; +EOD + +if ($windoof and not @ARGV and not $ENV{PROMPT}) { + # restart with cmd.exe to have mouse cut+paste + my $cmd = "cmd /k \"$0\""; + # print "$cmd\n"; + exec $cmd; + exit; +} + +my $atype = '\.(tgz|tar|zip|7z)$'; +my $proxy = ''; +my $proxy_prefix = ''; +my $chunksize; + +our ($opt_h,$opt_v,$opt_l,$opt_d,$opt_m,$opt_z,$opt_K,$opt_o,$opt_a); +our ($opt_s,$opt_k,$opt_i,$opt_V,$opt_X,$opt_f,$opt_P,$opt_L,$opt_H); +$opt_m = $opt_h = $opt_v = $opt_l = $opt_d = $opt_K = $opt_o = $opt_a = 0; +$opt_V = $opt_X = $opt_f = $opt_L = $opt_H = 0; +${'opt_+'} = 0; +$opt_s = $opt_k = $opt_i = $opt_P = ''; +$_ = "$fexhome/config.pl"; require if -f; +getopts('hvVHlLdkzoaXf+m:s:i:K:P:') or die $usage; +$opt_k = '?KEEP' if $opt_k; + +if ($opt_m =~ /(\d+)/) { + $opt_m = $1 +} else { + $opt_m = 0 +} + +print "Version: $version\n" if $opt_V; +die $usage if $opt_h; +if ($opt_H) { + print $hints; + exit; +} + +# set SSL/TLS options +$SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); +foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) +) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); +} + +if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } +} elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! +} else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + +my $ffl = "$tmpdir/fexget"; # F*EX files list (cache) + +my @rcamel = ( +' +(_*) _ _ + \\\\/ \\/ \\ + \ __ )=* + //\\\\//\\\\ +', +' \\\\/\\\\/ +', +' //\\\\//\\\\ +'); + +# get fexlog +if ($opt_z) { + my $cmd = "$fexsend -Z"; + $cmd .= " -i $opt_i" if $opt_i; + warn "$cmd\n" if $opt_v; + exec $cmd; + die "$0: cannot run $cmd : $!\n"; +} + +if ($opt_l) { + &list; + exit; +} + +if ($opt_L) { + my $cmd = "$fexsend -L"; + $cmd .= " -i $opt_i" if $opt_i; + warn "$cmd\n" if $opt_v; + exec $cmd; + die "$0: cannot run $cmd : $!\n"; +} + +if ($opt_P) { + if ($opt_P =~ /^([\w.-]+:\d+)(:(\d+))?/) { + $proxy = $1; + $chunksize = $3 || 0; + } else { + die "$0: proxy must be: SERVER:PORT\n"; + } +} + +if ($opt_a) { + $opt_X = $opt_a; + die $usage if @ARGV; + &list; + print "\n"; + if (open $ffl,$ffl) { + while (<$ffl>) { + push @ARGV,$1 if /^\s+(\d+)/; + } + close $ffl; + } +} else { + unless (@ARGV) { + if ($windoof) { + my $url; + for (;;) { + print "download-URL: "; + chomp($url = ); + if ($url =~ /^http/) { + @ARGV = ($url); + last; + } + } + } else { + die $usage; + } + } +} + +my ($file,%files,$download,$server,$port,$fop); + +if ($opt_f) { + unless ($ENV{FEXID} or -f $ENV{HOME}.'/.fex/id') { + die "$0: no local FEXID\n"; + } + $opt_f = pop(@ARGV); + if ($opt_f =~ /^\d+$|^https?:/) { + die "$0: $opt_f is not an e-mail address\n"; + } +} + +URL: foreach my $url (@ARGV) { + + # do not overrun server + sleep 1 if $fop; + + if ($url !~ /^http/) { + unless (%files) { + open $ffl,$ffl or die "$0: no $ffl, use first: $0 -l\n"; + my $from = ''; + while (<$ffl>) { + if (/^from (.+) :$/) { + $from = $1; + } elsif (/^\s*(\d+)\)\s+\d+ MB.* (http\S+)/) { + push @{$files{all}},$2; + push @{$files{$from}},$2; + } + } + close $ffl; + } + + if ($url =~ /^(\d+)$/) { + $url = ${files{all}}[$1-1] or die "$0: unknown file number\n"; + } + } + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/.*fop/\S+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $fop = $5; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + if ($proxy) { + if ($port == 80) { $proxy_prefix = "http://$server" } + elsif ($port == 443) { $proxy_prefix = "" } + else { $proxy_prefix = "http://$server:$port" } + } + + serverconnect($server,$port); + + if ($opt_f) { + forward($url); + next; + } + + if ($opt_d) { + my @r = del($url); + $_ = shift @r; + if (/^HTTP.* 200/) { + ($file) = grep { $_ = $1 if /^X-File:\s+(.+)/ } @r; + $file = $url unless $file; + $file =~ s:.*/::; + printf "%s deleted\n",urldecode($file); + } else { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_"; + } + next; + } + + if ($opt_K) { + my @r = keep($url); + $_ = shift @r; + if (/^HTTP.* 200/) { + $file = $url; + $file =~ s:.*/::; + print "$file kept\n"; + } else { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_"; + } + next; + } + + $download = download($server,$port,$fop); + exit if $opt_s eq '-'; + unlink $download unless -s $download; + exit 2 unless -f $download; + + if ($windoof) { + print "READY\n"; + exit; + } + + if (not $opt_X and $download =~ /\.gpg$/) { + if (-t) { + print "decrypt \"$download\"? "; + $_ = ||'y'; + unless (/^[y\n]/i) { + print "keeping \"$download\"\n"; + exit; + } + } + if (system('gpg',$download) == 0) { + unlink $download; + $download =~ s/\.gpg$//; + } + } + + unless ($opt_X) { + + foreach my $a (keys %autoview) { + if ($download =~ /$a$/i and $autoview{$a}) { + printf "run \"%s %s\" [Yn] ? ",$autoview{$a},basename($download); + $_ = ||''; + system sprintf("%s %s",$autoview{$a},quote($download)) if /^y|^$/i; + next URL; + } + } + + if ($ENV{DISPLAY} and $download =~ /\.(gif|jpg|png|tiff?)$/i) { + # see also mimeopen and xdg-mime + if (my $xv = $xv || pathsearch('xv') || pathsearch('xdg-open')) { + printf "run \"%s %s\" [Yn] ? ",basename($xv),basename($download); + $_ = ||''; + system $xv,$download if /^y|^$/i; + next URL; + } + } + + if ($download =~ /$atype/) { + if ($download =~ /\.(tgz|tar.gz)$/) { extract('tar tvzf','tar xvzf') } + elsif ($download =~ /\.tar$/) { extract('tar tvf','tar xvf') } + elsif ($download =~ /\.zip$/i) { extract('unzip -l','unzip') } + elsif ($download =~ /\.7z$/i) { extract('7z l','7z x') } + else { die "$0: unknown archive \"$download\"\n" } + if ($? == 0) { + unlink $download; + } else { + die "$0: keeping \"$download\"\n"; + } + } + } + +} + +exit; + +sub extract { + my $l = shift; + my $x = shift; + my $d = $download; + my $xd = '.'; + local $_; + + if (-t and not $windoof) { + print "Files in archive:\n"; + system(split(' ',$l),$download); + $d =~ s:.*/:./:; + $d =~ s/\.[^.]+$//; + for (;;) { + $xd = inquire("extract to directory (Ctrl-C to keep archive): ",$d); + last if $xd =~ s:^(\./*)*!?$:./:; + if ($xd eq '-') { + print "keeping $download\n"; + exit; + } + if ($xd !~ s/!$//) { + if (-d $xd) { + print "directory $xd does already exist, add \"!\" to overwrite\n"; + redo; + } + unless (mkdir $xd) { + print "cannot mkdir $xd - $!\n"; + redo; + } + } + unless (chdir $xd) { + print "cannot chdir $xd - $!\n"; + redo; + } + last; + } + } + print "extracting to $xd :\n"; + system(split(' ',$x),$download); +} + +sub del { + my $url = shift; + my ($server,$port); + my $del; + my @r; + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $del = $5.'?DELETE'; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + sendheader("$server:$port","GET $del HTTP/1.1","User-Agent: $useragent"); + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + warn "<-- $_" if $opt_v; + push @r,$_; + } + die "$0: no response from fex server $server\n" unless @r; + return @r; +} + + +sub forward { + my $url = shift; + my ($server,$port); + my ($uri,$dkey,$list,$cmd,$n); + my @r; + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $uri = $5; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + sendheader( + "$server:$port", + "GET $uri?COPY HTTP/1.1", + "User-Agent: $useragent", + ); + + $_ = <$SH>; + die "$0: no reply from fex server $server\n" unless $_; + warn "<-- $_" if $opt_v; + + unless (/^HTTP.*200/) { + s/^HTTP.... \d+ //; + die "$0: $_"; + } + + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + $dkey = $1 if /^Location:.*\/(\w+)\/.+/; + warn "<-- $_" if $opt_v; + } + + $cmd = 'fexsend -l >/dev/null 2>&1'; + print "$cmd\n" if $opt_v; + system 'fexsend -l >/dev/null 2>&1'; + $list = $ENV{HOME}.'/.fex/tmp/fexlist'; + open $list,$list or die "$0: cannot open $list - $!\n"; + while (<$list>) { + if (/^\s+(\d+)\) (\w+)/ and $2 eq $dkey) { + $n = $1; + $cmd = "fexsend -b $n $opt_f"; + print "$cmd\n" if $opt_v; + system $cmd; + last; + } + } + close $list; + + if ($n) { + $cmd = "fexsend -d $n >/dev/null 2>&1"; + print "$cmd\n" if $opt_v; + system $cmd; + } else { + warn "$0: forwarding failed\n"; + } +} + + +sub keep { + my $url = shift; + my ($server,$port); + my $keep; + my (@hh,@r); + + if ($url =~ m{^http(s?)://([\w\.\-]+)(:(\d+))?(/fop/.+)}) { + $server = $2; + $port = $4 || ($1?443:80); + $keep = "$5?KEEP=$opt_K"; + } else { + die "$0: unknown F*EX URL $url\n"; + } + + push @hh,"GET $keep HTTP/1.1", + "Host: $server:$port", + "User-Agent: $useragent", + ""; + + foreach (@hh) { + warn $_,"\n" if $opt_v; + print $SH $_,"\r\n"; + } + while (<$SH>) { + s/\r//; + last if /^\n/; + push @r,$_; + } + die "$0: no response from fex server $server\n" unless @r; + grep { warn "\t$_" } @r if $opt_v; + return @r; +} + + +sub download { + my ($server,$port,$fop,$nocheck) = @_; + my ($file,$download,$ssl,$pipe,$filesize,$checkstorage); + my (@hh,@r); + my ($t0,$t1,$t2,$tt,$tm,$ts,$kBs,$b,$bt,$tb,$B,$buf); + my $length = 0; + my $seek = 0; + my $tc = 0; + local $_; + local *X; + + if ($opt_s) { + $file = $opt_s; + if ($opt_s eq '-') { + $pipe = $download = $opt_s; + } elsif (-p $opt_s or -c $opt_s) { + $download = $opt_s; + } else { + $download = $file.'.tmp'; + $seek = -s $download || 0; + } + } else { + # ask server for real file name + serverconnect($server, $port); + sendheader("$server:$port","HEAD $proxy_prefix$fop HTTP/1.1","User-Agent: $useragent"); + my $reply = $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + warn "<-- $_" if $opt_v; + unless (/^HTTP\/[\d.]+ 200/) { + s:HTTP/[\d. ]+::; + die "$0: server response: $_"; + } + while (<$SH>) { + s/\r//; + warn "<-- $_" if $opt_v; + last if /^\r?\n/; + if (/^Content-Disposition: attachment; filename="(.+)"/i) { + $file = locale(decode_utf8($1)); + $file =~ s:.*/::; + } + } + unless ($file) { + $file = $fop; + $file =~ s:.*/::; + } + $download = $file.'.tmp'; + $seek = -s $download || 0; + } + + push @hh,"GET $proxy_prefix$fop$opt_k HTTP/1.1", + "User-Agent: $useragent", + "Connection: close"; + push @hh,"Range: bytes=$seek-" if $seek; + + # HTTPS needs a new connection for actually downloading the file + serverconnect($server,$port) if $opt_P and $port == 443; + sendheader("$server:$port",@hh); + $_ = <$SH>; + die "$0: no response from fex server $server\n" unless $_; + s/\r//; + + if (/^HTTP\/[\d.]+ 2/) { + warn "<-- $_" if $opt_v; + while (<$SH>) { + s/\r//; + warn "<-- $_" if $opt_v; + last if /^\r?\n/; + if (/^Content-length:\s*(\d+)/i) { + $length = $1; + } elsif (/^X-Size: (\d+)/i) { + $filesize = $1; + } + } + } else { + s/HTTP\/[\d.]+ \d+ //; + die "$0: bad server reply: $_"; + } + + if ($pipe) { + *X = *STDOUT; + } else { + if ($opt_s and $opt_s eq $download) { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + $checkstorage = $filesize unless $nocheck; + } else { + if (-e $file and not $opt_o) { + die "$0: destination file \"$file\" does already exist\n"; + } + if ($seek) { + open X,'>>',$download or die "$0: cannot write to \"$download\" - $!\n"; + } else { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + $checkstorage = $filesize unless $nocheck; + } + } + if ($checkstorage and not $nocheck) { + $t0 = time; + my $n = 0; + print STDERR "checking storage...\r"; + $buf = '.' x M; + while (-s $download < $checkstorage) { + syswrite X,$buf or do { + unlink $download; + die "\n$0: cannot write $download - $!\n"; + }; + $n++; + print STDERR "checking storage... ".$n." MB\r"; + } + close X or do { + unlink $download; + die "\n$0: cannot write $download - $!\n"; + }; + print STDERR "checking storage... ".$n." MB ok!\n"; + unlink $download; + if (time-$t0 < 25) { + open X,'>',$download or die "$0: cannot write to \"$download\" - $!\n"; + } else { + # retry after timeout + return(download($server,$port,$fop,'nocheck')) + } + } + } + + $t0 = $t1 = $t2 = int(time); + $tb = $B = 0; + printf STDERR "resuming at byte %s\n",$seek if $seek; + print $rcamel[0] if ${'opt_+'}; + while ($B < $length and $b = read $SH,$buf,$bs) { + syswrite X,$buf; + $B += $b; + $tb += $b; + $bt += $b; + $t2 = time; + if (${'opt_+'} and int($t2*10)>$tc) { + print $rcamel[$tc%2+1]; + $tc = int($t2*10); + } + if (int($t2) > $t1) { + $kBs = int($bt/k/($t2-$t1)); + $kBs = int($tb/k/($t2-$t0)) if $kBs < 10; + $t1 = $t2; + $bt = 0; + # smaller block size is better on slow links + $bs = 4096 if $bs>4096 and $tb/($t2-$t0)<65536; + if ($tb<10*M) { + printf STDERR "%s: %d kB (%d%%) %d kB/s \r", + $download, + int(($tb+$seek)/k), + int(($tb+$seek)/($length+$seek)*100), + $kBs; + } else { + printf STDERR "%s: %d MB (%d%%) %d kB/s \r", + $download, + int(($tb+$seek)/M), + int(($tb+$seek)/($length+$seek)*100), + $kBs; + } + } + if ($opt_m) { + if ($t2 == $t0 and $B > $opt_m*k) { + print "\nsleeping...\r" if $opt_v; + sleep 1; + } else { + while ($t2 > $t0 and $tb/k/($t2-$t0) > $opt_m) { + print "\nsleeping...\r" if $opt_v; + sleep 1; + $t2 = time; + } + } + } + } + close $SH; + close X; + + print $rcamel[2] if ${'opt_+'}; + + $tt = $t2-$t0; + $tm = int($tt/60); + $ts = $tt-$tm*60; + $kBs = int($tb/k/($tt||1)); + if ($seek) { + printf STDERR "$file: %d MB, last %d MB in %d s (%d kB/s) \n", + int(($tb+$seek)/M),int($tb/M),$tt,$kBs; + } else { + printf STDERR "$file: %d MB in %d s (%d kB/s) \n", + int($tb/M),$tt,$kBs; + } + + if ($tb != $length) { + if ($windoof) { + exec "\"$0\" @ARGV"; + exit; + } else { + die "$0: $server annouced $length bytes, but only $tb bytes has been read\n"; + } + } + + unless ($pipe or -p $download or -c $download) { + my @s = stat $file if -e $file; + rename $download,$file + or die "$0: cannot rename \"$download\" to \"$file\" - $!\n"; + chmod $s[2],$file if @s; + } + + return sprintf("%s/%s",getcwd(),$file); +} + + +sub list { + my $cmd = "$fexsend -L"; + $cmd .= " -i $opt_i" if $opt_i; + if ($opt_v) { + $cmd .= " -v"; + warn "$cmd\n"; + } + open $cmd,"$cmd|" or die "$0: cannot run $cmd : $!\n"; + open $ffl,'>',$ffl or die "$0: cannot open $ffl : $!\n"; + my $n; + while (<$cmd>) { + if (/\d MB .*http/) { + $n++; + printf {$ffl} "%4d) %s",$n,$_; + s:http[^\"]*/::; + printf "%4d) %s",$n,$_; + } else { + print; + print {$ffl} $_; + } + } +} + + +sub locale { + my $string = shift; + + if ($CTYPE) { + if ($CTYPE =~ /UTF-?8/i) { + return $string; + } elsif (grep { $CTYPE =~ /^$_$/i } Encode->encodings()) { + return encode($CTYPE,$string); + } else { + return encode('ISO-8859-1',$string); + } + } + + return $string; +} + + +sub pathsearch { + my $prg = shift; + + foreach my $dir (split(':',$ENV{PATH})) { + return "$dir/$prg" if -x "$dir/$prg"; + } +} + + +sub quote { + local $_ = shift; + s/([^\w¡-ÿ_%\/=~:.,-])/\\$1/g; + return $_; +} + + +{ + my $tty; + + sub inquire { + my $prompt = shift; + my $default = shift; + local $| = 1; + local $_; + + if (defined $default) { + unless ($tty) { + chomp($tty = `tty 2>/dev/null`); + eval { local $^W; require "sys/ioctl.ph"; }; + } + + if (defined(&TIOCSTI) and $tty and open($tty,'>',$tty)) { + print $prompt; + foreach my $a (split("",$default)) { ioctl($tty,&TIOCSTI,$a) } + chomp($_ = ||''); + } else { + $prompt =~ s/([\?:=]\s*)/ [$default]$1/ or $prompt .= " [$default]"; + print $prompt; + chomp($_ = ||''); + $_ = $default unless length; + } + } else { + print $prompt; + chomp($_ = ||''); + } + + return $_; + } +} + + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/htdocs/download/fexsend b/htdocs/download/fexsend new file mode 100755 index 0000000..607d139 --- /dev/null +++ b/htdocs/download/fexsend @@ -0,0 +1,3055 @@ +#!/usr/bin/perl -w + +# CLI client for the F*EX service (send, list, delete) +# +# see also: fexget +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +use 5.006; +use strict qw'vars subs'; +use Encode; +use Config; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Getopt::Std; +use File::Basename; +use Cwd qw'abs_path'; +use Fcntl qw':flock :mode'; +use Digest::MD5 qw'md5_hex'; # encrypted ID / SID +use Time::HiRes qw'time'; +# use Smart::Comments; +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +&update if "@ARGV" eq 'UPDATE'; + +$| = 1; + +our ($SH,$fexhome,$idf,$tmpdir,$windoof,$useragent,$editor,$nomail); +our ($anonymous,$public); +our ($tpid,$frecipient); +our ($FEXID,$FEXXX,$HOME); +our (%alias); +our $chunksize = 0; +our $version = 20150120; +our $_0 = $0; +our $DEBUG; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +if ($Config{osname} =~ /^mswin/i) { + $windoof = $Config{osname}; + $HOME = $ENV{USERPROFILE}; + $fexhome = $ENV{FEXHOME} || $HOME.'\fex'; + $tmpdir = $ENV{FEXTMP} || $ENV{TEMP} || "$fexhome\\tmp"; + $idf = "$fexhome\\id"; + $editor = $ENV{EDITOR} || 'notepad.exe'; + $useragent = sprintf("fexsend-$version (%s %s)", + $Config{osname},$Config{archname}); + $SSL{SSL_verify_mode} = 0; +} else { + $0 =~ s:.*/::; + $HOME = (getpwuid($<))[7]||$ENV{HOME}; + $fexhome = $HOME.'/.fex'; + $tmpdir = $ENV{FEXTMP} || "$fexhome/tmp"; + $idf = "$fexhome/id"; + $editor = $ENV{EDITOR} || 'vi'; + $_ = `(lsb_release -d||uname -a)2>/dev/null`||''; + chomp; + s/^Description:\s+//; + $useragent = "fexsend-$version ($_)"; + chmod 0600,$idf; +} + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +my $from = ''; +my $to = ''; +my $id = ''; +my $skey = ''; +my $gkey = ''; +my $atype = ''; # archive type +my $fexcgi; # F*EX CGI URL +my @files; # files to send +my %AB = (); # server based address book +my ($server,$port,$sid); +my $proxy = ''; +my $proxy_prefix = ''; +my $features = ''; +my $timeout = 30; # server timeout +my $fexlist = "$tmpdir/fexlist"; +my ($usage,$hints); +my $xx = $0 =~ /^xx/; + +if ($xx) { + $usage = "usage: send file(s): xx [:slot] file...\n". + " or: send STDIN: xx [:slot] -\n". + " or: send pipe: ... | xx [:slot] \n". + " or: get file(s) or STDIN: xx [:slot] \n". + " or: get file(s) no-questions: xx [:slot] --\n". + "examples: dmesg | xx\n". + " xx project\n". + " xx --\n". + " xx :conf /etc /boot\n"; +} else { + $usage = < 'user1\@domain1.org', + 'alias2' => 'user2\@domain2.org', + 'both' => 'user1\@domain1.org,user2\@domain2.org', + 'extra' => 'extra\@special.net:-i other -K -k 30', + ); + +fexsend also respects aliases in $HOME/.mutt/aliases +The alias priority is (descending): +\$HOME/.fex/config.pl +\$HOME/.mutt/aliases +fexserver address book + +In \$HOME/.fex/config.pl you can also set the SSL* environment variables and the +\$opt_* variables, e.g.: + +\$ENV{SSLVERSION} = 'TLSv1'; +\${'opt_+'} = 1; +\$opt_m = 200; +EOD +} + +my @rcamel = ( +' + _ _ c*_) + / \/ \// + *=( __ / + \\\\/\\\\/ +', +' \\\\/\\\\/ +', +' //\\\\//\\\\ +'); + +autoflush STDERR; + +if ($windoof and not @ARGV and not $ENV{PROMPT}) { + # restart with cmd.exe to have mouse cut+paste + exec qw'cmd /k',$0,'-W'; + exit; +} + +unless (-d $fexhome) { + mkdir $fexhome,0700 or die "$0: cannot create FEXHOME $fexhome - $!\n"; +} + +unless (-d $tmpdir) { + mkdir $tmpdir,0700 or die "$0: cannot create tmpdir $tmpdir - $!\n"; +} + +my @_ARGV = @ARGV; # save arguments + +our ($opt_q,$opt_h,$opt_H,$opt_v,$opt_m,$opt_c,$opt_k,$opt_d,$opt_l,$opt_I, + $opt_K,$opt_D,$opt_u,$opt_f,$opt_a,$opt_C,$opt_R,$opt_M,$opt_L,$opt_Q, + $opt_A,$opt_i,$opt_z,$opt_Z,$opt_b,$opt_P,$opt_x,$opt_X,$opt_V,$opt_U, + $opt_s,$opt_o,$opt_g,$opt_F,$opt_n,$opt_r,$opt_S,$opt_N); + +if ($xx) { + $opt_q = 1 if @ARGV and $ARGV[-1] eq '--' and pop @ARGV or not -t STDOUT; + $opt_h = $opt_v = $opt_m = $opt_I = 0; + $opt_X = ''; + $_ = "$fexhome/config.pl"; require if -f; + getopts('hvIm:') or die $usage; +} else { + $opt_h = $opt_v = $opt_m = $opt_c = $opt_k = $opt_d = $opt_l = $opt_I = 0; + $opt_H = $opt_K = $opt_D = $opt_R = $opt_M = $opt_L = $opt_Q = $opt_A = 0; + $opt_x = $opt_o = $opt_g = $opt_V = $opt_U = $opt_F = $opt_n = $opt_q = 0; + $opt_S = $opt_N = 0; + ${'opt_@'} = ${'opt_!'} = ${'opt_+'} = ${'opt_.'} = ${'opt_/'} = 0; + ${'opt_='} = ${'opt_#'} = ''; + $opt_u = $opt_f = $opt_a = $opt_C = $opt_i = $opt_b = $opt_P = $opt_X = ''; + $opt_s = $opt_r = ''; + $_ = "$fexhome/config.pl"; require if -f; + getopts('hHvcdognVDKlILUARWMFzZqQS@!+./r:m:k:u:f:a:s:C:i:b:P:x:X:N:=:#:') + or die $usage; + + if ($opt_H) { + print $hints; + exit; + } + + if ($opt_V) { + print "Version: $version\n"; + } + + if ($opt_K and $opt_D) { + die "$0: you cannot use both options -D and -K\n"; + } + + if ($opt_a and $opt_c) { + die "$0: you cannot use both options -a and -c\n"; + } + + if ($opt_a and $opt_s) { + die "$0: you cannot use both options -a and -s\n"; + } + + if ($opt_g and $opt_c) { + $opt_c = 0; + } + + $opt_f ||= $opt_b; + if ($opt_f and $opt_f !~ /^\d+$/) { + die "$0: option -f needs a number, see $0 -l\n"; + } + + if ($opt_I and $opt_R) { + die "$0: you cannot use both options -I and -R\n"; + } + + # $opt_C is COMMENT command in F*EX protocol + $opt_C = + ($opt_d) ? 'DELETE': + ($opt_l or $opt_L) ? 'LIST': + ($opt_Q) ? 'CHECKQUOTA': + ($opt_S) ? 'LISTSETTINGS': + ($opt_Z) ? 'RECEIVEDLOG': + ($opt_z) ? 'SENDLOG': + (${'opt_!'}) ? 'FOPLOG': + $opt_C; + + $opt_D = + ($opt_D) ? 'DELAY': + ($opt_K) ? 'NO': + $opt_D; +} + +&get_ssl_env; + +if ($opt_h) { + female_mode("show help?") if $opt_F; + print $usage; + exit; +} + + +if ($opt_R) { + ®ister; + exit; +} + + +die $usage if $opt_m and $opt_m !~ /^\d+/; + +if ($opt_P) { + if ($opt_P =~ /^([\w.-]+:\d+)(:(\d+))?/) { + $proxy = $1; + $chunksize = $3 || 0; + } else { + die "$0: proxy must be: SERVER:PORT\n"; + } +} + +if ($FEXID = $ENV{FEXID}) { + $FEXID = decode_b64($FEXID) if $FEXID !~ /\s/; + ($fexcgi,$from,$id) = split(/\s+/,$FEXID); +} else { + if ($windoof and not -f $idf) { &init_id } + if (open $idf,$idf) { + &get_id($idf); + close $idf; + } +} + +if ($xx) { + # convert old idxx file + if ($idf and open $idf,$idf.'xx') { + &get_id($idf); + close $idf; + if (open $idf,'>>',$idf) { + print {$idf} "\n[xx]\n", + "$fexcgi\n", + "$from\n", + "$id\n"; + close $idf; + unlink $idf.'xx'; + } + } + + # special xx ID? + if ($FEXXX = $ENV{FEXXX}) { + $FEXXX = decode_b64($FEXXX) if $FEXXX !~ /\s/; + ($fexcgi,$from,$id) = split(/\s+/,$FEXXX); + } elsif (open $idf,$idf) { + while (<$idf>) { + if (/^\[xx\]/) { + $proxy = $proxy_prefix = ''; + &get_id($idf); + last; + } + } + close $idf; + } + +} else { + + # alternativ ID? + if ($opt_i) { + $proxy = $proxy_prefix = ''; + open $idf,$idf or die "$0: cannot open $idf - $!\n"; + while (<$idf>) { + if (/^\[$opt_i\]/) { + &get_id($idf); + last; + } + } + close $idf; + die "$0: no [$opt_i] in $idf\n" unless $_; + } +} + +if ($opt_I) { + if ($xx) { &show_id } + else { &init_id } + exit; +} + +if (@ARGV > 1 and $ARGV[-1] =~ /(^|\/)anonymous/) { + $fexcgi = $1 if $ARGV[-1] =~ s:(.+)/::; + die "usage: $0 [options] file FEXSERVER/anonymous\n" unless $fexcgi; + $anonymous = $from = 'anonymous'; + $sid = $id = 'ANONYMOUS'; +} elsif (@ARGV > 1 and $id eq 'PUBLIC') { + $public = $sid = $id; +} elsif (@ARGV > 1 and $ARGV[-1] =~ m{^(https?://[\w.-]+(:\d+)?/fup\?[sg]key=\w+)}) { + $fexcgi = $1; + $skey = $1 if $fexcgi =~ /skey=(\w+)/; + $gkey = $1 if $fexcgi =~ /gkey=(\w+)/; +} else { + + $fexcgi = $opt_u if $opt_u; + + if (not -e $idf and not ($fexcgi and $from and $id)) { + die "$0: no ID file $idf found, use \"fexsend -I\" to create it\n"; + } + + unless ($fexcgi) { + die "$0: no FEX URL found, use \"$0 -u URL\" or \"$0 -I\"\n"; + } + + unless ($from and $id) { + die "$0: no sender found, use \"$0 -f FROM:ID\" or \"$0 -I\"\n"; + } + + if ($fexcgi !~ /^http/) { + if ($fexcgi =~ /:443/) { $fexcgi = "https://$fexcgi" } + else { $fexcgi = "http://$fexcgi" } + } + +} + +$server = $fexcgi; + +$port = 80; +$port = 443 if $server =~ s{https://}{}; +$port = $1 if $server =~ s/:(\d+)//; + +if (0 and $port == 443) { + $opt_s and die "$0: cannot use -s with https due to stunnel bug\n"; + $opt_g and die "$0: cannot use -g with https due to stunnel bug\n"; +} + +$server =~ s{http://}{}; +$server =~ s{/.*}{}; + +# $chunksize = 4*k unless $chunksize; +$chunksize *= M; + +if ($proxy) { + if ($port == 80) { $proxy_prefix = "http://$server" } + elsif ($port != 443) { $proxy_prefix = "http://$server:$port" } +} + +# xx: special file exchange between own accounts +if ($xx) { + my $transferfile = "$tmpdir/STDFEX"; + # slot? + if ($0 eq 'xxx') { + $transferfile = "$tmpdir/xx:xxx"; + } elsif (@ARGV and $ARGV[0] =~ /^:([\w.=+-]+)$/) { + $transferfile = "$tmpdir/xx:$1"; + shift @ARGV; + } + open my $lock,'>>',$transferfile + or die "$0: cannot write $transferfile - $!\n"; + flock($lock,LOCK_EX|LOCK_NB) + or die "$0: $transferfile is locked by another process\n"; + truncate $transferfile,0; + if (not @ARGV and -t) { + &get_xx($transferfile); + } else { + &send_xx($transferfile); + } + exit; +} + +# regular fexsend + +&inquire if $windoof and not @ARGV and not + ($opt_l or $opt_L or $opt_Q or $opt_A or $opt_U or $opt_I or + $opt_f or $opt_x or $opt_N); + +if (${'opt_.'}) { + $opt_C = "!SHORTMAIL! $opt_C"; +} + +if ($opt_n or $opt_C =~ /NOMAIL|!#!/) { + $nomail = 'NOMAIL'; +} + +unless ($skey or $gkey or $anonymous) { + if (not $opt_q and ( + $opt_f||$opt_x||$opt_Q||$opt_l||$opt_L||$opt_U||$opt_z||$opt_Z||$opt_A + ||$opt_d||${'opt_!'}||${'opt_@'}) + ) { warn "Server/User: $fexcgi/$from\n" } +} + +if ($opt_V and not @ARGV) { exit } +if ($opt_f) { &forward } +elsif ($opt_x) { &modify } +elsif ($opt_N) { &renotify } +elsif ($opt_Q) { &query_quotas } +elsif ($opt_S) { &query_settings } +elsif ($opt_l or $opt_L) { &list } +elsif ($opt_U) { &show_URL } +elsif ($opt_z or $opt_Z or ${'opt_!'}) { &get_log } +elsif ($opt_A) { edit_address_book($from) } +elsif (${'opt_@'}) { &show_address_book } +elsif ($opt_d and $anonymous) { &purge } +elsif ($opt_d and $ARGV[-1] =~ /^\d+$/) { &delete } +else { &send_fex } + +exit; + + +# initialize ID file or show ID +sub init_id { + my $tag; + my $proxy = ''; + + if ($opt_I) { + $tag = shift @ARGV; + die $usage if @ARGV; + } + + $fexcgi = $from = $id = ''; + + unless (-d $fexhome) { + mkdir $fexhome,0700 or die "$0: cannot create FEXHOME $fexhome - $!\n"; + } + + # show ID + if (not $tag and open $idf,$idf) { + if ($opt_i) { + while (<$idf>) { + last if /^\[$opt_i\]/; + } + } + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + close $idf; + if ($id) { + chomp($fexcgi,$from,$id); + $FEXID = encode_b64("$fexcgi $from $id"); + if (-t STDIN) { + print "# hint: to edit the ID file $idf use \"$0 -I .\" #\n"; + print "export FEXID=$FEXID\n"; + print "history -d \$((HISTCMD-1));history -d \$((HISTCMD-1))\n"; + } else { + print "FEXID=$FEXID\n"; + } + exit; + } else { + die "$0: no ID data found\n"; + } + } + + if ($tag and $tag eq '.') { exec $ENV{EDITOR}||'vi',$idf } + + if ($tag) { print "F*EX server URL for [$tag]: " } + else { print "F*EX server URL: " } + $fexcgi = ; + $fexcgi =~ s/[\s\n]//g; + die "you MUST provide a FEX-URL!\n" unless $fexcgi; + if ($fexcgi =~ /\?/) { + $from = $1 if $fexcgi =~ /\bfrom=(.+?)(&|$)/i; + $id = $1 if $fexcgi =~ /\bid=(.+?)(&|$)/i; + $skey = $1 if $fexcgi =~ /\bskey=(.+?)(&|$)/i; + $gkey = $1 if $fexcgi =~ /\bgkey=(.+?)(&|$)/i; + $fexcgi =~ s/\?.*//; + } + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "\"$fexcgi\" is not a legal FEX-URL!\n"; + } + $fexcgi =~ s:/fup/*$::; + print "proxy address (hostname:port or empty if none): "; + $proxy = ; + $proxy =~ s/[\s\n]//g; + if ($proxy =~ /^[\w.-]+:\d+$/) { + $proxy = "!$proxy"; + } elsif ($proxy =~ /\S/) { + die "wrong proxy address format\n"; + } else { + $proxy = ""; + } + if ($proxy) { + print "proxy POST limit in MB (use 2048 if unknown): "; + $_ = ; + if (/(\d+)/) { + $proxy .= "[$1]"; + } + } + if ($skey) { + $from = 'SUBUSER'; + $id = $skey; + } elsif ($gkey) { + $from = 'GROUPMEMBER'; + $id = $gkey; + } else { + unless ($from) { + print "Your e-mail address as registered at $fexcgi: "; + $from = ; + $from =~ s/[\s\n]//g; + die "you MUST provide your e-mail address!\n" unless $from; + } + unless ($from =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "\"$from\" is not a legal e-mail address!\n"; + } + unless ($id) { + print "Your auth-ID for $from at $fexcgi: "; + $id = ; + $id =~ s/[\s\n]//g; + die "you MUST provide your ID!\n" unless $id; + } + } + if (open $idf,'>>',$idf) { + print {$idf} "\n[$tag]\n" if $tag and -s $idf; + print {$idf} "$fexcgi$proxy\n", + "$from\n", + "$id\n"; + close $idf; + print "data written to $idf\n"; + } else { + die "$0: cannot write to $idf - $!\n"; + } +} + + +sub show_id { + my ($fexcgi,$from,$id); + if (open $idf,$idf) { + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + while (<$idf>) { + if (/^\[xx\]/) { + $fexcgi = <$idf>; + $from = <$idf>; + $id = <$idf>; + } + } + close $idf; + die "$0: too few data in $idf" unless defined $id; + chomp($fexcgi); + chomp($from); + chomp($id); + $FEXXX = encode_b64("$fexcgi $from $id"); + if (-t STDIN) { + print "export FEXXX=$FEXXX\n"; + print "history -d \$((HISTCMD-1));history -d \$((HISTCMD-1))\n"; + } else { + print "FEXXX=$FEXXX\n"; + } + } else { + die "$0: cannot read $idf - $!\n"; + } +} + + +sub register { + my $fs = shift @ARGV or die $usage; + my $mail = shift @ARGV or die $usage; + my $port; + my ($server,$user,$id); + + die "$0: $idf does already exist\n" if -e $idf; + + if ($fs =~ /^https/) { + die "$0: cannot handle https at this time\n"; + } + + $fs =~ s{^http://}{}; + $fs =~ s{/.*}{}; + if ($fs =~ s/:(\d+)//) { $port = $1 } + else { $port = 80 } + + tcpconnect($fs,$port); + sendheader("$fs:$port","GET $proxy_prefix/fur?user=$mail&verify=no HTTP/1.1"); + http_response(); + + while (<$SH>) { + s/\r//; + printf "<-- $_"if $opt_v; + last if /^\s*$/; + } + + while (<$SH>) { + s/\r//; + printf "<-- $_"if $opt_v; + if (m{http://(.*)/fup\?from=(.+)&ID=(.+)}) { + $server = $1; + $user = $2; + $id = $3; + + if (open F,">$idf") { + print F "$server\n", + "$user\n", + "$id\n"; + close F; + chmod 0600,$idf; + print "user data written to $idf\n"; + print "you can now fex!\n"; + exit; + } else { + die "$0: cannot write to $idf - $!\n"; + } + } + } + + die "$0: no account data received from F*EX server\n"; + +} + + +sub send_xx { + my $transferfile = shift; + my $file = ''; + my (@r,@tar); + + $SIG{PIPE} = $SIG{INT} = sub { + unlink $transferfile; + exit 3; + }; + + if ($0 eq 'xxx') { @tar = qw'tar -cv' } + else { @tar = qw'tar -cvz' } + + if (-t) { + if ("@ARGV" eq '-') { + # store STDIN to transfer file + shelldo("cat >> $transferfile"); + } elsif (@ARGV) { + print "making tar transfer file $transferfile :\n"; + # single file? then add this directly + if (scalar @ARGV == 1) { + my ($dir,$file); + # strip path if not ending with / + if ($ARGV[0] =~ m:(.+)/(.+): and $2 !~ m:/$:) { + ($dir,$file) = ($1,$2); + chdir $dir or die "$0: $dir - $!\n"; + } else { + $file = $ARGV[0]; + } + if (-l $file) { + shelldo(@tar,qw'--dereference -f',$transferfile,$file); + } else { + shelldo(@tar,'-f',$transferfile,$file); + } + } else { + shelldo(@tar,'-f',$transferfile,@ARGV); + } + if ($?) { + unlink $transferfile; + if ($? == 2) { + die "$0: interrupted making tar transfer file\n"; + } else { + die "$0: error while making tar transfer file\n"; + } + } + } + } else { + # write input from pipe to transfer file + shelldo("cat >> $transferfile"); + } + + die "$0: no transfer file\n" unless -s $transferfile; + + serverconnect($server,$port); + query_sid($server,$port); + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + file => $transferfile, + comment => 'NOMAIL', + autodelete => $transferfile =~ /STDFEX/ ? 'NO' : 'DELAY', + ); + + # open P,'|w3m -T text/html -dump' or die "$0: w3m - $!\n"; + # print P @r; + http_response(@r); + if ($transferfile =~ /:/ and $0 ne 'xxx') { + if ("@r" =~ /\s(X-)?Location: (http.*)\s/) { + print "wget -O- $2 | tar xvzf -\n"; + } + } + + unlink $transferfile; +} + + +sub query_quotas { + my (@r,$r); + local $_; + + female_mode("query quotas?") if $opt_F; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 2/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + if (($_) = grep(/^X-Sender-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "sender quota (used): $1 ($2) MB\n"; + } else { + print "sender quota: unlimited\n"; + } + if (($_) = grep(/^X-Recipient-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "recipient quota (used): $1 ($2) MB\n"; + } else { + print "recipient quota: unlimited\n"; + } +} + + +sub query_settings { + my (@r,$r); + local $_; + + female_mode("query settings?") if $opt_F; + + if ($FEXID) { + print "ID data from \$FEXID\n"; + } elsif (-f $idf) { + print "ID data from $idf\n"; + } else { + die "$0: found no ID\n"; + } + print "server: $fexcgi\n"; + print "user: $from\n"; + print "auth-ID: $id\n"; + print "login URL: "; + &show_URL; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 2/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + if (($_) = grep(/^X-Autodelete/,@r) and /:\s+(\w+)/) { + print "autodelete: $1\n"; + } + if (($_) = grep(/^X-Default-Keep/,@r) and /(\d+)/) { + print "default keep: $1 days\n"; + } + if (($_) = grep(/^X-Default-Locale/,@r) and /:\s+(\w+)/) { + print "default locale: $1\n"; + } + if (($_) = grep(/^X-MIME/,@r) and /:\s+(\w+)/) { + print "display file with browser: $1\n"; + } + if (($_) = grep(/^X-Sender-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "sender quota (used): $1 ($2) MB\n"; + } else { + print "sender quota: unlimited\n"; + } + if (($_) = grep(/^X-Recipient-Quota/,@r) and /(\d+)\s+(\d+)/) { + print "recipient quota (used): $1 ($2) MB\n"; + } else { + print "recipient quota: unlimited\n"; + } +} + + +# list spool +sub list { + my (@r,$r); + my ($data,$dkey,$n); + local $_; + + female_mode("list spooled files?") if $opt_F; + + if ($opt_l and $n = shift @ARGV and $n =~ /^\d+$/) { + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) (.+)/ and $1 eq $n) { + serverconnect($server,$port) unless $SH; + sendheader( + "$server:$port", + "GET $proxy_prefix/fop/$2/$2?LIST HTTP/1.1", + "User-Agent: $useragent", + ); + $_ = <$SH>||''; + s/\r//; + print "<-- $_" if $opt_v; + if (/^HTTP.* 200/) { + print "<-- $_" if $opt_v; + while (<$SH>) { + s/\r//; + if (/^\n/) { + print; + print while <$SH>; + } + } + } elsif (s:HTTP/[\d\. ]+::) { + die "$0: server response: $_"; + } else { + die "$0: no response from fex server $server\n"; + } + exit; + } + } + die "$0: file \#$n not found in fexlist\n"; + } else { + @r = formdatapost( + from => $from, + to => $opt_l ? '*' : $from, + command => $opt_C, + ); + } + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + + # list sent files + if ($opt_l) { + open $fexlist,">$fexlist" or die "$0: cannot write $fexlist - $!\n"; + foreach (@r) { + next unless /
/ or $data;
+      $data = 1;
+      last if m:
:; + if (//) { $dkey = $1 } + else { $dkey = '' } +# $_ = encode_utf8($_); + s/<.*?>//g; + if (/^(to .* :)/) { + print "\n$1\n"; + print {$fexlist} "\n$1\n"; + } elsif (m/(\d+) MB (.+)/) { + $n++; + printf "%4s) %8d MB %s\n","#$n",$1,$2; + printf {$fexlist} "%3d) %s %s\n",$n,$dkey,$2; + } + } + close $fexlist; + } + + # list received files + if ($opt_L) { + foreach (@r) { + next unless /
/ or $data;
+      $data = 1;
+      next if m:
:;
+      last if m:
:; + if (/(from .* :)/) { + print "\n$1\n"; + } + if (m{(\d+) (MB.*)
(.+)( ".*")?}) { + printf "%8d %s%s%s\n",$1,$2,$3,($5||''); + } + } + } +} + + +sub show_URL { + printf "%s/fup/%s\n",$fexcgi,encode_b64("from=$from&id=$id"); +} + + +sub get_log { + my (@r); + local $_; + + @r = formdatapost( + from => $from, + to => $from, + id => $sid, + command => $opt_C, + ); + die "$0: no response from fex server $server\n" unless @r; + $_ = shift @r; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + die "$0: server response: $_\n"; + } + while (shift @r) {} + foreach (@r) { print "$_\n" } +} + + +sub show_address_book { + my (%AB,@r); + my $alias; + local $_; + + %AB = query_address_book($server,$port,$from); + foreach $alias (sort keys %AB) { + next if $alias eq 'ADDRESS_BOOK'; + $_ = sprintf "%s = %s (%s) # %s\n", + $alias, + $AB{$alias}, + $AB{$alias}->{options}, + $AB{$alias}->{comment}; + s/ \(\)//; + s/ \# $//; + print; + } +} + + +sub purge { + die "$0: not yet implemented\n"; +} + + +sub delete { + my ($to,$file); + + while (@ARGV) { + $opt_d = shift @ARGV; + die "$usage: $0 -d #\n" if $opt_d !~ /^\d+$/; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^to (.+\@.+) :/) { + $to = $1; + } elsif (/^\s*(\d+)\) (\w+) (.+)/ and $1 eq $opt_d) { + serverconnect($server,$port) unless $SH; + sendheader( + "$server:$port", + "GET $proxy_prefix/fop/$2/$2?DELETE HTTP/1.1", + "User-Agent: $useragent", + ); + $_ = <$SH>||''; + s/\r//; + print "<-- $_" if $opt_v; + if (/^HTTP.* 200/) { + while (<$SH>) { + s/\r//; + last if /^\n/; # ignore HTML output + print "<-- $_" if $opt_v; + if (/^X-File:.*\/(.+)/) { + printf "%s deleted\n",decode_utf8(urldecode($1)); + } + } + undef $SH; + } elsif (s:HTTP/[\d\. ]+::) { + die "$0: server response: $_"; + } else { + die "$0: no response from fex server $server\n"; + } + last; + } + } + close $fexlist; + sleep 1; # do not overrun server + } + + exit; +} + + +sub send_fex { + my @to; + my $file = ''; + my @files = (); + my ($data,$aname,$alias); + my (@r,$r); + my $ma = $HOME.'/.mutt/aliases'; + my $t0 = time; + my $transferfile; + my @transferfiles; + local $_; + + if ($from =~ /^SUBUSER|GROUPMEMBER$/) { + $to = '_'; + } else { + # look for single @ in arguments + for (my $i=1; $i<$#ARGV; $i++) { + if ($ARGV[$i] eq '@') { + $ARGV[$i] = join(',',@ARGV[$i+1 .. $#ARGV]); + $#ARGV = $i; + last; + } + } + $to = pop @ARGV or die $usage; + if ($to eq '.') { + $to = $from; + $nomail = $opt_C ||= 'NOMAIL'; + } + if ($to eq ':') { + $to = $from; + $nomail = $opt_C ||= 'NOMAIL'; + } + if ($opt_g and $to =~ /,/) { + die "$0: encryption is supported to only one recipient\n"; + } + if ($to =~ m{^https?://.*/fup\?skey=(\w+)}) { + $from = 'SUBUSER'; + $to = '_'; + $id = $1; + } + if ($to =~ m{^https?://.*/fup\?gkey=(\w+)}) { + $from = 'GROUPMEMBER'; + $to = '_'; + $id = $1; + } + } + @to = split(',',lc($to)); + + die $usage unless @ARGV or $opt_a or $opt_s; + die $usage if $opt_s and @ARGV; + + # early serverconnect necessary for X-Features info + serverconnect($server,$port); + + if ($anonymous) { + my $aok; + sendheader("$server:$port","OPTIONS FEX HTTP/1.1"); + $_ = <$SH>||''; + s/\r//; + die "$0: no response from fex server $server\n" unless $_; + print "<-- $_" if $opt_v; + if (/^HTTP.* 201/) { + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last unless /\w/; + $aok = $_ if /X-Features:.*ANONYMOUS/; + } + die "$0: no anonymous support on server $server\n" unless $aok; + } else { + die "$0: bad response from server $server : $_\n"; + } + } elsif ($public) { + } else { + + query_sid($server,$port); + + if ($from eq 'SUBUSER') { + $skey = $sid; + # die "skey=$skey\nid=$id\nsid=$sid\n"; + } + + if ($from eq 'GROUPMEMBER') { + $gkey = $sid; + } + + if ($to eq '.') { + @to = ($from); + $opt_C ||= 'NOMAIL'; + } elsif ($to =~ m:^(//.*):) { + my $xkey = $1; + if ($features =~ /XKEY/) { + @to = ($from); + $opt_C = $xkey; + } else { + die "$0: server does not support XKEY\n"; + } + } elsif (grep /^[^@]*$/,@to and not $skey and not $gkey) { + %AB = query_address_book($server,$port,$from); + if ($proxy) { + serverconnect($server,$port); + query_sid($server,$port); + } + foreach $to (@to) { + # alias in local config? + if ($alias{$to}) { + if ($alias{$to} =~ /(.+?):(.+)/) { + my $ato = $1; + my $opt = $2; + my @argv = @_ARGV; + pop @argv; + # special extra upload + system $0,split(/\s/,$opt),@argv,$ato; + $to = ''; + } else { + $to = $alias{$to}; + } + } + # alias in server address book? + elsif ($AB{$to}) { + # do not substitute alias with expanded addresses because then + # keep and autodelete options from address book will get lost + # $to = $AB{$to}; + } + # look for mutt aliases + elsif ($to !~ /@/ and $to ne $from and open $ma,$ma) { + $alias = $to; + while (<$ma>) { + if (/^alias \Q$to\E\s/i) { + chomp; + s/\s*#.*//; + s/\(.*?\)//; + s/\s+$//; + s/.*\s+//; + s/[<>]//g; + if (/,/) { + warn "$0: ignoring mutt multi-alias $to = $alias\n"; + last; + } + if (/@/) { + $alias = $_; + warn "$0: found mutt alias $to = $alias\n"; + last; + } + } + } + close $ma; + $to = $alias; + } + } + } + + $to = join(',',grep /./,@to) or exit; + warn "Server/User: $fexcgi/$from\n" unless $opt_q; + + if ( + not $skey and not $gkey + and $features =~ /CHECKRECIPIENT/ + and $opt_C !~ /^(DELETE|LIST|RECEIVEDLOG|SENDLOG|FOPLOG)$/ + ) { + checkrecipient($from,$to); + if ($proxy) { + serverconnect($server,$port); + query_sid($server,$port); + } + } + } + + if (@ARGV > 1 and not ($opt_a or $opt_s or $opt_d)) { + print "Archive name (name.tar, name.tgz or name.zip) or [ENTER] to send file for file:\n"; + $opt_a = ; + $opt_a =~ s/^\s+//; + $opt_a =~ s/\s+$//; + } + + if ($opt_s) { + $opt_s =~ s/^=//; + $opt_s =~ s:.*/::; + $opt_s =~ s/[^\w_.+-]/_/g; + @files = ($opt_s); + } elsif ($opt_a) { + $opt_a =~ s/^=//; + $opt_a =~ s:.*/::; + $opt_a =~ s/[^\w_.+-]/_/g; + if ($opt_a =~ /(.+)\.(zip|tar|tgz|7z)$/) { + $aname = $1; + $atype = $2; + } else { + die "$0: archive name must be one of ". + "$opt_a.tar $opt_a.tgz $opt_a.zip\n"; + } + # no file argument left? + unless (@ARGV) { + # use file name as archive name + push @ARGV,$aname; + $opt_a =~ s:/+$::g; + $opt_a =~ s:.*/::g; + } + foreach my $file (@ARGV) { + die "$0: cannot read $file\n" unless -l $file or -r $file; + } + $opt_a .= ".$atype" if $opt_a !~ /\.$atype$/; + $transferfile = "$tmpdir/$opt_a"; + unlink $transferfile; + print "Making fex archive ($opt_a):\n"; + if ($atype eq 'zip') { + if ($windoof) { + # if ($opt_c) { system(qw'7z a -tzip',$transferfile,@ARGV) } + # else { system(qw'7z a -tzip -mm=copy',$transferfile,@ARGV) } + system(qw'7z a -tzip',$transferfile,@ARGV); + @files = ($transferfile); + } else { + # zip archives must be < 2 GB, so split as necessary + @files = zipsplit($transferfile,@ARGV); + if (scalar(@files) == 1) { + $transferfile = $files[0]; + $transferfile =~ s/_1.zip$/.zip/; + rename $files[0],$transferfile; + @files = ($transferfile); + } + } + @transferfiles = @files; + } elsif ($atype eq '7z') { + # http://www.7-zip.org/ + my @X = (); # exclude list + if (${'opt_#'}) { + foreach my $x (split('#',${'opt_#'})) { + push @X,"-x!$x"; + } + } + if ($opt_c) { system(qw'7z a',@X,$transferfile,@ARGV) } + else { system(qw'7z a -t7z -mx0',@X,$transferfile,@ARGV) } + @transferfiles = @files = ($transferfile); + } elsif ($atype eq 'tar') { + if ($windoof) { + system(qw'7z a -ttar',$transferfile,@ARGV); + @transferfiles = @files = ($transferfile); + } else { + ## tar is now handled by formdatapost() + # system(qw'tar cvf',$transferfile,@ARGV); + @files = ($opt_a); + } + } elsif ($atype eq 'tgz') { + if ($windoof) { + die "$0: archive type tgz not available, use tar, zip or 7z\n"; + } else { + ## tgz is now handled by formdatapost() + # system(qw'tar cvzf',$transferfile,@ARGV); + @files = ($opt_a); + } + } else { + die "$0: unknown archive format \"$atype\"\n"; + } + + if (@transferfiles) { + + # error in making transfer archive? + if ($?) { + unlink @transferfiles; + die "$0: $! - aborting upload\n"; + } + + # maybe timeout, so make new connect + if (time-$t0 >= $timeout) { + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + } + + } + + } else { + + unless (@ARGV) { + if ($windoof) { + &inquire; + } else { + die $usage; + } + } + + foreach (@ARGV) { + my $file = $_; + unless ($opt_d) { + unless (-f $file) { + if (-e $file) { + die "$0: $file is not a regular file, try option -a\n" + } else { + die "$0: $file does not exist\n"; + } + } + die "$0: cannot read $file\n" unless -r $file; + } + push @files,$file; + } + } + + if (${'opt_/'}) { + foreach my $file (@files) { + my @s = stat($file); + unless (@s and ($s[2] & S_IROTH) and -r $file) { + die "$0: $file is not world readable\n"; + } + } + } + + foreach my $file (@files) { + sleep 1; # do not overrun server! + unless (-s $file or $opt_d or $opt_a or $opt_s) { + die "$0: cannot send empty file $file\n"; + } + female_mode("send file $file?") if $opt_F; + @r = formdatapost( + from => $from, + to => $to, + replyto => $opt_r, + id => $sid, + file => $file, + keep => $opt_k, + comment => $opt_C, + autodelete => $opt_D, + ); + + if (not @r or not grep /\w/,@r) { + die "$0: no response from server\n"; + } + if (($r) = grep /^ERROR:/,@r) { + if ($anonymous and $r =~ /purge it/) { + die "$0: file is already on server for $to - use another anonymous recipent\n"; + } else { + $r =~ s/.*?:\s*//; + $r =~ s/<.+?>//g; + die "$0: server error: $r\n"; + } + } + if (($r) = grep /

\Q$file/,@r) { + $r =~ s/<.+?>//g; + print "$r\n"; + } + if ($opt_a !~ /^afex_\d+\.tar$/ and $file !~ /afex_\d+\.tar$/) { + # print grep({s/^(X-Recipient:.*\((.+)\))/Parameters: $2\n/i} @r); + my $nonot = 0; + my ($recipient,$location); + foreach (@r) { + if (/^(X-)?(Recipient.*)/i) { + $recipient = $2; + if (/notification=no/i) { $nonot = 1 } + else { $nonot = 0 } + } + if (/^(X-)?(Location.*)/i) { + $location = $2; + if ($from eq $to or $from =~ /^\Q$to\E@/i + or $nomail or $anonymous or $nonot) { + print "$recipient\n"; + print "$location\n"; + } + } + } + } + } + + # delete transfer tmp file + unlink $transferfile if $transferfile; +} + + +sub forward { + my (@r); + my ($to,$n,$dkey,$file,$req); + my $status = 1; + local $_; + + # look for single @ in arguments + for (my $i=1; $i<$#ARGV; $i++) { + if ($ARGV[$i] eq '@') { + $ARGV[$i] = join(',',@ARGV[$i+1 .. $#ARGV]); + $#ARGV = $i; + last; + } + } + + # if ($windoof and not @ARGV) { &inquire } + $to = pop @ARGV or die $usage; + $to = $from if $to eq '.'; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_f) { + $n = $1; + $dkey = $2; + $file = $3; + if ($file =~ s/ "(.*)"$//) { + $opt_C ||= $1 if $1 ne 'NOMAIL'; + } + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_f not found in fexlist\n"; + } + + female_mode("forward file #$opt_f?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&to=$to&dkey=$dkey&command=FORWARD"; + $req .= "&comment=$opt_C" if $opt_C; + $req .= "&keep=$opt_k" if $opt_k; + $req .= "&autodelete=$opt_D" if $opt_D; + $req .= "&$opt_X" if $opt_X; + $req .= " HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + if ($opt_v) { + print; + $status = 0 if /\Q"$file"/; + } else { + if (/\Q"$file"/) { + print; + $status = 0; + } + } + } + + if ($status) { + die "$0: server failed, rerun command with option -v\n"; + } + exit; +} + + +sub renotify { + my (@r); + my ($to,$n,$dkey,$file,$req,$recipient); + local $_; + + die $usage if @ARGV; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_N) { + $n = $1; + $dkey = $2; + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_N not found in fexlist\n"; + } + + female_mode("resend notification for file #$opt_N?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&dkey=$dkey&command=RENOTIFY" + ." HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^\s*$/; + if (/^X-Notify: (.+)\/(.+)\/(.+)/) { + $recipient = $1; + $file = $3; + } + } + + if ($file) { + print "notification e-mail for $file has been resent to $recipient\n"; + } else { + if ($opt_v) { + die "$0: server failed\n"; + } else { + die "$0: server failed, rerun command with option -v\n"; + } + } + + exit; +} + + +sub modify { + my (@r); + my ($n,$dkey,$file,$req); + local $_; + + die $usage if @ARGV; + die $usage unless $opt_C or $opt_k or $opt_D; + + open $fexlist,$fexlist or die "$0: $fexlist - $!\n"; + while (<$fexlist>) { + if (/^\s*(\d+)\) (\w+) \[\d+ d\] (.+)/ and $1 eq $opt_x) { + $n = $1; + $dkey = $2; + $file = $3; + $file =~ s/ "(.*)"$//; + last; + } + } + close $fexlist; + + unless ($n) { + die "$0: file #$opt_x not found in fexlist\n"; + } + + female_mode("modify file #$opt_x?") if $opt_F; + + serverconnect($server,$port); + query_sid($server,$port); + + $req = "GET $proxy_prefix/fup?" + ."from=$from&ID=$sid&dkey=$dkey&command=MODIFY"; + $req .= "&comment=$opt_C" if $opt_C; + $req .= "&keep=$opt_k" if $opt_k; + $req .= "&autodelete=$opt_D" if $opt_D; + $req .= " HTTP/1.1"; + sendheader("$server:$port",$req); + http_response(); + while (<$SH>) { + if ($opt_v) { + print "<-- $_"; + } else { + print if /\Q$file/; + } + } + + exit; +} + + +sub get_xx { + my $transferfile = shift; + my $ft = ''; + local $_; + + # get transfer file from FEX server + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port); + } + + xxget($from,$sid,$transferfile); + + # empty file? + unless (-s $transferfile) { + unlink $transferfile; + exit; + } + + # no further processing if delivering to pipe + exec 'cat',$transferfile unless -t STDOUT; + + if ($ft = `file $transferfile 2>/dev/null`) { + if ($ft =~ /compressed/) { + rename $transferfile,"$transferfile.gz"; + shelldo(ws("gunzip $transferfile.gz")); + } + $ft = `file $transferfile`; + } + # file command failed, so we look ourself into the file... + elsif (open $transferfile,$transferfile) { + read $transferfile,$_,4; + close $transferfile; + # gzip magic? + if (/\x1F\x8B\x08\x00/) { + rename $transferfile,"$transferfile.gz"; + shelldo(ws("gunzip $transferfile.gz")); + # assuming tar + $ft = 'tar archive'; + } + } + if ($ft =~ /tar archive/) { + rename $transferfile,"$transferfile.tar"; + $transferfile .= '.tar'; + if ($opt_q) { + $_ = 'y'; + } else { + print "Files in transfer-container:\n\n"; + shelldo(ws("tar tvf $transferfile")); + print "\nExtract these files? [Yn] "; + $_ = ; + } + if (/^n/i) { + print "keeping $transferfile\n"; + } else { + system("tar xvf $transferfile && rm $transferfile"); + die "$0: error while untaring, see $transferfile\n" if -f $transferfile; + } + } else { + exec 'cat',$transferfile; + } + exit; +} + + +sub formdatapost { + my %P = @_; + my ($boundary,$filename,$filesize,$length,$buf,$file,$fpsize,$resume,$seek); + my ($flink); + my (@hh,@hb,@r,@pv,$to); + my ($bytes,$t,$bt); + my ($t0,$t1,$t2,$tt,$tc); + my $bs = 2**16; # blocksize for reading and sending file + my $fileid = int(time); + my $chunk = 0; + my $connection = ''; + my $pct = ''; + my ($tar,$aname,$atype,$tarlist,$tarerror,$location,$transferfile); + local $_; + + if (defined($file = $P{file})) { + + $to = $AB{$P{to}} || $P{to}; # for gpg + + # special file: stream from STDIN + if ($opt_s) { + $filename = encode_utf8($file); + $filesize = -1; + } + + # compression? + if ($opt_c) { + my ($if,$of); + $if = $file; + $if =~ s/([^_\w\.\-])/\\$1/g; + $transferfile = $tmpdir . '/' . basename($file) . '.gz'; + $of = $transferfile; + $of =~ s/([^_\w\.\-])/\\$1/g; + shelldo("gzip <$if>$of"); + $filesize = -s $transferfile; + die "$0: cannot gzip $file\n" unless $filesize; + $file = $transferfile; + } + + # special file: tar-on-the-fly + if (not $windoof and $opt_a and $file =~ /(.+)\.(tar|tgz)$/) { + $aname = $1; + $atype = $2; + $tarlist = "$tmpdir/$aname.list"; + $tarerror = "$tmpdir/$aname.error"; + $tar = 'tar -cv'; + $tar .= 'z' if $atype eq 'tgz'; + if (`tar --help 2>/dev/null` =~ /--index-file/) { + $tar .= " --index-file=$tarlist -f-"; + } else { + $tar .= " -f-"; + } + if (${'opt_#'}) { + foreach my $x (split('#',${'opt_#'})) { + $tar .= " --exclude=$x"; + } + } + foreach (@ARGV) { + $file = $_; + $file =~ s/([^\w\-\@\#%,.=+~_:])/\\$1/g; + $tar .= ' '.$file; + } + # print "calculating archive size... "; + open $tar,"$tar 2>$tarerror|" or die "$0: cannot run tar - $!\n"; + $t0 = int(time) if -t STDOUT; + while ($b = read $tar,$_,$bs) { + $filesize += $b; + if ($t0) { + $t1 = int(time); + if ($t1>$t0) { + printf "Archive size: %d MB\r",int($filesize/M); + $t0 = $t1; + } + } + } + printf "Archive size: %d MB\n",int($filesize/M) if -t STDOUT; + unless (close $tar) { + $_ = ''; + if (open $tarerror,$tarerror) { + local $/; + $_ = <$tarerror>; + close $tarerror; + } + unlink $tarlist,$tarerror; + die "$0: tar error:\n$_"; + } + $file = "$aname.$atype"; + $filename = encode_utf8($file); + undef $SH; # force reconnect (timeout!) + } + + # single file + else { + $filename = encode_utf8(${'opt_='} || $file); + + if ($windoof) { + $filename =~ s/^[a-z]://; + $filename =~ s/.*\\//; + } + $filename =~ s:.*/::; + $filename =~ s:[\r\n]+: :g; + if ($opt_d) { + $filesize = 0; + } elsif (not $opt_g and not $opt_s) { + $filesize = -s $file or die "$0: $file is empty or not readable\n"; + } + } + + $filename .= '.gpg' if $opt_g; + + unless ($opt_d) { + if ($opt_g) { + $filesize = -1; + $fileid = int(time); + } else { + if ($opt_a) { + $fileid = md5_hex(fmd(@ARGV)); + } else { + $fileid = fileid($file); + } + } + } + + } else { + $file = $filename = ''; + $filesize = 0; + } + + FORMDATAPOST: + + @hh = (); # HTTP header + @hb = (); # HTTP body + @r = (); + $seek = 0; + $resume = ''; + $chunk++; + + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + } + + $P{id} = $sid; # ugly hack! + + # ask server if this file has been already sent + if ($file and not $xx and not + ($opt_s or $opt_g or $opt_o or $opt_d or $opt_l or $opt_L or ${'opt_/'})) + { + ($seek,$location) = query_file($server,$port,$frecipient||$P{to},$P{from}, + $P{id},$filename,$fileid); + if ($filesize == $seek) { + print "Location: $location\n" if $location and $nomail; + warn "$0: $file has been already transferred\n"; + return $file; + } elsif ($seek and $seek < $filesize) { + $resume = " (resuming at byte $seek)"; + } elsif ($filesize <= $seek) { + $seek = 0; + } + if ($proxy) { + sleep 1; # do not overrun proxy + serverconnect($server,$port); + } + } + + # file part size + if ($chunksize and $proxy and $port != 443 + and $filesize - $seek > $chunksize - $bs) { + if ($features !~ /MULTIPOST/) { + die sprintf("$0: server does not support chunked multi-POST needed for" + ." files > %d MB via proxy\n",$chunksize/M); + } + $opt_o = 0; # no overwriting mode for next chunks + $fpsize = $chunksize - $bs; + } else { + $fpsize = $filesize - $seek; + } + + $boundary = randstring(48); + + $P{seek} = $seek; + $P{filesize} = $filesize; + + # send HTTP POST variables + if ($skey) { + $P{skey} = $skey; + @pv = qw'from to skey keep autodelete comment seek filesize'; + } elsif ($gkey) { + $P{gkey} = $gkey; + @pv = qw'from to gkey keep autodelete comment seek filesize'; + } else { + @pv = qw'from to id replyto keep autodelete comment command seek filesize'; + } + foreach my $v (@pv) { + if ($P{$v}) { + my $name = uc($v); + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"$name\""; + push @hb,""; + push @hb,encode_utf8($P{$v}); + } + } + + # at last, POST the file + if ($file) { + push @hb,"--$boundary"; + push @hb,"Content-Disposition: form-data; name=\"FILE\"; filename=\"$filename\""; + unless ($opt_d) { + if ($opt_M) { push @hb,"Content-Type: application/x-mime" } + else { push @hb,"Content-Type: application/octet-stream" } + if (${'opt_/'}) { + $flink = abs_path($file); + push @hb,"Content-Location: $flink"; + } else { + # push @hb,"Content-Length: " . ((-s $file||0) - $seek); # optional header! + push @hb,"Content-Length: $fpsize"; # optional header! NOT filesize! + push @hb,"X-File-ID: $fileid"; + } + push @hb,""; + } + push @hb,""; + # prevent proxy chunked mode reply + $connection = "close"; + } + + push @hb,"--$boundary--"; + + if ($fpsize < 0) { + $length = $fpsize; + } else { + $length = length(join('',@hb)) + scalar(@hb)*2 + $fpsize; + } + + if ($file and not $opt_d) { + if ($flink) { $hb[-2] = $flink } + else { $hb[-2] = '(file content)' } + } + # any other extra URL arguments + my $opt_X = ''; + $opt_X = "?$::opt_X" if $::opt_X and $file; + + # HTTP header + push @hh,"POST $proxy_prefix/fup$opt_X HTTP/1.1"; + push @hh,"Host: $server:$port"; + push @hh,"User-Agent: $useragent"; + push @hh,"Content-Length: $length"; + push @hh,"Content-Type: multipart/form-data; boundary=$boundary"; + push @hh,"Connection: $connection" if $connection; + push @hh,''; + + if ($opt_v) { + print "--> $_\n" foreach (@hh,@hb); + } + + $SIG{PIPE} = \&sigpipehandler; +# foreach $sig (keys %SIG) { +# eval '$SIG{$sig} = sub { print "\n!!! SIGNAL '.$sig.' !!!\n"; exit; }'; +# } + + if ($file) { + pop @hb; + pop @hb unless $flink; + nvtsend(@hh,@hb) or do { + warn "$0: server has closed the connection, reconnecting...\n"; + sleep 3; + goto FORMDATAPOST; # necessary: new $sid ==> new @hh + }; + + unless ($opt_d or $flink) { + + $t0 = $t2 = int(time); + $tt = $t0-1; + $t1 = 0; + $tc = 0; + + if ($opt_s) { + if ($opt_g) { + open $file,"gpg -e -r $to|" or die "$0: cannot run gpg - $!\n"; + } else { + open $file,'>&=STDIN' or die "$0: cannot open STDIN - $!\n"; + } + } elsif ($tar) { + if ($opt_g) { + open $file,"$tar|gpg -e -r $to|" or die "$0: cannot run tar&gpg - $!\n"; + } else { + open $file,"$tar|" or die "$0: cannot run tar - $!\n"; + } + if (-t STDOUT) { + $tpid = fork(); + if (defined $tpid and $tpid == 0) { + sleep 1; + if (open $tarlist,$tarlist) { + # print "\n$tar|\n"; system "ls -l $tarlist"; + while ($tarlist) { + while (<$tarlist>) { + print ' 'x(length($file)+40),"\r",$_; + } + sleep 1; + } + } + exit; + } + $SIG{CHLD} = 'IGNORE'; + } + if ($seek) { + print "Fast forward to byte $seek (resuming)\n"; + readahead($file,$seek); + } + } else { + if ($opt_g) { + my $fileq = $file; + $fileq =~ s/([^\w\-\@\#%,.=+~_:])/\\$1/g; + open $file,"gpg -e -r $to <$fileq|" or die "$0: cannot run gpg - $!\n"; + } else { + open $file,$file or die "$0: cannot read $file - $!\n"; + seek $file,$seek,0; + } + binmode $file; + } + + $bytes = 0; + autoflush $SH 0; + + print $rcamel[0] if ${'opt_+'}; + + while (my $b = read $file,$buf,$bs) { + print {$SH} $buf or &sigpipehandler; + $bytes += $b; + if ($filesize > 0 and $bytes+$seek > $filesize) { + die "$0: $file filesize has grown while uploading\n"; + } + $bt += $b; + $t2 = time; + if (${'opt_+'} and int($t2*10)>$tc) { + print $rcamel[$tc%2+1]; + $tc = int($t2*10); + } + if (not $opt_q and -t STDOUT and int($t2)>$t1) { + &sigpipehandler unless $SH->connected; + # smaller block size is better on slow links + $bs = 4096 if $t1 and $bs>4096 and $bytes/($t2-$t0)<65536; + if ($filesize > 0) { + $pct = sprintf "(%d%%)",int(($bytes+$seek)/$filesize*100); + } + if ($bytes>2*M and $bs>4096) { + printf STDERR "%s: %d MB of %d MB %s %d kB/s \r", + $opt_s||$opt_a||$file, + int(($bytes+$seek)/M), + int($filesize/M), + $pct, + int($bt/k/($t2-$tt)); + } else { + printf STDERR "%s: %d kB of %d MB %s %d kB/s \r", + $opt_s||$opt_a||$file, + int(($bytes+$seek)/k), + int($filesize/M), + $pct, + int($bt/k/($t2-$tt)); + } + $t1 = $t2; + # time window for transfer rate calculation + if ($t2-$tt>10) { + $bt = 0; + $tt = $t2; + } + } + last if $filesize > 0 and $bytes >= $fpsize; + sleep 1 while ($opt_m and $bytes/k/(time-$t0||1) > $opt_m); + } + close $file; # or die "$0: error while reading $file - $!\n"; + $tt = ($t2-$t0)||1; + + print $rcamel[2] if ${'opt_+'}; + + # terminate tar verbose output job + if ($tpid) { + sleep 2; + kill 9,$tpid; + unlink $tarlist; + } + + unless ($opt_q) { + if (not $chunksize and $bytes+$seek < $filesize) { + die "$0: $file filesize has shrunk while uploading\n"; + } + + if ($seek or $chunksize and $chunksize < $filesize) { + if ($fpsize>2*M) { + printf STDERR "%s: %d MB in %d s (%d kB/s)", + $opt_s||$opt_a||$file, + int($bytes/M), + $tt, + int($bytes/k/$tt); + if ($bytes+$seek == $filesize) { + printf STDERR ", total %d MB\n",int($filesize/M); + } else { + printf STDERR ", chunk #%d : %d MB\n", + $chunk,int(($bytes+$seek)/M); + } + } else { + printf STDERR "%s: %d kB in %d s (%d kB/s)", + $opt_s||$opt_a||$file, + int($bytes/k), + $tt, + int($bytes/k/$tt); + if ($bytes+$seek == $filesize) { + printf STDERR ", total %d kB\n",int($filesize/k); + } else { + printf STDERR ", chunk #%d : %d kB\n", + $chunk,int(($bytes+$seek)/k); + } + } + } else { + if ($bytes>2*M) { + printf STDERR "%s: %d MB in %d s (%d kB/s) \n", + $opt_s||$opt_a||$file, + int($bytes/M), + $tt, + int($bytes/k/$tt); + } else { + printf STDERR "%s: %d kB in %d s (%d kB/s) \n", + $opt_s||$opt_a||$file, + int($bytes/k), + $tt, + int($bytes/k/$tt); + } + } + + if (-t STDOUT and not ($opt_s or $opt_g)) { + print STDERR "waiting for server ok..." + } + } + } + + autoflush $SH 1; + print {$SH} "\r\n--$boundary--\r\n"; + + # special handling of streaming file because of stunnel tcp shutdown bug + if ($opt_s or $opt_g) { + close $SH; + sleep 1; + serverconnect($server,$port); + query_sid($server,$port) unless $anonymous; + ($seek,$location) = query_file($server,$port,$P{to},$P{from},$sid, + $filename,$fileid); + if ($seek != $bytes) { + die "$0: streamed $bytes bytes but server received $seek bytes\n"; + } + return "X-Location: $location\n"; + } + + if ($flink) { + $bytes = -s $flink; + if ($bytes>2*M) { + printf STDERR "%s: %d MB\n",$flink,int($bytes/M); + } else { + printf STDERR "%s: %d kB\n",$flink,int($bytes/k); + } + } + } else { + autoflush $SH 1; + nvtsend(@hh,@hb); + } + + # SuSe: Can't locate object method "BINMODE" via package "IO::Socket::SSL::SSL_HANDLE" + # binmode $SH,':utf8'; + + if (not $opt_q and $file and -t STDOUT) { + print STDERR "\r \r"; + } + while (<$SH>) { + s/[\r\n]+//; + print "<-- $_\n" if $opt_v; + last if @r and $r[0] =~ / 204 / and /^$/ or /<\/html>/i; + push @r,decode_utf8($_); + } + + if ($file) { + close $SH; + undef $SH; + if ($proxy and $fpsize+$seek < $filesize) { + goto FORMDATAPOST; + } + } + + return @r; +} + + +sub randstring { + my $n = shift; + my @rc = ('A'..'Z','a'..'z',0..9 ); + my $rn = @rc; + my $rs; + + for (1..$n) { $rs .= $rc[int(rand($rn))] }; + return $rs; +} + + +sub zipsplit { + my $zipbase = shift; + my @files = @_; + my @zipfiles = (); + my $file; + my ($zsize,$size,$n); + + $zipbase =~ s/\.zip$//; + map { s/([^_\w\+\-\.])/\\$1/g } @files; + + open my $ff,"find @files|" or die "$0: cannot search for @_ - $!\n"; + @files = (); + + zipfile: for (;;) { + $n++; + if ($n eq 10) { + unlink @zipfiles; + die "$0: too many zip-archives\n"; + } + $zsize = 0; + while ($file = <$ff>) { + chomp $file; + # next if -l $file or not -f $file; + next unless -f $file; + $size = -s $file; + if ($size > 2147480000) { + unlink @zipfiles; + die "$0: $file too big for zip\n"; + } + if ($zsize + $size > 2147000000) { + push @zipfiles,zip($zipbase.'_'.$n.'.zip',@files); + @files = ($file); + next zipfile; + } else { + push @files,$file; + $zsize += $size; + } + } + close $ff; + last; + } + push @zipfiles,zip($zipbase.'_'.$n.'.zip',@files); + return @zipfiles; +} + + +sub zip { + no strict 'refs'; + my $zip = shift; + my $cmd; + local $_; + + unlink $zip; + # if ($opt_c) { $cmd = "zip -@ $zip" } + # else { $cmd = "zip -0 -@ $zip" } + $cmd = "zip -@ $zip"; + if (${'opt_#'}) { + ${'opt_#'} =~ s/#/ /g; + $cmd .= " -x ".${'opt_#'}; + } + print $cmd,"\n" if $opt_v; + open $cmd,"|$cmd" or die "$0: cannot create $zip - $!\n"; + foreach (@_) { + print {$cmd} $_."\n"; + print " $_\n" if $opt_v; + } + close $cmd or die "$0: zip failed - $!\n"; + + return $zip; +} + + +sub getline { + my $file = shift; + local $_; + + while (<$file>) { + chomp; + s/^#.*//; + s/\s+#.*//; + s/^\s+//; + s/\s+$//; + return $_ if length($_); + } + return ''; +} + + +sub query_file { + my ($server,$port,$to,$from,$id,$filename,$fileid) = @_; + my $seek = 0; + my $qfileid = ''; + my ($head,$location); + my ($response,$fexsrv); + local $_; + + $to =~ s/,.*//; + $to =~ s/:\w+=.*//; + $to = $AB{$to} if $AB{$to}; + $filename =~ s/([^_=:,;<>()+.\w\-])/'%'.uc(unpack("H2",$1))/ge; # urlencode + if ($skey) { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??SKEY=$id HTTP/1.1"; + } elsif ($gkey) { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??GKEY=$id HTTP/1.1"; + } else { + $head = "HEAD $proxy_prefix/fop/$to/$from/$filename??ID=$id HTTP/1.1"; + } + sendheader("$server:$port",$head); + $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + unless (/^HTTP.* 200/) { + s:HTTP/[\d\. ]+::; + $response = $_; + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $fexsrv = $_ if /^(Server: fexsrv|X-Features:)/; + last if /^\s*$/; + } + die "$0: no fexserver at $server:$port\n" unless $fexsrv; + die "$0: server response: $response"; + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^$/; + if (/^Content-Length:\s+(\d+)/) { $seek = $1 } + if (/^X-File-ID:\s+(.+)/) { $qfileid = $1 } + if (/^X-Features:\s+(.+)/) { $features = $1 } + if (/^X-Location:\s+(.+)/) { $location = $1 } + } + + # return true seek only if file is identified + $seek = 0 if $qfileid and $qfileid ne $fileid; + + return ($seek,$location); +} + + +sub edit_address_book { + my ($user) = @_; + my $alias; + my $ab = "$fexhome/ADDRESS_BOOK"; + my (%AB,@r); + local $_; + + die "$0: address book not available for subusers\n" if $skey; + die "$0: address book not available for group members\n" if $gkey; + + female_mode("edit your address book?") if $opt_F; + + %AB = query_address_book($server,$port,$user); + if ($AB{ADDRESS_BOOK} !~ /\w/) { + $AB{ADDRESS_BOOK} = + "# Format: alias e-mail-address # Comment\n". + "# Example:\n". + "framstag framstag\@rus.uni-stuttgart.de\n"; + } + open $ab,">$ab" or die "$0: cannot write to $ab - $!\n"; + print {$ab} $AB{ADDRESS_BOOK}; + close $ab; + + system $editor,$ab; + exit unless -s $ab; + + $opt_o = $opt_A; + + serverconnect($server,$port); + query_sid($server,$port); + + @r = formdatapost( + from => $user, + to => $user, + id => $sid, + file => $ab, + ); + + unlink $ab,$ab.'~'; +} + + +sub query_address_book { + my ($server,$port,$user) = @_; + my ($req,$alias,$address,$options,$comment,$cl,$ab,$b); + my %AB; + local $_; + + unless ($SH) { + serverconnect($server,$port); + query_sid($server,$port); + } + + $req = "GET $proxy_prefix/fop/$user/$user/ADDRESS_BOOK?ID=$sid HTTP/1.1"; + sendheader("$server:$port",$req); + $_ = <$SH>; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + unless (/^HTTP.* 200/) { + if (/^HTTP.* 404/) { + while (<$SH>) { last if /^\r?\n/ } + return; + } else { + # s:HTTP/[\d\. ]+::; + # die "$0: server response: $_"; + close $SH; + undef $SH; + return (); + } + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + last if /^$/; + $cl = $1 if /^Content-Length: (\d+)/; + } + + if ($cl) { + while (<$SH>) { + $b += length; + $ab .= $_; + s/[\r\n]//g; + s/^\s+//; + s/\s+$//; + print "<-- $_\n" if $opt_v; + s/\s*#\s*(.*)//; + if ($_) { + $comment = $1||''; + ($alias,$address,$options) = split; + if ($address) { + if ($options) { $options =~ s/[()]//g } + else { $options = '' } + $AB{$alias} = $address; + $AB{$alias}->{options} = $options||''; + $AB{$alias}->{comment} = $comment||''; + if ($options and $options =~ /keep=(\d+)/i) { + $AB{$alias}->{keep} = $1; + } + if ($options and $options =~ /autodelete=(\w+)/i) { + $AB{$alias}->{autodelete} = $1; + } + } + } + last if $b >= $cl; + } + } + + $AB{ADDRESS_BOOK} = $ab; + + return %AB; +} + + +# sets global $sid $features $timeout # ugly hack! :-} +sub query_sid { + my ($server,$port) = @_; + my ($req,$fexsrv); + local $_; + + $sid = $id; + + if ($port eq 443) { + return if $features; # early return if we know enough + $req = "OPTIONS FEX HTTP/1.1"; + } elsif ($proxy) { + return if $features; # early return if we know enough + $req = "GET $proxy_prefix/SID HTTP/1.1"; + } else { + $req = "GET SID HTTP/1.1"; + } + + sendheader("$server:$port",$req,"User-Agent: $useragent"); + $_ = <$SH>; + unless (defined $_ and /\w/) { + print "\n" if $opt_v; + die "$0: no response from server\n"; + } + s/\r//; + print "<-- $_" if $opt_v; + + if (/^HTTP.* [25]0[01] /) { + if (not $proxy and $port ne 443 and /^HTTP.* 201 (.+)/) { + $sid = 'MD5H:'.md5_hex($id.$1); + } + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $features = $1 if /^X-Features: (.+)/; + $timeout = $1 if /^X-Timeout: (\d+)/; + last if /^\n/; + } + } elsif (/^HTTP.* 301 /) { + while (<$SH>) { last if /Location/ } + die "$0: cannot use $server:$port because server has a redirection to\n".$_; + } else { + # no SID support - perhaps transparent web proxy? + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $fexsrv = $_ if /^(Server: fexsrv|X-Features:)/; + last if /^\s*$/; + } + die "$0: no fexserver at $server:$port\n" unless $fexsrv; + serverconnect($server,$port); + $sid = $id; + } + + # warn "proxy: $proxy\n"; + if ($proxy) { + serverconnect($server,$port); + $sid = $id; + } + +} + + +sub xxget { + my ($from,$id,$save) = @_; + my $bs = 4096; + my $xx = $save; + my ($url,$B,$b,$t0,$t1,$cl); + my ($ts,$tso); + local $_; + + $xx =~ s:.*/::; + $url = "$proxy_prefix/fop/$from/$from/$xx?ID=$id"; + + sendheader("$server:$port","GET $url HTTP/1.0","User-Agent: $useragent"); + http_response(); + while (<$SH>) { + s/\r//; + print "<-- $_" if $opt_v; + $cl = $1 if /^Content-Length:\s(\d+)/; + # $ft = $1 if /^X-File-Type:\s(.+)/; + last if /^$/; + } + + die "$0: no Content-Length in server-reply\n" unless $cl; + + open F,">$save" or die "$0: cannot write to $save - $!\n"; + binmode F; + + $t0 = $t1 = int(time); + $tso = ''; + + while ($b = read($SH,$_,$bs)) { + $B += $b; + print F; + if (int(time) > $t1) { + $t1 = int(time); + $ts = ts($B,$cl); + if ($ts ne $tso) { + print STDERR $ts,"\r"; + $tso = $ts; + } + } + sleep 1 while ($opt_m and $B/k/(time-$t0||1) > $opt_m); + } + + print STDERR ts($B,$cl),"\n"; + close F; +} + + +# transfer status +sub ts { + my ($b,$tb) = @_; + return sprintf("transferred: %d MB (%d%%)",int($b/M),int($b/$tb*100)); +} + + +sub sigpipehandler { + $SIG{ALRM} = sub { }; + if (fileno $SH) { + alarm(1); + @_ = <$SH>; + alarm(0); + kill 9,$tpid if $tpid; + if (@_ and $opt_v) { + die "\n$0: ($$) server error: @_\n"; + } + if (@_ and $_[0] =~ /^HTTP.* \d+ (.*)/) { + die "\n$0: server error: $1\n"; + } + } + $timeout *= 2; + warn "\n$0: connection to $server died\n"; + warn "retrying after $timeout seconds...\n"; + sleep $timeout; + if ($windoof) { exec $^X,$0,@_ARGV } + else { exec $_0,@_ARGV } + die $!; +} + + +sub checkrecipient { + my ($from,$to) = @_; + my @r; + local $_; + + @r = formdatapost( + from => $from, + to => $to, + id => $sid, + command => 'CHECKRECIPIENT', + ); + + $_ = shift @r or die "$0: no reply from server\n"; + + if (/ 2\d\d /) { + foreach (@r) { + last if /^$/; + if (s/X-(Recipient: .+)/$1\n/) { + s/autodelete=\w+/autodelete=$opt_D/ if $opt_D; + s/keep=\d+/keep=$opt_k/ if $opt_k; + print; + $frecipient ||= (split)[1]; + } + } + } else { + http_response($_,@r); + } +} + + +# get ID data from ID file +sub get_id { + my $idf = shift; + + $fexcgi = getline($idf) || die "$0: no FEX-URL in $idf\n"; + $from = getline($idf) || die "$0: no FROM in $idf\n"; + $id = getline($idf) || die "$0: no ID in $idf\n"; + if ($fexcgi =~ s/!([\w.-]+:\d+)(:(\d+))?//) { + $proxy = $1; + $chunksize = $3 || 0; + } + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "$0: illegal FEX-URL \"$fexcgi\" in $idf\n"; + } + unless ($from =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "$0: illegal FROM \"$from\" in $idf\n"; + } + $fexcgi =~ s:/+$::; +} + + +# for windows +sub inquire { + my ($file,$to); + for (;;) { + print "file to send: "; + chomp($file = ); + $file =~ s/^\"//; + $file =~ s/\"$//; + last if -e $file; + warn "$file does not exist\n"; + } + print "recipient (e-mail address): "; + chomp($to = ); + die $usage unless $to; + unless ($opt_n) { + print "comment: "; + chomp($opt_C = ); + } + @ARGV = ($file,$to); +} + + +sub shelldo { + if (system(@_) < 0) { die "failed: @_\n" } +} + + +# emulate seek on a pipe +sub readahead { + my $fh = shift; # filehandle + my $ba = shift; # bytes ahead + my $bs = 2**16; + my $s = 0; + my $n; + local $_; + + while ($s < $ba) { + $n = $ba-$s; + $n = $bs if $n > $bs; + $s += read $fh,$_,$n; + } +} + + +# fileid is inode and mtime +sub fileid { + my @s = stat(shift); + return @s ? $s[1].$s[9] : int(time); +} + + +# collect file meta data (filename, inode, mtime) +sub fmd { + my @files = @_; + my ($file,$dir); + my $fmd = ''; + + foreach $file (@files) { + if (not -l $file and -d $file) { + $dir = $file; + if (opendir $dir,$dir) { + while (defined ($file = readdir($dir))) { + next if $file eq '..'; + if ($file eq '.') { + $fmd .= $file.fileid($dir); + } else { + $fmd .= fmd("$dir/$file"); + } + } + closedir $dir; + } + } else { + $fmd .= $file.fileid($file); + } + } + + return $fmd; +} + + +# from MIME::Base64::Perl +sub decode_b64 { + local $_ = shift; + my $uu = ''; + my ($i,$l); + + tr|A-Za-z0-9+=/||cd; + s/=+$//; + tr|A-Za-z0-9+/| -_|; + return "" unless length; + + $l = (length)-60; + for ($i = 0; $i <= $l; $i += 60) { + $uu .= "M" . substr($_,$i,60); + } + $_ = substr($_,$i); + if (length) { + $uu .= chr(32+(length)*3/4) . $_; + } + return unpack("u",$uu); +} + + +sub female_mode { + local $_; + if (open my $tty,'/dev/tty') { + print "@_\n"; + print " [y] yes\n", + " [n] no\n", + " [p] perhaps - don't know\n", + "your choice: "; + $_ = <$tty> || ''; + close $tty; + if (/^y/i) { return } + if (/^n/i) { exit } + if (/^p/i) { int(rand(2)) ? return : exit } + female_mode(@_); + } +} + + +sub http_response { + local $_ = shift || <$SH>; + my @r = @_; + my $error; + + $_ = <$SH> unless $_; + unless (defined $_ and /\w/) { + die "$0: no response from server\n"; + } + s/\r?\n//; + # CGI fatalsToBrowser + if (/^HTTP.* 500/) { + @r = <$SH> unless @r; + @r = () unless @r; + die "$0: server error: $_\n@r\n"; + } + unless (/^HTTP.* 200/) { + $error = $_; + $error =~ s/HTTP.[\s\d.]+//; + if ($opt_v) { + print "<-- $_"; + print "<-- $_" while <$SH>; + } + die "$0: server error: $error\n"; + } + + print "<-- $_\n" if $opt_v; + return $_; +} + + +sub ws { + local $_ = shift; + return split; +} + + +sub update { + my $cfb = '### common functions ###'; + my $cfc; + + local $/; + + open $0,$0 or die "cannot read $0 - $!\n"; + $_ = <$0>; + close $0; + s/.*\n$cfb\n//s; + $cfc = $_; + + foreach my $p (qw(fexget sexsend)) { + open $p,$p or die "cannot read $p - $!\n"; + $_ = <$p>; + close $p; + s/\n$cfb.*/\n$cfb\n$cfc/s; + system "vv -s $p"; + open $p,'>',$p or die "cannot write $p - $!\n"; + print {$p} $_; + close $p; + } + + exec "l $0 fexget sexsend"; + exit; +} + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/htdocs/download/sex.stream b/htdocs/download/sex.stream new file mode 120000 index 0000000..8350da9 --- /dev/null +++ b/htdocs/download/sex.stream @@ -0,0 +1 @@ +:sexsend:sexget: \ No newline at end of file diff --git a/htdocs/download/sexget b/htdocs/download/sexget new file mode 120000 index 0000000..73cf1eb --- /dev/null +++ b/htdocs/download/sexget @@ -0,0 +1 @@ +sexsend \ No newline at end of file diff --git a/htdocs/download/sexsend b/htdocs/download/sexsend new file mode 100755 index 0000000..7340e49 --- /dev/null +++ b/htdocs/download/sexsend @@ -0,0 +1,723 @@ +#!/usr/bin/perl -w + +# client for stream exchange of the FEX service +# +# Author: Ulli Horlacher +# +# Perl Artistic Licence + +# sexsend / sexget / sexxx + +use Getopt::Std; +use Socket; +use IO::Handle; +use IO::Socket::INET; +use Digest::MD5 qw(md5_hex); # encypted ID / SID + +use constant k => 2**10; +use constant M => 2**20; + +eval 'use Net::INET6Glue::INET_is_INET6'; + +our $version = 20150120; + +my %SSL = (SSL_version => 'TLSv1'); +my $sigpipe; + +if (-f ($_ = '/etc/fex/config.pl')) { + eval { require } or warn $@; +} + +$0 =~ s:.*/::; +$| = 1; + +# sexsend is default +$usage = + "usage: ... | $0 [options] [SEX-URL/]recipient [stream]\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -V show version\n". + " -t timeout timeout in s (waiting for recipient)\n". + "special: recipient may be \"public\" or \"anonymous\" or \".\"\n". + "see also: sexget, sexxx\n". + "example: tail -f /var/log/syslog | $0 fex.flupp.org/admin log\n"; + +if ($0 eq 'sexget' or $0 eq 'fuckme') { + $usage = + "usage: $0 [options] [[SEX-URL/]user:ID] [stream]\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -V show version\n". + "arguments: user:ID use this user & ID\n". + " (ID may be \"public\" or user:ID may be \"anonymous\")\n". + " stream name of the stream\n". + "see also: sexsend, sexxx\n". + "example: $0 log | grep kernel\n"; +} + +if ($0 eq 'sexxx') { + $usage = + "usage: $0 [-v] [-g] [-c] [-u [SEX-URL/]user] [-s stream] [files...]\n". + "usage: $0 [-v] [-g] [-u [SEX-URL/]user] [-s stream] | ...\n". + "options: -v verbose mode\n". + " -g show transfer rate\n". + " -q quiet mode\n". + " -c compress files\n". + " -u SEX-URL/user SEX-URL and user (default: use FEXID/FEXXX)\n". + " -s stream stream name (default: xx)\n". + "see also: sexsend, sexget\n". + "examples: $0 -s config /etc /usr/local/etc\n". + " $0 > backup.tar\n"; +} + +$fexhome = $ENV{FEXHOME} || $ENV{HOME}.'/.fex'; +$user = $id = ''; +$type = $timeout = $stream = $mode = ''; +$idf = "$fexhome/id"; +$bs = $ENV{BS} || 2**16; # I/O blocksize + +# server URL, user and auth-ID +if ($FEXID = $ENV{FEXID}) { + $FEXID = decode_b64($FEXID) if $FEXID !~ /\s/; + ($fexcgi,$user,$id) = split(/\s+/,$FEXID); +} else { + if (open $idf,$idf) { + chomp($fexcgi = <$idf>) or die "$0: no FEX-URL in $idf\n"; + chomp($user = <$idf>) or die "$0: no FROM in $idf\n"; + chomp($id = <$idf>) or die "$0: no ID in $idf\n"; + close $idf; + despace($fexcgi,$user,$id); + unless ($fexcgi =~ /^[_:=\w\-\.\/\@\%]+$/) { + die "$0: illegal FEX-URL \"$fexcgi\" in $idf\n"; + } + unless ($user =~ /^[_:=\w\-\.\/\@\%\+]+$/) { + die "$0: illegal FROM \"$user\" in $idf\n"; + } + } +} + +$opt_h = $opt_v = $opt_V = $opt_q = 0; +$opt_u = $opt_s = $opt_c = $opt_t = ''; + +$_ = "$fexhome/config.pl"; require if -f; + +if ($0 eq 'sexxx') { + + # xx server URL, user and auth-ID + if ($FEXXX = $ENV{FEXXX}) { + $FEXXX = decode_b64($FEXXX) if $FEXXX !~ /\s/; + ($fexcgi,$user,$id) = split(/\s+/,$FEXXX); + } elsif (open $idf,$idf) { + while (<$idf>) { + if (/^\[xx\]/) { + chomp($fexcgi = <$idf>) or die "$0: no xx FEX-URL in $idf\n"; + chomp($user = <$idf>) or die "$0: no xx FROM in $idf\n"; + chomp($id = <$idf>) or die "$0: no xx ID in $idf\n"; + last; + } + } + close $idf; + } + + getopts('hgvcu:s:') or die $usage; + die $usage if $opt_h; + die $usage unless -t; + + if ($opt_c) { + $opt_c = 'z'; + $type = '&type=GZIP'; + } + + if ($opt_u) { + $fexcgi = $1 if $opt_u =~ s:(.+)/::; + $user = $opt_u; + } + + unless ($fexcgi) { + die "$0: no xx user found, use \"$0 -u SEX-URL/user\"\n"; + } + + unless ($user) { + die "$0: no xx user found, use \"$0 -u user\"\n"; + } + +} elsif ($0 eq 'sexget' or $0 eq 'fuckme') { + getopts('hgvVdu:') or die $usage; + die $usage if $opt_h; + + + if ($opt_V) { + print "Version: $version\n"; + exit unless @ARGV; + } + + if (not $opt_u and @ARGV and $ARGV[0] =~ m{^anonymous|/|:}) { + $opt_u = shift @ARGV; + } + + if ($opt_u) { + $fexcgi = $1 if $opt_u =~ s:(.+)/::; + ($user,$id) = split(':',$opt_u); + if ($user =~ /^anonymous/) { + $anonymous = $user; + } elsif (not $id) { + die $usage; + } + } + + unless ($fexcgi) { + die "$0: no SEX URL found, use \"$0 -u SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + + unless ($user) { + die "$0: no recipient found, use \"$0 -u SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + +} else { # sexsend + + $opt_g = 1; + getopts('hguvqVTt:') or die $usage; + die $usage if $opt_h; + + if ($opt_V) { + print "Version: $version\n"; + exit unless @ARGV; + } + + if ($opt_t and $opt_t =~ /^\d+$/) { + $timeout = "&timeout=$opt_t"; + } + + my $save_user = $user; + $user = shift or die $usage; + $fexcgi = $1 if $user =~ s:(.+)/::; + + if ($user =~ /^anonymous/) { + die "$0: need SEX-URL with anonymous SEX\n" unless $fexcgi; + $mode = 'anonymous'; + } elsif ($user eq 'public') { + unless ($id) { + die "$0: public SEX not possible without FEXID, set it with \"fexsend -I\"\n"; + } + $mode = $user; + $user = $save_user; + } elsif ($user eq '.') { + open $idf,$idf or die "$0: no $idf\n"; + $_ = <$idf>; + $user = <$idf>||''; + chomp $user; + } else { + unless ($fexcgi) { + die "$0: no SEX URL found, use \"$0 SEX-URL/recipient\" or \"fexsend -I\"\n"; + } + } + +} + +&get_ssl_env; + +$fexcgi =~ s(^http://)()i; +$fexcgi =~ s(/fup.*)(); +$server = $fexcgi; + +if ($server =~ s(^https://)()i) { $port = 443 } +elsif ($server =~ /:(\d+)/) { $port = $1 } +else { $port = 80 } + +$server =~ s([:/].*)(); + +## set up tcp/ip connection +# $iaddr = gethostbyname($server) +# or die "$0: cannot find ip-address for $server $!\n"; +# socket(SH,PF_INET,SOCK_STREAM,getprotobyname('tcp')) or die "$0: socket $!\n"; +# connect(SH,sockaddr_in($port,$iaddr)) or die "$0: connect $!\n"; +# warn "connecting $server:$port user=$user\n"; +if ($port == 443) { + if ($opt_v and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); +} else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); +} + +die "cannot connect $server:$port - $!\n" unless $SH; +warn "TCPCONNECT to $server:$port\n" if $opt_v; + +# autoflush $SH 1; +autoflush STDERR; + +$SIG{PIPE} = \&sigpipehandler; + +if ($0 eq 'sexget' or $0 eq 'fuckme') { + $stream = "&stream=" . shift if @ARGV; + if ($anonymous) { + $cid = 'anonymous'; + } elsif ($id eq 'public') { + $cid = 'public'; + } else { + $cid = query_sid($server,$port,$id); + } + request("GET /sex?BS=$bs&user=$user&ID=$cid$stream HTTP/1.0"); + transfer($SH,STDOUT); + # print while sysread $SH,$_,$bs; + exit; +} + +if ($0 eq 'sexxx') { + $stream = "&stream=" . ($opt_s || 'xx'); + if (@ARGV) { + warn "streaming:\n"; + open my $tar,'-|','tar',"cv${opt_c}f",'-',@ARGV or die "$0: cannot run tar - $!\n"; + request("POST /sex?BS=$bs&user=$user$type$stream HTTP/1.0"); + transfer($tar,$SH); + # while (read $tar,$_,$bs) { syswrite $SH,$_ } + } else { + $cid = query_sid($server,$port,$id); + request("GET /sex?BS=$bs&user=$user&ID=$cid$stream HTTP/1.0"); + $opt_c = 'z' if $H{'CONTENT-TYPE'} =~ /gzip/i; + if (-t STDOUT) { + print "extracting from stream:\n"; + open $out,"|tar xv${opt_c}f -" or die "$0: cannot run tar - $!\n"; + } else { + if ($opt_c) { + open $out,"|gzip -d" or die "$0: cannot run gunzip - $!\n"; + } else { + $out = *STDOUT; + } + } + print {$out} $_ while sysread $SH,$_,$bs; + } + exit; +} + +# sexsend +$stream = "&stream=" . shift if @ARGV; + +if ($mode eq 'anonymous') { + unless ($opt_q) { + print "http://$server:$port/sex?user=$user&ID=anonymous$stream\n"; + printf "http://$server:$port/sex?%s\n", + encode_b64("user=$user&ID=anonymous$stream"); + } + $mode = "&mode=anonymous"; +} elsif ($mode eq 'public') { + die "$0: need user/ID when sending to public, set it with fexsend -I\n" unless $user and $id; + unless ($opt_q) { + print "http://$server:$port/sex?user=$user&ID=public$stream\n"; + printf "http://$server:$port/sex?%s\n", + encode_b64("user=$user&ID=public$stream"); + } + $cid = query_sid($server,$port,$id); + $mode = "&ID=$cid&mode=public"; +} else { + # $user = checkalias($user) unless $opt_d; +} + +request("POST /sex?BS=$bs&user=$user$mode$type$timeout$stream HTTP/1.0"); +print STDERR "==> (streaming ...)\n" if $opt_v; + +transfer(STDIN,$SH); + +exit; + + +sub transfer { + my $source = shift; + my $destination = shift; + my ($t0,$t1,$tt); + my ($B,$b,$bt); + + $t0 = $t2 = time; + $tt = $t0-1; + $t1 = 0; + + while ($b = sysread $source,$_,$bs) { + print {$destination} $_ or die "$0: link failure - $!\n"; + $B += $b; + $bt += $b; + $t2 = time; + if ($t2>$t1) { + if ($opt_g) { + if ($B>2*M) { + printf STDERR "%d MB %d kB/s \r", + int($B/M),int($bt/k/($t2-$tt)); + } else { + printf STDERR "%d kB %d kB/s \r", + int($B/k),int($bt/k/($t2-$tt)); + } + } + $t1 = $t2; + if ($t2-$tt>10) { + sleep 1; # be nice to bandwith + $bt = 0; + $tt = $t2; + } + } + } + + die "$0: no stream data\n" unless $B; + + $tt = (time-$t0)||1; + + if ($opt_v or $opt_g) { + if ($B>2097152) { + printf STDERR "transfered: %d MB in %d s with %d kB/s\n", + int($B/1048576),$tt,int($B/1024/$tt); + } elsif($B>2048) { + printf STDERR "transfered: %d kB in %d s with %d kB/s\n", + int($B/1024),$tt,int($B/1024/$tt); + } else { + printf STDERR "transfered: %d B in %d s with %d kB/s\n", + $B,$tt,int($B/1024/$tt); + } + } + +} + + +sub request { + my $req = shift; + + print STDERR "==> $req\n" if $opt_v; + syswrite $SH,"$req\r\n\r\n"; + for (;;) { + unless (defined($_ = &getline)) { + die "$0: server has closed the connection\n"; + } + if (/^HTTP\/[\d\.]+ 200/) { + print STDERR "<== $_" if $opt_v; + last; + } elsif (/^HTTP\/[\d\.]+ 199/) { + print STDERR "<== $_" if $opt_v; + } else { + if ($opt_v) { + print STDERR "<== $_"; + exit 3; + } else { + s:^HTTP/[ \d\.]+::; + s/\r//; + die "$0: server response: $_"; + } + } + } + while (defined($_ = &getline)) { + last if /^\s*$/; + $H{uc($1)} = $2 if /(.+):\s*(.+)/; + print STDERR "<== $_" if $opt_v; + } +} + +# check for (mutt) alias +sub checkalias { + my $to = shift; + if ($to !~ /@/ and open F,$ENV{HOME}.'/.mutt/aliases') { + while () { + next if /,/; + if (/^alias $to\s/i) { + chomp; + s/\s*#.*//; + s/\s+$//; + s/.*\s+//; + s///; + $to = $_; + warn "$0: found alias, using address $to\n"; + die unless $to; + last; + } + } + close F; + } + return $to; +} + +sub despace { + foreach (@_) { + s/^\s+//; + s/\s+$//; + } +} + +sub query_sid { + my ($server,$port,$id) = @_; + my $req; + local $_; + + $req = "GET SID HTTP/1.1"; + print STDERR "==> $req\n" if $opt_v; + syswrite $SH,"$req\r\n\r\n"; + $_ = &getline; + unless (defined $_ and /\w/) { + print STDERR "\n" if $opt_v; + die "$0: no response from server\n"; + } + s/\r//; + if (/^HTTP.* 201 (.+)/) { + print STDERR "<== $_" if $opt_v; + $id = 'MD5H:'.md5_hex($id.$1); + while (defined($_ = &getline)) { + s/\r//; + last if /^\n/; + print STDERR "<== $_" if $opt_v; + } + } else { + die "$0: $server does not support session ID\n"; + } + return $id; +} + +sub sigpipehandler { + local $_ = ''; + $SIG{ALRM} = sub { }; + alarm(1); + $_ = &getline||''; + if (/^HTTP.* \d+ (.*)/) { + if ($opt_v) { + die "\n$0: server error: @_\n"; + } else { + die "\n$0: server error: $1\n"; + } + } else { + die "\n$0: got SIGPIPE (server closed connection)\n"; + } +} + +# read one text line from $SH; +sub getline { + my $line = ''; + my $c; + + local $SIG{ALRM} = sub { die "$0: timeout while waiting for server reply\n" }; + alarm($opt_t||300); + + # must use sysread to avoid perl line buffering + while (sysread $SH,$c,1) { + $line .= $c; + last if $c eq "\n"; + } + + alarm(0); + + return $line; +} + +# from MIME::Base64::Perl +sub decode_b64 { + local $_ = shift; + my $uu = ''; + my ($i,$l); + + tr|A-Za-z0-9+=/||cd; + s/=+$//; + tr|A-Za-z0-9+/| -_|; + return "" unless length; + + $l = (length) - 60; + for ($i = 0; $i <= $l; $i += 60) { + $uu .= "M" . substr($_,$i,60); + } + $_ = substr($_,$i); + if (length) { + $uu .= chr(32 + (length)*3/4) . $_; + } + return unpack ("u",$uu); +} + + +### common functions ### + + +sub mtime { + my @d = localtime((stat shift)[9]); + return sprintf('%d%02d%02d',$d[5]+1900,$d[4]+1,$d[3]); +} + + +sub urldecode { + local $_ = shift; + s/\%([a-f\d]{2})/chr(hex($1))/ige; + return $_; +} + + +sub get_ssl_env { + # set SSL/TLS options + $SSL{SSL_verify_mode} = $ENV{SSLVERIFY} if defined($ENV{SSLVERIFY}); + foreach my $opt (qw( + SSL_version + SSL_cipher_list + SSL_verify_mode + SSL_ca_path + SSL_ca_file) + ) { + my $env = uc($opt); + $env =~ s/_//g; + $SSL{$opt} = $ENV{$env} if defined($ENV{$env}); + } + + if ($SSL{SSL_verify_mode}) { + &search_ca; + unless ($SSL{SSL_ca_path} or $SSL{SSL_ca_file}) { + die "$0: \$SSLVERIFYMODE, but not valid \$SSLCAPATH or \$SSLCAFILE\n"; + } + } elsif (defined($SSL{SSL_verify_mode})) { + # user has set SSLVERIFY=0 ! + } else { + &search_ca; + $SSL{SSL_verify_mode} = 1 if $SSL{SSL_ca_path} or $SSL{SSL_ca_file}; + } +} + +sub search_ca { + local $_; + return if $SSL{SSL_ca_file} or $SSL{SSL_ca_path}; + foreach (qw(/etc/ssl/certs/ca-certificates.crt)) { + if (-f) { + $SSL{SSL_ca_file} = $_; + return; + } + } + foreach (qw(/etc/ssl/certs /etc/pki/tls/certs)) { + if (-f) { + $SSL{SSL_ca_path} = $_; + return; + } + } +} + + +sub serverconnect { + my ($server,$port) = @_; + my $connect = "CONNECT $server:$port HTTP/1.1"; + local $_; + + if ($opt_v and $port == 443 and %SSL) { + foreach my $v (keys %SSL) { + printf "%s => %s\n",$v,$SSL{$v}; + } + } + + if ($proxy) { + tcpconnect(split(':',$proxy)); + if ($port == 443) { + printf "--> %s\n",$connect if $opt_v; + nvtsend($connect,""); + $_ = <$SH>; + s/\r//; + printf "<-- $_"if $opt_v; + unless (/^HTTP.1.. 200/) { + die "$0: proxy error : $_"; + } + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->start_SSL($SH,%SSL); + } + } else { + tcpconnect($server,$port); + } +# if ($port == 443 and $opt_v) { +# printf "%s\n",$SH->get_cipher(); +# } +} + + +# set up tcp/ip connection +sub tcpconnect { + my ($server,$port) = @_; + + if ($SH) { + close $SH; + undef $SH; + } + + if ($port == 443) { + # eval "use IO::Socket::SSL qw(debug3)"; + eval "use IO::Socket::SSL"; + die "$0: cannot load IO::Socket::SSL\n" if $@; + $SH = IO::Socket::SSL->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + %SSL + ); + } else { + $SH = IO::Socket::INET->new( + PeerAddr => $server, + PeerPort => $port, + Proto => 'tcp', + ); + } + + if ($SH) { + autoflush $SH 1; + } else { + die "$0: cannot connect $server:$port - $@\n"; + } + + print "TCPCONNECT to $server:$port\n" if $opt_v; +} + + +sub sendheader { + my $sp = shift; + my @head = @_; + my $head; + + push @head,"Host: $sp"; + + foreach $head (@head) { + print "--> $head\n" if $opt_v; + print {$SH} $head,"\r\n"; + } + print "-->\n" if $opt_v; + print {$SH} "\r\n"; +} + + +sub nvtsend { + local $SIG{PIPE} = sub { $sigpipe = "@_" }; + + $sigpipe = ''; + + die "$0: internal error: no active network handle\n" unless $SH; + die "$0: remote host has closed the link\n" unless $SH->connected; + + foreach my $line (@_) { + print {$SH} $line,"\r\n"; + if ($sigpipe) { + undef $SH; + return 0; + } + } + + return 1; +} + + +# from MIME::Base64::Perl +sub encode_b64 { + my $res = ""; + my $eol = "\n"; + my $padding; + + pos($_[0]) = 0; + $res = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + $res =~ tr|` -_|AA-Za-z0-9+/|; + $padding = (3-length($_[0])%3)%3; + $res =~ s/.{$padding}$/'=' x $padding/e if $padding; + return $res; +} diff --git a/htdocs/dynamic.html b/htdocs/dynamic.html new file mode 100644 index 0000000..ba9391a --- /dev/null +++ b/htdocs/dynamic.html @@ -0,0 +1,35 @@ + +
    +
  • <> +
  • <<$y+1>> +
  • <> +
+
+
+<<`date +"%Y-%m-%d %H:%M:%S"`>>
+
+
+

+ +#if $y>2 +

xxx

+#elseif 0 +

000

+#elseif 4>3 +

###############

+#else +

zzz

+#endif +


+

+$PATH=$PATH$
+URL parameter=$QUERY_STRING$
+
+


+ +

+<<`env`>>
+
+


+see >">sourcecode + diff --git a/htdocs/favicon.ico b/htdocs/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/htdocs/features.html b/htdocs/features.html new file mode 100644 index 0000000..a68df17 --- /dev/null +++ b/htdocs/features.html @@ -0,0 +1,69 @@ + +F*EX feature list + +

F*EX feature list

+
    +
  • file transfer of virtually unlimited file size +
  • recipient and sender only need an e-mail program and a web browser - + of any kind, they do not have to install any software
    + (the F*EX server itself is UNIX based) +
  • RESEND and REGET for resuming after link failures at last sent byte +
  • auto-notification of recipient +
  • auto-deletion after download +
  • auto-deletion after expiration date (default: 5 days) +
  • full-users can create one time upload URLs for foreign users +
  • full-users can create sub-users, who can send only to this full-user +
  • full-users can create groups, an analogy to mailing lists, but for files +
  • admin can allow (internal or external) user self-registration +
  • admin can allow upload to public recipients without authentification +
  • admin can allow upload for LAN users without registration + (anonymous upload) +
  • user can forward a file to a second recipient without re-uploading it +
  • user can forward a received file without download +
  • adminstration by CLI or Web +
  • server based user address books +
  • user and admin can throttle bandwith usage +
  • admin can restrict access based on e-mail or ip addresses +
  • sending to multiple recipients needs storage on the server only once +
  • quotas for sending and receiving +
  • support for named based virtual hosts + (multiple server instances with different hostnames on same IP) +
  • support for streams, including streaming recursive file transfer +
  • support for file linking (upload just a link, not the file itself) +
  • integrated web server with special features: +
      +
    • HTML with inline perl code +
    • HTML with conditional if..then..elseif..end blocks +
    • HTML with include statement +
    • on-the-fly zip, tar and tgz streaming output +
    • (restricted) directory file viewer +
    +
  • for real UNIX users, there are the shell programs + fexsend and + fexget
    + to avoid annoying web browser usage and with a lot of additional + features,
    + also there is an Internet clipboard + and anonymous usage +
  • protocol and source-code free available +
  • localization for + many languanges available +
  • optional authentification by LDAP, RADIUS, POP, IMAP, mailman +
  • server available for UNIX and Windows hosts +
  • about 10 times faster than apache +
  • very low memory usage +
  • (reverse) proxy support +
  • F*EX is a HTTP web-service and needs no firewall-tunnels +
  • works with NAT or DHCP clients, too +
  • postfix filter available to send + e-mails with attachments of any size +
  • maintenance-free: no admin interaction necessary +
  • minimal software & hardware requirements for the server +
  • no external database necessary, but possible (LDAP) +
  • full IPv6 support +
  • easy server installation, no installation necessary on client side +
  • great FAQ, use cases + and detailed internal documentation +
+ + diff --git a/htdocs/fup_template.html b/htdocs/fup_template.html new file mode 100644 index 0000000..7d9fd30 --- /dev/null +++ b/htdocs/fup_template.html @@ -0,0 +1,52 @@ + + + + F*EX upload template + + +

F*EX upload template

+


+ +

+ + + + + + + +
sender: (e-mail address)
auth-ID:
recipient(s):(e-mail address)
comment: (optional)
file name:
+

+ +

+

+


+After "submit" you will see an upload progress bar +(if you have javascript enabled and popups allowed). +

+NOTE: Most web browsers cannot upload files > 2 GB!
+If your file is greater you have to use a special F*EX client.
+You also need one for resuming interrupted uploads. Your web browser cannot do this. +


+

Contact: fexmaster
+ + diff --git a/htdocs/index.html b/htdocs/index.html new file mode 100644 index 0000000..548e82a --- /dev/null +++ b/htdocs/index.html @@ -0,0 +1,140 @@ + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) is a service to send big (large, huge, +giant, ...) files from a user A to a user B. +

+The sender uploads the file to the F*EX server using a +WWW upload form and the recipient +automatically gets a notification e-mail with a download-URL. +

+ +You say: +

+ Why do I need another service for file transfer?!
+ I have e-mail, ftp, ssh and even sendfile! +
+

+I say: +

+ You still need F*EX :-) +
+

+ +For example, you want to send your friend your last holiday video (1 GB). +You have the following possibilities (and problems):

+ +

    +
  • sending a DVD by postal service

    + Out of the question - we live in the year + <> + after invention of the internet! + Sending media (hardware) is for grandpas. +

    +

  • using e-mail

    + Most e-mail servers have a limit of 10 MB per e-mail and a + storage-quota of a few 100 MB per user or even less. +

    +

  • uucp

    + Why not cuneiform writing on stone plates? +

    +

  • ssh

    + You have your friends password or you are willing to give him yours + - just for a file transfer? +

    +

  • ftp

    +

      +
    • Using which ftp server? +
    • Using which account, which password? +
    • You do not mind sending unencrypted passwords and files over the insecure internet? +
    • Your proxy supports passive-ftp? +
    • In case of anonymous ftp: +
        +
      • Does it allow 1 GB uploads? +
      • Does it allow to delete the upload afterwards? +
      • Who else can download your file? +
      • Who else can delete your file? +
      • You have to send your friend the download-URL, he has to + inform you about the successful download, you have to delete + it afterwards.
        + All in all: a pain in the ass. +
      +
    +

    +

  • http

    +

      +
    • No default upload and user management - must be programmed +
    • No auto-notification +
    • No auto-deletion +
    • Very few http servers can handle files greater than 2 GB +
    +

    +

  • + sendfile

    +

      +
    • You run UNIX and have sendfile installed? +
    • Your recipient runs UNIX and has sendfile installed? +
    • Neither you nor your recipient has a firewall blocking port 487? +
    +

    +

  • commercial services like DropLoad, ALLPeers, YouSendIt, etc

    +

      +
    • What limit do they have (most: < 2 GB)? +
    • What about security and privacy: will your files be save and secure? +
    • Are they open source based or closed proprietary? +
    • Are they accessible with any browser or do you need java, active-X, flash or other evil plugins? +
    • Will they exist longer than a few months?
      + (DropLoad, ALLPeers and drop.io already have terminated their business) +
    +

    +

+

+If you have answered only once "no" to the questions above, then you need +F*EX. +

+

Main features of F*EX

+

+

    +
  • file transfer of virtually unlimited file size +
  • recipient and sender only need an e-mail program and a web browser - + of any kind, they do not have to install any software +
  • RESEND and REGET for resuming after link failures at last sent byte +
  • auto-notification of recipient +
  • auto-deletion after download +
  • auto-deletion after expiration date (default: <<$keep>> days) +
  • full-users can create one time upload URLs for foreign users +
  • full-users can create sub-users, who can send only to this full-user +
  • full-users can create groups, an analogy to mailing lists, but for files +
  • maintenance-free: no admin interaction necessary besides creating new F*EX accounts +
  • Sending to multiple recipients needs storage on the server only once +
  • F*EX is a HTTP web-service and needs no firewall-tunnels +
  • support for streams, too +
  • for real UNIX users, there are the shell programs fexsend and fexget to + avoid annoying web browser usage +
  • protocol and source-code free available +
+ +

Let's talk about SEX

+F*EX has a companion: Stream EXchange (SEX).

+You can imagine SEX as network wide UNIX pipes with a relay between. +This can be useful for piping data from user A to user B where A and B cannot +establish a direct connection, but both can connect by HTTP to the +SEX server. For seamless integration into the UNIX tool chain, there are +the shell-tools sexsend and sexget. +

+Authentication is the same as with F*EX. + +

Still questions?

+See the FAQ +and the use cases. + +

+

contact: fexmaster
+ + + diff --git a/htdocs/logo.jpg b/htdocs/logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4aeaa63d891ba0aaa8be6a5e633efc2806f7bc02 GIT binary patch literal 14240 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 literal 0 HcmV?d00001 diff --git a/htdocs/robots.txt b/htdocs/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/htdocs/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/htdocs/small_logo.jpg b/htdocs/small_logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7b2f73844cd44de384ec57322052654e221dbc1d GIT binary patch literal 5104 zcmbW5cTm$yyT^Yafe?xqihxE45)K`uNkT6YKt!aY6zN3)A)$8=q)3s_J5mG#$U%@M zy+;I<-laDMX(CPXa?W|@-goX__ugmcyE8kxv(J8J=h@w7$>ZcX;Noqp1{MH;004Ae z0P-22rGm4ybhouZdO5l~Ak{Rq?$OYw=&CB|YwJoQjSZ28wm7`w6Bneoi0BPVJ0w!a z!_vvo-3KX$l#&!e>N!7o;_l$+Vt?MgK|`JbQ~+u!Dkv2tH53Yk!Ki8InCa7(z(}rH0Yao)36; z5ugBp!4wcMB_#xMK04sMAArCq8M#E2sF-vtq1W7)#X=HZQgbU;wz24b*+z+5;X+|F zmsr`@FZ2At%f~MuA$d~@jgeNlrHWNk*SM{xZ(wL-eE)&9jjf%%gX1H-yN9Qjw~z1B zu<&OQkx|iv#H8eu)U@=B{DQ)wSH&f-iEpc_-__LC)i<PB0VWh$j=ESUo@pvWEU#CLC56`?O z$iP>6GSFqv!Wn;<)*iGTOa?w@q+2h}+gdt5{+-%Fin5+rUG$_9kA3%Dr-0LvUBJKp zXnd#CAhjmR?5=)X^Voyhn;Djk$=B+eBgOb2R8AC%at$#yzsfdcI$u_Jgb$-?LuUt` zh)AuOq<%{zwI2|3{%9V2Q+-7yTX|AXVkgSNSbaLefp_j10|&*Wbb91R&^cNhN=(W;BZ-JU6qTtt03Lt zoIf?W7IE7sA&+nEe&ozERL=O1b#vQSW?J*Pj9}ODlVZ_3M7MhFK;O79-%$yN!3tQ( zb)QE~^p8eLmG9vLzkNB*dG1p|8*pd5iy>nU=)8HOCvSZ{exT-C*!EkEl8v`By;PsO zjR3c%c+SN`BQMkOXt!b>%7*EUj^X56D+g=LI;!|=kSg=N{}hyRhw5ULiT3-{m{+1h zP=ymot@(0VrBMlE7u(AI_IQzpvvo(o-^LIz9O#wI#i`#^{LaEZ%^ZbnXa-&{RTsWS z+Jv7JAa{M|jxQI@W6C$}2?1C1Ylia(a)S?E^UJroz5ifYXOTGeMy;em)e5=&ACqK!yNkHpe>Z@Vwa8ru0VCr3{a+1Zcl+V8A>5Rg&oHkoVEwDXI zkGr7p>EU4YYLoH)(RJ?FRfEXh*KB?ARIX5*uk~mnHYi3O`FKBt)`V?NCbac~F(M(< z1W5okZpd3F3~}Jg=G|vki|C|Fi6&P+bp~EY6D0$3(w-;pVqYIxkpT_$AI^3scOXwR zGhMM?Vz$sH1=Eb^%`PR|g|ud*<8#VkO{#jAfzMs=BNrxx8~3zl0Sc@}Yws4-r-*lc z<;=fx6o)27=V3>Qa-Jt1i^W4($A`Cfy}cXm9yE>Nd%Na`-53oFDjv)CJSkA$T}u(W zy}ab-J(2bkRYH0L?P;+&n|@B>-jp}qYhMJP)c?rxJ(w~NcXV@b-_Q7J^?>MKXGSE- zSl0-C;u>1s;fy++3U0?d^bcle2zEvHrYCd9YRZTM02oE^W@+>GTX>UQ_Ncx4v4$|@jUkM^ z!yR(A?N$}rB*l*7^h8B@Va3sXAemES$>Y_s13fV z1ZG+Eom#Ku;2A~@G5i+7nt^SIcc@u-h(CFVf*{J-X8foOh4X zx6=~+X+5FH4`OXbG}L6k9@EOHJxbKW8Cr$&z-~Ujs4bEk@Wks1N>53E#O^PO)uqWU zu0y)TpS3hP)Q-xF4C?7sQ;Ve1`Z317x9LIAwb!E0Jk68Ul40Ixr4&iU}=t5shCp zCIj0^-k}S0TIG)v;qQ{p&lwpCT71vLmrF*sDpR#g@B}nfhVys7Pmz*O=*MS;8r~Em zbh~dk(>XV_VQfE?2#Lv@M6YZGO02cd1Xb;Sn^<-Vzkj>Ck>LkLkNmjg!U@MLDjw2T zy^5m@m_T=cW9xbz>aE|q*siQ2C4!z|v≥;8=WvW(ligBB-xFW6bi9>3`UBoE!bh z`0^mzD61oP+^nJDM2^Z$A2h@U^fhiI=!}uxQ&Z4yyirT8@KW5IrrVc2uhm(o9`!9;5t^lJ)2xf?d~!x&GAN zhdM0B26?_XjQ}n{(cl>C&kGIxOg*epMhBy~d{ZGpy?*5qX!x~2*InxGN|1o_mDi8~s(l$B<5(3v{%T0)OEVK* zw`r(<$WWXgf&rUf)TN0lz^K`|F3tz06jc&8#x0+wTVoKefp>jrUY2`b(fCp=^L*l` zmcihxn7&VMQCe=24X>^`_?!82?lN_=ae)#NYK~^fANT3?;q8^d*-1ybeh!!^T@>>s z@V?YlR?aj&wjkB*d!>fl4VE%MtSxW4C%{;uSS`6FXNb zqI61cV|HlQz2bIF10_h}XQF@KU=QI4x;>47{UY(^b#c#$z`FgckB5^AM|&8`){HKD z)Mi4;g%p?G(#bx;eDaT@wCcw7zU5QIeo3~%;dg^EJsdf&n$Z1#^`4-A8_m-J@40xV zm}781{hRouto(ri}sn!pjY0X!`h&Ubj zB^Oq-QgHp;>FO&V^!W)`+wqmbU!?;3wu5HU#L2mqRk6f>E*Ppyjoj*%-pdi3+}EaD zljrbA>24Qwg^H8*>d|dZxee;yYJp=TB@=AK9%86V;cdL&+e1;8)IUsSa0|vC{ru~$ z!JZuxu+Yz(fg^*CEp(@%#X|QhrEs^pp3YzbW;0X6(2JbcEqwRP!dZyLET7v(GH0@u zSA$Q*{q;#jsvKW}g(qIJed|>Ql^$zHRQF%(b#ne7nQLLs6AntqPIt;$&HLgn*KY9#>oYeHScLlWaKr7W2hThjE0%5#}sphR|a`Rz{# zk5m34FH0#~d_>jG;;fmL+{}yGDAPi^Jr?8bJaJ$x_;f0%MnhMv@998uvlHsil)?Qz zZjzJrizzf0t}o@N{>Ye)X-lpYbb9^jtCAJg^z!m?^*&UDJAn!}n3$Wk#h)X+xfx^d z>~X}5a5a8<_6HnW&Q90L2Z?K>_^rY1KvlE6{2;BiU$C>lQG8-5T&%JE54)r8{sfEI zkM+n^=nGr{`$@-T(KPN%Mh)KCDHNWI!vyD9xwwM3*od$%4otdVUewf*)vQl=FHv6o z^2yA6TF8i3nOOuf5R=0n$1@C82GvX1zHm47;q?Kw??Q4;A}aI}j7>MIq!s8NXAt^- zr{irZxi{Uj-qy9w?bPA*uUGf0sWsJB5C5dr+Z51HxA2Q--#=o?QM8aDupKOxZo9i= zd_1$D*#uuY3gKN*NsO;JT1o8om1syQ67FRDXdl{(f@7Bz{Fe{pRW4xJUA?(JIj!cP zJwCcOsw|6t-wzP`btiq_S!t1`_4zt#c2}%s^F6M>0o%s?gpRtG?>)nugBxs$p>z7fJaZ1pnlTri%JyMw3ZCsf-!f*(?O@R(3_4%5T)ki4`FIGzE?Y<&`}@9C}e31`QC zPZ7?d4-57sn4kwJ?~J7cHSIc!JlE=Dc>6K921YvamZMUWlM|HvdOzyo6iFJq_gouU zk%1DwlK`kSmi%XMii;??Q&{2de^(?W~oKmF!H);0WC;r(v-3kUZ`&qF3zqvr~@ zA+LM{$GecAe32sJ0}W^Tk#}V{sSK?G=LX)_F^z>Kh-R zMLfwXxy6%ekDci!RoL3&D?bL1cbG? zRAKjMne~ck5l@WNO%Z}IYMyI%l(u9fDI_}^KeUzg!Y@moLeMr5H|`X^WY1Sh%|zc- zd-Wp>ifKb|_}LZaY{1MO+-lsDVi1lkBYxDQ-=lAW8DPxSTU*py$*UhQ9I93S*fI^8({DL7 zkXB$=ul#^Ael>G8(is-0T9Thyo$FSDJ-Lv3YiL!cnP1) + + + F*EX simple upload + + +

F*EX simple upload

+


+ +

+ + + + + + +
your e-mail address: + +
your auth-ID: + +
your file: + +
+

+ +

+

+


+After "submit" you will see an upload progress bar +(if you have javascript enabled and popups allowed). +

+If you have lost your auth-ID use "?" as auth-ID and select a small dummy file. +Your auth-ID will be sent by e-mail to you. +

+You can also use the regular upload form +(with more features). +

+NOTE: Only Firefox or Google Chrome can upload files > 2 GB!
+


+

Contact: fexmaster
+ + diff --git a/htdocs/tools.html b/htdocs/tools.html new file mode 100644 index 0000000..fd29c2c --- /dev/null +++ b/htdocs/tools.html @@ -0,0 +1,40 @@ + +F*EX tools + +
+

F*EX tools

+ + + + + + + +
fexsend + UNIX CLI client for sending files (with many + + additional features)
fexget + UNIX CLI client for receiving files (with many + + additional features)
fexget + Windows CLI client for receiving files +
sexsend, sexget + UNIX CLI clients for sending and receiving streams
schwuppdiwupp + Windows GUI client for sending files
schwuppdiwupp + Macintosh GUI client for sending files
+

+In opposite to most web browsers all these clients can handle files +greater than 2 GB and are able to resume interrupted up/downloads. +

+Hint for UNIX users: +

  wget -qO- http://$HTTP_HOST$/xx.tar | tar xvf -
+installs fexsend fexget and +xx. +
  wget -qO- http://$HTTP_HOST$/afs.tar | tar xvf -
+also installs the client programs for +Stream EXchange +and +anonymous usage. + + + diff --git a/htdocs/version b/htdocs/version new file mode 100644 index 0000000..733bf4c --- /dev/null +++ b/htdocs/version @@ -0,0 +1 @@ +fex-20150120 diff --git a/install b/install new file mode 100755 index 0000000..7ffdfc0 --- /dev/null +++ b/install @@ -0,0 +1,514 @@ +#!/usr/bin/perl -w + +use 5.006; +use Getopt::Std; +use File::Basename; +use Socket; +use IO::Socket::INET; +use Digest::MD5 'md5_hex'; + +$ENV{PATH} .= ':/sbin:/usr/sbin'; + +$usage = "usage: $0 [-p port] [IP-address]\n"; +$xinetd = '/etc/xinetd.d/fex'; + +umask 022; + +if ($<) { + die "you must be root to install F*EX\n"; +} + +goto INSTALL if $0 =~ /upgrade$/; + +$fex = 'fex.rus.uni-stuttgart.de'; +if (system("host $fex >/dev/null") != 0) { + die "host $fex is not resolvable - check /etc/resolv.conf\n"; +} + +if (`uname` =~ /^SunOS/) { + die "Solaris is currently not supported. " + ."Please contact framstag\@rus.uni-stuttgart.de for details.\n"; +} + +$opt_p = 80; + +if (open $xinetd,$xinetd) { + while (<$xinetd>) { + if (/^\s*port\s*=\s*(\d+)/) { + $opt_p = $fexport = $1; + } + if (/^\s*bind\s*=\s*([\d.]+)/) { + $fexip = $ip = $1; + } + } + close $xinetd; +} + +getopts('p:') or die $usage; + +$arg = shift; +if ($arg and -f "locale/$arg/lib/fup.pl") { + exec 'locale/translate',$arg; +} else { + $ip = $arg || $fexip || 0; +} + + +# if (not $ip and open P,"ifconfig 2>/dev/null |") { +if (not $ip and open P,'host $(hostname)|') { + $guessed_ip = 0; + while (

) { + if (/(\d+\.\d+\.\d+\.\d+)/) { + $guessed_ip = $1; + last; + } + } + close P; + print "Your IP [$guessed_ip] : "; + chomp($ip = ); + $ip ||= $guessed_ip; +} + +$ip =~ /^\d+\.\d+\.\d+\.\d+$/ or die $usage; + +($hostname) = gethostbyaddr(gethostbyname($ip),AF_INET); +die "cannot find hostname for IP $ip\n" unless $hostname; + +print "checking prerequisites\n"; + +if (`which xinetd` =~ m{^/}) { + print "found xinetd\n"; +} else { + print "xinetd executable NOT found\n"; + $premiss++; +} + +foreach (qw'/usr/lib/sendmail /usr/sbin/sendmail') { + if (-x) { + $sendmail = $_; + print "found $sendmail\n"; + last; + } +} +unless ($sendmail) { + print "sendmail NOT found\n"; + $premiss++; +} + +if ($premiss) { + print "installation aborted, nothing has been touched yet\n"; + print "what now? ==> see doc/installation\n"; + exit 1; +} + +unless ($fexport) { + + $SH = IO::Socket::INET->new( + PeerAddr => $ip, + PeerPort => $opt_p, + Proto => 'tcp', + ); + + if ($SH) { + print "There is already a tcp-service running on $ip:$opt_p !\n"; + print "Select another port for F*EX by running $0 -p OTHERPORT $ip\n"; + print "or an alternative IP-address by running $0 OTHERADDRESS\n"; + exit 5; + } +} + +print "prerequisites checked, ok\n"; + +unless (getpwnam('fex')) { + print "creating user fex\n"; + system 'useradd -s /bin/bash -c "File EXchange" -m fex'; + exit $? if $?; +} + +if (open F,'/etc/passwd') { + while () { + $fexbash = $_ if /^fex:.*\/bash/; + } + close F; +} +unless ($fexbash) { + die "no bash login shell for user fex\n"; +} + +INSTALL: + +umask 077; + +@FEX = getpwnam('fex') or die "no user fex\n"; +$FEXHOME = $FEX[7]; + +die "no HOME directory for user fex\n" unless -d $FEXHOME; + +print "Installing:\n"; + +@save = ( + "lib/fex.ph", + "lib/fup.pl", + "lib/reactivation.txt", + "etc/mime.types", + "htdocs/index.html", + "htdocs/robots.txt", + "htdocs/FAQ/local.faq", +); + +foreach $s (@save) { + $f = "$FEXHOME/$s"; + if (-e $f) { + $fs = $f.'_save'; + rename $f,$fs and print "$f --> $fs\n"; + } +} + +cpav(qw'bin cgi-bin lib etc htdocs doc',$FEXHOME); +unlink "$FEXHOME/doc/License"; +unlink "$FEXHOME/htdocs/License"; + +$hl = "$FEXHOME/htdocs/locale"; +unless (-d $hl) { mkdir $hl or die "$0: cannot mkdir $hl - $!\n" } + +if (-d "$FEXHOME/spool") { + warn "checking spool ...\n"; + &convert_spool; + system "chown -R fex $spooldir/"; +} else { + $newinstall = $FEXHOME; + chmod 0700,$FEXHOME; + mkdir "$FEXHOME/spool",0700 or die "cannot mkdir $FEXHOME/spool - $!\n"; + mkdir "$FEXHOME/spool/.error",0700; + system "chown -R fex $FEXHOME/spool"; +} + +foreach $s (@save) { + $f = "$FEXHOME/$s"; + $fs = $f.'_save'; + $fn = $f.'_new'; + if (-e $fs) { + system "rm -rf $fn"; + rename $f,$fn and print "$f --> $fn\n"; + rename $fs,$f and print "$fs --> $f\n"; + } +} + +system(qw'perl -p -i -e', + 's:href="/?FAQ.html":href="/FAQ/FAQ.html":', + "$FEXHOME/lib/fup.pl" +); + +$fph = "$FEXHOME/lib/fex.ph"; +open $fph,$fph or die "cannot read $fph - $!\n"; +while (<$fph>) { + s/'MYHOSTNAME.MYDOMAIN'/'$hostname'/; + $conf .= $_; +} +close $fph; + +eval $conf; +$spooldir ||= "$FEXHOME/spool"; + +$fid = "$FEXHOME/.fex/id"; +$aa = "$spooldir/$admin/@"; + +if ($newinstall) { + print "\n"; + for (;;) { + print "Server hostname [$hostname] : "; + $_ = ; + s/\s//g; + $hostname = $_ if $_; + last if gethostbyname($hostname); + print "No DNS for $hostname\n"; + } + for (;;) { + print "F*EX admin [$admin] : "; + $_ = ; + s/\s//g; + $admin = $_ if $_; + last if $admin =~ /.\@./; + print "admin must be a valid email address!\n"; + } + while (not $admin_pw) { + print "F*EX admin password: "; + $admin_pw = ; + $admin_pw =~ s/\s//g; + } + mkfid(); + print "(admin password is in $aa)\n"; + $conf =~ s/^\s*\$hostname\s*=.*/\$hostname = '$hostname';/m; + $conf =~ s/^\s*\$admin\s*=.*/\$admin = '$admin';/m; +} else { + if ($admin_pw) { + print "\nFound old \$admin_pw in $fph !\n"; + print "This is no longer supported for security reason.\n"; + if (open $aa,$aa) { + $_ = <$aa>||''; + chomp; + close $aa; + if ($_ ne $admin_pw) { + print "\nYou have to delete \$admin_pw in $fph and run\n"; + print "$FEXHOME/bin/fac -u $admin $admin_pw\n"; + print "\nThen rerun $0\n"; + exit 2; + } + } + mkfid(); + print "\$admin_pw is transfered to auth-ID in $aa\n\n"; + $conf =~ s/^\s*(\$admin_pw)\s*=.*/# $1 is now auth_ID of user \$admin/m; + } +} + +sub mkfid { + my $ad = dirname($aa); + mkdir $ad; + open $aa,'>',$aa or die "$0: cannot create $aa - $!\n"; + print {$aa} "$admin_pw\n"; + close $aa; + my $fd = dirname($fid); + mkdir $fd; + rename $fid,$fid.'_save'; + open $fid,'>',$fid or die "$0: cannot create $fid - $!\n"; + print {$fid} "$hostname:$opt_p\n"; + print {$fid} "$admin\n"; + print {$fid} "$admin_pw\n"; + close $fid; + chmod 0700,$fd; + system "chown -R fex $fd $ad"; +} + +open $fph,">$fph.new" or die "$0: cannot write $fph.new - $!\n"; +print {$fph} $conf; +close $fph; +system "chown fex $fph.new"; +rename "$fph.new",$fph or die "$0: cannot rename $fph.new to $fph - $!\n"; + +do $fph or die "$0: error in new $fph - $!\n"; + +rename "locale/deutsch","locale/german" if -d "locale/deutsch"; +rename "locale/espanol","locale/spanish" if -d "locale/espanol"; + +if (@locales = glob "locale/*/lib/fup.pl") { + foreach (@locales) { + m{locale/(.+?)/} and $locale = $1; + if (-f "$FEXHOME/$_") { + system 'locale/translate',$locale; + system "chown -R fex $FEXHOME/locale/$locale"; + $hl = "$FEXHOME/htdocs/locale/$locale"; + symlink "$FEXHOME/locale/$locale/htdocs",$hl unless -l $hl; + } else { + push @nlocales,"./install $1\n"; + } + } + if (@nlocales) { + if (glob "$FEXHOME/locale/*/lib/fup.pl") { + print "\nTo install another localized version, type:\n"; + } else { + print "\nTo install a localized version, type:\n"; + } + print @nlocales; + } +} + +$fph = "$FEXHOME/lib/fex.ph"; +do $fph; + +unless (-f $xinetd) { + my $xc = '/etc/xinetd.conf'; + if (open $xc,$xc) { + while (<$xc>) { + if (/^\s*only_from/) { + print "WARNING: found \"only_from\" in $xc : fexsrv is restricted!\n"; + } + } + close $xc; + } + if (-d '/etc/xinetd.d') { + unless (-f $xinetd) { + open $xinetd,">$xinetd" or die "cannot write $xinetd - $!\n"; + open F,'etc/xinetd_fex' or die "cannot read etc/xinetd_fex - $!\n"; + while () { + s/FEXHOME/$FEXHOME/; + s/PORT/$opt_p/; + s/ADDRESS/$ip/; + print {$xinetd} $_; + } + close F; + close $xinetd; + system qw'/etc/init.d/xinetd restart'; + print "WARNING: cannot restart xinetd\n" if $?; + } + } else { + print "WARNING: No /etc/xinetd.d found.\n"; + print "WARNING: You have to install etc/xinetd_fex manually.\n"; + } + + $crontab = `crontab -u fex -l 2>/dev/null`; + if ($crontab !~ /fex_cleanup/) { + open $crontab,">fex.cron" or die "cannot create fex.cron - $!\n"; + print {$crontab} $crontab,"\n"; + print {$crontab} " 3 3 * * * exec $FEXHOME/bin/fex_cleanup\n"; + close $crontab; + system qw(crontab -u fex fex.cron); + } + + system "chown -R fex:root $FEXHOME $FEXHOME/spool/"; + system "chmod -R go-r $FEXHOME/lib $FEXHOME/cgi-bin $FEXHOME/spool/"; + + print "\n"; + print "Now check configuration file $FEXHOME/lib/fex.ph and run\n"; + print "$FEXHOME/bin/fac for further configuration and user management.\n"; + print "(You can do this as user \"fex\")\n"; +} else { + + system "chmod -R go-r $FEXHOME/lib $FEXHOME/cgi-bin"; + + print "\n"; + print "F*EX update installed.\n"; + print "You can inform your users about the new features with:\n"; + print "$FEXHOME/bin/fexwall 'new F*EX features on $hostname' ". + "< $FEXHOME/doc/newfeatures\n"; +} + +if (@local_rdomains and not @local_rhosts) { + print "\nWARNING:\n"; + print "In $fph you have @local_rdomains but not @local_rhosts!\n"; + print "Selfregistrating of external users will not work!\n"; + print "See ${fph}_new/\n"; +} + +if (`$sendmail -h 2>&1` =~ /exim/ and + `grep trusted_users /etc/exim4/exim4.conf 2>/dev/null` !~ /\bfex\b/) { + print "\nWARNING:\n"; + print "$sendmail is exim\n"; + print "You MUST set in your exim4.conf:\n"; + print "trusted_users = mail : uucp : fex\n"; +} +exit; + + +sub convert_spool { + my ($f,$d,$to,$from,$link); + + local $) = $FEX[3]; + local $> = $FEX[2]; + + our ($spooldir,$skeydir,$gkeydir); + $ENV{FEXLIB} = $FEXLIB = "$FEXHOME/lib"; + require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n"; + + # User --> user@maildomain + if ($mdomain) { + foreach $f (glob "$spooldir/.dkeys/*") { + if ($link = readlink $f) { + (undef,$to,$from,$file) = split('/',$link); + if ($file) { + $to .= '@'.$mdomain if $to !~ /@/; + $from .= '@'.$mdomain if $from !~ /@/; + if ($link ne "../$to/$from/$file") { + symlink "../$to/$from/$file",$f; + } + } + } + } + } + + # fix spool layout: FROM and TO must have domains and must be lower case + foreach $d ((glob "$spooldir/*/*"),(glob "$spooldir/*")) { + if (not -l $d and -d $d and $d =~ m:(.+)/(.+):) { + $p = $1; + $b = $2; + if ($b !~ /^@/ and $b !~ /^[A-Z_-]+$/) { + if ($mdomain and $b !~ /@/) { + rename $d,sprintf("%s/%s@%s",$p,lc($b),$mdomain); + } elsif ($b ne lc($b)) { + rename $d,sprintf("%s/%s",$p,lc($b)); + } + } + } + } + + # split auth-ID and subuser file: @ --> @ @SUBUSER + foreach my $u (glob "$spooldir/*@*") { + next if -f "$u/\@SUBUSER"; + open my $idf,"$u/\@" or next; + $id = <$idf>; + if (defined ($su = <$idf>) and $su =~ /\w/ + and open my $suf,">$u/\@SUBUSER") { + print {$suf} $su; + while (defined ($su = <$idf>)) { print {$suf} $su } + close $suf; + close $idf; + if (open my $idf,">$u/\@") { + print {$idf} $id; + close $idf; + } + } + } + + # create new SKEYs + foreach my $sf (glob "$spooldir/*/\@SUBUSER") { + $user = (split '/',$sf)[-2]; + if (open $sf,$sf) { + while (<$sf>) { + s/#.*//; + if (/(.+\@.+):(.+)/) { + ($subuser,$id) = ($1,$2); + next if $subuser =~ /\*/; + $skey = md5_hex("$user:$subuser:$id"); + if (open $skey,'>',"$skeydir/$skey") { + print {$skey} "from=$subuser\n", + "to=$user\n", + "id=$id\n"; + close $skey; + } + mkdirp("$spooldir/$subuser/\@MAINUSER"); + symlink $skey,"$spooldir/$subuser/\@MAINUSER/$user"; + } + } + } + close $sf; + } + + # create new GKEYs + foreach my $gf (glob "$spooldir/*/\@GROUP/*") { + next unless -f $gf; + $group = (split '/',$gf)[-1]; + $user = (split '/',$gf)[-3]; + if (open $gf,$gf) { + while (<$gf>) { + s/#.*//; + if (/(.+\@.+):(.+)/) { + ($gm,$id) = ($1,$2); + $gkey = md5_hex("$user:$group:$gm:$id"); + if (open $gkey,'>',"$gkeydir/$gkey") { + print {$gkey} "from=$gm\n", + "to=\@$group\n", + "user=$user\n", + "id=$id\n"; + close $gkey; + } + mkdirp("$spooldir/$gm/\@GROUP"); + symlink "../../$user/\@GROUP/$group","$spooldir/$gm/\@GROUP/$group"; + } + } + } + close $gf; + } +} + +sub cpav { + my $dd = pop @_; + local *P; + + die "cpav: $dd is not a directory" unless -d $dd; + open P,"tar cf - @_ | su -c 'cd $dd; umask 022; tar xvf - 2>&1' fex |" + or die "cpav: cannot tar - $!\n"; + while (

) { + chomp; + print "$_ --> $dd/$_\n" unless /\/$/; + } + close P; +} diff --git a/lib/dop b/lib/dop new file mode 100755 index 0000000..df9511b --- /dev/null +++ b/lib/dop @@ -0,0 +1,614 @@ +#!/usr/bin/perl -wT + +# F*EX document output +# +# is a subprogram of fexsrv! do not run it directly! +# +# Author: Ulli Horlacher +# + +use File::Basename; +use CGI::Carp qw(fatalsToBrowser); +use Fcntl qw(:flock :seek :mode); +use POSIX qw(strftime locale_h); +use Cwd qw(getcwd abs_path); + +# import from fex.pp +our ($bs,$tmpdir,@doc_dirs); + +my $log = "$logdir/dop.log"; + +# POSIX time format needed for HTTP header +setlocale(LC_TIME,'POSIX'); + +sub dop { + my $doc = shift; + my $source = shift; + my $seek = 0; + my $stop = 0; + my ($link,$host,$path,$range); + + our $error = 'F*EX document output ERROR'; + + security_check($doc); + + # reget? + if ($range = $ENV{HTTP_RANGE}) { + $seek = $1 if $range =~ /^bytes=(\d+)-/i; + $stop = $1 if $range =~ /^bytes=\d*-(\d+)/i; + } + + # redirect on relative symlinks without "../" + if ($link = readlink($doc) and + $link !~ m:^/: and $link !~ m:\.\./: and $link !~ /^:.+:$/) { + $path = $ENV{REQUEST_URI}; + $path =~ s:[^/]*$::; + $doc = "$path/$link"; + $doc =~ s:/+:/:g; + $doc =~ s:^/::; + $host = $ENV{HTTP_HOST} || $hostname; + nvt_print( + "HTTP/1.1 301 Moved Permanently", + "Location: $ENV{PROTO}://$host/$doc", + "Content-Length: 0", + "Connection: close", + "" + ); + &reexec; + } + + # watchdog documents + if (@wdd and $wdd and grep { $doc =~ /$_/ } @wdd) { &$wdd($doc) } + + my $dir = untaint(getcwd()); + chdir(dirname($doc)); + http_output($doc,$seek,$stop); + chdir($dir); +} + +sub http_output { + my ($file,$seek,$stop) = @_; + my ($filename,$files,$streamfile,$size,$total_size); + my ($data,$type); + my ($var,$env,$con); + my @files; + my $htmldoc = ''; + my $htauth; + my @s; + my $s = 0; + my $b = 0; + my $http_client = $ENV{HTTP_USER_AGENT} || ''; + local $_; + + # extra security check: document must not be in lib or spool directory + if (path_match($file,$FEXLIB) or path_match($file,$spooldir)) { + http_error(403); + } + + security_check($file); + $htauth = dirname($file).'/.htauth'; + require_auth($htauth,$file) if -f $htauth; + + if (-f $file) { + # normal file + open $file,'<',$file or http_error(400); + security_check($file); + } elsif ($file =~ /(.+)\.gz$/ and -f $1) { + @files = ($1); + open $file,'-|',qw'gzip -c',@files or http_error(503); + } elsif ($file =~ /(.+)\.tgz$/ and -f "$1.tar") { + @files = ("$1.tar"); + open $file,'-|',qw'gzip -c',@files or http_error(503); + } elsif ($file =~ /(.+)\.(tar|tgz|zip)$/ and + @s = lstat($streamfile = "$1.stream") and $s[4] == $<) + { + # streaming file (only if it is owned by user fex) + chdir dirname($file); + security_check($file); + if (-l $streamfile and readlink($streamfile) =~ /^:(.+):$/) { + # special symlink pointer file for streaming + @files = split(/:/,$1); + } elsif (open $streamfile,$streamfile) { + # special streaming file + while (<$streamfile>) { + chomp; + if (/^(\/.*):/) { + chdir $1; + security_check($1); + } else { + push @files,$_; + } + } + } else { + http_error(503); + } + close $streamfile; + foreach (@files) { + if (/^\// or /\.\.\//) { + # absolute path or relative path with parent directory is not allowed + http_error(403); + } + if (@s = stat($_) and not($s[2] & S_IRGRP) or not -r $_) { + # file must be readable by user and group + http_error(403); + } + } + http_error(416) if $ENV{HTTP_RANGE}; + close STDERR; + if ($file =~ /\.tar$/) { @a = qw'tar --exclude *~ --exclude .* -cf -' } + elsif ($file =~ /\.tgz$/) { @a = qw'tar --exclude *~ --exclude .* -czf -' } + elsif ($file =~ /\.zip$/) { @a = qw'zip -x *~ */.*/* @ -rq -' } + else { http_error(400) } + open $file,'-|',@a,@files or http_error(503); + } else { + http_error(404); + } + + $type = 'application/octet-stream'; + if ($file =~ /\.html$/) { $type = 'text/html' } + # elsif ($file =~ /\.txt$/) { $type = 'text/plain' } + elsif ($file =~ /\.css$/) { $type = 'text/css' } + elsif ($file =~ /\.js$/) { $type = 'text/javascript' } + elsif ($file =~ /\.ps$/) { $type = 'application/postscript' } + elsif ($file =~ /\.pdf$/) { $type = 'application/pdf' } + elsif ($file =~ /\.jpg$/) { $type = 'image/jpeg' } + elsif ($file =~ /\.png$/) { $type = 'image/png' } + elsif ($file =~ /\.gif$/) { $type = 'image/gif' } + elsif ($file !~ /\.(tar|tgz|zip|jar|rar|arj|7z|bz2?|gz)$/) { + my $qfile = untaint(abs_path($file)); + $qfile =~ s/([^\/\.\+\w!=,_-])/\\$1/g; + $_ = `file $qfile`; + if (/HTML/) { + $type = 'text/html'; + } elsif (/text/i and not -x $file) { + $type = 'text/plain'; + if (/\sASCII\s/) { $type .= "; charset=us-ascii" } + elsif (/(ISO-[\w-]+)/) { $type .= "; charset=".lc($1) } + else { $type .= "; charset=utf-8" } + } + } + + # show sourcecode if URL ends with '!' + # to avoid this for a HTML file, simple do a: chmod o-r file + if ($type eq 'text/html') { + if ($htmlsource) { + if (@s = stat($file) and $s[2] & S_IROTH) { + $type = 'text/plain'; + } else { + http_error(403); + } + } + } elsif ($ENV{'QUERY_STRING'} eq '!') { + $type = 'text/plain'; + } + + + if ($type eq 'text/html') { + $seek = $stop = 0; + local $^W = 0; + local $/; + $htmldoc = <$file>; + while ($htmldoc =~ s/\n##.*?\n/\n/) {}; + # evaluate #if ... #else ... #elseif ... #endif blocks + my $mark = randstring(16); + while ($htmldoc =~ s/\n(#if\s+(.+?)\n.+?\n)#endif/\n$mark/s) { + $_ = $1; + # if block + if (eval $2) { + s/#if.*\n//; + s/\n#else.*//s; + $htmldoc =~ s/$mark/$_/; + } else { + # elseif blocks + while (s/.*?\n#elseif\s+(.+?)\n//s) { + if (eval $1) { + s/\n#else.*//s; + $htmldoc =~ s/$mark/$_/; + } + } + # else block left? + if ($htmldoc =~ /$mark/) { + s/.*\n#else\s*\n//s or $_ = ''; + $htmldoc =~ s/$mark/$_/; + } + } + }; + # evaluate #include + while ($htmldoc =~ s/\n#include "(.*?)"/\n$mark/s) { + my $file = $1; + my $include = ''; + if (open $file,$file) { + $include = <$file>; + close $file; + } + $dynamic = $htmldoc =~ s/$mark/$include/; + } + # evaluate <> + while ($htmldoc =~ /<<(.+?)>>/s) { + local $pc = $1; + local $__ = ''; + tie *STDOUT => "Buffer",\$__; + $__ .= eval $pc; + untie *STDOUT; + $dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s; + }; + # substitute $variable$ with value from environment (if present) + while ($htmldoc =~ /\$([\w_]+)\$/g) { + $var = $1; + if (defined($env = $ENV{$var})) { + $htmldoc =~ s/\$$var\$/$env/g; + } + }; + $total_size = $size = $s = length($htmldoc); + } else { + if (@files) { + $size = 0; + } else { + $total_size = -s $file || 0; + $size = $total_size - $seek - ($stop ? $total_size-$stop-1 : 0); + } + } + + if ($size < 0) { + http_header('416 Requested Range Not Satisfiable'); + exit; + } + + alarm($timeout*10); + + if ($seek or $stop) { + my $range; + if ($stop) { + $range = sprintf("bytes %s-%s/%s",$seek,$stop,$total_size); + } else { + $range = sprintf("bytes %s-%s/%s",$seek,$total_size-1,$total_size); + } + nvt_print( + 'HTTP/1.1 206 Partial Content', + 'Server: fexsrv', + "Content-Length: $size", + "Content-Range: $range", + "Content-Type: $type", + '', + ); + } else { + # streaming? + if (@files) { + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Expires: 0", + "Content-Type: $type", + '', + ); + } else { + # Java (clients) needs Last-Modified header! + # if there are locale versions, use actual time for Last-Modified + # to enforce reload of page + $file =~ m{/htdocs/(.+)}; + my @lfiles = glob("$FEXHOME/locale/*/htdocs/$1"); + my $date = ($dynamic or @lfiles > 1) ? + strftime("%a, %d %b %Y %T GMT",gmtime(time)) : + http_date($file); + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Last-Modified: $date", + "Expires: 0", + "Content-Length: $size", + "Content-Type: $type", + ); + nvt_print("Set-Cookie: locale=$locale") if $use_cookies and $locale; + nvt_print(''); + } + } + + if ($ENV{REQUEST_METHOD} eq 'GET') { + if ($type eq 'text/html') { + alarm($timeout*10); + print $htmldoc; + } else { + # binary data # can be stream! + seek $file,$seek,0 if $seek; + while ($b = read($file,$data,$bs)) { + if ($stop and $s+$b > $size) { + $b = $size-$s; + $data = substr($data,0,$b) + } + $s += $b; + alarm($timeout*10); + print $data or last; + } + } + fdlog($log,$file,$s,$size) if $s; + } + + alarm(0); + close $file; + exit if @files; # streaming end + return $s; +} + + +# show directory index +sub showindex { + my $dir = shift; + my ($htmldoc,$size); + my @links = (); + my @dirs = (); + my @files = (); + my $uri = $ENV{REQUEST_URI}; + my $allowed; + my ($htindex,$htauth); + local $_; + + $uri =~ s:/+$::; + $dir =~ s:/+$::; + + security_check($dir); + + $htindex = "$dir/.htindex"; + $htauth = "$dir/.htauth"; + + open $htindex,$htindex or http_error(403); + require_auth($htauth,$dir) if -f $htauth; + + # .htindex may contain listing regexp + chomp ($allowed = <$htindex>||'.'); + close $htindex; + + opendir $dir,$dir or http_error(503); + while (defined($_ = readdir $dir)) { + next if /^[.#]/ or /~$/; + if (@s = lstat "$dir/$_" and ($s[2] & (S_IRGRP|S_IROTH))) { + if (-l _) { push @links,$_ } + elsif (-d _) { push @dirs,$_ } + elsif (-f _) { push @files,$_ } + } + } + closedir $dir; + + # parent directory listable? + if ($uri =~ m:(/.+)/.+: and -f "$dir/../.htindex") { + unshift @dirs,$1; + } + + # first the (sub)directories + $htmldoc = "\n

$uri/

\n"; + foreach my $d (sort @dirs) { + if ($d =~ m:^/: and -f "$d/.htindex") { + $htmldoc .= "

$d/

\n"; + } elsif (-f "$dir/$d/.htindex") { + $htmldoc .= "

$uri/$d/

\n"; + } + } + +# # then the symlinks +# $htmldoc .= "\n
\n";
+#  my $link;
+#  foreach my $l (sort @links) {
+#    if ($l =~ /$allowed/ and $link = readlink "$dir/$l" and $link =~ /^[^.\/]/) {
+#      $htmldoc .= "$l -> $dir/$link\n";
+#    }
+#  }
+  
+  # then the files
+  $htmldoc .= "\n
\n";
+  foreach my $f (sort @files) {
+    if ($f =~ /$allowed/) {
+      $htmldoc .= sprintf "%20s %20s %s\n",
+                          isodate(mtime("$dir/$f")),
+                          d3(-s "$dir/$f"||0),
+                          $uri,urlencode($f),$f;
+    }
+  }
+  $htmldoc .= "
\n\n"; + + $size = length($htmldoc); + nvt_print( + 'HTTP/1.1 200 OK', + 'Server: fexsrv', + "Content-Length: $size", + "Content-Type: text/html", + '', + ); + print $htmldoc; + fdlog($log,"$dir/",$size,$size); +} + + +sub mtime { + return (lstat shift)[9]; +} + + +sub d3 { + local $_ = shift; + while (s/(\d)(\d\d\d\b)/$1,$2/) {}; + return $_; +} + + +sub http_date { + my $file = shift; + my @stat; + + if (@stat = stat($file)) { + return strftime("%a, %d %b %Y %T GMT",gmtime($stat[9])); + } else { + return 0; + } +} + + +sub path_match { + my $p1 = abs_path(shift); + my $p2 = abs_path(shift); + + if (defined $p1 and defined $p2) { + return 1 if $p1 =~ /^\Q$p2/; + return 2 if dirname($p1) =~ /^\Q$p2/; + } + return 0; +} + + +# return real file name (from symlink) +sub realfilename { + my $file = shift; + + return '' unless -e $file; + + if (-l $file) { + return realfilename(readlink($file)); + } else { + return $file; + } +} + + +sub security_check { + my $file = shift; # can be directory, too! + my @s; + + # client ip allowed? + access_check($file); + + # documents with leading . are not allowed + if (abs_path($file) =~ /\/\./) { + errorlog("$file with leading ."); + http_error(403); + } + + if (-f $file) { + + # document filename must not contain @ + if (realfilename($file) =~ /@/ or abs_path($file) =~ /@/) { + errorlog("$file contains @"); + http_error(403); + } + + # document filename must not end with ~ + if (realfilename($file) =~ /~$/) { + errorlog("$file ends with ~"); + http_error(403); + } + + # file must be group or world readable + if (@s = stat($file) and not($s[2] & (S_IRGRP|S_IROTH))) { + errorlog("$file not group or world readable"); + http_error(403); + } + + # symlink to regular file and symlink owned by root or fex? ==> ok! + if (-l $file and path_match(dirname($file),$docdir)) { + @s = lstat($file); + return if $s[4] == 0 or $s[4] == $<; + } + + } + + # file in allowed directory? ==> ok! + foreach my $dir (@doc_dirs) { + return if path_match($file,$dir); + } + + errorlog("$file not in \@doc_dirs"); + http_error(403); +} + +# security check: client ip allowed? +sub access_check { + my $file = abs_path(shift); + my $dir = $file; + my $af; + local $_; + + $dir .= '/x' if -d $dir; + + while ($dir = dirname($dir) and $dir ne '/') { + $af = "$dir/.htaccessfrom"; + if (open $af,$af) { + while (<$af>) { + s/\s//g; + if (ipin($ra,$_)) { + close $af; + return; + } + } + errorlog("no access to $file by $af"); + http_error(403); + } + } + +} + +# HTTP Basic authentication +sub require_auth { + my $htauth = shift; + my $doc = shift; + my ($realm,$auth); + my @http_auth; + my $uri = $ENV{REQUEST_URI} || '/'; + + $uri =~ s/\/index\.html$//; + $uri =~ s/\/$//; + + if (-d $doc or $doc =~ /\/index\.html$/) { + $realm = $uri; + } else { + $realm = dirname($uri); + } + + $auth = slurp($htauth); + unless ($auth and $realm) { + http_header("200 OK"); + print html_header("$ENV{SERVER_NAME} no authentication"); + pq(qq( + '

$htauth missing

' + '' + )); + exit; + } + chomp $auth; + + if ($ENV{HTTP_AUTHORIZATION} and $ENV{HTTP_AUTHORIZATION} =~ /Basic\s+(.+)/) + { @http_auth = split(':',decode_b64($1)) } + if (@http_auth != 2 or $http_auth[1] ne $auth) { + http_header( + '401 Authorization Required', + "WWW-Authenticate: Basic realm=\"$realm\"", + 'Content-Length: 0', + ); + # control back to fexsrv for further HTTP handling + &reexec; + } +} + + +# function for <> inside HTML documents +sub out { + $__ .= join('',@_); + return ''; +} + +# tie STDOUT to buffer variable (redefining print) +package Buffer; + +sub TIEHANDLE { + my ($class,$buffer) = @_; + bless $buffer,$class; +} + +sub PRINT { + my $buffer = shift; + $$buffer .= $_ foreach @_; +} + +sub PRINTF { + my $buffer = shift; + my $fmt = shift @_; + $$buffer .= sprintf($fmt,@_); +} + +1; diff --git a/lib/fex.ph b/lib/fex.ph new file mode 100644 index 0000000..f7d26e5 --- /dev/null +++ b/lib/fex.ph @@ -0,0 +1,156 @@ +## your F*EX server host name (with domain) +$hostname = 'MYHOSTNAME.MYDOMAIN'; + +## admin email address used in notification emails +## to change it, you must call: fac -/ admin-email-address auth-id +$admin = 'fex@'.$hostname; + +## server admin email address shown on web page +$ENV{SERVER_ADMIN} = $admin; + +## restrict web administration to ip range(s) +@admin_hosts = qw(127.0.0.1 10.0.0.0-10.10.255.255); + +## Bcc address for notification emails +$bcc = 'fex'; + +## send notifications about new F*EX releases +$notify_newrelease = $admin; + +## optional: download-URLs sent in notification emails +# @durl = qw( +# http://MYFEXSERVER/fop +# https://MYFEXSERVER/fop +# http://MYPROXY/fex/fop +# ); + +## On AUTO mode the fexserver sends notification emails automatically. +## On MANUAL mode the user must notify the recipients manually. +# $mailmode = 'MANUAL'; +$mailmode = 'AUTO'; + +## optional: your mail domain +## if set it will be used as domain for every user without domain +## local_user ==> local_user@$mdomain +## if not set, addresses without domains produce an error +# $mdomain = 'MY.MAIL.DOMAIN'; +# $admin = 'fexmaster@'.$mdomain; + +## optional: static address (instead of F*EX user) in notification email From +## BEWARE: if set, mail error bounces will not go to the real sender, but +## to this address! +# $sender_from = $admin; + +## optional HTML header extra link and logo +# @H1_extra = qw(http://www.MY.ORG http://www.MY.ORG/logo.gif); + +## disclaimer to be appended to every notification email +# $disclaimer = 'powered by camelcraft!'; + +## optional: suppress funny messages +# $boring = 1; + +# locales to present (must be installed!) +# if empty, present all installed locales +# @locales = qw(english swabian); + +## default locale: which languange is used in first place +# $default_locale = 'swabian'; + +## where to store the files and logs, must be writable for user fex! +# $spooldir = "$ENV{HOME}/spool"; +# $logdir = $spooldir; + +## Default quota in MB for recipient; 0 means "no quota" +$recipient_quota = 0; + +## Default quota in MB for sender; 0 means "no quota" +$sender_quota = 0; + +## Expiration: keep files that number of days (default) +$keep = 5; + +## Expiration: keep files that number of days (maximum) +$keep_max = 99; + +## Autodelete: delete files after download (automatically) +## YES ==> immediatelly (1 minute grace time) +## DELAY ==> after download at next fex_cleanup cronjob run +## 2 ==> 2 days after download (can be any number!) +## NO ==> keep until expiration date (see $keep) +$autodelete = 'YES'; + +## if the file has been already downloaded then subsequentials +## downloads are only allowed from the same client (uses cookies) +## to prevent unwanted file sharing +$limited_download = 'YES'; + +## Allow or disallow overwriting of files +$overwrite = 'YES'; + +## Allow user requests for forgotten auth-IDs (then send by email) +$mail_authid = 'YES'; + +## optional: from which hosts and for which mail domains users may +## register themselves as full users (must set both!) +# @local_hosts = qw(127.0.0.1 ::1 10.10.100.0-10.10.200.255 129.69.1.129); +# @local_domains = qw(uni-stuttgart.de flupp.org); +# @local_domains = qw(uni-stuttgart.de *.uni-stuttgart.de); + +## optional: external users may register themselves as restricted users +## for local receiving domains and hosts (must set both!) +# @local_rdomains = qw(flupp.org *.flupp.org); +# @local_rhosts = qw(10.0.0.0-10.0.255.255 129.69.1.129); +## optional: allow restricted user registration only by certain domains +# @registration_domains = qw(belwue.de ietf.org); +## optional: allow restricted user registration only by certain hosts +# @registration_hosts = qw(129.69.0.0-129.69.255.255 176.9.84.26); + +## optional: for certain remote domains do not use sender address in +## notfication email From, because their MTA will probably +## reject it if From and To contain their domain name. +## Instead use $admin for From. See also $sender_from +# @remote_domains = qw(flupp.org); + +## optional: allow public upload via http://$hostname/pup for +# @public_recipients = qw(fexmaster@rus.uni-stuttgart.de); + +## optional: allow anonymous upload without authentication for these IP ranges +# @anonymous_upload = qw(127.0.0.1 ::1 10.10.100.0-10.10.200.255 129.69.1.129); + +## optional: forbidden addresses +# @forbidden_recipients = qw(nobody@* *@listserv*); + +## optional: forbidden ip addresses for CGIs +# @forbidden_hosts = qw(64.124.0.0-64.125.255.255); + +## optional: restrict upload to these IP ranges +# @upload_hosts = qw(127.0.0.1 ::1 10.10.100.0-10.10.200.255 129.69.1.129); + +## optional: restrict download to these address ranges +# @download_hosts = qw(127.0.0.1 10.10.100.0-10.10.200.255 129.69.1.129); + +## optional: throttle bandwith for certain addresses (in kB/s) +## 0 means : full speed +## first match wins +# @throttle = qw( +# framstag@*:0 microsoft.com:100 +# 127.0.0.1:0 202.0.0.0-211.255.255.255:1024 +# [::1]:0 [fe00::0-fe00::ffff]:0 +# ); + +## optional: expire user accounts after x days of inactivity +## delete=wipe out, notify=send mail to fex admin +# $account_expire = "100:delete"; +# $account_expire = "365:notify"; + +## optional: allowed directories for file linking (see fexsend) +# @file_link_dirs = qw(/sw /nfs/home/exampleuser); + +## optional: allow additional directories with static documents +## ($docdir (/home/fex/htdocs) is always allowed implicitly) +# @doc_dirs = qw(/sw /nfs/home/exampleuser/htdocs); + +## optional: text file with your conditions of using +## will be append to registrations request replies +# $usage_conditions = "$docdir/usage_conditions.txt"; diff --git a/lib/fex.pp b/lib/fex.pp new file mode 100644 index 0000000..bb72a4e --- /dev/null +++ b/lib/fex.pp @@ -0,0 +1,1449 @@ +# -*- perl -*- + +use 5.008; +use Fcntl qw':flock :seek :mode'; +use IO::Handle; +use IPC::Open3; +use Encode; +use Digest::MD5 qw'md5_hex'; +use File::Basename; +use Sys::Hostname; +use Symbol qw'gensym'; + +# set and untaint ENV if not in CLI (fexsrv provides clean ENV) +unless (-t) { + foreach my $v (keys %ENV) { + ($ENV{$v}) = ($ENV{$v} =~ /(.*)/s); + } + $ENV{PATH} = '/usr/local/bin:/bin:/usr/bin'; + $ENV{IFS} = " \t\n"; + $ENV{BASH_ENV} = ''; +} + +unless ($FEXLIB = $ENV{FEXLIB} and -d $FEXLIB) { + die "$0: found no FEXLIB - fexsrv needs full path\n" +} + +$FEXLIB =~ s:/+:/:g; +$FEXLIB =~ s:/$::; + +# $FEXHOME is top-level directory of F*EX installation or vhost +# $ENV{HOME} is login-directory of user fex +# in default-installation both are equal, but they may differ +$FEXHOME = $ENV{FEXHOME} or $ENV{FEXHOME} = $FEXHOME = dirname($FEXLIB); + +umask 077; + +# defaults +$hostname = gethostname(); +$tmpdir = $ENV{TMPDIR} || '/var/tmp'; +$spooldir = $FEXHOME.'/spool'; +$docdir = $FEXHOME.'/htdocs'; +$logdir = $spooldir; +$autodelete = 'YES'; +$overwrite = 'YES'; +$limited_download = 'YES'; # multiple downloads only from same client +$keep = 5; # days +$recipient_quota = 0; # MB +$sender_quota = 0; # MB +$timeout = 30; # seconds +$bs = 2**16; # I/O blocksize +$use_cookies = 1; +$sendmail = '/usr/lib/sendmail'; +$sendmail = '/usr/sbin/sendmail' unless -x $sendmail; +$mailmode = 'auto'; +$bcc = 'fex'; +$default_locale = ''; +$fop_auth = 0; +$mail_authid = 'yes'; +$force_https = 0; +$debug = 0; + +$FHS = -f '/etc/fex/fex.ph' and -d '/usr/share/fex/lib'; +# Debian FHS +if ($FHS) { + $ENV{FEXHOME} = $FEXHOME = '/usr/share/fex'; + $spooldir = '/var/spool/fex'; + $logdir = '/var/log/fex'; + $docdir = '/var/lib/fex/htdocs'; + $notify_newrelease = ''; +} + +# allowed download managers (HTTP User-Agent) +$adlm = '^(Axel|fex)'; + +# allowed multi download recipients +$amdl = '^(anonymous|_fexmail_)'; + +# local config +require "$FEXLIB/fex.ph" or die "$0: cannot load $FEXLIB/fex.ph - $!"; + +$fop_auth = 0 if $fop_auth =~ /no/i; +$mail_authid = 0 if $mail_authid =~ /no/i; +$force_https = 0 if $force_https =~ /no/i; +$debug = 0 if $debug =~ /no/i; + +# check for name based virtual host +$vhost = vhost($ENV{'HTTP_HOST'}); + +push @doc_dirs,$docdir; +foreach my $ld (glob "$FEXHOME/locale/*/htdocs") { + push @doc_dirs,$ld; +} + +$nomail = ($mailmode =~ /^MANUAL|nomail$/i); + +if (not $nomail and not -x $sendmail) { + http_die("found no sendmail\n"); +} +http_die("cannot determine the server hostname") unless $hostname; + +$ENV{PROTO} = 'http' unless $ENV{PROTO}; +$keep = $keep_default ||= $keep || 5; +$fra = $ENV{REMOTE_ADDR} || ''; +$sid = $ENV{SID} || ''; + +mkdirp($dkeydir = "$spooldir/.dkeys"); # download keys +mkdirp($ukeydir = "$spooldir/.ukeys"); # upload keys +mkdirp($akeydir = "$spooldir/.akeys"); # authentification keys +mkdirp($skeydir = "$spooldir/.skeys"); # subuser authentification keys +mkdirp($gkeydir = "$spooldir/.gkeys"); # group authentification keys +mkdirp($xkeydir = "$spooldir/.xkeys"); # extra download keys +mkdirp($lockdir = "$spooldir/.locks"); # download lock files + +if (my $ra = $ENV{REMOTE_ADDR} and $max_fail) { + mkdirp("$spooldir/.fail"); + $faillog = "$spooldir/.fail/$ra"; +} + +unless ($admin) { + $admin = $ENV{SERVER_ADMIN} ? $ENV{SERVER_ADMIN} : 'fex@'.$hostname; +} + +# $ENV{SERVER_ADMIN} may be set empty in fex.ph! +$ENV{SERVER_ADMIN} = $admin unless defined $ENV{SERVER_ADMIN}; + +$mdomain ||= ''; + +if ($use_cookies) { + if (my $cookie = $ENV{HTTP_COOKIE}) { + if ($cookie =~ /\bakey=(\w+)/) { $akey = $1 } + # elsif ($cookie =~ /\bskey=(\w+)/) { $skey = $1 } + } +} + +if (@locales) { + if ($default_locale and not grep /^$default_locale$/,@locales) { + push @locales,$default_locale; + } + if (@locales == 1) { + $default_locale = $locales[0]; + } +} + +$default_locale ||= 'english'; + +unless ($durl) { + my $host = ''; + my $port = 0; + + ($host,$port) = split(':',$ENV{HTTP_HOST}||''); + $host = $hostname; + + unless ($port) { + $port = 80; + if (open my $xinetd,'<',"/etc/xinetd.d/fex") { + while (<$xinetd>) { + if (/^\s*port\s*=\s*(\d+)/) { + $port = $1; + last; + } + } + close $xinetd; + } + } + + # use same protocal as uploader for download + if ($ENV{PROTO} eq 'https' and $port == 443 or $port == 80) { + $durl = "$ENV{PROTO}://$host/fop"; + } else { + $durl = "$ENV{PROTO}://$host:$port/fop"; + } +} + +@durl = ($durl) unless @durl; + + +sub reexec { + exec($FEXHOME.'/bin/fexsrv') if $ENV{KEEP_ALIVE}; + exit; +} + + +sub jsredirect { + $url = shift; + $cont = shift || 'request accepted: continue'; + + http_header('200 ok'); + print html_header($head||$ENV{SERVER_NAME}); + pq(qq( + '' + '' + '' + )); + &reexec; +} + + +sub debug { + print header(),"
\n";
+  print "file = $file\n";
+  foreach $v (keys %ENV) {
+    print $v,' = "',$ENV{$v},"\"\n";
+  }
+  print "

\n"; +} + + +sub nvt_print { + foreach (@_) { syswrite STDOUT,"$_\r\n" } +} + + +sub html_quote { + local $_ = shift; + + s/&/&/g; + s/' + '' + ' ' + ' ' + ' $title' + '' + )); + # '' + + if ($0 =~ /fexdev/) { $head .= "\n" } + else { $head .= "\n" } + + $title =~ s:F\*EX:F*EX:; + + if (open $header,'<',"$docdir/$header") { + $head .= $_ while <$header>; + close $header; + } + + $head .= &$prolog($title) if defined($prolog); + + if (@H1_extra) { + $head .= sprintf( + '

%s

', + $H1_extra[0],$H1_extra[1]||'',$title + ); + } else { + $head .= "

$title

"; + } + $head .= "\n"; + + return $head; +} + + +sub html_error { + my $error = shift; + my $msg = "@_"; + my @msg = @_; + my $isodate = isodate(time); + + $msg =~ s/[\s\n]+/ /g; + $msg =~ s/<.+?>//g; # remove HTML + map { s///gi } @msg; + + errorlog($msg); + + # cannot send standard HTTP Status-Code 400, because stupid + # Internet Explorer then refuses to display HTML body! + http_header("666 Bad Request - $msg"); + print html_header($error); + print 'ERROR: ',join("

\n",@msg),"\n"; + pq(qq( + '


' + '

+ ' $ENV{HTTP_HOST}' + ' $isodate' + ' $ENV{SERVER_ADMIN}' + '
' + '' + )); + exit; +} + + +sub http_die { + + # not in CGI mode + die "$0: @_\n" unless $ENV{GATEWAY_INTERFACE}; + + debuglog(@_); + + # create special error file on upload + if ($uid) { + my $ukey = "$spooldir/.ukeys/$uid"; + $ukey .= "/error" if -d $ukey; + unlink $ukey; + if (open $ukey,'>',$ukey) { + print {$ukey} join("\n",@_),"\n"; + close $ukey; + } + } + + html_error($error||'',@_); +} + + +sub check_maint { + if (my $status = readlink '@MAINTENANCE') { + my $isodate = isodate(time); + http_header('666 MAINTENANCE'); + print html_header($head||''); + pq(qq( + "
" + "

Server is in maintenance mode

" + "

($status)

" + "
" + "


" + "

$ENV{HTTP_HOST} $isodate
" + "" + )); + exit; + } +} + + +sub check_status { + my $user = shift; + + $user = lc $user; + $user .= '@'.$mdomain if $mdomain and $user !~ /@/; + + if (-e "$user/\@DISABLED") { + my $isodate = isodate(time); + http_header('666 DISABLED'); + print html_header($head); + pq(qq( + "

$user is disabled

" + "Contact $ENV{SERVER_ADMIN} for details" + "


" + "

$ENV{HTTP_HOST} $isodate
" + "" + )); + exit; + } +} + + +sub isodate { + my @d = localtime shift; + return sprintf('%d-%02d-%02d %02d:%02d:%02d', + $d[5]+1900,$d[4]+1,$d[3],$d[2],$d[1],$d[0]); +} + + +sub encode_Q { + my $s = shift; + $s =~ s{([\=\x00-\x20\x7F-\xA0])}{sprintf("=%02X",ord($1))}eog; + return $s; +} + + +# from MIME::Base64::Perl +sub decode_b64 { + local $_ = shift; + my $uu = ''; + my ($i,$l); + + tr|A-Za-z0-9+=/||cd; + s/=+$//; + tr|A-Za-z0-9+/| -_|; + return '' unless length; + $l = (length)-60; + for ($i = 0; $i <= $l; $i += 60) { + $uu .= "M" . substr($_,$i,60); + } + $_ = substr($_,$i); + $uu .= chr(32+(length)*3/4) . $_ if $_; + return unpack ("u",$uu); +} + + +# short base64 encoding +sub b64 { + local $_ = ''; + my $x = 0; + + pos($_[0]) = 0; + $_ = join '',map(pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs)); + tr|` -_|AA-Za-z0-9+/|; + $x = (3 - length($_[0]) % 3) % 3; + s/.{$x}$//; + + return $_; +} + + +# simulate a "rm -rf", but never removes '..' +# return number of removed files +sub rmrf { + my @files = @_; + my $dels = 0; + my ($file,$dir); + local *D; + local $_; + + foreach (@files) { + next if /(^|\/)\.\.$/; + /(.*)/; $file = $1; + if (-d $file and not -l $file) { + $dir = $file; + opendir D,$dir or next; + while ($file = readdir D) { + next if $file eq '.' or $file eq '..'; + $dels += rmrf("$dir/$file"); + } + closedir D; + rmdir $dir and $dels++; + } else { + unlink $file and $dels++; + } + } + return $dels; +} + + +sub gethostname { + my $hostname = hostname; + my $domain; + local $_; + + unless ($hostname) { + $_ = `hostname 2>/dev/null`; + $hostname = /(.+)/ ? $1 : ''; + } + if ($hostname !~ /\./ and open my $rc,'/etc/resolv.conf') { + while (<$rc>) { + if (/^\s*domain\s+([\w.-]+)/) { + $domain = $1; + last; + } + if (/^\s*search\s+([\w.-]+)/) { + $domain = $1; + } + } + close $rc; + $hostname .= ".$domain" if $domain; + } + if ($hostname !~ /\./ and $admin and $admin =~ /\@([\w.-]+)/) { + $hostname .= '.'.$1; + } + + return $hostname; +} + + +# strip off path names (Windows or UNIX) +sub strip_path { + local $_ = shift; + + s/.*\\// if /^([A-Z]:)?\\/; + s:.*/::; + + return $_; +} + + +# substitute all critcal chars +sub normalize { + local $_ = shift; + + return '' unless defined $_; + + # we need perl native utf8 (see perldoc utf8) + $_ = decode_utf8($_) unless utf8::is_utf8($_); + + s/[\r\n\t]+/ /g; + s/[\x00-\x1F\x80-\x9F]/_/g; + s/^\s+//; + s/\s+$//; + + return encode_utf8($_); +} + + +# substitute all critcal chars +sub normalize_html { + local $_ = shift; + + return '' unless defined $_; + + $_ = normalize($_); + s/[\"<>]//g; + + return $_; +} + + + +# substitute all critcal chars with underscore +sub normalize_filename { + local $_ = shift; + + return $_ unless $_; + + # we need native utf8 + $_ = decode_utf8($_) unless utf8::is_utf8($_); + + $_ = strip_path($_); + + # substitute all critcal chars with underscore + s/[^a-zA-Z0-9_=.+-]/_/g; + s/^\./_/; + + return encode_utf8($_); +} + + +sub normalize_email { + local $_ = lc shift; + + s/[^\w_.+=!~#^\@\-]//g; + s/^\./_/; + /(.*)/; + return $1; +} + + +sub untaint { + local $_ = shift; + /(.*)/s; + return $1; +} + + +sub checkchars { + my $input = shift; + local $_ = shift; + + if (/^([|+.])/) { + http_die("\"$1\" is not allowed at beginning of $input"); + } + if (/([\/\"\'\\<>;])/) { + http_die(sprintf("\"&#%s;\" is not allowed in %s",ord($1),$input)); + } + if (/(\|)$/) { + http_die("\"$1\" is not allowed at end of $input"); + } + if (/[\000-\037]/) { + http_die("control characters are not allowed in $input"); + } + /(.*)/; + return $1; +} + + +sub checkaddress { + my $a = shift; + my $re; + local $_; + local ($domain,$dns); + + $a =~ s/:\w+=.*//; # remove options from address + + return $a if $a eq 'anonymous'; + + $re = '^[.@]|@.*@|local(host|domain)$|["\'\`\|\s()<>/;,]'; + if ($a =~ /$re/i) { + debuglog("$a has illegal syntax ($re)"); + return ''; + } + $re = '^[!^=~#_:.+*{}\w\-\[\]]+\@(\w[.\w\-]*\.[a-z]+)$'; + if ($a =~ /$re/i) { + $domain = $dns = $1; + { + local $SIG{__DIE__} = sub { die "\n" }; + eval q{ + use Net::DNS; + $dns = Net::DNS::Resolver->new->query($domain)||mx($domain); + unless ($dns or mx('uni-stuttgart.de')) { + http_die("Internal error: bad resolver"); + } + } + }; + if ($dns) { + return untaint($a); + } else { + debuglog("no A or MX DNS record found for $domain"); + return ''; + } + } else { + debuglog("$a does not match e-mail regexp ($re)"); + return ''; + } +} + + +# check forbidden addresses +sub checkforbidden { + my $a = shift; + my ($fr,$pr); + local $_; + + $a .= '@'.$mdomain if $mdomain and $a !~ /@/; + return $a if -d "$spooldir/$a"; # ok, if user already exists + if (@forbidden_recipients) { + foreach (@forbidden_recipients) { + $fr = quotemeta; + $fr =~ s/\\\*/.*/g; # allow wildcard * + # skip public recipients + if (@public_recipients) { + foreach $pr (@public_recipients) { + return $a if $a eq lc $pr; + } + } + return '' if $a =~ /^$fr$/i; + } + } + return $a; +} + + +sub randstring { + my $n = shift; + my @rc = ('A'..'Z','a'..'z',0..9 ); + my $rn = @rc; + my $rs; + + for (1..$n) { $rs .= $rc[int(rand($rn))] }; + return $rs; +} + + +# emulate mkdir -p +sub mkdirp { + my $dir = shift; + my $pdir; + + return if -d $dir; + $dir =~ s:/+$::; + http_die("cannot mkdir /\n") unless $dir; + $pdir = $dir; + if ($pdir =~ s:/[^/]+$::) { + mkdirp($pdir) unless -d $pdir; + } + unless (-d $dir) { + mkdir $dir,0770 or http_die("mkdir $dir - $!\n"); + } +} + + +# hash with SID +sub sidhash { + my ($rid,$id) = @_; + + if ($rid and $ENV{SID} and $id =~ /^MD5H:/) { + $rid = 'MD5H:'.md5_hex($rid.$ENV{SID}); + } + return $rid; +} + + +# test if ip is in iplist (ipv4/ipv6) +# iplist is an array with ips and ip-ranges +sub ipin { + my ($ip,@list) = @_; + my ($i,$ia,$ib); + + $ipe = lc(ipe($ip)); + map { lc } @list; + + foreach $i (@list) { + if ($ip =~ /\./ and $i =~ /\./ or $ip =~ /:/ and $i =~ /:/) { + if ($i =~ /(.+)-(.+)/) { + ($ia,$ib) = ($1,$2); + $ia = ipe($ia); + $ib = ipe($ib); + return $ip if $ipe ge $ia and $ipe le $ib; + } else { + return $ip if $ipe eq ipe($i); + } + } + } + return ''; +} + +# ip expand (ipv4/ipv6) +sub ipe { + local $_ = shift; + + if (/^\d+\.\d+\.\d+\.\d+$/) { + s/\b(\d\d?)\b/sprintf "%03d",$1/ge; + } elsif (/^[:\w]+:\w+$/) { + s/\b(\w+)\b/sprintf "%04s",$1/ge; + s/^:/0000:/; + while (s/::/::0000:/) { last if length > 39 } + s/::/:/; + } else { + $_ = ''; + } + return $_; +} + + +sub filename { + my $file = shift; + my $filename; + + if (open $file,'<',"$file/filename") { + $filename = <$file>||''; + chomp $filename; + close $file; + } + + unless ($filename) { + $filename = $file; + $filename =~ s:.*/::; + } + + return $filename; +} + + +sub urlencode { + local $_ = shift; + s/(^[.~]|[^\w.,=:~^+-])/sprintf "%%%X",ord($1)/ge; + return $_; +} + + +# file and document log +sub fdlog { + my ($log,$file,$s,$size) = @_; + my $ra; + + if (open $log,'>>',$log) { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + $ra = $ENV{REMOTE_ADDR}||'-'; + $ra .= '/'.$ENV{HTTP_X_FORWARDED_FOR} if $ENV{HTTP_X_FORWARDED_FOR}; + $ra =~ s/\s//g; + $file =~ s:/data$::; + printf {$log} + "%s [%s_%s] %s %s %s/%s\n", + isodate(time),$$,$ENV{REQUESTCOUNT},$ra,encode_Q($file),$s,$size; + close $log; + } +} + + +# extra debug log +sub debuglog { + my $prg = $0; + local $_; + + return unless $debug and @_; + unless ($debuglog and fileno $debuglog) { + mkdir "$logdir/.debug",0770 unless -d "$logdir/.debug"; + $prg =~ s:.*/::; + $prg = untaint($prg); + $debuglog = sprintf("%s/.debug/%s_%s_%s.%s", + $logdir,time,$$,$ENV{REQUESTCOUNT}||0,$prg); + $debuglog =~ s/\s/_/g; + # open $debuglog,'>>:encoding(UTF-8)',$debuglog or return; + open $debuglog,'>>',$debuglog or return; + autoflush $debuglog 1; + # printf {$debuglog} "\n### %s ###\n",isodate(time); + } + while ($_ = shift @_) { + s/\n*$/\n/; + s/<.+?>//g; # remove HTML + print {$debuglog} $_; + print "DEBUG: $_" if -t; + } +} + + +# extra debug log +sub errorlog { + my $prg = $0; + my $log = "$logdir/error.log"; + my $msg = "@_"; + + $prg =~ s:.*/::; + $msg =~ s/[\r\n]+$//; + $msg =~ s/[\r\n]+/ /; + $msg =~ s/\s*

.*//; + + if (open $log,'>>',$log) { + flock $log,LOCK_EX; + seek $log,0,SEEK_END; + $ra = $ENV{REMOTE_ADDR}||'-'; + $ra .= '/'.$ENV{HTTP_X_FORWARDED_FOR} if $ENV{HTTP_X_FORWARDED_FOR}; + $ra =~ s/\s//g; + printf {$log} "%s %s %s %s\n",isodate(time),$prg,$ra,$msg; + close $log; + } +} + + +# failed authentification log +sub faillog { + my $request = shift; + my $n = 1; + + if ($faillog and $max_fail_handler and open $faillog,"+>>$faillog") { + flock($faillog,LOCK_EX); + seek $faillog,0,SEEK_SET; + $n++ while <$faillog>; + printf {$faillog} "%s %s\n",isodate(time),$request; + close $faillog; + &$max_fail_handler($ENV{REMOTE_ADDR}) if $n > $max_fail; + } +} + +# remove all white space +sub despace { + local $_ = shift; + s/\s//g; + return $_; +} + + +# superquoting +sub qqq { + local $_ = shift; + my ($s,$i,@s); + my $q = "[\'\"]"; # quote delimiter chars " and ' + + # remove first newline and look for default indention + s/^(\«(\d+)?)?\n//; + $i = ' ' x ($2||0); + + # remove trailing spaces at end + s/[ \t]*\»?$//; + + @s = split "\n"; + + # first line have a quote delimiter char? + if (/^\s+$q/) { + # remove heading spaces and delimiter chars + foreach (@s) { + s/^\s*$q//; + s/$q\s*$//; + } + } else { + # find the line with the fewest heading spaces (and count them) + # (beware of tabs!) + $s = length; + foreach (@s) { + if (/^( *)\S/ and length($1) < $s) { $s = length($1) }; + } + # adjust indention + foreach (@s) { + s/^ {$s}/$i/; + } + } + + return join("\n",@s)."\n"; +} + + +# print superquoted +sub pq { + my $H = STDOUT; + if (@_ > 1 and defined fileno $_[0]) { $H = shift } + print {$H} qqq(@_); +} + + +# check sender quota +sub check_sender_quota { + my $sender = shift; + my $squota = $sender_quota||0; + my $du = 0; + my ($file,$size,%file,$data); + local $_; + + if (open $qf,'<',"$sender/\@QUOTA") { + while (<$qf>) { + s/#.*//; + $squota = $1 if /sender.*?(\d+)/i; + } + close $qf; + } + + foreach $file (glob "*/$sender/*") { + $data = "$file/data"; + if (not -l $data and $size = -s $data) { + # count hard links only once (= same inode) + my $i = (stat($data))[1]||0; + unless ($file{$i}) { + $du += $size; + $file{$i} = $i; + } + } elsif (-f "$file/upload" and $size = readlink "$file/size") { + $du += $size; + } + } + + return($squota,int($du/1024/1024)); +} + + +# check recipient quota +sub check_recipient_quota { + my $recipient = shift; + my $rquota = $recipient_quota||0; + my $du = 0; + my ($file,$size); + local $_; + + if (open my $qf,'<',"$recipient/\@QUOTA") { + while (<$qf>) { + s/#.*//; + $rquota = $1 if /recipient.*?(\d+)/i; + } + close $qf; + } + + foreach $file (glob "$recipient/*/*") { + if (-f "$file/upload" and $size = readlink "$file/size") { + $du += $size; + } elsif (not -l "$file/data" and $size = -s "$file/data") { + $du += $size; + } + } + + return($rquota,int($du/1024/1024)); +} + + +sub getline { + my $file = shift; + local $_; + chomp($_ = <$file>||''); + return $_; +} + + +# (shell) wildcard matching +sub wcmatch { + local $_ = shift; + my $p = quotemeta shift; + + $p =~ s/\\\*/.*/g; + $p =~ s/\\\?/./g; + $p =~ s/\\\[/[/g; + $p =~ s/\\\]/]/g; + + return /$p/; +} + + +sub logout { + my $logout; + if ($skey) { $logout = "/fup?logout=skey:$skey" } + elsif ($gkey) { $logout = "/fup?logout=gkey:$gkey" } + elsif ($akey) { $logout = "/fup?logout=akey:$akey" } + else { $logout = "/fup?logout" } + return qqq(qq( + '

' + '

' + ' ' + '
' + '

' + )); +} + + +# print data dump of global or local variables in HTML +# input musst be a string, eg: '%ENV' +sub DD { + my $v = shift; + local $_; + + $n =~ s/.//; + $_ = eval(qq(use Data::Dumper;Data::Dumper->Dump([\\$v]))); + s/\$VAR1/$v/; + s/&/&/g; + s/\n$_\n

\n"; +} + +# make symlink +sub mksymlink { + my ($file,$link) = @_; + unlink $file; + return symlink untaint($link),$file; +} + + +# copy file (and modify) or symlink +# returns chomped file contents or link name +# preserves permissions and time stamps +sub copy { + my ($from,$to,$mod) = @_; + my $link; + local $/; + local $_; + + $to .= '/'.basename($from) if -d $to; + + if (defined($link = readlink $from)) { + mksymlink($to,$link); + return $link; + } else { + open $from,'<',$from or return; + open $to,'>',$to or return; + $_ = <$from>; + close $from; + eval $mod if $mod; + print {$to} $_; + close $to or http_die("internal error: $to - $!"); + if (my @s = stat($from)) { + chmod $s[2],$to; + utime @s[8,9],$to unless $mod; + } + chomp; + return $_; + } +} + + +sub slurp { + my $file = shift; + local $_; + local $/; + + if (open $file,$file) { + $_ = <$file>; + close $file; + } + + return $_; +} + + +# name based virtual host? +sub vhost { + my $hh = shift; # HTTP_HOST + my $vhost; + my $locale = $ENV{LOCALE}; + + # memorized vhost? (default is in fex.ph) + %vhost = split(':',$ENV{VHOST}) if $ENV{VHOST}; + + if (%vhost and $hh and $hh =~ s/^([\w\.-]+).*/$1/) { + if ($vhost = $vhost{$hh} and -f "$vhost/lib/fex.ph") { + $ENV{VHOST} = "$hh:$vhost"; # memorize vhost for next run + $ENV{FEXLIB} = $FEXLIB = "$vhost/lib"; + $logdir = $spooldir = "$vhost/spool"; + $docdir = "$vhost/htdocs"; + if ($locale and -e "$vhost/locale/$locale/lib/fex.ph") { + $ENV{FEXLIB} = $FEXLIB = "$vhost/locale/$locale/lib"; + } + require "$FEXLIB/fex.ph" or die "$0: cannot load $FEXLIB/fex.ph - $!"; + $ENV{SERVER_NAME} = $hostname; + @doc_dirs = ($docdir); + foreach my $ld (glob "$FEXHOME/locale/*/htdocs") { + push @doc_dirs,$ld; + } + return $vhost; + } + } +} + + +sub gpg_encrypt { + my ($plain,$to,$keyring,$from) = @_; + my ($pid,$pi,$po,$pe,$enc,$err); + local $_; + + $pe = gensym; + + $pid = open3($po,$pi,$pe, + "gpg --batch --trust-model always --keyring $keyring". + " -a -e -r $bcc -r $to" + ) or return; + + print {$po} $plain; + close $po; + + $enc .= $_ while <$pi>; + $err .= $_ while <$pe>; + errorlog("($from --> $to) $err") if $err; + + close $pi; + close $pe; + waitpid($pid,0); + + return $enc; +} + + +# extract locale functions into hash of subroutine references +# e.g. \&german ==> $notify{german} +sub locale_functions { + my $locale = shift; + local $/; + local $_; + + if ($locale and open my $fexpp,"$FEXHOME/locale/$locale/lib/fex.pp") { + $_ = <$fexpp>; + s/.*\n(\#\#\# locale functions)/$1/s; + # sub xx {} ==> xx{$locale} = sub {} + s/\nsub (\w+)/\n\$$1\{$locale\} = sub/gs; + s/\n}\n/\n};\n/gs; + eval $_; + close $fexpp; + } +} + +sub notify_locale { + my $dkey = shift; + my $status = shift || 'new'; + my ($to,$keep,$locale,$file,$filename,$comment,$autodelete,$replyto,$mtime); + local $_; + + if ($dkey =~ m:/.+/.+/:) { + $file = $dkey; + $dkey = readlink("$file/dkey"); + } else { + $file = readlink("$dkeydir/$dkey") + or http_die("internal error: no DKEY $DKEY"); + } + $file =~ s:^../::; + $filename = filename($file); + $to = $file; + $to =~ s:/.*::; + $mtime = mtime("$file/data") or http_die("internal error: no $file/data"); + $comment = slurp("$file/comment") || ''; + $replyto = readlink "$file/replyto" || ''; + $autodelete = readlink "$file/autodelete" + || readlink "$to/\@AUTODELETE" + || $::autodelete; + $keep = readlink "$file/keep" + || readlink "$to/\@KEEP" + || $keep_default; + + $locale = readlink "$to/\@LOCALE" || readlink "$file/locale" || 'english'; + $_ = untaint("$FEXHOME/locale/$locale/lib/lf.pl"); + require if -f; + unless ($notify{$locale}) { + $locale = 'english'; + $notify{$locale} ||= \¬ify; + } + return &{$notify{$locale}}( + status => $status, + dkey => $dkey, + filename => $filename, + keep => $keep-int((time-$mtime)/DS), + comment => $comment, + autodelete => $autodelete, + replyto => $replyto, + ); +} + +### locale functions ### +# will be extracted by install process and saved in $FEXHOME/lib/lf.pl +# you cannot modify them here without re-installing! + +sub notify { + # my ($status,$dkey,$filename,$keep,$warn,$comment,$autodelete) = @_; + my %P = @_; + my ($to,$from,$file,$mimefilename,$receiver,$warn,$comment,$autodelete); + my ($size,$bytes,$days,$header,$data,$replyto); + my ($mfrom,$mto,$dfrom,$dto); + my $index; + my $fileid = 0; + my $fua = $ENV{HTTP_USER_AGENT}||''; + my $warning = ''; + my $disclaimer = ''; + my $download = ''; + my $keyring; + my $boundary = randstring(16); + my ($body,$enc_body); + + return if $nomail; + + $warn = $P{warn}||2; + $comment = encode_utf8($P{comment}||''); + $comment =~ s/^!\*!//; # multi download allow flag + $autodelete = $P{autodelete}||$::autodelete; + $index = $durl; + $index =~ s/fop/index.html/; + + (undef,$to,$from,$file) = split('/',untaint(readlink("$dkeydir/$P{dkey}"))); + $filename = strip_path($P{filename}); + $mfrom = $from; + $mto = $to; + $mfrom .= '@'.$mdomain if $mdomain and $mfrom !~ /@/; + $mto .= '@'.$mdomain if $mdomain and $mto !~ /@/; + $keyring = $to.'/@GPG'; + # $to = '' if $to eq $from; # ??? + $replyto = $P{replyto}||$mfrom; + $header = "From: <$mfrom> ($mfrom via F*EX service $hostname)\n"; + $header .= "Reply-To: <$replyto>\n" if $replyto ne $mfrom; + $header .= "To: <$mto>\n"; + $data = "$dkeydir/$P{dkey}/data"; + $size = $bytes = -s $data; + return unless $size; + $warning = + "Please avoid download with Internet Explorer, ". + "because it has too many bugs.\n". + "We recommend Firefox or wget."; + if ($filename =~ /\.(tar|zip|7z|arj|rar)$/) { + $warning .= "\n\n". + "$filename is a container file.\n". + "You can unpack it for example with 7zip ". + "(http://www.7-zip.org/download.html)"; + } + if ($limited_download =~ /^y/i) { + $warning .= "\n\n". + 'This download link only works for you, you cannot distribute it.'; + } + if ($size < 2048) { + $size = "$size Bytes"; + } elsif ($size/1024 < 2048) { + $size = int($size/1024)." kB"; + } else { + $size = int($size/1024/1024)." MB"; + } + if ($autodelete eq 'YES') { + $autodelete = "WARNING: After download (or view with a web browser!), " + . "the file will be deleted!"; + } elsif ($autodelete eq 'DELAY') { + $autodelete = "WARNING: When you download the file it will be deleted " + . "soon afterwards!"; + } else { + $autodelete = ''; + } + $mimefilename = $filename; + if ($mimefilename =~ s{([_\?\=\x00-\x1F\x7F-\xFF])}{sprintf("=%02X",ord($1))}eog) { + $mimefilename =~ s/ /_/g; + $mimefilename = '=?UTF-8?Q?'.$mimefilename.'?='; + } + + unless ($fileid = readlink("$dkeydir/$P{dkey}/id")) { + my @s = stat($data); + $fileid = @s ? $s[1].$s[9] : 0; + } + + if ($P{status} eq 'new') { + $days = $P{keep}; + $header .= "Subject: F*EX-upload: $mimefilename\n"; + } else { + $days = $warn; + $header .= "Subject: reminder F*EX-upload: $mimefilename\n"; + } + $header .= "X-FEX-Client-Address: $fra\n" if $fra; + $header .= "X-FEX-Client-Agent: $fua\n" if $fua; + foreach my $u (@durl) { + my $durl = sprintf("%s/%s/%s",$u,$P{dkey},normalize_filename($filename)); + $header .= "X-FEX-URL: $durl\n" unless -s $keyring; + $download .= "$durl\n"; + } + $header .= + "X-FEX-Filesize: $bytes\n". + "X-FEX-File-ID: $fileid\n". + "X-FEX-Fexmaster: $ENV{SERVER_ADMIN}\n". + "X-Mailer: F*EX\n". + "MIME-Version: 1.0\n"; + if ($comment =~ s/^\[(\@(.*?))\]\s*//) { + $receiver = "group $1"; + if ($_ = readlink "$from/\@GROUP/$2" and m:^../../(.+?)/:) { + $receiver .= " (maintainer: $1)"; + } + } else { + $receiver = 'you'; + } + if ($days == 1) { $days .= " day" } + else { $days .= " days" } + + # explicite sender set in fex.ph? + if ($sender_from) { + map { s/^From: <$mfrom/From: <$sender_from/ } $header; + open $sendmail,'|-',$sendmail,$mto,$bcc + or http_die("cannot start sendmail - $!\n"); + } else { + # for special remote domains do not use same domain in From, + # because remote MTA will probably reject this e-mail + $dfrom = $1 if $mfrom =~ /@(.+)/; + $dto = $1 if $mto =~ /@(.+)/; + if ($dfrom and $dto and @remote_domains and + grep { + $dfrom =~ /(^|\.)$_$/ and $dto =~ /(^|\.)$_$/ + } @remote_domains) + { + $header =~ s/(From: <)\Q$mfrom\E(.*?)\n/$1$admin$2\nReply-To: $mfrom\n/; + open $sendmail,'|-',$sendmail,$mto,$bcc + or http_die("cannot start sendmail - $!\n"); + } else { + open $sendmail,'|-',$sendmail,'-f',$mfrom,$mto,$bcc + or http_die("cannot start sendmail - $!\n"); + } + } + if ($comment =~ s/^!(shortmail|\.)!\s*//i + or (readlink "$to/\@NOTIFICATION"||'') =~ /short/i + ) { + $body = qqq(qq( + '$comment' + '' + '$download' + '$size' + )); + } else { + $comment = "Comment: $comment\n" if $comment; + $disclaimer = slurp("$from/\@DISCLAIMER") || qqq(qq( + '$warning' + '' + 'F*EX is not an archive, it is a transfer system for personal files.' + 'For more information see $index' + '' + 'Questions? ==> F*EX admin: $admin' + )); + $disclaimer .= "\n" . $::disclaimer if $::disclaimer; + $body = qqq(qq( + '$from has uploaded the file' + ' "$filename"' + '($size) for $receiver. Use' + '' + '$download' + 'to download this file within $days.' + '' + '$comment' + '$autodelete' + '' + '$disclaimer' + )); + } + if (-s $keyring) { + $enc_body = gpg_encrypt($body,$to,$keyring,$from); + } + if ($enc_body) { + # RFC3156 + $header .= qqq(qq( + 'Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";' + '\tboundary="$boundary"' + 'Content-Disposition: inline' + )); + $body = qqq(qq( + '--$boundary' + 'Content-Type: application/pgp-encrypted' + 'Content-Disposition: attachment' + '' + 'Version: 1' + '' + '--$boundary' + 'Content-Type: application/octet-stream' + 'Content-Disposition: inline; filename="fex.pgp"' + '' + '$enc_body' + '--$boundary--' + )); + } else { + $header .= + "Content-Type: text/plain; charset=UTF-8\n". + "Content-Transfer-Encoding: 8bit\n"; + } + print {$sendmail} $header,"\n",$body; + close $sendmail + or $! and http_die("cannot send notification e-mail (sendmail error $!)\n"); + return $to; +} + + +sub reactivation { + my ($expire,$user) = @_; + my $fexsend = "$FEXHOME/bin/fexsend"; + + return if $nomail; + + if (-x $fexsend) { + $fexsend .= " -M -D -k 30 -C" + ." 'Your F*EX account has been inactive for $expire days," + ." you must download this file to reactivate it." + ." Otherwise your account will be deleted.'" + ." $FEXLIB/reactivation.txt $user"; + # on error show STDOUT and STDERR + system "$fexsend >/dev/null 2>&1"; + if ($?) { + warn "$fexsend\n"; + system $fexsend; + } + } else { + warn "$0: cannot execute $fexsend for reactivation()\n"; + } +} + +1; diff --git a/lib/fup.pl b/lib/fup.pl new file mode 100644 index 0000000..dd53f4c --- /dev/null +++ b/lib/fup.pl @@ -0,0 +1,40 @@ +# config for F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +is a service to send big (large, huge, giant, ...) files. +

+The sender (you) uploads the file to the F*EX server and the recipient automatically gets +a notification e-mail with a download-URL.
+After download or after $keep_default days the server deletes the file. +F*EX is not an archive! +

+See also questions & answers and +use cases. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+After submission you will see an upload progress bar +(if you have javascript enabled and popups allowed). +

+NOTE: Many web browsers cannot upload files > 2 GB!
+If your file is larger you have to use a special F*EX client +or Firefox or Google Chrome which have no size limit.
+You also need a F*EX client for resuming interrupted uploads. Your web browser cannot do this. +

+If you want to send more than one file, then put them in a zip or tar archive, +e.g. with 7-Zip. +

+See also the FAQ and +use cases. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD diff --git a/lib/reactivation.txt b/lib/reactivation.txt new file mode 100644 index 0000000..1e55dc0 --- /dev/null +++ b/lib/reactivation.txt @@ -0,0 +1 @@ +Your F*EX account has been successfully reactivated. diff --git a/locale/czech/htdocs/index.html b/locale/czech/htdocs/index.html new file mode 100644 index 0000000..45cc933 --- /dev/null +++ b/locale/czech/htdocs/index.html @@ -0,0 +1,139 @@ + + + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) je služba pro odesílání velkých +souborů uživatelem A uživateli B. +

+Odesilatel pomocí webového formuláře pro nahrání nahraje +soubor na F*EX server a ten příjemci automaticky odešle +e-mail s oznámením a s URL ke stažení. +

+ +Říkáte si: +

+ Proč potřebuji další službu pro přenos souborů?!
+ Mám e-mail, ftp, ssh a v neposlední řadě i sendfile! +
+

+Já pravím: +

+ Stále potřebujete F*EX :-) +
+

+ +Například chcete poslat svému známému video z vaší poslední dovolené (1 GB). +Máte následující možnosti (a s tím související problémy):

+ +

    +
  • poslat DVD poÅ¡tou

    + Nepřichází v úvahu - žijeme + <> let + od roku, kdy byl vynalezen Internet! + Posílání paměťových médií je pro staříky. +

    +

  • použít e-mail

    + Většina e-mailových serverů má limit pro přílohu 10 MB a + velikost schránky kolem 100 MB a někdy i méně. +

    +

  • uucp

    + Proč rovnou nezůstat u psaní klínovým písmem na kamenné destičky? +

    +

  • ssh

    + Vy máte heslo svého známého, nebo se mu chystáte dát to své + jen kvůli přenosu souboru? +

    +

  • ftp

    +

      +
    • Pomocí jakého ftp serveru? +
    • Pomocí jakého účtu, jakého hesla? +
    • Vám nevadí posílání neÅ¡ifrovaného hesla a souborů přes nezabezpečený Internet? +
    • Podporuje vaÅ¡e proxy pasivní režim pro ftp? +
    • V případě anonymního ftp: +
        +
      • Umožňuje nahrát 1 GB? +
      • Umožňuje po nahrání soubor smazat? +
      • Kdo další si váš soubor může stáhnout? +
      • Kdo další může váš soubor smazat? +
      • Svému známému musíte poslat URL, kde si soubor může stáhnout, on vás musí + informovat, že si soubor stáhl, vy jej pak + musíte smazat.
        + Sečteno a podrženo: Otrava. +
      +
    +

    +

  • http

    +

      +
    • Žádné výchozí nahrávání a správa uživatelů - musí se naprogramovat +
    • Žádné automatické oznamování +
    • Žádné automatické mazání +
    • Velice málo http serverů umí zpracovat soubory větší než 2 GB +
    +

    +

  • sendfile

    +

      +
    • Používáte UNIX a máte nainstalovaný sendfile? +
    • Používá příjemce UNIX a má nainstalovaný sendfile? +
    • Nemáte vy ani příjemce firewall, který blokuje port 487? +
    +

    +

  • komerční služby jako jsou DropLoad, ALLPeers, YouSendIt, etd.

    +

      +
    • Jaký mají limit (větÅ¡inou méně než 2 GB)? +
    • Co bezpečnost a ochrana osobních údajů: Budou vaÅ¡e soubory skutečně uloženy a v bezpečí? +
    • Jsou provozovány na open-source, nebo na uzavřeném proprietálním softwaru? +
    • Jsou přístupné se vÅ¡emi prohlížeči, nebo potřebujete Javu, Active-X, Flash či jiné hnusné zásuvné moduly? +
    • Budou existovat více, jak pár měsíců?
      + (DropLoad, ALLPeers a drop.io své služby již ukončili) +
    +

    +

+

+Pokud jste byť na jedinou z výše uvedených otázek odpověděli "ne", potom potřebujete +F*EX. +

+

Hlavní funkce F*EX

+

+

    +
  • přenos souborů s prakticky neomezenou velikostí +
  • příjemci a uživatelé potřebují pouze program pro elektronickou poÅ¡tu a webový prohlížeč + jakéhokoli typu, nemusí instalovat žádný další software +
  • ZNOVU ODESLÁNÍ a ZNOVU STAŽENÍ pro pokračování přesně tam, kde doÅ¡lo k selhání spojení +
  • automatické oznamování pro příjemce +
  • automatické mazání po stažení +
  • automatické mazání po době platnosti (výchozí: 5 dnů) +
  • plnohodnotní uživatelé si mohou vytvářet poduživatelé, kteří mohou odesílat pouze jim +
  • plnohodnotní uživatelé mohou vytvářet skupiny, obdoba poÅ¡tovních konferencí s tím rozdílem, že se jedná o soubory +
  • bezúdržbovost: ze strany správce nejsou nutné žádné zásahy s vyjímkou vytváření nových F*EX účtů +
  • odesílání více příjemcům spotřebuje na serveru pouze místo pro jednoho příjemce +
  • F*EX je webová služba pro protokol HTTP a nepotřebuje žádné tunely ve firewallu +
  • podporuje také vysílání +
  • pro skalní UNIXové uživatele jsou k dispozici programy pro příkazovou řádku fexsend a fexget pro + vyhnutí se použití otravných webových prohlížečů +
  • protokol i zdrojový kód jsou volně dostupné (Perl Artistic) +
+ +

Promluvme si o SEXu

+F*EX má společníka: Stream EXchange (SEX).

+SEX si můžete představit jako bránu mezi UNIXovými síťovými rourami. +Ta může být užitečná k odesílání dat uživatelem A uživateli B, kde A a B mezi sebou +nemohou navázat přímé spojení, ale oba dva se mohou připojit pomocí HTTP k +SEX serveru. Pro snadné začlenění do řady UNIXových nástrojů slouží nástroje +pro příkazovou řádku sexsend a sexget. +

+Ověřování je stejné jako u F*EX. + +

Máte otázky?

+Přečtěte si FAQ + +

+

kontaktujte: fexmaster
+ + + diff --git a/locale/czech/lang.html b/locale/czech/lang.html new file mode 100644 index 0000000..cd83f0f --- /dev/null +++ b/locale/czech/lang.html @@ -0,0 +1 @@ +čeština diff --git a/locale/czech/lib/fup.pl b/locale/czech/lib/fup.pl new file mode 100644 index 0000000..9bf5dd9 --- /dev/null +++ b/locale/czech/lib/fup.pl @@ -0,0 +1,35 @@ +# config for F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +je služba pro odesílání velkých souborů. +

+Odesilatel (vy) nahraje soubor na F*EX server a ten příjemci autimaticky odešle +e-mail s oznámením a s URL ke stažení.
+Po jeho stažení, nebo po uplynutí $keep_default dnů, server soubor smaže. +F*EX není archiv! +

+Přečtěte si také Otázky a odpovědi (FAQ). +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Po potrzení uvidíte lištu s průběhem nahrávání +(pouze, pokud máte povolen javascript a povolené automatické otevírání oken). +

+POZNÁMKA: Většina webových prohlížečů neumožňuje nahrávat soubory větší než 2 GB!
+Pokud je váš soubor větší, použíjte speciálního klienta pro F*EX.
+Potřebuvoat budete také klient pro obnovení nahrávání v případě přerušení. Váš webový prohlížeč toto neumožňuje. +

+UPOZORNĚNÍ: Některé HTTP proxy servery, jako je třeba privoxy, spomalují průběh nahrávání!
+V případě, že se s tímto pborlémem setkáte, bude zřejmě třeba zakázat používání proxy pro $ENV{SERVER_NAME}. +

+Pro uživatele Firefoxu: Nemačkejte klávesu ESC, protože jinak se stahování přeruší! +

+Přečtěte si také FAQ. +EOD diff --git a/locale/czech/lib/reactivation.txt b/locale/czech/lib/reactivation.txt new file mode 100644 index 0000000..6fe52c6 --- /dev/null +++ b/locale/czech/lib/reactivation.txt @@ -0,0 +1 @@ +Váš F*EX účet byl úspěšně znovu aktivován diff --git a/locale/debian_translate b/locale/debian_translate new file mode 100755 index 0000000..b295e96 --- /dev/null +++ b/locale/debian_translate @@ -0,0 +1,132 @@ +#!/usr/bin/perl -w + +# translate english F*EX files into locale languange, debian special + +use File::Basename; +use File::Copy; + +@trfiles = qw( + lib/fex.pp + cgi-bin/foc + cgi-bin/fop + cgi-bin/fuc + cgi-bin/fup + cgi-bin/fur + cgi-bin/rup + cgi-bin/pup +); + +@cpfiles = qw( + htdocs/index.html + htdocs/FAQ.html + lib/fup.pl + lang.html +); + +$source = shift; +$FEXHOME = shift; +$dest = shift; + +$tr = "$source/locale/translations"; + +mkdirp($dest); +unless (-l "$dest/english") { + symlink '..',"$dest/english" + or die "$0: cannot symlink $dest/english - $!\n"; +} + +foreach $lang (glob "$source/locale/*/lib/fup.pl") { + $lang =~ s:.*/locale/::; + $lang =~ s:/.*::; + next if $lang eq 'english'; + next if $lang =~ /_$/; + + print "\n$lang:\n"; + open $tr,$tr or die "$0: cannot open $tr - $!\n"; + %T = (); + $n = $ll = 0; + + while (<$tr>) { + $n++; + last if /^\s*$/; + if (/^#\s*([\w-]+):/ and $lang eq $1) { + $ll = $n; + } + } + + next unless $ll; + + while (<$tr>) { + next if /^#/; + next if /^\s*$/; + chomp; + unless (/[a-z]/i) { + die "$0: syntax error in $tr line $. : no text\n"; + } + $e = $_; + for my $l (2 .. $ll) { + $_ = <$tr>||''; + chomp; + unless (/[a-z]/i) { + die "$0: syntax error in $tr line $. : no text\n"; + } + } + $T{$e} = $_; + while (<$tr>) { last if /^\s*$/ } + } + + close $tr; + @E = sort {length $b <=> length $a} keys %T; + + foreach $file (@trfiles) { + local $/; + mkdirp("$dest/$lang/".dirname($file)); + $fe = "$source/$file"; + $ft = "$dest/$lang/$file"; + open $fe,"<$fe" or die "$0: cannot read $fe - $!\n"; + open $ft,">$ft" or die "$0: cannot write $ft - $!\n"; + $_ = <$fe>; + close $fe; + foreach $e (@E) { + s/\Q$e/$T{$e}/g; + } + print {$ft} $_; + close $ft; + chmod((stat $fe)[2],$ft); + print "$ft written\n"; + } + + foreach $file (@cpfiles) { + $fs = "$source/locale/$lang/$file"; + $fd = "$dest/$lang/$file"; + mkdirp(dirname($fd)); + $fd .= '_new' if -f $fd; + if (copy($fs,$fd)) { + chmod((stat $fs)[2],$fd); + print "$fd written\n"; + } + } + + foreach $fs (qw(dop fex.ph)) { + $fd = "$dest/$lang/lib/$fs"; + symlink "$FEXHOME/lib/$fs",$fd or die "$0: cannot symlink $fd - $!\n"; + print "$fd linked\n"; + } +} + +# emulate mkdir -p +sub mkdirp { + my $dir = shift; + my $pdir; + + return if -d $dir; + $dir =~ s:/+$::; + die "$0: cannot mkdir /\n" unless $dir; + $pdir = $dir; + if ($pdir =~ s:/[^/]+$::) { + mkdirp($pdir) unless -d $pdir; + } + unless (-d $dir) { + mkdir $dir,0755 or die "$0: mkdir $dir - $!\n"; + } +} diff --git a/locale/french/htdocs/FAQ/FAQ.html b/locale/french/htdocs/FAQ/FAQ.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/FAQ.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##

+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/admin.faq b/locale/french/htdocs/FAQ/admin.faq new file mode 100644 index 0000000..6f8c75d --- /dev/null +++ b/locale/french/htdocs/FAQ/admin.faq @@ -0,0 +1,47 @@ +
+
+Q: Je ne peux pas installer un serveur web comme fexsrv parce que je n'ai pas les permissions root. Est-ce qu'il existe une version pure CGI de F*EX qui puisse tourner avec un server Apache ?
+A: F*EX est fortement lié à fexsrv pour plusieurs raisons (performance, limite de la taille des fichiers, session, etc...) et ne peut pas tourner comme un CGI sous Apache. Mais vous pouvez jeter un oeil à 
+
    +
  • http://gpl.univ-avignon.fr/filez/ +
  • http://freshmeat.net/projects/eventh/ +
  • http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (en Allemand) +
+qui implementent le transfert de fichier avec des CGIs pures, mais avec une limite de 2GB. + +Q: F*EX ne fonctionne pas du tout ! Je ne peux pas m'y connecter avec mon navigateur web ! +A: Vérifier votre routage, ipfilters et la configuration de votre pare-feux. + Vérifier également si votre xinetd est linké à tcp-wrapper et configuré convenablement (hosts.allow). + F*EX a besoin du port 80/tcp pour HTTP et optionnellement du port 443/tcp pour HTTPS. + +Q: F*EX est trop complexe ! J'ai besoin de quelque chose encore plus simple. +A: Essayez http://www.home.unix-ag.org/simon/woof.html + +Q: Comment puis-je intégrer F*EX à un système d'annuaire ou de gestion d'identité ? +A: F*EX a plusieurs modules d'authentification: local, RADIUS, LDAP, mailman et POP. + Pour les quatre derniers, contacter framstag@rus.uni-stuttgart.de + +Q: Je veux que tous mes utilisateurs locaux puissent utiliser F*EX. Comment je fais ? +A: Ils doivent s'enregistrer eux-mêmes avec http://$HTTP_HOST$/fur

+ Il faut éditer lib/fex.ph et configurer (exemple): +

+ @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+ @local_domains = qw(flupp.org ulm.sub.net);
+
+(Bien entendu, vous devez utiliser les paramètres propres à votre réseau !) + +Q: J'ai besoin de plus de sécurité ! Comment activer HTTPS ? +A: Lisez doc/SSL and jetez un oeil à "fop_auth" dans doc/concept + +Q: J'ai besoin d'un look adapté à mon image. Comment puis-je configurer F*EX en ce sens ? +A: Voir la variable @H1_extra dans fex.ph et aussi l'ajout possible de code HTML à htdocs/header.html

+ Voir htdocs/fup_template.html, le modifier selon vos besoins et l'utiliser comme page de démarrage. + +Q: F*EX est trop compliqué pour mes utilisateurs. J'ai besoin d'un formulaire d'upload simplifié. +A: Voir htdocs/fup_template.html + +Q: Je veux que les mails Bcc destinés à F*EX (utilisateur admin) soient envoyés à une autre adresse. +A: Positionnez la variable $bcc dans fex.ph + +Q: Puis-je avoir une version localisé dans ma langue ? +A: Avec votre aide, oui. Merci de contacter framstag@rus.uni-stuttgart.de diff --git a/locale/french/htdocs/FAQ/admin.html b/locale/french/htdocs/FAQ/admin.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/admin.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##

+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/all.html b/locale/french/htdocs/FAQ/all.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/all.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/faq.pl b/locale/french/htdocs/FAQ/faq.pl new file mode 100644 index 0000000..7770549 --- /dev/null +++ b/locale/french/htdocs/FAQ/faq.pl @@ -0,0 +1,119 @@ +package FAQ; + +my ($faq,$var,$env,$q,$a,$c,$s,$t,$n); +my (@faq,%Q,%A,@s); +my @sections = qw'Meta User Admin Misc'; + +@faq = ($faq) = $ENV{PATH_INFO} =~ /(\w+).html/; +@faq = map {lc} @sections if $faq eq 'all'; + +print "\n"; + +print '

F*EX ', + " Frequently Asked Questions

\n"; + +if ($faq ne 'local') { + print "

\n"; + foreach $s (@sections,'All') { + if ($s =~ /$faq/i) { + print "$s\n"; + } else { + printf "[%s]\n",lc($s),$s; + } + } + print "

\n"; +} + +print "\n"; + +foreach my $faq (@faq) { + open $faq,"$faq.faq" or next; + local $/ = "Q:"; + local $_ = <$faq>; + while (<$faq>) { + chomp; + while (/\$([\w_]+)\$/) { + $var = $1; + $env = $ENV{$var} || ''; + # s/\$$var\$/$env<\/code>/g; + s/\$$var\$/$env/g; + }; + ($q,$a) = split /A:\s*/; + $q =~ s/[\s\n]+$//; + $q =~ s! (/\w[\S]+/[\S]+)! $1!g; + $a =~ s/[\s\n]+$/\n/; + while ($a =~ s/^(\s*)\*/$1
    \n$1
  • /m) { + while ($a =~ s/(
  • .*\n\s*)\*/$1
  • /g) {} + $a =~ s:(.*\n)(\s*)(
  • [^\n]+\n):$1$2$3$2
\n:s + } + $a =~ s/\n\n/\n

\n/g; + $a =~ s/([^>\n\\])\n/$1
\n/g; + $a =~ s/

(.+?)<\/pre>/pre($1)/ges;
+    $a =~ s/\\\n/\n/g;
+#    $a =~ s/^\s*
\s*//mg; + $a =~ s/<([^\s<>\@]+\@[\w.-]+)>/<$1><\/a>/g; + $a =~ s! (/\w[\S]+/[\S]+)! $1!g; + $a =~ s!(https?://[\w-]+\.[^\s<>]+)![$1]!g or + $a =~ s!(https?://[^\s<>]+)!$1!g; + push @{$Q{$faq}},$q; + push @{$A{$faq}},$a; + } + close $faq; +} + +print "
\n"; + +foreach $s (sections($faq)) { + + $c = lc $s; + $s = '' if $s eq 'Local'; + $t = ''; + $t = $s if $faq eq 'all'; + + for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) { + printf "\n", + $s,$n+1,$t,$n+1,${Q{$c}[$n]}; + } +} + +print "
%s Q%d: %s
\n"; + +foreach $s (sections($faq)) { + + $c = lc $s; + $s = '' if $s eq 'Local'; + $t = ''; + $t = $s if $faq eq 'all'; + + for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) { + print "


\n"; + print "\n"; + printf "\n", + $t,$n+1,$s,$n+1,${Q{$c}[$n]}; + printf "\n", + $s,$n+1,${A{$c}[$n]}; + print "\n"; + print "
%s Q%d:%s
%s A%d:\n%s
[Top]
\n"; + } +} + +print "

\n";
+print "\n" x 99;
+print "
\n"; + + +sub sections { + my $faq = shift; + if ($faq eq 'all') { + return @sections; + } else { + return ucfirst($faq); + } +} + +sub pre { + local $_ = shift; + s/
//g; + s/\s+$//; + return "
$_
\n"; +} diff --git a/locale/french/htdocs/FAQ/index.html b/locale/french/htdocs/FAQ/index.html new file mode 120000 index 0000000..1dadbb5 --- /dev/null +++ b/locale/french/htdocs/FAQ/index.html @@ -0,0 +1 @@ +meta.html \ No newline at end of file diff --git a/locale/french/htdocs/FAQ/local.faq b/locale/french/htdocs/FAQ/local.faq new file mode 100644 index 0000000..8479331 --- /dev/null +++ b/locale/french/htdocs/FAQ/local.faq @@ -0,0 +1,7 @@ +Q: Comment puis-je utiliser ma propre FAQ ? +A: Placer votre FAQ dans le fichier /home/fex/htdocs/FAQ/local.faq et exécuter : + + + cd /home/fex/htdocs/FAQ + ln -sf local.html index.html + diff --git a/locale/french/htdocs/FAQ/local.html b/locale/french/htdocs/FAQ/local.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/local.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/meta.faq b/locale/french/htdocs/FAQ/meta.faq new file mode 100644 index 0000000..53b9153 --- /dev/null +++ b/locale/french/htdocs/FAQ/meta.faq @@ -0,0 +1,48 @@ +
+
+Q: Pourquoi "F*EX" comme nom et pas simplement "FEX"
+A: À l'époque de l'annonce du logiciel, il existait déja un programme (plus ancien) nommé "FEX" sur 
+   freshmeat.net.
+
+Q: Pourquoi ne pas utiliser un service commercial comme DropLoad, ALLPeers, YouSendIt, etc ?
+A: 
    +
  • Ils ont une limite de 2GB ou moins. +
  • Leur politique de sécurité et de confidentialité est inconnue. +
  • Ils ne sont pas opensource. +
  • Il n'y a pas d'interface en ligne de commande (CLI) UNIX. +
  • Ils ont besoin de java, active-X, flash ou d'autres plugins esotériques. +
  • On ne sait pas combien de temps ils vont exister - DropLoad and ALLPeers ont déja cessé leur activité. +
+ +Q: Pourquoi un chameau comme logo ? +A: Le logo est inspiré du chameau de Perl, mais il est basé sur un chameau "Steiff plush" + qui courent avec nous lors de nos courses de tandem. Le logo a été dessiné par mon "chauffeur" Beate. + http://fex.rus.uni-stuttgart.de/Vortrag/tosa.html + +Q: Où puis-je récupérer les sources de F*EX ? +A: http://fex.rus.uni-stuttgart.de/fex.html + +Q: Perl n'est-il pas trop lent pour faire tout ça ? +A: fex.rus.uni-stuttgart.de tourne sur un ordinateur de bureau et est capable de gérer des uploads + à plus de 300 MB/s. Essayer donc ça avec un serveur web généraliste comme Apache ! + +Q: De quoi ais-je besoin de pour installer F*EX ? +A: D'une machine UNIX avec une entrée DNS et un service smtp fonctionnel. Vous devez être root sur la machine. + +Q: Qu'est-ce que DNS et smtp ? +A: N'installez pas F*EX. Ce n'est pas fait pour vous. + +Q: Qui est l'auteur ? +A: Ulli Horlacher framstag@rus.uni-stuttgart.de + +Q: Quel est la licence de F*EX ? +A: Perl Artistic free software + +Q: Est-ce qu'il y a une mailing list F*EX ? +A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex + +Q: Où puis-je avoir un support commercial pour F*EX ? +A: Contacter fex@nepustil.net http://www.nepustil.net/ + +Q: J'ai encore des questions ! +A: Demandez directement à l'auteur framstag@rus.uni-stuttgart.de diff --git a/locale/french/htdocs/FAQ/meta.html b/locale/french/htdocs/FAQ/meta.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/meta.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/misc.faq b/locale/french/htdocs/FAQ/misc.faq new file mode 100644 index 0000000..c7f9941 --- /dev/null +++ b/locale/french/htdocs/FAQ/misc.faq @@ -0,0 +1,12 @@ +
+
+Q: F*EX est un très bon logiciel ! Est-ce que je peux rejoindre l'équipe de développement ? Qu'est-ce qu'il y a à faire ?
+A: Contacter l'auteur

+ +Les fonctionnalités souhaitées sont : +

    +
  • des testeurs pour MacOS, AIX et les autres UNIX +
  • un nouveau mainteneur pour le client Java F*EX +
  • un plugin F*EX pour thunderbird ou outlook +
  • plus de langages supportés (japonais, klingon ...) +
diff --git a/locale/french/htdocs/FAQ/misc.html b/locale/french/htdocs/FAQ/misc.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/misc.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##
+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/FAQ/user.faq b/locale/french/htdocs/FAQ/user.faq new file mode 100644 index 0000000..dab0a9d --- /dev/null +++ b/locale/french/htdocs/FAQ/user.faq @@ -0,0 +1,60 @@ +
+
+Q: Qu'est-ce que l'auth-ID ?
+A: L'auth-ID est un moyen d'authentification interne qui permet d'authentifier l'utilisateur. Il sera d'abord généré par l'admin ou le processus d'enregistrement automatique et pourra être modifié plus tard par vous, l'utilisateur. Vous pouvez y penser comme à un mot de passe à faible sécurité.
+
+Q: Puis-je utiliser un proxy HTTP ?
+A: Oui, mais attention:
+   Certain proxy http comme HTTP introduise un délai dans l'affichage de la barre de progression lors d'un upload !
+   Vous pouvez essayer de désactiver le proxy pour $SERVER_NAME si vous rencontrez ce problème.
+
+Q: J'ai uploadé un fichier très volumineux mais j'ai fait une faute dans l'adresse du destinataire. J'ai reçu un message d'erreur par mail. Dois-je uploader à nouveau ce fichier ?
+A: Non, cela n'est pas nécessaire. Vous pouvez rediriger un fichier via le menu "Configuration utilisateur & Gestion"
+
+Q: Mon destinataire a perdu son e-mail de notification avec l'URL de téléchargement. Que puis-je faire ?
+A: Vous pouvez vous faire suivre une nouvelle copie du fichier via le menu "Configuration utilisateur & Gestion".
+   Vous recevrez un nouveau message de notification que vous pourrez envoyer à votre destinataire par la poste ou un fax :-)
+
+Q: Je ne peux pas uploader de fichiers > 2 GB avec mon navigateur internet !?
+A: Tous les navigateurs web que je connais ont des bugs dans leur implémentation de HTML-FORM. La plupart du temps, la limite est de 2 GB, parfois 4 GB.
+   Vous devez utiliser un client F*EX spécial pour uploader des fichiers > 2 GB, voir http://$HTTP_HOST$/tools.html
+   Firefox 7 (et suivant) est une exception : F*EX contourne des failles dans l'implémentation de l'upload afin de pouvoir uploader des fichiers de n'importe quelle taille.
+
+Q: Mon téléchargement a été interrompu avant la fin. Puis-je reprendre le téléchargement là où il s'est arrêté ?
+A: F*EX support la reprise de téléchargement, mais votre client doit aussi le supporter.
+   Firefox ne possède pas cette capacité HTTP, vous devez utiliser une autre client comme opera, wget ou fexget.
+
+Q: Mon upload a été interrompu avant la fin. Puis-je reprendre l'upload là où il s'est arrêté ?
+A: F*EX supporte la reprise d'upload, mais votre client doit aussi le supporter.
+   Aucun navigateur web n'a cette capacité, vous devez utiliser un autre client comme fexsend, schwuppdiwupp ou F*IX,
+   voir http://$HTTP_HOST$/tools.html
+
+Q: Mon nvaigateur web ne peut pas démarrer le client java F*IX, avec comme message d'erreur : "found no java runtime environment, cannot start F*IX upload applet"
+A: un plugin java pour votre navigateur est manquant. Sur Debian et Ubuntu, vous pouvez l'installer avec :
+   sudo aptitude install sun-java6-plugin
+
+Q: Lorsque j'appuie sur [ESC] dans firefox, l'upload est annulé. Pourquoi ?
+A: C'est une fonctionnalité intégré à Firefox. ESC termine l'opération courante.
+   Solution simple: ne pas appuyer sur ESC dans Firefox.
+   Solution complexe: demander aux développeurs de Firefox d'ajouter la configuration du clavier.
+
+Q: Firefox 3 se bloque lors de l'upload d'un fichier et je ne vois pas la barre de progression ?
+A: C'est un bug connu dans Firefox 3.6.23. Solution: passer à Firefox 7.
+
+Q: Envoyer un fichier en tant qu'utilisateur F*EX est facile, mais comment recevoir des fichiers de personnes extérieures ?
+A: Vous pouvez les enregistrer comme sous-utilisateurs ou créer un group F*EX via le menu "Configuration utilisateur & Gestion"
+
+Q: Parfois je peux télécharger un fichier plus d'une fois, surtout lorsque je le fais rapidement. Est-ce que la fonction de suppression automatique est défectueuse ?
+A: Le serveur F*EX a un délai d'une minute après le premier téléchargement réussi pendant lequel le fichier reste disponible. Cela est nécessaire
+car certains "gestionnaires de téléchargements" lancent plusieurs téléchargements du même fichier à la fois. Sinon, ils afficheraient une erreur à l'utilisateur. Votre administrateur F*EX a laissé AUTODELETE=DELAY par défaut, ce qui signifie que le nettoyage automatique est appelé une fois par jour.

+ Les utilisateurs avancés (use the source, Luke !) peuvent activer l'option "ne pas supprimer après téléchargement". + +Q: La rétentation par défaut est trop courte pour moi, j'ai besoin de plus. Comment puis-je l'augmenter ? +A: Utilisez fexsend, demandez à votre fexmaster ou bien lisez le code source :-) + +Q: J'ai envoyé un second fichier avec le même nom, mais le destinataire n'a pas reçu deuxième message de confirmation. Pourquoi ? +A: Un fichier avec le même nom et le même destinataire écrase le premier si il est toujours présent, un deuxième e-mail de notification pour un même fichier n'a pas tellement de sens. + +Q: Je ne peux pas télécharger des fichiers avec Internet Explorer, il me dit : "Cannot open Internet site". Que dois-je faire ? +A: Utilisez Firefox ou tout autre navigateur compatible Internet, ce qui n'est pas le cas d'Internet Explorer. Cela fait parti des nombreux bugs d'Internet Explorer. + diff --git a/locale/french/htdocs/FAQ/user.html b/locale/french/htdocs/FAQ/user.html new file mode 100644 index 0000000..a096645 --- /dev/null +++ b/locale/french/htdocs/FAQ/user.html @@ -0,0 +1,12 @@ + +F*EX FAQ + + +##

+## << while (($v,$vv) = each %ENV) { print "$v = $vv\n" } >>
+## 
+ +<< require "./faq.pl" or print $! >> + + + diff --git a/locale/french/htdocs/index.html b/locale/french/htdocs/index.html new file mode 100644 index 0000000..925a3a1 --- /dev/null +++ b/locale/french/htdocs/index.html @@ -0,0 +1,131 @@ + + + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) est un service pour envoyer des fichiers +volumineux d'un utilisateur A à un utilisateur B. +

+L'expéditeur upload le fichier au serveur F*EX en utilisant +un formulaire WWW et le destinataire reçoit automatiquement +une notification. +

+ +Vous vous dîtes: +

+ Pourquoi aurais -je besoin d'un autre service de transfert de fichier ?!
+ J'ai déja l'e-mail, le ftp, ssh et même sendfile ! +
+

+Je réponds: +

+ Vous avez toujours besoin de F*EX :-) +
+

+ +Par exemple, vous voulez envoyer à vos amis la dernière vidéo de vos vacances (1 GB). +Vous avez les possibilités suivantes (et les problèmes):

+ +

    +
  • envoyer un DVD par la voie postale

    + Hors de question - nous vivons en <> après l'invention d'Internet. C'est pour les grand-pères. +

    +

  • utiliser l'e-mail

    + La plupart des serveurs e-mail ont une limite de 10 MB par message et très souvent un quota d'utilisation de quelques centaines de méga-octets. +

    +

  • uucp

    + Et pourquoi pas du marbre et un burin ? +

    +

  • ssh

    + Vous avez le mot de passe de vos amis ou bien vous êtes prêts à leur donne le votre, juste pour un transfert de fichier ? +

    +

  • ftp

    +

      +
    • Quel serveur ? +
    • Quel compte, quel mot de passe ? +
    • Vous ne vous souciez pas d'envoyer des mots de passes non chiffrés et des fichiers sur un Internet non sécurisé ? +
    • Est-ce que votre proxy support le ftp passif ? +
    • Dans le cas d'un ftp anonyme : +
        +
      • Est-ce qu'il permet des uploads de 1GB ? +
      • Est-ce qu'il permet de supprimer le fichier uploadé ? +
      • Qui peut télécharger votre fichier ? +
      • Qui peut supprimer votre fichier ? +
      • Vous devez envoyer à votre ami l'URL de téléchargement, il doit vous informer + que le download s'est bien passé et vous devez supprimer le fichier + .
        + C'est plutôt pénible. +
      +
    +

    +

  • http

    +

      +
    • Pas d'upload par défaut et de gestion des utilisateurs. Cela doit être programmé +
    • Pas de notification automatique +
    • Pas d'effacement automatique +
    • Peu de serveur http peuvent gérer des fichiers de plus de 2GB +
    +

    +

  • sendfile

    +

      +
    • Vous utilisez UNIX et sendfile est installé ? +
    • Votre destinataire utilise UNIX et a sendfile d'installé ? +
    • Ni vous ou votre destinataire n'a le port 487 bloqué par un firewall ? +
    +

    +

  • Des services commerciaux comme DropLoad, ALLPeers, YouSendIt, etc

    +

      +
    • Quel limite ont-ils (le plupart: < 2 GB)? +
    • Quid de la sécurité et de la confidentialité : est-ce vos fichiers seront entre de bonnes mains ? +
    • Est-ce qu'ils sont opensource ou propriétaire ? +
    • Est-ce qu'ils sont accessibles avec n'importe quel navigateur ou bien avez-vous besoin de java, active-X, flash ou d'autres plugins ésotériques ? +
    • Est-ce qu'ils vont encore exister d'ici quelques mois?
      + (DropLoad, ALLPeers et drop.io ont déja mis la clé sous la porte) +
    +

    +

+

+Si vous avez répondu "non" à une seule de ces questions, alors vous avez besoin de F*EX +

+

Principales fonctionnalités de F*EX

+

+

    +
  • transfert de fichier de taille virtuellement infini +
  • le destinataire et l'expéditeur ont uniquement besoin d'un e-mail et d'un navigateur web, ils n'ont pas besoin d'installer de logiciels. +
  • reprise d'upload et de téléchargement en cas de défaillance +
  • notification automatique du destinataire +
  • suppression automatique après un téléchargement +
  • suppression automatique après un délai ajustable (par défaut: 5 jours) +
  • les utilisateurs F*EX peuvent créer des URLs d'upload à usage unique pour des utilisateurs extérieurs +
  • les utilisateurs F*EX peuvent créer des sous-utilisateurs qui ne pourront envoyer des fichiers uniquement à cet utilisateur +
  • les utilisateurs F*EX peuvent créer des groupes, similaire à des listes de diffusions, mais pour des fichiers +
  • maintenance réduite au minimum : pas d'interventations de l'administrateur nécessaires mise à part la création de nouveaux utilisateurs +
  • l'envoi à plusieurs destinataires ne nécessite pas le stockage d'autant de fichiers sur le serveur +
  • F*EX est un service web HTTP qui ne nécessite pas de contourner les parre-feux. +
  • support des flux +
  • pour les vrais utilisateurs UNIX, il existe les programmes shell fexsend et fexget afin d'éviter l'utilisation ennuyeuse de l'interface web +
  • protocole et code source librement disponible (Perl Artistic) +
+ +

Parlons de SEX

+F*EX a un ami : Stream EXchange (SEX).

+Vous pouvez imager SEX comme un tube UNIX réseau s'appuyant sur un relais. +Cela peut s'avérer utile pour envoyer des données d'un utilisateur A à un utilisateur B lorsque A et B ne peuvent établir +une connexion directe, mais que chacun peut accéder en HTTP au serveur SEX. Pour une intégration sans peine avec les outils UNIX, +il y a les commandes shell sexsend et sexget. +

+L'authentifaction est la même qu'avec F*EX + +

Encore des questions?

+Voir la FAQ + +

+

contact: fexmaster
+ + + diff --git a/locale/french/lang.html b/locale/french/lang.html new file mode 100644 index 0000000..75cddf3 --- /dev/null +++ b/locale/french/lang.html @@ -0,0 +1 @@ +français diff --git a/locale/french/lib/fup.pl b/locale/french/lib/fup.pl new file mode 100644 index 0000000..fb72a49 --- /dev/null +++ b/locale/french/lib/fup.pl @@ -0,0 +1,32 @@ +# config for F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +est un service pour envoyer des fichiers très volumineux (grand, énorme, géant, ...). +

+L'expéditeur (vous) upload le fichier vers un serveur F*EX et le destinataire reçoit automatiquement un message +de notification par mail avec l'URL de téléchargement.
+Après un téléchargement ou après $keep_default jours, le serveur efface le fichier. +F*EX n'est pas un système d'archivage! +

+Voir les questions & réponses. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Après soumission de votre fichier pour l'upload, vous verrez une barre de progression +(si vous avez javascript activé et que les popups sont autorisés) +

+REMARQUE: La plupart des navigateurs ne peuvent pas uploader des fichiers > 2 GB!
+Si votre fichier est plus gros, vous devez utiliser un client F*EX spécial.
+Vous devez aussi en utiliser un pour la reprise d'upload interrompu. Votre navigateur ne peut pas le faire. +

+Pour les utilisateurs de Firefox : ne pas appuyer sur [ESC] parce que cela stoppera l'upload ! +

+Voir aussi la FAQ. +EOD diff --git a/locale/french/lib/reactivation.txt b/locale/french/lib/reactivation.txt new file mode 100644 index 0000000..f00dc9e --- /dev/null +++ b/locale/french/lib/reactivation.txt @@ -0,0 +1 @@ +Votre compte F*EX a été activé avec succès. diff --git a/locale/galician/htdocs/FAQ.html b/locale/galician/htdocs/FAQ.html new file mode 100644 index 0000000..b1ed318 --- /dev/null +++ b/locale/galician/htdocs/FAQ.html @@ -0,0 +1,264 @@ + +

+Cuestións meta:
+===============
+
+Q: Por que o nome "F*EX" e non directamente "FEX"?
+
+A: No momento de facerse público xa había unha (antigo) aplicativo chamado "FEX" en
+   freshmeat.net.
+
+
+Q: Por que non usar un servizo comercial como
+   DropLoad, ALLPeers, YouSendIt, etc?
+
+A: Teñen un límite de 2 GB ou menor.
+   A súa seguranza e privacidade son descoñecidas.
+   Non se basean en código fonte aberto.
+   Non hai clientes de UNIX (CLI) para eles.
+   Necesitan java, active-X, flash ou outros endemoñados complementos.
+   Descoñécese canto tempo van funcionar - DropLoad e ALLPeers xa pecharon
+   as súas portas.
+
+
+Q: Por que un camelo no logo?
+
+A: O logo inspirouse no camelo de Perl, pero baseáse en Steiff, un camelo de peluxe,
+   co cal constituímos o noso tándem. O logo foi debuxado
+   por Beate
+   http://fex.rus.uni-stuttgart.de/Vortrag/tosa.html
+
+
+Q: Onde podo eu obter as fontes de F*EX?
+
+A: http://fex.rus.uni-stuttgart.de/fex.html
+
+
+Q: Que necesito para instalar F*EX?
+
+A: Un servidor UNIX con entrada no DNS e smtp para o correo de saída.
+   E debe ser root nese servidor.
+
+
+Q: Que é o DNS e smtp?
+
+A: Non instale F*EX. Está alén das súas posibilidade.
+
+
+Q: Quen e o autor?
+
+A: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
+
+
+Q: Que licenza ten F*EX?
+
+A: De software libre, Perl Artistic, vexa http://fex.rus.uni-stuttgart.de/doc/Licence
+
+
+Q: Hai unha lista de correo de F*EX?
+
+A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex
+
+
+Q: Onde podo obter asistencia comercial para F*EX?
+
+A: Contacto fex@nepustil.net http://www.nepustil.net/
+
+
+Q: Teñeo máis/outras preguntas diferentes!
+
+A: Preguntarlle ao autor <framstag@rus.uni-stuttgart.de>
+
+
+
+Preguntas de usuario:
+=====================
+
+Q: Que é o "auth-ID"?
+
+A: O auth-ID é unha identificación interna que autentica o usuario.
+   Será a primeira xerada polo admin ou o proceso de rexistro automático
+   e pode despois modificalo vostede, o usuario. Trátase dun contrasinal
+   de baixa seguranza.
+
+
+Q: Podo usar un proxy HTTP?
+
+A: Si.
+
+
+Q: Carguei un ficheiro ENORME pero equivoqueime ao escribir o enderezo do destinatario. Agora teño
+   un erro de entrega de correo. Debo volver cargar ese ENORME ficheiro?
+
+A: Non, non fai falta. Pode redirixir o ficheiro con
+   http://$HTTP_HOST$/rup
+
+
+Q: Cargue un ficheiro ENORME pero esquecín outro destinatario.
+   Debo volver cargar ese ENORME ficheiro?
+
+A: Non, non é necesario. Pode reenviar copia do ficheiro con
+   http://$HTTP_HOST$/foc
+
+
+Q: Non podo cargar ficheiros > 2 GB co meu navegador web!?
+
+A: Todos os navegadores teñen defectos na implementación dos
+   seus formularios HTML. O límite máis frecuente é de 2 GB, ás veces 4 GB.
+
+   Debe usar un cliente especial de F*EX para cargar ficheiros > 2 GB, vexa
+   http://$HTTP_HOST$/tools.html
+
+
+Q: A miña descarga abortouse antes de rematar. Podo retomar esa descarga?
+
+A: F*EX permite retomar e descargar, pero o seu cliente tamén debe permitir
+   esta funcionalidade. Firefox por exemplo carece desta funcionalidade HTTP, necesitará
+   outro cliente como Opera, wget ou fexget.
+
+
+Q: A miña carga foi abortada antes de rematar. Podo retomar esa carga?
+
+A: F*EX permite retomar a carga, pero o seu cliente debe permitir vbnm, 1tupports resuming at upload, but your client also has to support it.
+   No web browser has this feature, you need a special F*EX client like
+   fexsend, schwuppdiwupp or F*IX.
+   See http://$HTTP_HOST$/tools.html
+
+
+Q: O meu navegador non pode iniciar o cliente java F*IX, que indica:
+   "non se atopou un entorno de execución java, non se pode iniciar F*IX o miniaplicativo de carga"
+
+A: Non se localiza un complemento java do navegador. En Debian e Ubuntu pode
+   instalalo con: "sudo aptitude install sun-java6-plugin"
+
+
+Q: Cando premo[ESC] no Firefox a carga cancélase. Por que?
+
+A: Esta é unha funcionalidade interna do Firefox: ESC termina a operación actual.
+   Solución simple: non prema ESC no Firefox.
+   Solución complexa: pídalles aos desenvolvedores do Firefox que engadan un atallo de teclado.
+
+
+Q: O envío como un usuario F*EX é doado, pero como recibir ficheiros doutros,
+   de fóra?
+
+A: Rexístreos como subusuarios ou cree un grupo F*EX
+   con http://$HTTP_HOST$/fuc
+
+
+Q: Ás veces podo descargar un ficheiro máis dunha vez, especialamente cando
+   o repito rapidamente. Está a funcionalidade de auteliminación defectuosa?
+
+A: O servidor F*EX ten un períod de gracia de 1 minuto despois da primeira
+   descarga correcta no cal o ficheiro aínda está dispoñíbel. Isto é necesario
+   porque algúns "xestores de descargas" estúpidos solicitan o ficheiro
+   varias veces á vez. Caso contrario poderían indicar un erro ao usuario.
+
+A: O seu fexmaster ten un conxunto AUTODELETE=DELAY como predeterminado, o que significa que
+   o proceso de autolimpeza realízase unha vez ao día.
+
+A: Os "Power users" ou usuarios con permisos (usa a forza, Luke!) poden establecer unha marca "non eliminar ata
+   despois da descarga".
+
+
+Q: O período de reserva predeterminado é demasiado curto para min, cómpreme máis. Como podo estabelecelo?
+
+A: Use fexsend, pídallo ao seu fexmaster ou lea o código fonte :-)
+
+
+Q: Non podo descargar ficheiros con Internet Explorer, dime "Non se pode
+   abrir o sitio da Internet". Que debería facer?
+
+A: Use Firefox ou calquera outro navegador compatíbel con Internet, xa que Internet
+   Explorer non o é. Este é un de tanto defectos do Internet Explorer.
+
+
+
+
+Preguntas de administrador:
+===========================
+
+Q: Non podo instalar un servidor web como fexsrv, porque non teño permisos de root
+   Hai algunha versión en puro CGI de F*EX que funcione cun servidor web Apache?
+
+A: F*EX está intimamente unido a fexsrv por varias razóns (rendemento, límite de
+   tamaño de ficheiro, concepto de sesiónt, etc.) e non se pode executar como CGI
+   con Apache.
+   Pero pódelle botar un ollo a
+   http://gpl.univ-avignon.fr/filez/
+   http://freshmeat.net/projects/eventh/
+   http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (só en alemán!)
+   que implementa un intercambio de ficheiros como puros CGI, pero cun tamaño límite de 2 GB por ficheiro.
+
+
+Q: F*EX non funciona! Non podo conectarme co meu navegador web!
+
+A: Comprobe o seu enrutamento, filtros ip e configuración de devasa.
+   Tamén comprobe se o seu xinetd está ligado cun tcp-wrapper e configúreo
+   correctamente (hosts.allow).
+   F*EX necesita o porto 80/tcp (HTTP) e o porto opcional 443/tcp (HTTPS).
+
+
+Q: F*EX é complicado de máis! Necesito algo máis simplificado.
+
+A: Probe http://www.home.unix-ag.org/simon/woof.html
+
+
+Q: Como podo integrar F*EX no xestor de usuarios do meu sitio?
+
+A: F*EX ten varios módulos de autenticación:
+   local, RADIUS, LDAP, mailman e POP
+   Para os 4 últimos, contacte por favor co autor framstag@rus.uni-stuttgart.de
+
+
+Q: Que que todos os meus usuarios locais poidan usar F*EX automatimente. Como?
+
+A: Permítaos rexistrarse a si mesmos con http://yourfexserver/fur
+   Ten que editar lib/fex.ph e establecer (exemplo):
+   @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+   @local_domains = qw(flupp.org ulm.sub.net);
+   (Por suposto, ten que engadir os seus servidores/redes locais reais!)
+
+
+Q: Necesito máis seguranza! Como podo activar HTTPS?
+
+A: Lea doc/SSL e busque "fop_auth" en doc/concept
+
+
+Q: Necesito un aspecto corporativo. Como podo configurar F*EX neste sentido?
+
+A: Vexa a variábel @H1_extra en fex.ph e pode engadir o código HTML a
+   htdocs/header.html
+
+A: Vexa htdocs/fup_template.html, modifíqueo ás súas necesidades e úseo como a súa
+   páxina de inicio.
+
+
+Q: F*EX é demasiado complicado para os meus pobres usuarios. Necesito un formulario de
+   carga simmplificado.
+
+A: Vexa htdocs/fup_template.html
+
+
+Q: Quero que os correos Ccc a (ao usuario admin) se envíen a outro enderezo.
+
+A: Use procmail ou escriba OTHERADDRESS en /home/fex/.forward
+
+
+Q: Podo obter unha versión localizada no meu idioma?
+
+A: Sempre coa súa axuda, si. Contacte co autor framstag@rus.uni-stuttgart.de
+
+
+Preguntas en miscelánea:
+========================
+
+Q: F*EX é fantástico! Podo unirme ao equipo de desenvolvemento? Que hai que facer?
+
+A: Contacte co autor framstag@rus.uni-stuttgart.de
+   As funcionalidades buscadas son:
+
+     - un complemento F*EX para o Thunderbird ou o Outlook
+     - máis (outras) idiomas dispoñíbeis
+
+
diff --git a/locale/galician/htdocs/index.html b/locale/galician/htdocs/index.html new file mode 100644 index 0000000..3bea7b5 --- /dev/null +++ b/locale/galician/htdocs/index.html @@ -0,0 +1,133 @@ + + + +F*EX - File EXchange +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) é un servizo para enviar voluminosos +(grandes, enormes, xigantes, ...) ficheiros dun usuario A a un usuario +B. +

+O remisor carga o ficheiro no servidor F*EX usando un formulario WWW e o receptor automaticamente obtén unha notificación vía correo cun enderezo URL para descargar. +

+ +Vostede dirá: +

+ Por que necesito outro servizo para transferencia de ficheiros?!
Teño correo, ftp, ssh e mesmo sendfile! +
+

+Ao que respondo: +

+ Aínda así necesita F*EX :-) +
+

+ +Por exemplo, quere enviar ao seu amigo o video das últimas vacacións (1 GB).  Ten as seguintes posibilidades (e problemas):

+ +

    +
  • o envío dun DVD vía correo postal

    + Nin o vou considerar - vivimos na época actual + <> + despois da invención da Internet! + O envío de soportes multimedia (físicos) é para avoíñas. +

    +

  • o uso do correo

    +A maior parte dos servidores de correo teñen un límite de 10 MB por +mensaxe e unha cota de uso de disco duns poucos 100 MB por usuario ou +mesmo menor.

    +

  • uucp

    E por que non escritura cuneiforme en laxes de pedra? +

    +

  • ssh

    Ou ben tes os contrasinais dos teus amigos ou ben terás que darlles a túa + - fai falta iso só para transferir un ficheiro? +

    +

  • ftp

    +

      +
    • Usando que servidor ftp? +
    • Usando que conta, que contrasinal? +
    • Non se lle pasará pola cabeza enviar contrasinais sen cifrar e ficheiros na incerta Internet? +
    • O seu proxy permite o ftp pasivo? +
    • No caso de ftp anónimo: +
        +
      • Permite cargas de 1 GB? +
      • Permite eliminar a carga despois? +
      • Quen pode descargar ademais o seu ficheiro? +
      • Quen pode eliminar o seu ficheiro? +
      • Ten +que enviarlle ao seu amigo/a o URL de descarga, el ten que informarte +de que o descargou correctamente, despois ten vostede que eliminalo.
        + Definitivamente: unha merda pinchada nun pao. +
      +
    +

    +

  • http

    +

      +
    • Nin carga predeterminada nin xestión de usuario - debe ser programada
    • +
    • Sen autonotificación +
    • +
    • Sen autoeliminado +
    • Moi poucos servidores http poden xestionar ficheiros superiores a 2 GB +
    +

    +

  • sendfile

    +

      +
    • Executas un UNIX e tes o sendfile instalado? +
    • O teu receptor executa UNIX e ten o sendfile instalado? +
    • Nin ti nin o teu receptor ten unha devasa que bloquee o porto 487? +
    +

    +

  • servizos comerciais como DropLoad, ALLPeers, YouSendIt, etc

    +

      +
    • Que límite teñen (maiormente: < 2 GB)? +
    • Como andan de seguranza e privacidade: estarán os seus ficheiros gardados e seguros? +
    • Están baseados en software aberto ou en privativo? +
    • Están accesíbeis con calquera outro navegador ou cómpre usar java, active-X, flash ou outros complementos endemoñados? +
    • Funcionarán alén duns poucos meses?
      + (DropLoad, ALLPeers e drop.io xa pecharon as súas portas) +
    +

    +

+

+Se respondeu só unha vez "non" ás cuestións anteriores, entón necesita F*EX. +

+

Principais funcionalidades de F*EX

+

+

    +
  • transferencia de ficheiro ou  tamaño virtualmente ilimitada +
  • receptor e remitente só necesitan un programa de correo e un navegador web - + de calquer clase, non teñen que instalar ningún software +
  • REENVIAR and REOBTER para retomar despois de fallos de ligazón ata que se envíe o último byte +
  • autonotificación de receptor +
  • autoeliminación despois da descarga +
  • autoeliminación despois dunha data de expiración (predeterminada: 5 días) +
  • os usuarios con plenos dereitos poden crear subusuarios, que poden envíar soamente a este usuario pleno +
  • os usuarios con plenos dereitos poden crear grupos, en analoxía coas listas de correo, pero para ficheiros +
  • sen mantemetno: non se necesita interacción acompañando a creación de novas contas con F*EX +
  • o envío a múltiples receptores necesita capacidade de almacenamento no servidor só unha vez +
  • F*EX é un servizo web por HTTP e non necesita túneles nin devasas +
  • permite a distribución de fluxos, tamén +
  • para usuarios reais de UNIX, hai aplicativos da shell como fexsend e fexget que evitan o uso impertinente de navegador +
  • o protocolo e o código fonte están dispoñíbeis libremente (Perl Artistic) +
+ +

Falemos de SEX

+F*EX ten un compañeiro: Stream EXchange (SEX).

Pode +imaxinar SEX como unha rede de tubarías UNIX cun reenviador (relay) +entre elas. +Isto pode ser moi práctico para intercambiar datos entre o usuario A e +o usuario B alí onde A e B non poden establecer unha conexión directa, +pero ambos poden conectar vía HTTP ao servidor +SEX. Para unha integración perfecta na cadea de ferramentas UNIX, hai +ferramentas de shell como sexsend e sexget. +

+A autenticación é a mesma que con F*EX. + +

Quedanlle preguntas?

Vexa a FAQ + +

+

contacto: fexmaster
+ + + diff --git a/locale/galician/lang.html b/locale/galician/lang.html new file mode 100644 index 0000000..c835df4 --- /dev/null +++ b/locale/galician/lang.html @@ -0,0 +1 @@ +galego diff --git a/locale/galician/lib/fup.pl b/locale/galician/lib/fup.pl new file mode 100644 index 0000000..fb730ce --- /dev/null +++ b/locale/galician/lib/fup.pl @@ -0,0 +1,35 @@ +# config for F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +é un servizo para enviar (grandes, enormes, xigantes, ...) ficheiros. +

+O remitente (vostede) carga o ficheiro no servidor F*EX e o receptor obtén automaticamente +unha notificación vía correo cun enderezo URL para descargalo.
+Despois de descargalo ou tras $keep_default días o servidor elimina o ficheiro. +F*EX non é un arquivo! +

+Vexa máis información en preguntas e respostas. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Despois de remitilo verá unha barra de progreso de carga +(se ten o javascript activado e permite as xanelas emerxentes). +

+NOTA: A maior parte dos navegadores non poden cargar ficheiros > 2 GB!
+Se o seu ficheiro é maior, ten que usar un cliente F*EX especial.
+Tamén pode necesitalo para retomar cargas interrompidas. O seu navegador non pode facelo. +

+Aviso: algúns proxies HTTP como privoxy retardan a barra de progreso de carga!
+Pode querer desactivar a intermediación do proxy $ENV{SERVER_NAME} se se encontra con este problema. +

+Usuarios do Firefox: non prema en [ESC] porque isto abortará a carga! +

+Vexa máis información na FAQ. +EOD diff --git a/locale/galician/lib/reactivation.txt b/locale/galician/lib/reactivation.txt new file mode 100644 index 0000000..7289245 --- /dev/null +++ b/locale/galician/lib/reactivation.txt @@ -0,0 +1 @@ +A súa conta F*EX reactivouse correctamente diff --git a/locale/german/htdocs/FAQ.html b/locale/german/htdocs/FAQ.html new file mode 100644 index 0000000..43d4140 --- /dev/null +++ b/locale/german/htdocs/FAQ.html @@ -0,0 +1,260 @@ + +

Dieses Dokument ist veraltet. Bitte benutzen Sie die + englische FAQ.

+
+Allgemeine Fragen:
+==================
+
+F: Warum der Name "F*EX" und nicht einfach "FEX"?
+
+A: Zur Zeit der Veröffentlichung existierte bereits ein (älteres) Programm 
+   namens "FEX" auf freshmeat.net.
+   
+
+F: Warum nicht einen kommerziellen Dienst benutzen wie
+   DropLoad, ALLPeers, YouSendIt, etc?
+   
+A: Solche Dienste haben ein Limit von 2 GB oder sogar weniger.
+   Es ist unklar wie es bei ihnen mit Sicherheit und Datenschutz aussieht.
+   Sie basieren nicht auf Open Source.
+   Es gibt keine UNIX (CLI) Clients für sie.
+   Sie brauchen Java, Active-X, Flash oder andere bösartige Plugins.
+   Es ist unklar wie lange sie noch existieren werden - DropLoad und ALLPeers
+   haben bereits aufgehört zu existieren.
+
+
+F: Warum ein Kamel als Logo?
+
+A: Das Logo war inspiriert durch das Perl Kamel, zu Grunde liegt aber ein 
+   Plüschkamel von Steiff welches auf unserem Renn-Tandem mitfährt. 
+   Das Logo wurde von meiner Stokerin Beate gezeichnet, siehe
+   http://fex.rus.uni-stuttgart.de/Vortrag/tosa.html
+
+
+F: Wo kann ich die F*EX Sourcen bekommen?
+
+A: http://fex.rus.uni-stuttgart.de/fex.html
+
+
+F: Was braucht man um F*EX installieren zu können?
+
+A: Ein UNIX Server mit DNS Eintrag und smtp für ausgehende E-Mail.
+   Und Sie müssen root auf diesem Server sein.
+   
+
+F: Was ist DNS und smtp?
+
+A: Installieren Sie kein F*EX. Es ist jenseits Ihres Horizonts.
+
+
+F: Wer ist der Autor?
+
+A: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
+
+
+F: Unter welcher Lizenz läuft F*EX?
+
+A: Perl Artistic Freie Software, siehe http://fex.rus.uni-stuttgart.de/doc/Licence
+
+
+F: Gibt es eine F*EX Mailing Liste?
+
+A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex
+
+
+F: Wo kann ich einen kommerziellen Support für F*EX bekommen?
+
+A: Nehmen Sie Kontakt auf mit fex@nepustil.net http://www.nepustil.net/
+
+
+F: Ich habe noch weitere Fragen bezüglich dieses Dokuments!
+
+A: Fragen Sie den Autor <framstag@rus.uni-stuttgart.de>
+
+
+Benutzerfragen:
+===============
+
+Q: Was ist die "auth-ID"?
+
+A: Mit Hilfe der auth-ID werden Sie auf dem Server als ein authorisierter 
+   Benutzer identifiziert. Die auth-ID wird zuerst vom Administrator oder 
+   durch automatische Registrierung vergeben und kann später durch Sie 
+   geändert werden. Bitte beachten Sie dass man hier keine wertvollen
+   Passwörter verwenden sollte weil diese unverschlüsselt auf dem 
+   Server liegen.
+
+
+F: Kann ich einen HTTP-Proxy verwenden?
+
+A: Ja
+
+
+F: Ich habe eine RIESIGE Datei an eine falsche Adresse versendet. Jetzt 
+   bekomme ich eine Fehler-Meldung vom System. Muß ich die RIESIGE Datei
+   noch mal hochhladen?
+
+A: Nein, das ist nicht nötig. Sie können die Datei einfach weiterleiten 
+   mit Hilfe von http://$HTTP_HOST$/rup
+
+
+F: Ich habe eine RIESIGE Datei versendet doch leider habe ich noch einen 
+   Empfänger vergessen. Muß ich die RIESIGE Datei noch mal hochladen?
+
+A: Nein, das ist nicht nötig. Sie können die Datei einfach kopieren und
+   weiterleiten mit Hilfe von http://$HTTP_HOST$/foc
+
+
+F: Warum kann ich keine Dateien größer als 2 GB mittels Web-Browser 
+   hochladen?
+
+A: Alle Web-Browser die mir bekannt sind haben Fehler in ihrer HTML-FORM
+   Implementierung. Dadurch ergibt sich der Limit von 2 GB, manchmal 4 GB.
+
+   Sie müssen einen speziellen F*EX Client benutzen um Dateien größer 
+   als 2 GB hochzuladen, siehe http://$HTTP_HOST$/tools.html
+
+
+F: Mein Download brach frühzeitig ab. Kann ich ihn wieder aufnehmen?
+
+A: F*EX unterstützt Download-Wiederaufnahme, aber Ihr Client muss es ebenso 
+   unterstützen. Firefox zB fehlt diese HTTP Eigenschaft, daher benötigen 
+   Sie einen anderen Client wie opera, wget oder fexget.
+
+
+F: Mein Upload brach frühzeitig ab. Kann ich ihn wieder aufnehmen?
+
+A: F*EX unterstützt Upload-Wiederaufnahme, aber Ihr Client muss es ebenso 
+   unterstützen. Kein Web-Browser hat diese Unterstützung, Sie 
+   benötigen dfür einen speziellen F*EX Client wie
+   fexsend, schwuppdiwupp oder F*IX.
+   Siehe http://$HTTP_HOST$/tools.html
+
+
+F: Wenn ich die Taste [ESC] in Firefox drücke, dann wird der Upload 
+   abgebrochen. Warum?
+
+A: Das ist die eingebaute Funktion von Firefox: ESC unterbricht die 
+   laufende Operation. 
+   Einfache Lösung des Problems: 
+   [ESC] sollte man nicht drücken.
+   Komplizierte Lösung: 
+   bitten Sie die Firefox-Entwickler, eine Tastatur-Konfiguration hinzuzufügen
+
+
+F: Daten mit F*EX zu versenden ist einfach, wie kann ich aber Daten
+   von anderen (von der Aussenwelt) empfangen?
+
+A: Registrieren Sie sie als Ihre Subuser oder legen Sie eine F*EX Gruppe an.
+   
+
+F: Es kommt manchmal vor dass ich eine Datei mehrmals herunterladen kann, 
+   insbesondere wenn ich die Downloads schnell wiederhole. Ist etwa das 
+   automatische Löschen fehlerhaft?
+
+A: Der F*EX-Server wartet 1 Minute lang nach dem ersten erfolgreichen Download.
+   In dieser Zeit kann man die Datei nochmal herunterladen. Diese Wartezeit 
+   ist notwendig weil manche idiotische "Download Manager" die Datei gleich 
+   mehrmals anfordern. Ohne die Wartezeit würden sie dem Benutzer einen
+   Fehler melden.
+
+A: Ihr Fexmaster hat die Variable AUTODELETE auf DELAY gesetzt. Das hat
+   zur Folge dass das automatische Löschen nur einmal täglich stattfindet.
+
+A: Power-Benutzer (sehen Sie die Software-Quelltexte!) können den Flag
+   "nach dem Download nicht löschen" setzen.
+
+
+F: Die Standard Aufbewahrungszeit ist mir zur kurz. Wie kann ich diesen Wert 
+   erhöhen?
+
+A: Benutzen Sie fexsend, fragen Sie Ihren Fexmaster oder lesen Sie die 
+   Quelltexte :-)
+
+
+F: Ich kann Dateien mit dem Internet Explorer nicht herunterladen, es
+   meldet mir "Die Internet-Seite ist nicht verfügbar". Was soll ich tun?
+
+A: Benutzen Sie Firefox oder anderen Internet-kompatiblen Web-Browser, was der 
+   Internet Explorer eben nicht ist. Das ist nur einer seiner vielen Bugs.
+
+
+Administrator Fragen:
+=====================
+
+F: Ich kann keinen Web-Server wie fexsrv aufsetzen, mir fehlen dazu die
+   Rechte. Gibt es vielleicht eine reine CGI-Version von F*EX die
+   unter dem Apache Web-Server läuft?
+
+A: fexsrv ist ein fester Bestandteil von F*EX, dazu gibt es viele Gründe 
+   (Leistung, maximale Dateigröße, Session Konzept usw). So kann F*EX nicht 
+   als CGI unter Apache laufen, Sie könnten sich aber das hier anschauen:
+   
+   http://gpl.univ-avignon.fr/filez/
+   http://freshmeat.net/projects/eventh/
+   http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html
+   
+   Das sind einfache CGI-Implementierungen von Daten-Übertragungssystemen,
+   jedoch begrenzt auf 2 GB.
+   
+
+F: F*EX funktioniert überhaupt nicht! Es kommt keine Verbindung zum Server mit 
+   meinem Web-Browser zustande!
+
+A: Prüfen Sie Ihr Routing, IP-Filter und die Firewall-Einstellungen.
+   Prüfen Sie auch ob Ihr xinetd mit dem TCP-Wrapper verlinkt ist und
+   konfigurieren Sie es richtig (hosts.allow).
+   F*EX braucht den Port 80/tcp (HTTP) und optional den Port 443/tcp
+
+
+F: F*EX ist mir zu kompliziert! Ich brauche was einfacheres!
+
+A: Probieren Sie http://www.home.unix-ag.org/simon/woof.html
+
+F: Wie kann ich F*EX in das bestehende Benutzer-Management in meinem Netzwerk 
+   integrieren?
+
+A: F*EX hat verschiedene Authentifizierungs-Module:
+   lokal, RADIUS, LDAP, mailman und POP
+   Bezüglich der letzten 4 kontaktieren Sie bitte den Autor.
+
+
+F: Ich möchte dass alle meine lokalen Benutzer automatisch F*EX benutzen 
+   können. Wie geht das?
+
+A: Lassen Sie sie sich selbst registrieren.
+   Dazu müssen Sie lib/fex.ph editieren (Beispiel):
+   
+   @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+   @local_domains = qw(flupp.org ulm.sub.net);
+
+   Natürlich müssen Sie Ihre echten Hosts/Networks eigeben!
+
+
+F: Ich brauche mehr Sicherheit! Wie kann ich HTTPS benutzen?
+
+A: Lesen Sie doc/SSL und schauen Sie auch nach "fop_auth" in doc/concept 
+
+
+F: Die F*EX-Startseite sollte an unsere Firmen-Seiten angepaßt werden. 
+   Wie kann ich F*EX entsprechend konfigurieren?
+
+A: Siehe Variable @H1_extra in fex.ph, ausserdem können Sie htdocs/header.html
+   hinzufügen.
+
+A: Nehmen Sie fup_template.html, modifizieren Sie die Vorlage nach Ihren 
+   Wünschen und nutzen Sie diese als Ihre Startseite.
+
+
+Sonstige Fragen:
+================
+
+F: F*EX ist großartig! Wie kann ich mich dem Entwicklungs-Team anschließen? 
+   Was muß noch gemacht werden?
+
+A: Kontaktieren Sie den Autor wegen:
+
+   - ein F*EX plugin für Outlook
+   
+   - weiteren Übersetzungen in andere Sprachen - Latein wäre toll! :-) 
+
diff --git a/locale/german/htdocs/index.html b/locale/german/htdocs/index.html new file mode 100644 index 0000000..7e969bc --- /dev/null +++ b/locale/german/htdocs/index.html @@ -0,0 +1,135 @@ + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) ist ein Dienst, um große (sehr große, riesige, +gigantische, ...) Dateien von User A zu User B zu senden. +

+Der Absender lädt die Datei über ein +WWW upload Formular auf den F*EX Server hoch und der Empfänger +bekommt automatisch eine Benachrichtigungs-E-Mail mit der Download-URL. +

+ +Sie fragen vielleicht: +

+ Warum brauche ich noch einen Service für Dateitranfer?!
+ Ich habe E-Mail, FTP, SSH und sogar sendfile! +
+

+Ich sage: +

+ Sie brauchen F*EX trotzdem :-) +
+

+ +Sie möchten zum Beispiel einem Freund das letztes Urlaubsvideo senden (1 GB). +Sie haben dazu folgende Möglichkeiten (und Probleme):

+ +

    +
  • eine DVD per Briefpost verschicken

    + Steht außer Frage - wir leben im Jahr + <> + nach der Erfindung des Internet! + Versand von (Hardware-)Medien ist etwas für Opas. +

    +

  • E-Mail benutzen

    + Die meisten E-Mail Server haben ein Limit von 10 MB pro E-Mail + und ein Speicherkontingent von wenigen 100 MB pro User oder sogar weniger. +

    +

  • UUCP

    + Warum nicht gleich Keilschrift-Zeichen in Tonplatten eindrücken? +

    +

  • SSH

    + Sie haben das Passwort Ihres Freundes oder sind gewillt, ihm Ihres zu geben + - nur für einen Datei-Transfer? +

    +

  • FTP

    +

      +
    • Welchen FTP Server benutzen? +
    • Welchen Account benutzen, welches Passwort? +
    • Stört es Sie unverschlüsselte Passwörter über das unsichere Internet zu übertragen? +
    • Unterstützt Ihr Proxy passives FTP? +
    • Im Fall von anonymen FTP: +
        +
      • Erlaubt es 1 GB Uploads? +
      • Kann man den Upload nach dem Transfer wieder löschen? +
      • Wer kann Ihre Datei noch downloaden? +
      • Wer noch kann Ihre Datei löschen? +
      • Sie müssen Ihrem Freund die Download-URL zukommen lassen und er + muss Sie über den erfolgreichen Download informieren, danach müssen Sie die Datei löschen.
        + Alles in Allem: eine nervige Sache. +
      +
    +

    +

  • HTTP

    +

      +
    • Es gibt keine standardmäßige Upload- und User-Verwaltung (muss erst programmiert werden) +
    • Keine Auto-Benachrichtigung +
    • Kein automatisches Löschen +
    • Sehr wenige HTTP Server können mit Dateien größer 2 GB umgehen +
    +

    +

  • sendfile

    +

      +
    • Sie benutzen UNIX und haben sendfile installiert? +
    • Ihr Empfänger benutzt UNIX und hat sendfile installiert? +
    • Weder Ihr Empfänger noch Sie selbst haben eine Firewall die Port 487 blockiert? +
    +

    +

  • Kommerzielle Dienste wie DropLoad, ALLPeers, YouSendIt, etc

    +

      +
    • Welche Beschränkungen haben sie? (meist: < 2 GB)? +
    • Was ist mit Sicherheit und Privatsphäre: werden Ihre Dateien sicher und geschützt sein? +
    • Basieren sie auf Open Source- oder proprietärer Software? +
    • Sind sie mit jedem Browser benutzbar oder braucht man Java, Active-X, Flash oder andere üble Plugins? +
    • Werden sie länger als ein paar Monate existieren?
      + (DropLoad und ALLPeers haben ihren Betrieb schon eingestellt) +
    +

    +

+

+Wenn Sie auch nur eine der Fragen von oben mit "Nein" beantwortet haben, dann brauchen Sie F*EX. +

+

Hauptmerkmale von F*EX

+

+

    +
  • Datei-Transfer mit praktisch unbegrenzter Dateigröße +
  • Empfänger und Absender brauchen lediglich ein E-Mail Programm und einen Web-Browser - + es muss keine zusätzliche Software installiert werden +
  • RESEND und REGET für Wiederaufnahme bei Link Fehlern beim letzten gesendeten Byte +
  • Auto-Benachrichtigung der Empfänger +
  • automatisches Löschen nach Download +
  • automatisches Löschen nach Ablaufdatum (Standard: 5 Tage) +
  • Full-User können Sub-User erstellen, die dann nur an den Full-User senden dürfen +
  • Full-User können Gruppen erstellen, eine Analogie zu Mailinglisten, aber für Dateien +
  • wartungsfrei: bis auf die Erstellung neuer F*EX Accounts ist keine Interaktion eines Admins erforderlich +
  • Für das Senden an mehrere Empfänger wird auf dem Server nur einmal Speicherplatz verbraucht +
  • F*EX ist ein HTTP-Web-Dienst und benötigt keine Firewall-Tunnel +
  • Unterstützung für Streams +
  • für UNIX Benutzer gibt es die Shell-Programme fexsend und fexget, um den lästigen Gebrauch von Webbrowsern zu umgehen +
  • Protokoll und Quellcode sind frei verfügbar (Perl Artistic) +
+ +

Lassen Sie uns über SEX sprechen

+F*EX hat einen Begleiter: Stream EXchange (SEX).

+Man kann sich SEX als netzwerkweite UNIX Pipes mit einem Relay dazwischen vorstellen. +Das kann hilfreich sein, wenn man Daten von User A zu User B leiten will, +ohne dass A und B eine direkte Verbindung zueinander aufbauen können, aber beide sich +über HTTP zum SEX Server verbinden können. +Für eine nahtlose Integration in die UNIX Programm Reihe, +gibt es die Shell-Programme sexsend und sexget. +

+Die Authentifizierung ist dieselbe wie bei F*EX. + +

Noch Fragen?

+Siehe FAQ (Fragen und Antworten) + +

+

Kontakt: fexmaster
+ + + diff --git a/locale/german/lang.html b/locale/german/lang.html new file mode 100644 index 0000000..bf777b7 --- /dev/null +++ b/locale/german/lang.html @@ -0,0 +1 @@ +deutsch diff --git a/locale/german/lib/fup.pl b/locale/german/lib/fup.pl new file mode 100644 index 0000000..ddbda20 --- /dev/null +++ b/locale/german/lib/fup.pl @@ -0,0 +1,46 @@ +# lokale Konfiguration fuer F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +ist ein Dienst um große (sehr große, riesige, gigantische, ...) Dateien zu senden. +

+Der Absender (Sie) lädt eine Datei auf den F*EX Server hoch und der +Empfänger bekommt automatisch eine Benachrichtigungs-E-Mail mit der Download-URL.
+Nach dem Download oder nach $keep_default Tagen löscht der Server die Datei.
+F*EX ist kein Archiv! +

+Um es zu nutzen, geben Sie Ihre Empfänger E-Mail Adresse(n) in die Felder oben ein. +

+Noch immer verwirrt?
+Testen Sie F*EX, indem Sie eine Datei an sich selbst senden +(Absender = Empfänger = Ihre E-Mail Adresse). +

+Siehe auch Fragen & Antworten. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Nach dem Abschicken sehen Sie einen Upload Fortschrittsbalken +(wenn Sie Javascript aktiviert haben und Popups erlauben). +

+Bemerkung: Viele Webbrowser können keine Dateien hochladen, +die größer als 2 GB sind!
+Wenn Ihre Datei größer ist, müssen Sie einen speziellen +F*EX client nutzen.
+Sie brauchen ihn außerdem, wenn Sie abgebrochene Uploads +wiederaufnehmen wollen. Ihr Webbrowser ist dazu nicht in der Lage. +

+Wenn Sie mehr als eine Datei verschicken wollen, dann verpacken Sie sie vorher in ein zip oder tar Archiv, +z.B. mit 7-Zip. +

+Siehe auch FAQ. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD diff --git a/locale/german/lib/reactivation.txt b/locale/german/lib/reactivation.txt new file mode 100644 index 0000000..413dace --- /dev/null +++ b/locale/german/lib/reactivation.txt @@ -0,0 +1 @@ +Ihr F*EX Account wurde erfolgreich reaktiviert. diff --git a/locale/italian/htdocs/FAQ.html b/locale/italian/htdocs/FAQ.html new file mode 100644 index 0000000..2872df9 --- /dev/null +++ b/locale/italian/htdocs/FAQ.html @@ -0,0 +1,297 @@ + +

Questo documento non è aggiornato. Si prega di utilizzare il + inglese FAQ.

+
+
+Domande Generiche:
+==================
+
+Q: Perche' il nome e' "F*EX" invece del piu' corto "FEX"?
+
+A: Al momento della pubblicazione c'era gia' un (vecchio) programma
+   nominato "FEX" su freashmeat.net
+
+
+Q: Perche' non usare un servizio commerciale come
+   DropLoad, ALLPeers, YouSendIt, ecc. ?
+
+A: Tutti hanno un limite di 2 GB o meno.
+   I loro livelli di sicurezza e privacy sono sconosciuti.
+   Non sono servizi basati su software open-source.
+   Non ci sono client UNIX (a linea di comando) per loro.
+   Hanno bisogno di java, Active-X, Flash o altri plug-in.
+   Non si sa quanto tempo sopravviveranno - DropLoad e ALLPeers hanno
+   gia' concluso la loro attivita'.
+
+
+Q: Perche' c'e' un cammello nel logo?
+
+A: Il logo e' stato ispirato al cammello del Perl, ma e' basato sul
+   cammello di peluche della Steiff che ci portiamo insieme con noi
+   nelle nostre corse con il tandem.
+   Il logo e' stato disegnato dal mio "fuochista" Beate
+   http://fex.rus.uni-stuttgart.de/Vortrag/tosa.html
+
+
+Q: Dovo posso prendere i sorgenti di F*EX ?
+
+A: http://fex.rus.uni-stuttgart.de/fex.html
+
+
+Q: Dove posso installare F*EX ?
+
+A: In un host UNIX con una entry DNS ed un SMTP per la spedizione
+   delle e-mail. Su questo server bisogna avere i privilegi di root.
+
+
+Q: Cosa sono DNS e SMTP?
+
+A: Lascia perdere F*EX. E' al di la' delle tue possibilita'.
+
+
+Q: Chi e' l'autore ?
+
+A: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
+
+
+Q: Che tipo di licenza ha F*EX ?
+
+A: Perl Artistic free software, vedete http://fex.rus.uni-stuttgart.de/doc/Licence
+
+
+Q: C'e' una mailing list per F*EX ?
+
+A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex
+
+
+Q: Dove posso trovare un servizio commerciale per F*EX ?
+
+A: Contattate fex@nepustil.net http://www.nepustil.net/
+
+
+Q: Ho altre domande che non trovo in questo documento.
+
+A: Chiedete all'autore <framstag@rus.uni-stuttgart.de>
+
+
+
+Domande Utente:
+===============
+
+Q: Cos'e' il campo "auth-ID" ?
+
+A: Il campo auth-ID e' un identificativo interno che individua l'utente;
+   e' lo username.
+   E' creato la prima volta o dall'amministratore o attraverso il processo
+   di registrazione automatico e puo' essere successivamente modificato
+   da te (che sei l'utente).
+   Pensa come se fosse una password a bassa sicurezza.
+
+Q: Posso usare un proxy HTTP ?
+
+A: Si'.
+
+
+Q: Ho caricato un file ENORME, ma ho fatto un errore di battitura
+   nell'indirizzo del destinatario. Ora mi trovo con una e-mail
+   di errore.
+   Devo effettuare di nuovo il caricamento di questo ENORME file?
+
+A: No, non e' necessario. Puoi ridirigere il file con
+   http://$HTTP_HOST$/rup
+
+
+Q: Ho caricato un file ENORME ma ho dimenticato uno dei destinatari.
+   Devo ricaricarlo?
+
+
+A: No, non e' necessario. Puo' inoltrare il file con
+   http://$HTTP_HOST$/foc
+
+
+Q: Posso caricare file di dimensioni > di 2 GB con il mio browser !?
+
+A: Tutti i browser che conosco hanno dei bug nella loro implementazione
+   delle FORM HTML.
+   Il limite e' per lo piu' di 2 GB, molto spesso e' di 4 GB.
+   Dovete usare uno speciale client F*EX per caricare file > 2GB,
+   vedete http://$HTTP_HOST$/tools.html
+
+
+Q: Il mio download si e' bloccato prima di finire.
+   Posso riprenderlo?
+
+A: F*EX supporta il recupero del download ma anche il vostro client deve
+   supportare questa funzione. Firefox, per esempio, non ha questa funzione,
+   serve un'altro client come Opera, Wget o Fexget.
+
+
+Q: Il caricamento del mio file si e' interrotto prima di finire.
+   Posso riprenderlo?
+
+A: F*EX supporta la ripresa del caricamento interrotto di un file ma anche
+   il client deve supportarlo. Nessun browser WEB ha questa funzionalita',
+   avete bisogno di uno speciale client F*EX come fexsend, schwuppdiwupp o F*IX.
+   Vedete http://$HTTP_HOST$/tools.html
+
+
+Q: Il mio browser WEB non puo' eseguire il client java F*IX
+   in quanto non trova l'ambiente java runtime e quindi
+   non puo' caricare la applet F*IX
+
+
+A: Manca il plug-in java per il vostro browser WEB. Sui sistemi Debian e
+   Ubuntu potete installarlo con questo comando:
+   "sudo aptitude install sun-java6-plugin"
+
+
+Q: Quando schiaccio [ESC] in firefox il caricamento si cancella. Perche'?
+
+A: Si tratta di una caratteristica di firefox: il tasto ESC termina
+   l'operazione corrente.
+   Soluzione semplica: non schiacciate ESC in Firefox.
+   Soluzione complessa: chiedete agli sviluppatori di Firefox di aggiungere
+   la configurazione della tastiera.
+
+
+Q: Spedire come utente F*EX e' facile, ma come posso
+   ricevere i file da altri utenti all'esterno?
+
+A: Registrali come tuoi "sotto-utenti" oppure crea un gruppo F*EX
+   con http://$HTTP_HOST$/fuc
+
+
+Q: Qualche volta posso scaricare un file piu' di una volta,
+   specialmente quando ripeto l'operazione velocemente.
+   La funziona di autodelete e' poco affidabile?
+
+A: Il server F*EX rende disponibile il file scaricato ancora per un
+   periodo di 1 minuto. Questo e' necessario per evitare che alcuni
+   "download managers" piuttosto stupidi diano errore in quanto
+   richiedono il file parecchie volte di seguito.
+
+A: Il vostro fexmaster ha impostato la variabile AUTODELETE=DELAY
+   come default, il che significa che il processo di
+   autocancellazione e' eseguita una volta al giorno.
+
+A: Certi utenti (usate i sorgenti!!!) possono impostare il flag
+   "non cancellare dopo il download".
+
+
+Q: La finestra temporale prima che il file sia cancellato e' troppo
+   stretta per me, ho bisogno di allargarla. Come posso fare?
+
+A: Usate fexsend, chiedete al vostro fexmaster oppure leggete il
+   codice sorgente :-)
+
+
+Q: Durante il download di un file con Internet Explorer
+   mi dice "Non posso aprire il sito Internet". Cosa posso fare?
+
+A: Usate Firefox o qualsiasi altro browser WEB compatibile con Internet,
+   dato che Internet Explorer non lo e'. Questo e' uno dei tanti bug di
+   Internet Explorer.
+
+
+
+
+Domande Amministrative:
+=======================
+
+Q: Non posso installare un server web come fexsrv perche'
+   non ho i permessi di root. Esiste una pura versione CGI
+   di F*EX eseguibile con un web server Apache ?
+
+A: F*EX e' rigidamente vincolato a fexsrv per diverse ragioni (performance,
+   limite dimensione file, concetto di sessione, etc) e non puo' essere
+   eseguito come una CGI sotto apache.
+   Potete dare un'occhiata a
+   http://gpl.univ-avignon.fr/filez/
+   http://freshmeat.net/projects/eventh/
+   http://www.schaarwaechter.de/sp/projekte/dateiaustausch.html (Solo in Tedesco!)
+   il quale implementa uno scambio file come pura CGI, ma ha il limite dei 2 GB.
+
+
+Q: F*EX non funziona per nulla!
+   Non mi posso connettere con il mio browser web!
+
+A: Controllate il routing, le impostazioni del firewall e di ipfilters.
+   Controllate anche che il vostro xinetd sia collegato con il
+   wrapper-tcp e sia configurato correttamente (hosts.allow).
+   F*EX necessita della porta 80/tcp (HTTP) e opzionalmente
+   della 443/tcp (HTTPS).
+
+
+Q: F*EX e' troppo complicato!
+   Mi serve qualcosa di piu' semplice.
+
+A: Provate http://www.home.unix-ag.org/simon/woof.html
+
+
+Q: Come posso integrare F*EX nell'ambiente di gestione
+   dell'utente esistente nel mio sito?
+
+A: F*EX ha diversi moduli di autenticazione:
+   locale, RADIUS, LDAP, mailman e POP
+   Per gli ultimi 4 si prega di contattare l'autore
+   framstag@rus.uni-stuttgart.de
+
+
+Q: Vorrei che i miei utenti locali usassero
+   F*EX automaticamente. Come??
+
+A: Lasciate che si registrino da soli con http://yourfexserver/fur
+   Dovete editare il file lib/fex.ph ed impostare (esempio):
+   @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+   @local_domains = qw(flupp.org ulm.sub.net);
+   (Ovviamente dovete iunserire i vostri dati reali!)
+
+
+Q: Ho bisogno di maggior sicurezza! Come posso abilitare HTTPS??
+
+A: Leggete la documentazione doc/SSL ed anche cercate "fop_auth" in doc/concept
+
+
+Q: Ho bisogno di un look aziendale.
+   Come posso configurare F*EX per questo?
+
+A: Potete Guardare la variabile @H1_extra nel file fex.ph ed aggiungere
+   codice HTML al file htdocs/header.html
+
+A: Guardate il file htdocs/fup_template.html, modificatelo secondo i vostri
+   bisogni ed utilizzatelo come start-page.
+
+
+Q: F*EX e' troppo complicato per i miei utenti.
+   Ho bisogno di una form semplificata.
+
+A: Guardate il file htdocs/fup_template.html
+
+
+Q: Vorrei che le e-mail BCC indirizzate all'amministratore
+   fex fossero spedite ad altro indirizzo.
+
+A: Usate procmail o scrivete OTHERADDRESS in /home/fex/.forward
+
+
+Q: Posso avere una versione localizzata
+   nella mia lingua??
+
+A: Con il vostro aiuto, si'. Per favore contattate l'autore a
+   framstag@rus.uni-stuttgart.de
+
+
+Domande varie:
+==============
+
+Q: F*EX e' ottimo! Posso lavorare con
+   il team di sviluppo?
+   Che cosa c'e' bisogno di fare?
+
+A: Contattate l'autore framstag@rus.uni-stuttgart.de
+   Funzionalita' richieste:
+
+     - Un plug-in F*EX per thunderbird o outlook
+     - Supporto in altre lingue
+
+
diff --git a/locale/italian/htdocs/index.html b/locale/italian/htdocs/index.html new file mode 100644 index 0000000..43170ca --- /dev/null +++ b/locale/italian/htdocs/index.html @@ -0,0 +1,128 @@ + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) e' un servizio per spedire grossi (grandi, enormi, giganti, ...) file da un utente A ad un utente B. +

+Il mittente carica il file nel server F*EX usando una +form WWW di carico mentre al destinatario viene recapitata una e-mail di notifica con un link per effettuare il download. +

+ +Direte: +

+ Per quale motivo ho bisogno di un altro servizio per effettuare il trasferimento dei files?!
+ Per questo ho gia' la posta elettronica(e-mail), l'ftp, l'ssh ed anche il comando sendfile! +
+

+Io dico: +

+ Nonostante tutto hai bisogno di F*EX :-) +
+

+ +Supponiamo, per esempio, che tu voglia spedire ai tuoi amici il video delle tue ultime vacanze (1 GB). Hai le seguenti possibilita' (e problemi):

+ +

    +
  • spedire un DVD con il servizio postale

    + Fuori discussione - viviamo nell'anno + <> + dopo l'invenzione di Internet! + Spedire supporti hardware e' da trogloditi. +

    +

  • usare la posta elettronica (e-mail)

    + Gran parte dei server di posta elettronica hanno un limite di 10 MB per ognuna delle e-mail e la quota totale e' di meno di 100 MB per utente. +

    +

  • uucp

    + Perche' non usare la scrittura cuneiforme su una lastra di pietra? +

    +

  • ssh

    + Avete la password dei vostri amici oppure siete disposti a dargli la vostra? + - solo per trasferire un file? +

    +

  • ftp

    +

      +
    • Quale server ftp usare? +
    • Quale utente usare, quale password? +
    • Non vi dispiace mandare password e files non crittografati su Internet (insicura per definizione)? +
    • Il vostro proxy supporta l'ftp passivo? +
    • In caso di ftp anonimo: +
        +
      • Permette di caricare file da 1 GB? +
      • Permette di cancellare il file caricato subito dopo? +
      • Chi altri puo' fare il download del vostro file? +
      • Chi altri puo' cancellare il vostro file? +
      • Dovete mandare ai vostri amici il link per lo scarico, loro devono informarvi di avere effettuato il download del file e voi dovete cancellarlo subito dopo.
        + In poche parole: una rottura di scatole. +
      +
    +

    +

  • http

    +

      +
    • Non esiste un programma di default - deve essere costruito. +
    • Non esiste l'auto-notifica. +
    • Non esiste l'auto-cancellazione. +
    • Pochissimi server HTTP possono trattare file piu' grandi di 2 GB. +
    +

    +

  • sendfile

    +

      +
    • Avete UNIX ed avete sendfile installato? +
    • Il vostro destinatario ha UNIX ed ha sendfile installato? +
    • Sicuri che ne' voi, ne' il vostro destinatario avete un firewall che blocca la porta 487? +
    +

    +

  • servizi commerciali come DropLoad, ALLPeers, YouSendIt, eccetera

    +

      +
    • Quale limite hanno (gran parte: < 2 GB)? +
    • Cosa dire di sicurezza e privacy: i vostri file saranno salvi e sicuri? +
    • Sono basati su servizi open source o su proprietari? +
    • Sono accessibili con qualsiasi browser oppure hanno bisogno di java, active-X, flash o qualche altro plug-in? +
    • Sopravviveranno per piu' di qualche mese?
      + (Per esempio servizi quali DropLoad, ALLPeers e drop.io hanno gia' terminato la loro attivita') +
    +

    +

+

+Se avete risposto "no" ad almeno ad una delle domande, avete bisogno di +F*EX. +

+

Principali caratteristiche di F*EX

+

+

    +
  • trasferimento file di dimensioni virtualmente illimitate. +
  • il destinatario ed il mittente hanno bisogno solo di un programma di posta elettronica e di un browser WEB + di qualsiasi tipo: non devono installare nulla. +
  • funzioni RESEND e REGET per riprendere l'esecuzione dopo un blocco della connessione all'ultimo byte. +
  • auto-notifica del destinatario. +
  • auto-cancellazione dopo il download. +
  • auto-cancellazione dopo un periodo di 5 giorni (per default). +
  • gli utenti "full" possono creare "sottoutenti" o utenti "limitati" i quali possono spedire solo a questo server. +
  • gli utenti "full" possono creare gruppi in analogia a quanto succede per le liste di distribuzione, solo che viene fatto per i file. +
  • manutenzione semplice: non e' necessario l'intervento dell'amministratore per la creazione di nuovi utenti F*EX. +
  • l'invio di file a piu' destinatari occupa nel server solo lo spazio di una sola spedizione. +
  • F*EX e' un web-service di tipo HTTP e non ha bisogno di "tunnels" nel firewall. +
  • sono supportati anche i flussi (stream). +
  • per gli utenti che conoscono UNIX, ci sono gli script-shell fexsend e fexget + che evitano l'uso di un browser-WEB. +
  • i protocolli ed il codice sorgente sono liberamente disponibili (Perl Artistic). +
+ +

Parliamo di SEX

+F*EX ha un compagno: Stream EXchange (SEX).

+Potete immaginare che SEX sia una specie di lunga pipe UNIX con un relay in mezzo. +Questo servizio puo' essere utilizzato per il travaso di dati da un utente A ad un utente B quando A e B non possono stabilire una connessione diretta ma entrambi possono stabilire una connessione HTTP con il server SEX. Per una completa integrazione con i tool di concatenazione dei comandi di UNIX, ci sono gli script-shell sexsend and sexget. +

+L'autenticazione e' la stessa utilizzata da F*EX. + +

Altre domande?

+Vedi le FAQ + +

+

contattate: fexmaster
+ + + diff --git a/locale/italian/lang.html b/locale/italian/lang.html new file mode 100644 index 0000000..acb1394 --- /dev/null +++ b/locale/italian/lang.html @@ -0,0 +1 @@ +italiano diff --git a/locale/italian/lib/fup.pl b/locale/italian/lib/fup.pl new file mode 100644 index 0000000..7c44cd4 --- /dev/null +++ b/locale/italian/lib/fup.pl @@ -0,0 +1,35 @@ +# configurazione per F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +e' un servizio per spedire grossi (grandi, enormi, giganti, ...) file. +

+Il mittente (tu) carica il file nel server F*EX ed automaticamente il destinatario si vede recapitare +una e-mail di notifica con il link per effettuare il download.
+Dopo il download o dopo $keep_default giorni, il server cancella il file. +F*EX non e' un sistema di archiviazione! +

+Guardate anche domande e risposte (Q&A). +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Dopo il caricamento del file vedrete una barra di avanzamento +(bisogna avere javascript abilitato ed i popup abilitati). +

+NOTA: Parte dei browser-WEB non possono caricare file > 2 GB!
+Se il tuo file e' piu' grande devi usare un client F*EX particolare.
+Hai bisogno anche di un tool per recuperare i download interrotti. Il tuo browser-WEB non puo' farlo. +

+Attenzione: alcuni proxy HTTP come privoxy ritardano lo stattttto della barra di avanzamento!
+Potresti voler disabilitare il proxying $ENV{SERVER_NAME} se ti capita di incorrere in questo problema. +

+Utenti Firefox: non digitare [ESC] perche' questo interrompera' il caricamento! +

+Vedere anche FAQ. +EOD diff --git a/locale/italian/lib/reactivation.txt b/locale/italian/lib/reactivation.txt new file mode 100644 index 0000000..53d5052 --- /dev/null +++ b/locale/italian/lib/reactivation.txt @@ -0,0 +1 @@ +Il tuo account F*EX è stato riattivato con successo. diff --git a/locale/spanish/htdocs/FAQ.html b/locale/spanish/htdocs/FAQ.html new file mode 100644 index 0000000..31e61dc --- /dev/null +++ b/locale/spanish/htdocs/FAQ.html @@ -0,0 +1,254 @@ + +

Este documento está obsoleto. Por favor, use + FAQ en inglés.

+
+Meta preguntas:
+===============
+
+P: ¿Por qué el nombre de F*EX y no uno más corto?
+
+R: En el momento de la publicación había ya un programa llamado "FEX" activo 
+   (más viejo) freshmeat.net.
+
+
+P: ¿Por qué no emplear un servicio comercial
+   DropLoad, ALLPeers, YouSendIt, etc?
+   
+R: Tienen un límite de 2GB incluso ó menos.
+   Su estado de privacidad y seguridad es desconocido.
+   No están basados en software abierto.
+   No existe ningún cliente UNIX (CLI) para ellos.
+   Necesitan java, active-X, flash u otros plugins endemeniados.
+   Se desconoce cuanto durarán - DropLoad y ALLPeers
+   ha finalizado sus asuntos.
+
+
+P: ¿Por qu el camello como logo?
+
+R: El logo fue inspirado por el camello de Perl, pero est basado en un Steiff
+   el camello de peluche, que correo con con nosotros on nuestro tamdem de 
+   carrelas.  El logo fue dibujado por Beate.
+
+
+P: ¿Dónde puedo conseguir los fuentes de F*EX?
+
+R: http://fex.rus.uni-stuttgart.de/fex.html
+
+
+P: ¿Que hace falta para instalar F*EX?
+
+R: Un servidor UNIX con una entrega DNS y smtp para correo saliendo.
+   Y hace falta estar root en este ordenador.
+
+
+P: ¿Que es DNS y smtp?
+
+R: Que no instale F*EX. Es allende de su horizonte.
+
+
+P: ¿Quién es el autor?
+
+A: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
+
+
+P: ¿Qué licencia tiene F*EX?
+
+R: Software libre Perl Artistic, vea http://fex.rus.uni-stuttgart.de/doc/Licence
+
+
+P: ¿Hay una lista de correo de F*EX?
+
+A: https://listserv.uni-stuttgart.de/mailman/listinfo/fex
+
+
+P: ¿Dónde puede conseguir apoyo comercial para F*EX?
+
+R: Contacte con fex@nepustil.net http://www.nepustil.net/
+
+
+P: ¡Tengo más/otras preguntas de las que aparecen en este documento!
+
+R: Pregunte al autor <framstag@rus.uni-stuttgart.de>
+
+
+Preguntas de los usuarios:
+==========================
+
+P: ¿Qué es el "auth-ID"?
+
+R: El auth-ID es una identificación interna que autentica al usuario.
+   La primera vez es generado por el administrador o por el proceso de registro
+   automático y pude modificarlo más tarde. Piense en él como
+   una especie de clave poco segura.
+
+
+P: ¿Puedo usar un proxy HTTP?
+
+R: Sí
+
+
+P: He subido un fichero ENORME pero me he confundido al escribir la dirección 
+   de correo electrónico del destinatario.
+   Acabo de recibir un correo de error de rebote. 
+   ¿Tengo que volver a subir el fichero ENORME?
+
+R: No, no es necesario. Puede redirigir el fichero con
+   http://$HTTP_HOST$/rup
+
+
+P: He subido un fichero ENORME pero olvidé poner a un destinatario.
+   ¿Tengo que volver a subir el fichero ENORME?
+
+R: No, no es necesario. Puede reenviar una copia del fichero con
+   http://$HTTP_HOST$/foc
+
+
+P: ¿¡No puede subir ficheros > 2 GB con mi navegador web!?
+
+R: Todos los navegadores web que conozco tienen errores en su implementación
+   de HTML-FORM. El límite en la mayoría es de 2 GB, algunas veces 4 GB.
+   Tiene que usar un cliente especial de F*EX para subir ficheros > 2 GB, vea
+   http://$HTTP_HOST$/tools.html
+
+
+P: Mi descarga abortó antes de que acabara. ¿Puedo continuar la descarga?
+
+R: F*EX soporta la continuación de la descarga, pero su cliente debe soportar
+   también esta característica. Firefox, por ejemplo, no tiene esta 
+   característica HTTP, necesita otro cliente como opera, wget o fexget
+
+
+P: Mi subida abortó antes de que finalizara. ¿Puedo continuar la subida?
+
+R: F*EX soporta la continuación de la subida, pero su cliente también debe 
+   soportarla. Ningún navegador web tiene esta característica, necesita un 
+   cliente de F*EX especial como fexsend, schwuppdiwupp o F*IX
+   Vea http://$HTTP_HOST$/tools.html
+
+
+P: Cuando pulso [ESC] en firefox la subida se cancela. ¿Por qué?
+
+R: Esta es una característica de firefox: ESC finaliza la operación en curso.
+   Solución sencilla: no pulse ESC en Firefox
+   Solución compleja: pida a los desarrolladores de Firefox que añadan una 
+                      configuración del teclado
+
+
+P: Enviar como usario F*EX es fácil, pero ¿como pueden recibirse fichero de 
+   otros desde fuera?
+
+R: Registrelos como su subusuarios o cre un grupo F*EX
+
+
+P: A veces puedo descargar un fichero más de una vez, especialmente cuando
+   lo repito rápidamente. ¿Tiene errores la caracter de autoborrado?
+
+R: El servidor F*EX tiene un tiempo de gracia de 1 minuto tras la primera
+   descarga con exito durante el cual el fichero está disponible todavía.  
+   Este es necesario porque algunos "administradores de descargas" estúpidos 
+   solicitan el fichero varias al mismo tiempo.  De otra manera, informan al 
+   usuario de un error.
+
+R: Su fexmaster ha establecido AUTODELETE=DELAY por defecto, lo que significa 
+   que el proceso de limpieza del autoborrado se ejecuta una vez al día
+
+R: Los usuario normales (use los fuentes, Luke!) pueden establecer una bandera
+   de "no borrar tras la descarga"
+
+
+P: El tiempo por defecto para mantener el fichero en el sistema es desmasiado 
+   corto para mí, necesito más. ¿Cómo puedo cambiarlo?
+
+R: Use fexsend, pregunte a su fexmaster o lea el código fuente
+
+
+P: No puede descargar ficheros con Internet Explorer, me dice "No puedo
+   abrir el sistio de Internet". ¿Qué debería hacer?
+
+R: Use Firefox o cualquier otro navegador web compatible con Internet, puesto 
+   que Internet Explorer no lo es. Este es uno de los muchos errores de 
+   Internet Explorer.
+
+
+Preguntas del administrador:
+============================
+
+P: No puedo instalar un servidor web como fexsrv, porque no tengo permisos
+   de root. ¿Existe una versión CGI pura de F*EX que funcione con un
+   servidor web apache?
+
+R: F*EX está íntimamente unido a fexsrv por varias razones (prestaciones,
+   limitación en el tamaño del fichero, el concepto de sesión, etc.) y no 
+   puede ejecutarse como CGI desde apache.
+   Pero puede echar un vistazo a
+   
+   http://gpl.univ-avignon.fr/filez/
+   http://freshmeat.net/projects/eventh/
+
+   que implementa un intercambio de ficheros con CGIs puros, pero ambos están 
+   limitados a 2 GB.
+   
+
+P: ¡F*EX no funciona en absoluto! 
+   ¡No puedo conectarme a él con mi navegador web!
+
+R: Compruebe el encaminamiento, los filtros IP y la configuración del 
+   cortafuegos. Compruebe también si su xinetd está enlazado con tcp-wrapper 
+   y configúrelo correctamente (hosts.allow).
+
+   F*EX necesita el puerto 80/tcp (HTTP) y opcionalmente el puerto 443/tcp
+   (HTTPS).
+
+
+P: ¡F*EX es muy complicado! Necesito algo más sencillo.
+
+R: Pruebe http://www.home.unix-ag.org/simon/woof.html
+
+
+P: ¿Como puedo integrar F*EX la administración de usuario existente de mi 
+   sitio?
+
+R: F*EX tiene varios módulos de autenticación:
+   local, RADIUS, LDAP, mailman y POP
+   Para los últimos 4 póngase en contacto con el autor por favor.
+   
+
+P: Quiero que todos mis usuarios locales use F*EX automáticamente. 
+   ¿Cómo puedo hacerlo?
+
+R: Déjelos autoregistrarse.
+   Tiene que editar el fichero lib/fex.ph y establecer (ejemplo):
+
+   @local_hosts = qw(127.0.0.1 10.10.100.0-10.10.255.255);
+   @local_domains = qw(flupp.org ulm.sub.net);
+
+   ¡Desde luego tiene que añadir su hosts/redes locales reales!
+
+
+P: ¡Necesito más seguridad! ¿Cómo activo HTTPS?
+
+R: Lea doc/SSL y mire busque también "fop_auth" e doc/concept
+
+
+P: ¡Necesito que tenga una imagen corporativa. ¿Como configuro F*EX para que 
+   la tenga?
+
+R: Vea la variable @H1_extra en fex.ph y puede añadir htdocs/header.html
+
+R: Vea fup_template.html, modifíquela según sus necesidades y usela como 
+   página de inicio
+
+
+Otras preguntas:
+================
+
+P: ¡F*EX es estupendo! ¿Puedo unirme al equipo de desarrollo? 
+   ¿Qué hay que hacer?
+
+R: Contacte con el autor
+
+   Características no presente:
+
+   - otro cliente de subida que se integre mejor en Windows
+     arrastrar y soltar, libro de direcciones de Outlook, etc.
+
diff --git a/locale/spanish/htdocs/index.html b/locale/spanish/htdocs/index.html new file mode 100644 index 0000000..da71e28 --- /dev/null +++ b/locale/spanish/htdocs/index.html @@ -0,0 +1,136 @@ + +F*EX - File EXchange + +
+

F*EX - Frams' Fast File EXchange

+ +
+

+F*EX (Frams' Fast File EXchange) es un servicio para enviar ficheros (grandes, enormes, +gigantes, ...) de un usuario A a otro B. +

+El remitente sube el fichero al servidor F*EX usando +el formulario de subida WWW y el destinatario +automáticamente recibe una notifiación por correo electrónico con la URL de desacarga. +

+ +Usted dirá: +

+ ¡¿Por qué necesito de otro servicio de transferencia de ficheros?!
+ ¡Tengo el correo electrónico, ftp, ssh e incluso sendfile! +
+

+Yo le respondo: +

+ Aun así necesita F*EX :-) +
+

+ +Por ejemplo, quiere enviar a un amigo su último video de las vacaciones (1 GB). +Tiene las siguientes posibilidades (y problemas):

+ +

    +
  • enviar un DVD por correo postal

    + Sin comentarios - ¡vivimos en el año + <> + tras la invención de internet! + Enviar DVDs/CDs es para los abuelos. +

    +

  • usando el correo electrónico

    + La mayoría de los servidores de correo tienen una límite de 10 MB por mensaje de correo electrónico + y una cuota de almacenamiento de uno 100 MB por usuario e incluso menos. +

    +

  • uucp

    + ¿Por qué no escritura cuneiforme sobre planchas de piedra? +

    +

  • ssh

    + ¿Tiene la contraseña de su amigo o está deseando darle la suya tan sólo para la transferencia de un fichero? +

    +

  • ftp

    +

      +
    • Usando ¿qué servidor FTP? +
    • Usando ¿qué cuenta y con qué contraseña? +
    • ¿No le importa enviar contraseñas sin cifrar y ficheros a través de internet que no es seguro? +
    • ¿Su proxy soporta ftp pasivo? +
    • En caso de usar ftp anónimo: +
        +
      • ¿Permite subi 1 GB? +
      • ¿Permite borrar los ficheros subidos después? +
      • ¿Quién más puede descargar su fichero? +
      • ¿Quién más puede borrar su fichero? +
      • Tiene que enviarle a su amigo la URL de descarga, él tiene que + informarle de que la descarga ha finalizado sin problemas y + tiene que borrar el fichero después.
        + En resumen: un grano en el culo. +
      +
    +

    +

  • http

    +

      +
    • No hay una administración de ficheros subidos y usuarios - hay que programarla +
    • No hay autonotificación +
    • No hay autoborrado +
    • Muy pocos servidores http pueden manejar ficheros de más de 2 GB +
    +

    +

  • sendfile

    +

      +
    • ¿Tiene UNIX y tiene sendfile instalado? +
    • ¿Su destinatario tiene UNIX y tiene sendfile instalado? +
    • ¿Ni usted ni su destinatario tiene un cortafuegos que bloquee el puerto 487? +
    +

    +

  • servicios comerciales como DropLoad, ALLPeers, YouSendIt, etc.

    +

      +
    • ¿Qué limite tienen (la mayoría: < 2 GB)? +
    • ¿Qué pasa con la seguridad y la privacidad: estarán sus ficheros a salvo? +
    • ¿Están basados en software abierto o propietario? +
    • ¿Son accesible con cualquier navegador o necesita java, active-X, flash u otro plugins? +
    • ¿Sobrevirá más de unos cuantos meses?
      + (DropLoad y ALLPeers ya han finalizado su actividad) +
    +

    +

+

+Si ha contestado sólo una vez "no" a las preguntas anteriores, entonces necesita +F*EX. +

+

Principales características de F*EX

+

+

    +
  • transferencia de ficheros de tamaño virtualmente ilimitado +
  • el destinatario y el remitente solo necesitan un programa de correo electrónico y un navegador web - + de cualquier tipo, no necesitan instalar ningún software +
  • RESEND y REGET para continuar las descargas interrumpidas por fallos en el enlace +
  • autonotificación al destinatario +
  • autoborrado tras la descarga +
  • autoborrado tras la fecha de expiración (por defecto: 5 días) +
  • los usuarios normales pueden crear subusuarios, que pueden enviar solo al usuario normal que lo definió +
  • los usuarios normales puede crear grupos, una anología de las listas de correo, pero para ficheros +
  • sin mantenimiento: no es necesaria la intervención del administrador más allá de crear la cuentas en F*EX +
  • para enviar a múltiples destinatarios solo es necesario subir el fichero una vez +
  • F*EX es un servicio web HTTP y no necesita que se creen túneles en los cortafuegos +
  • también soporta streams +
  • los usuarios UNIX reales, puede usar los programas para el shell fexsend y fexget para + evitar el uso del navegador web +
  • el protocolo y código fuente están disponibles (Perl Artistic) +
+ +

Hablemos de SEX

+F*EX tiene un acompañante: Stream EXchange (SEX).

+Puede imaginar SEX como si fueran tubería de UNIX a través de la red con un relay en medio. +Esto puede ser útil para entubar datos del usuario A a otro B, donde A y B no pueden +establecer una conexión directa, per ambos puede conectar por HTTP a servidor SEX. +Las herramientas del shell sexsend y sexget permiten integrarlo fácilmente entre +el conjunto de herramientas de UNIX. +

+La autenticación es igual que en F*EX. + +

¿Todavía tiene más preguntas?

+Vea la FAQ + +

+

contacto: Administrador de F*EX
+ + + diff --git a/locale/spanish/lang.html b/locale/spanish/lang.html new file mode 100644 index 0000000..49201c4 --- /dev/null +++ b/locale/spanish/lang.html @@ -0,0 +1 @@ +español diff --git a/locale/spanish/lib/fup.pl b/locale/spanish/lib/fup.pl new file mode 100644 index 0000000..9367991 --- /dev/null +++ b/locale/spanish/lib/fup.pl @@ -0,0 +1,35 @@ +# config for F*EX CGI fup + +$info_1 = $info_login = <

+F*EX (File EXchange) +es un servicio para enviar ficheros (grandes, enormes, gigantes, ...). +

+El remitente (usted) sube el fichero al servidor F*EX y el destinatario recibe automáticamente +una notificación por correo electrónico con una URL de descarga.
+Tras la descarga o tras $keep_default días el servidor borra el fichero. +¡F*EX no es un archivador! +

+Vea también preguntas y respuestas. +


+

+ $ENV{SERVER_ADMIN}
+
+EOD + +$info_2 = <

+Tras pulsar el botón de enviar verá una barra de progreso de la subida +(si tiene javascript activado y permite las ventanas emergentes) +

+NOTE: ¡La mayoría de los navegadores web no pueden subir ficheros > 2 GB!
+Si su fichero es más grande tiene que usar un cliente de F*EX especial.
+También necesita uno para poder continuar con una subida interrumpida. Su navegador no puede hacerlo. +

+Aviso: ¡algunos proxys HTTP como privoy retrasan la barra de progreso de la subida!
+Quizá quiera desabilitar el proxy para $ENV{SERVER_NAME} si se encuentra con problemas. +

+Usuarios de firefox: ¡no pulse [ESC] porque aborta la subida! +

+Vea también la FAQ. +EOD diff --git a/locale/spanish/lib/reactivation.txt b/locale/spanish/lib/reactivation.txt new file mode 100644 index 0000000..f469da1 --- /dev/null +++ b/locale/spanish/lib/reactivation.txt @@ -0,0 +1 @@ +Su cuenta de F*EX ha sido reactivado con exito. diff --git a/locale/translate b/locale/translate new file mode 100755 index 0000000..041f4b7 --- /dev/null +++ b/locale/translate @@ -0,0 +1,205 @@ +#!/usr/bin/perl -w + +# translate english F*EX files into locale languange + +use File::Basename; +use File::Copy; + +@trfiles = qw( + lib/fex.pp + cgi-bin/foc + cgi-bin/fop + cgi-bin/fuc + cgi-bin/fup + cgi-bin/fur + cgi-bin/rup + cgi-bin/pup + htdocs/FAQ/FAQ.html +); + +# htdocs/FAQ/meta.faq +# htdocs/FAQ/user.faq +# htdocs/FAQ/admin.faq +# htdocs/FAQ/misc.faq + +@cpfiles = qw( + lang.html + htdocs/index.html + htdocs/FAQ + htdocs/FAQ.html + lib/fup.pl +); + +@FEX = getpwnam('fex') or die "$0: no user fex\n"; +$> = $FEX[2]; +$) = $FEX[3]; + +$FEXHOME = $ENV{FEXHOME} || $FEX[7]; + +# require "$FEXHOME/lib/fex.pp" +# or die "$0: cannot load $FEXHOME/lib/fex.pp - $!\n"; + +$tr = "locale/translations"; + +$lang = shift or &usage; +exit if $lang eq 'english'; + +open $tr,$tr or die "$0: cannot open $tr - $!\n"; + +while (<$tr>) { + $n++; + last if /^\s*$/; + if (/^#\s*([\w-]+):/ and $lang eq $1) { + $ll = $n; + } +} + +&usage unless $ll; + +while (<$tr>) { + next if /^#/; + next if /^\s*$/; + chomp; + unless (/[a-z]/i) { + die "$0: syntax error in $tr line $. : no text\n"; + } + $e = $_; + for my $l (2 .. $ll) { + $_ = <$tr>||''; + chomp; + unless (/[a-z]/i) { + die "$0: syntax error in $tr line $. : no text\n"; + } + } + $T{$e} = $_; + while (<$tr>) { last if /^\s*$/ } +} + +close $tr; +@E = sort {length $b <=> length $a} keys %T; + +mkdir "$FEXHOME/locale"; +$_ = "$FEXHOME/locale/english"; +symlink '..',$_ unless -e; + +foreach $file (@trfiles) { + local $/; + mkdirp("$FEXHOME/locale/$lang/".dirname($file)); + $fe = "$FEXHOME/$file"; + $ft = "$FEXHOME/locale/$lang/$file"; + open $fe,"<$fe" or die "$0: cannot read $fe - $!\n"; + unlink $ft; # beware symlink! + open $ft,">$ft" or die "$0: cannot write $ft - $!\n"; + $_ = <$fe>; + close $fe; + foreach $e (@E) { + s/\Q$e/$T{$e}/g; + } + print {$ft} $_; + close $ft; + chmod((stat $fe)[2],$ft); + print "$ft written\n"; +} + +foreach $file (@cpfiles) { + my $fs = "locale/$lang/$file"; + if (-e $fs) { + my $fd = "$FEXHOME/$fs"; + mkdirp(dirname($fd)); + if (-f $fs) { + $fd .= '_new' if -e $fd; + if (copy($fs,$fd)) { + chmod((stat $fs)[2],$fd); + print "$fd written\n"; + } + } else { + if (-f $fd) { + my $fds = $fd.'_save'; + my $fdn = $fd.'_new'; + system "rm -rf $fds $fdn"; + rename $fd,$fds; + system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; + rename $fd,$fdn; + rename $fds,$fd; + print "$fdn written\n"; + } else { + system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; + print "$fd written\n"; + } + } + } +} + +foreach $fs (qw(fex.ph dop)) { + $fd = "$FEXHOME/locale/$lang/lib/$fs"; + symlink "../../../lib/$fs",$fd and print "$fd linked\n"; +} + +unless (-f "$FEXHOME/locale/$lang/htdocs/FAQ/meta.faq") { + unlink "$FEXHOME/locale/$lang/htdocs/FAQ/FAQ.html"; + rmdir "$FEXHOME/locale/$lang/htdocs/FAQ"; +} + +make_lf($lang); +make_lf('english'); # unless -f "$FEXHOME/lib/lf.pl"; + +exit; + + +sub make_lf { + my $lang = shift; + my $fexpp = "$FEXHOME/locale/$lang/lib/fex.pp"; + my $lf = "$FEXHOME/locale/$lang/lib/lf.pl"; + + open $fexpp,$fexpp or die "$0: no $fexpp - $!\n"; + unlink $lf; + open $lf,'>',$lf or die "$0: cannot write $lf - $!\n"; + print {$lf} "### auto-generated by install/translate - DO NOT EDIT! ###\n\n"; + local $/; + $_ = <$fexpp>; + s/.*\n(\#\#\# locale functions)/$1/s; + s/\nsub (\w+)/\n\$$1\{$lang\} = sub/gs; + s/\n\}\n/\n\};\n/gs; + print {$lf} $_; + close $lf; + close $fexpp; +} + + + +# emulate mkdir -p +sub mkdirp { + my $dir = shift; + my $pdir; + + return if -d $dir; + $dir =~ s:/+$::; + die "$0: cannot mkdir /\n" unless $dir; + $pdir = $dir; + if ($pdir =~ s:/[^/]+$::) { + mkdirp($pdir) unless -d $pdir; + } + unless (-d $dir) { + mkdir $dir,0770 or die "$0: mkdir $dir - $!\n"; + } +} + + +sub usage { + my @langs; + + open $tr,$tr or die "$0: cannot open $tr - $!\n"; + + while (<$tr>) { + last if /^\s*$/; + push @langs,$1 if /^#\s*([\w-]+):/; + } + + foreach my $lang (@langs) { + if (not -l "locale/$lang" and -f "locale/$lang/lib/fup.pl") { + print "usage: $0 $lang\n"; + } + } + + exit 1; +} diff --git a/locale/translations b/locale/translations new file mode 100644 index 0000000..1e31a14 --- /dev/null +++ b/locale/translations @@ -0,0 +1,2852 @@ +# english: Ulli Horlacher +# german: Waldemar Bronsch +# swabian: Hans-Georg Bickel +# spanish: Francisco Ruiz +# galician: Anton Meixome +# italian: Vanni Piagno , +# czech: Michal Simunek +# french: Jean-Baptiste Denis + +F*EX operation control ERROR +F*EX Bedienungssteuerungs-Fehler +F*EX Fehler bei dr Bedienongsschdeuerong +Error del control de operaciones de F*EX +Erro do control de operacións do F*EX +Errore di controllo delle operazioni di F*EX +Chyba při řízení provozu F*EX +Erreur de gestion F*EX + +back to F*EX operation control +Zurück zur F*EX-Bedienungssteuerung +Zrigg zur Bedienongsschdeuerong +Volver al control de operaciones de F*EX +Volver ao control de operacións do F*EX +Torna al controllo delle operazioni di F*EX +Zpět na řízení provozu F*EX +Retour à la gestion de F*EX + +wrong user or auth-ID +Falscher Benutzer oder falsche auth-ID +Benutzr odr auth-ID isch falsch +usuario o auth-ID erróneo +o usuario ou o auth-ID son incorrectos +utente o auth-ID sbagliato +chybný uživatel nebo ověřovací ID +utilisateur ou auth-ID invalide + +operation control +Bedienungssteuerung +Bedienongsschdeuerong +control de operaciones +control de operacións +controllo delle operazioni +Řízení provozu +gestion + +for user +Für Benutzer +Fir dr Benutzr +para el usuario +para o usuario +per l'utente +pro uživatele +pour l'utilisateur + +You as the sender have a server disk quota of $quota MB and currently using +Sie als Absender haben auf dem Server insgesamt $quota MB Speicherplatz und Sie benutzen momentan +Du als Absender hosch uffm Server alles en allem $quota MB Platz zom Schbeichra ond Du benutzsch dovo grad +Usted como emisario tiene una cuota de disco en el servidor de $quota MB y actualmente en uso +Vostede como remitente ten unha cota de disco do servidor que está utilizando actualmente de $quota MB +Tu in qualita' di mittente hai una quota disco nel server di $quota MB ed attualmente stai usando +Jako odesilatel máte na serveru k dispozici $quota MB. Nyní využíváte +Vous disposez de $quota MB d'espace disque en tant qu'expéditeur et vous utilisez actuellement + +sender quota (used) +Absender Speicherplatz (benutzt) +Absender Platz zom Schbeichra (benutzt) +cuota de envío (usada) +cota de remitente (usada) +quota mittente (in uso) +limit pro odesilatele (využito) +quota expéditeur (utilisé) + +recipient quota (used): +Empfänger Speicherplatz (benutzt): +Empfänger Platz zom Schbeichra (benutzt): +quota de recepción (usada): +cota de destinatario (usada): +quota destinatario (in uso): +limit pro příjemce (využito): +quota destinataire (utilisé): + +Retrieve a list of all your received files in F*EX spool +Zeige die Liste aller empfangenen Dateien +Zeig mol a Lischde von älle empfangene Dateia +Ver la lista de todos los ficheros recibidos en la cola de F*EX +Ver a lista de todos os ficheiros recibidos na cola de F*EX +Richiama una lista di tutti i tuoi file ricevuti nello spool di F*EX +Načíst seznam vÅ¡ech souborů čekajících ve frontě +Récupérer une liste de tous les fichiers que vous avez reçus + +Show download URLs of files you have sent +Liste Download URLs von gesendeten Dateien auf +Zoig Ronderlad URLs von verschickte Dateia +Mostrar direcciones URL de los archivos enviados +Amosar os URL dos ficheiros enviados +Mostra scarica gli URL dei file inviati +Zobrazit URL pro stažení souborů, které jste odeslali +Lister les URLs des fichiers que vous avez envoyés + +Forward a copy of a file you already have uploaded to another recipient +Eine Kopie der Datei weiterleiten, welche Sie bereits für einen anderen Empfänger hochgeladen haben +A Kobie von der Datei weiderloide, die Du scho fier en andra Empfänger nuffglade hosch +Reenviar una copia de un fichero que ha subido a otro destinatario +Reenviar unha copia dun ficheiro que cargou a outro destinatario +Inoltra una copia di un file che hai gia' caricato per un altro destinatario +Přidat příjemce k již nahranému souboru +Reexpédier une copie d'un fichier que vous avez déja uploadé à un autre destinataire + +Redirect files you have uploaded to a wrong or misspelled recipient +Leite Dateien weiter, die an eine falsche oder ungültige E-Mail Adresse gegangen sind +Dateia weiderloide, die an a falsche oder ogildige E-Mail-Adress gange send +Redirigir ficheros que ha subido y enviado a un destinatario equivocado o mal escrito +Redirixir ficheiros que cargou e enviou a un destinatario equivocado ou mal escrito +Inoltra file che hai caricato ad un destinatario sbagliato o di cui hai sbagliato l'indirizzo +Přesměrovat nahrané soubory pro nesprávného či chybně uvedeného příjemce +Rediriger un fichier que vous avez déja uploadé vers un mauvais destinataire + +Resend notification e-mails for files you have sent +Benachrichtigungs E-Mails nochmals versenden +Sag dem Empfängr no amole Bscheid +Reenviar emails de recuerdo +Resend notification e-mails for files you have sent +Rispedisci e-mail di notifica per file che hai spedito +Znovu odeslat zprávy s upozorněním pro soubory, které ste odeslali +Renvoyer les messages de notifications pour les fichiers que vous avez envoyés + +Create a subuser who can send you files. Enter his e-mail address: +Subuser anlegen, der Ihnen Dateien schicken kann. Geben Sie seine E-Mail Adresse ein: +Subuser olega, der dir Dateia schicka ko. Gib sei E-Mail Adress ei: +Crear un subuser que pueda enviar archivos. Escriba su dirección de correo electrónico: +Crear un subusuario que poida enviarlle ficheiros. Escriba o seu enderezo de correo: +Crea un sottoutente che possa spedirti dei file. Inserisci il suo indirizzo e-mail: +Vytvořit poduživatele, který vám může zasílat soubory. Zadejte jeho e-mailovou adresu: +Créer un utilisateur qui peut vous envoyer des fichiers. Saisir son adresse électronique: + +for only one upload +nur für einen Upload +bloss fir oimal Nufflada +por sólo una carga +Soamente para un envío +per un solo upload +pouze pro jedno nahrání +pour un upload unique + +Comment to send with information e-mail: +Kommentar, der mit der Informations E-Mail mitgeschickt wird: +Kommentar, der mit dr Enformations E-Mail mitgschickt wird: +Comentario para enviar la información por e-mail: +Comentario que se enviará xunto coa información do correo: +Commenta per spedire con un'e-mail di notifica: +V informačním e-mailu odeslat komentář: +Commentaire à envoyer avec le message d'information: + +create subuser and send e-mail +Subuser anlegen und E-Mail verschicken +Subuser olegea ond E-Mail verschicka +crear subuser y enviar e-mail +Crear un subusuario en enviar un correo +crea un sottoutente se spedisci l'e-mail +vytvořit poduživatele a odeslat e-mail +créer un utilisateur et envoyer un message électronique + +You can register yourself +Sie können sich selbst registrieren +Du kosch De selber regischdriera +Puede autoregistrarse +Podo autorexistrarse +Puoi registrarti +Můžete se zaregistrovat +Vous pouvez vous enregistrer + +if you do not have a F*EX account yet +wenn Sie noch keinen F*EX Account haben +wenn De no koi F*EX Konto hosch +si no tiene todavía una cuenta en F*EX +se non ten aínda unha conta no F*EX +se non hai ancora il tuo account F*EX +pokud jeÅ¡tě nemáte svůj F*EX účet +si vous n'avez pas déjà un compte F*EX + +You may also use anonymous upload +Sie können auch anonymen Upload verwenden +Du kosch au anonymes Nufflada nemma +Se tambien puede usar anonymous upload +Tamén pode usar o envío anónimo +Potresti anhe utilizzare anonymous upload +Můžete také využít anonymnínahrávání +Vous pouvez aussi utiliser l'upload anonyme + +You may also use simple upload +Sie können auch vereinfachten Upload verwenden +Du kosch au oifachs Nufflada nemma +Puede tambien usar subir simplificado +You may also use simple upload +Potresti anche usare caricamento semplice +Můžete také použít jednoduché nahrávání. +Vous pouvez également utiliser l'upload simple + +$file already exists for +$file existiert bereits für +$file gibts scho fir +$file ya existe para +xa existe $file para +$file esiste giàper +$file již existuje pro +Le fichier $file existe déjàpour + +$file already exists - purge it?! +$file existiert bereits - entfernen?! +$file gibts scho - wegschmeissa?! +$file ya existe - ¡¿Purgarlo?! +xa existe $file - purgalo?! +$file esiste già - lo vuoi eliminare?! +$file již existuje - odstranit jej?! +Le fichier $file existe déjà - Effacer?! + +Manage your subusers and groups +Subusers und Gruppen verwalten +Onderbenutzr ond Grubba verwalde +Gestione sus subusuarios y grupos +Xestione os seus subusuarios e grupos +Gestisci i tuoi sotto-utenti e gruppi +Spravovat své poduživatele a skupiny +Gérer vos sous-utilisateurs et vos groupes + +Change the disclaimer to be sent with notification e-mail +Änderung des Disclaimers der in der Benachrichtigungs E-Mail mitversendet wird +Änder dr Disclaimer von dr Benochrichtigongs E-Mail +Cambiar renuncia de email enviado con emails de notificación +Change the disclaimer to be sent with notification e-mail +Cambia il disclaimer affinchè venga spedito assieme all'e-mail di notifica +Změnit odesílání zřeknutí se odpovědnosti u správy s upozorněním +Changer la clause de non-responsabilité à envoyer avec le message de notification + +Change your auth-ID to +Ändern Sie Ihre auth-ID in +Ändr die auth-ID noch +Cambie su auth-ID en +Cambie o seu auth-ID en +Cambia il tuo auth-ID in +Změnit si ověřovací ID auth-ID na +Changer votre auth-ID pour + +remember it +merken +aber ned vergessa, gell +recordar +recórdeo +ricordati +zapamatovat +souvenez-vous en + +Edit your address book +Ihr Adressbuch editieren +Dei Adressbüchle bearbeide +Edite su libro de direcciones +Edite a súa axenda de enderezos +Edita la tua rubrica +Upravit adresář +Éditez votre carnet d'adresses + +Get detailed notification e-mails (current setting: brief) +Ausfürliche Benachrichtigungs E-Mails bekommen (aktuelle Einstellung: kurz) +Langs Gschwätz en de Benochrichtigongs E-Mails (aktuelle Eischtellong: kurz) +Recibir detallado e-mails de notificación (configuración actual: corto) +Obter unha detallada notificación para os correos (axuste actual: breve) +Avere dettagliata di notifica e-mail (impostazione attuale: breve) +Dostávat podrobné e-maily s oznámením (současné nastavení: zkrácené) +Recevoir des emails de notifications détaillés (configuration courante: simple) + +Get brief notification e-mails (current setting: detailed) +Kurze Benachrichtigungs E-Mails bekommen (aktuelle Einstellung: detailliert) +Machs kurz en de Benochrichtigongs E-Mails (aktuelle Eischtellong: langs Gschwätz) +Recibir corto e-mails de notificación (configuración actual: detallado) +Obter unha breve notificación para os correos (axuste actual: detallado) +Avere breve notifica e-mail (impostazione attuale: dettagliata) +Dostávat e-maily s upozorněním v zkráceném formátu (současné nastavení: detailed) +Recevoir des emails de notifications simple (configuration courante: détaillé) + +Get reminder notification e-mails (current setting: no reminders) +Erinnerung E-Mails erhalten (aktuelle Einstellung: keine) +Drodenka E-Mails erhalta (aktuelle Eischtellong: koine) +Recibir emails de recuerdo (configuración actual: ningunos) +Get reminder notification e-mails (current setting: no reminders) +Impostaun Promemoria per l'e-mail di notifica (Impostazione attuale: nessun promemoria) +Odesílat zprávy s připomenutím (současné nastavení: žádná upozornění) +Recevoir les rappels par e-mail (configuration actuelle: pas de rappels) + +Get no reminder notification e-mails (current setting: send reminders) +Keine Erinnerung E-Mails erhalten (aktuelle Einstellung: Erinnerung E-Mails werden verschickt) +Koine Drodenka E-Mails erhalta (aktuelle Eischtellong: Drodenka E-Mails werdad verschickt) +No recibir emails de recuerdo (configuración actual: Se eniva emails de recuerdo) +Get no reminder notification e-mails (current setting: send reminders) +Imposta nessun promemoria per l'e-mail di notifica (Impostazione attuale: spedisci promemoria) +Neodesílat žádná připomenutí (současné nastavení: odeslat upozornění) +Ne pas recevoir les rappels par e-mail (configuration actuelle: rappels envoyés) + +Save files after download (current setting: display +Speichere Dateien nach dem download (aktuelle Einstellung: anzeigen +Schpeicher die Dateia nochm Ronderlada (aktuelle Eischtellong: ozeiga +Save downloads (current setting: display +Save downloads (current setting: display +Save downloads (current setting: display +Save downloads (current setting: display +Save downloads (current setting: display + +Display files when downloading with web browser (current setting: save +Anzeige von Dateien direkt beim download (aktuelle Einstellung: abspeichern +Ozeiga von Dateia beim Ronderlada (aktuelle Eischtellong: abschpeichra +Display downloads (current setting: save +Display downloads (current setting: save +Display downloads (current setting: save +Display downloads (current setting: save +Display downloads (current setting: save + +You will now get no reminder notification e-mails +Sie werden nun keine Erinnerung E-Mails erhalten +Du wirsch jetzt koine Drodenka E-Mails meh bekomma +Desde ahora ya no se recibe emails de recuerdo +You will now get no reminder notification e-mails +Non otterrai ora alcun promemoria di notifica e-mail +Nyní vám nebudou odesílány žádné zprávy s připomenutím +Vous n'allez plus recevoir d'emails de notifications + +You will now get reminder notification e-mails +Sie werden nun Erinnerung E-Mails erhalten +Du wirsch jetzt Drodenka E-Mails bekomma +Desde ahora se recibe emails de recuerdo +You will now get reminder notification e-mails +Otterrai ora promemoria di notifica e-mail +Nyní vám budou odesílány zprávy s připomenutím +Vous allez maintenant recevoir des rappels par e-mail + +Notification e-mails now come in detailed format +Benachrichtigungs E-Mails kommen ab jetzt in detailliertem Format +Benochrichtigongs E-Mails kommet ab jetzt mit langem Gschwätz +E-mails de notificación desde ahora datallados +Os correos de notificación virán a partir de agora en formato detallado +Notifica e-mail ora sono disponibili in formato dettagliato +E-maily s upozorněním jsou nyní odesílány v podrobném formátu +Les emails de notifications sont maintenant au format détaillé + +Notification e-mails now come in short format +Benachrichtigungs E-Mails kommen ab jetzt in kurzem Format +Benochrichtigongs E-Mails kommet ab jetzt em kurzem Format +E-mails de notificación desde ahora cortos +Os correo de notificación virán a partir de agora en formato curto +Notifica e-mail ora sono disponibili in formato breve +E-maily s upozorněním jsou nyní odesílány ve zkráceném formátu +Les emails de notifications sont maintenant au format simple + +Downloads will now be saved +Downloads werden nun gespeichert +Downloads werdet ab jetzt gschpeichert +Descargas están guardadas +Downloads will now be saved +I downloads saranno ora salvati +Stahované soubory se nyní uloží +Les téléchargements vont maintenant être sauvés + +Downloads will now be displayed (if possible) +Downloads werden nun angezeigt (wenn möglich) +Downloads werdet ab jetzt ozeigt (wenns ghot) +Descargas están indicadas ahora (si posible) +Downloads will now be displayed (if possible) +I downloads saranno mostrati (se possibile) +Stahované soubory se nyní zobrazí (je-li to možné) +Les téléchargements cont maintenant être affichés (si possible) + +E-mail disclaimer reset to default +Der E-Mail Disclaimer wurde auf Standard zurückgesetzt +Dr E-Mail Ohängsl isch wieder orginal +Renuncia de email reinicializado a defecto +E-mail disclaimer reset to default +E-mail disclaimer ripristinato su predefinito +Zřeknutí se odpovědnosti ve zprávě bylo nastaveno na výchozí hodnotu +Clause de non-responsabilité par défaut + +Disclaimer to be sent with download notification e-mail: +In Benachrichtigungs E-Mail angehängter Disclaimer: +Disclaimer en dr Benochrichtigongs E-Mail: +Renuncia de email enviado con emails de notificación para descargar: +Disclaimer to be sent with download notification e-mail: +Disclaimer spedito con il download dell'e-mail di notifica: +Zřeknutí se odpovědnosti odesílané společně se zprávou s připomenutím stažení: +Claude de non-responsabilité à envoyer avec le message de notification: + +reset the disclaimer to default +den Disclaimer zurücksetzen +dr Disclaimer zricksetza +Reinicializar renuncia de email a defecto +reset the disclaimer to default +ripristina il disclaimer su predefinito +obnovit výchozí zřeknutí se odpovědnosti +remise de la clause de non-responsabilité à sa valeur par défaut + +E-mail disclaimer changed to: +Der E-Mail Disclaimer wurde geändert auf: +Dr E-Mail Disclaimer isch jetzt: +Renuncia de email cambiado á: +E-mail disclaimer changed to: +E-mail disclaimer modificato in: +Zřeknutí se odpovědnosti ve zprávě bylo změněno na: +Clause de non-responsabilité de l'email: + +Back to fup (upload page) +Zurück zu fup (Upload Seite) +Zrigg zu fup (Nufflad-Seite) +Volver a fup (p´gina de carga) +Volver a fup (p´xina de carga) +Indietro a fup (pagina di caricamento) +Zpět na fup (stránku pro nahrávání) +Retour à fup (page d'upload) + +Download URLs of files you have sent +Download URLs von gesendeten Dateien +Ronderlad URLs von verschickte Dateia +URLs de descarga de los archivos enviados +Descargar os URL dos ficheiros enviados +Scarica URL dei file che sono stati inviati +URL pro stažení souborů, které jste odeslali +URLs de téléchargement que vous avez envoyés + +

to +

an +

an +

vez +

para +

per +

pro +

pour + +reminder F*EX-upload +Erinnerung F*EX-upload +Ned vergessa F*EX-upload +recuerdo del F*EX-upload +recordatorio do envío F*EX +ricordo F*EX-upload +Oznámení o nahraném souboru na F*EX +Pense-bête F*EX-upload + +value="continue" +value="weiter" +value="weidr ghods" +value="continuar" +value="continuar" +value="continua" +value="pokračovat" +value="continuer" + +>User: +>Benutzer: +>Benutzr: +>Usuario: +>Usuario: +>Utente: +>Uživatel: +>Utilisateur: + +user config ERROR +ERROR Benutzer-Einstellungen +ERROR Benutzr-Eischdellunga +ERROR en la confiuración del usuario +Produciuse un ERRO na configuación do usuario +ERRORE di configurazione utente +CHYBA nastavení uživatele +ERREUR de configuration utilisateur + +F*EX user config +F*EX Benutzer-Einstellungen +F*EX Benutzr-Eischdellunga +configuración del usuario F*EX +configuración do usuario F*EX +Configurazione utente F*EX +Nastavení F*EX uživatele +Configuration utilisateur F*EX + +An information e-mail has been sent to your subuser +Eine Benachrichtiguns-E-Mail wurde gesendet zu Ihrem Subuser +Dein Onderbenutzr isch per E-Mail benochrichdigt worde +Un correo electrónico informativo se ha enviado a su subusuario +Un correo electrónico informativo enviouse ao seu subusuario +Una e-mail di informazione e' stata spedita al tuo sotto-utente +VaÅ¡emu poduživateli byl odeslán informační e-mail +Un message d'information a été envoyé à votre sous-utilisateur + +A one time upload URL for $otuser has been created +Eine einmal gültige upload URL für $otuser wurde angelegt +A oimol giltig nufflad URL fir $otuser isch oglegt worda +Un URL para subir una vez $otuser ha sido creado +Un enderezo URL de único uso para $otuser acaba de se crear +E' stato creato un URL di caricamento utilizzabile una sola volta per l'utente $otuser +Jednorázová URL pro nahrání pro $otuser byla vytvořena +Une URL d'upload à usage unique pour $otuser a été créée + +and an information e-mail has been sent to this address +und eine Informations-E-Mail wurde an diese Adresse verschickt +ond a Was-macha-musch-E-Mail isch do no verschickt worda +y un email de información ha sido enviado a esta dirección +e un correo informativo acaba de se enviar a este enderezo +e una e-mail di informazioni è stata spedita a questo indirizzo +a informační e-mail byl odeslán na tuto adresu +et un message d'information a été envoyé à cette adresse + +wrong user or auth-ID +Falscher Benutzer oder falsche auth-ID +Benutzr oddr auth-ID send falsch +usuario o auth-ID erróneo +o usuario ou o auth-ID son incorrectos +utente o auth-ID sbagliato +chybný uživatel nebo ověřovací ID +utilisateur ou auth-ID invalide + +no group name specified +kein Gruppen-Name angegeben +Seggl, Du hosch koin Grubbenoma ogebe +nombre de grupo sin especificar +non se especificou o nome do grupo +nome gruppo non specificato +nebyl uveden žádný název skupiny +pas de nom de groupe spécifié + +is already a registered F*EX full user +ist bereits ein registrierter F*EX Voll-Benutzer +isch scho längscht als Vollbenutzr bei F*EX regischdriert +ya es un usuario normal registrado en F*EX +xa é un usuario completo rexistrado en F*EX +e' gia' un utente F*EX completo registrato +je již zaregistrovaným plnohodnotným F*EX uživatelem +est déja enregistré en tant qu'utilisateur F*EX + +Your subuser upload URL is: +Ihr Subuser Upload-URL ist: +Dei Onderbenutzr Nufflad-URL isch: +La URL de subida de su subusuario es: +O seu enderezo URL de carga como subusuario: +L'URL per il caricamento del tuo sotto-utente e': +URL pro nahrání pro vaÅ¡eho poduživatele je: +L'URL d'upload de votre sous-utilisateur est: + +Your subusers upload URLs are: +Die Upload-URLs für Ihre Subusers sind: +Dui Nufflad-URLs fier Deine Onderbenutzr send: +Las URLs de sus subusuarios son: +Os URL de carga dos seus subusuarios +Gli URL per il caricamento dei tuoi sotto-utenti sono: +URL pro nahrání pro vaÅ¡e poduživatele jsou: +Les URLs d'upload de vos sous-utilisateurs sont: + +An information e-mail has been sent to +Eine Benachrichtigungs-E-Mail wurde gesendet an +A Benochrichdigongs-E-Mail isch gschickt worde an +Un correo electrónico informativo se ha enviado a +Enviouse un correo electrónico informativo +Una e-mail di informazione e' stata spedita a +Informační e-mail byl odeslán na +Un message d'information a été envoyé à + +Edit address book +Adressbuch editieren +Adressbüchle bearbeita +Editar el libro de direcciones +Editar a axenda de enderezos +Edita la rubrica +Upravit adresář +Éditez le carnet d'adresse + +Entry:aliase-mail address# optional comment +Eintrag:AliasE-Mail Adresse# optionaler Kommentar +Eidrag:AliasE-Mail Adress# Kommendar (kosch macha oddr bleiba lassa) +Entrada:aliasdirección de correo electrónico# comentario opcional +Entrada:aliasenderezo de correo electrónico# comentario opcional +Entrata:aliasindirizzo e-mail# commento opzionale +Položka:aliase-mailová adresa volitelný komentář +Entrée:aliasadresse e-mail# comment optionnel + +Example: +Beispiel: +Beischbiel: +Ejemplo: +Exemplo: +Esempio: +Příklad +Exemple: + +value="submit" +value="Absenden" +value="Verschicke" +valor="enviar" +valor="enviar" +value="sottometti" +value="potvrdit" +value="soumettre" + +You may use these alias names as F*EX recipient addresses on +Sie können diese Alias-Namen als F*EX Empfänger-Adressen auf +Du kosch selle Alias-Nome als F*EX Empfänger-Adresse uff +Puede usar estos alias como direcciones de destinatarios en F*EX en +Pode usar estes alias como enderezos de destinatarios do F*EX en +Potresti usare questo alias come destinatario di F*EX +Tyto aliasy můžete používat jako adresy F*EX příjemce na +Vous pouvez utiliser ces alias comme destinataires F*EX sur + +'fup' +'fup benutzen.' +'fup nemme.' +'fup' +'fup' +'fup' +'fup' +'fup' + +Alternatively you can fex a file ADDRESS_BOOK to yourself +Alternativ können Sie die Datei ADDRESS_BOOK an sich selbst +Du kosch au dui Datei ADDRESS_BOOK an De selber +También puede enviar vía fex un fichero ADDRESS_BOOK a si mismo +Tamén pode enviar vía fex un ficheiro ADDRESS_BOOK a si mesmo +Alternativamente puoi inviare un file ADDRESS_BOOK a te stesso +Nebo si můžete poslat soubor sami sobě +Vous pouvez aussi vous envoyer un fichier ADDRESS_BOOK + +containing your alias definitions +fexen, welche Ihre Alias-Definitionen enthält +fexe, wo Deine Alias-Definitione dren send +que contenga sus definiciones de alias +que conteña as súas definicións de alias +contiene le tue definizioni degli alias +obsahuje definované aliasy +contenant vos alias + +aliase-mail addressoptionscomment +AliasE-Mail AdresseOptionenKommentar +AliasE-Mail AdresseOptionenKommendar +aliasdirección de correo electrónicoopcionescomentar +aliasenderezo de correo electrónicoopciónscomentar +aliasindirizzo e-mailopzionicommento +aliase-mailová adresavolbykomentář +aliasadresse e-mailoptionscommentaire + +back to fup (F*EX upload) +zurück zu fup (F*EX Upload) +zrigg zu fup (F*EX Nufflade) +volver a fup (subida a F*EX) +volver a fup (subida a F*EX) +torna a fup (caricamento F*EX) +zpět na fup (F*EX nahrání) +retour à fup (F*EX upload) + +You have to give these URLs to your subusers for fexing files to you +Sie müssen diese URLs Ihren Subusers geben, damit sie Dateien an Sie fexen können +Du musch selle URLs Deine Onderbenutzr gebba, damit se Dateia an Di fexe kenne +Tiene que dar estas URLs a sus subusuarios para que puedan enviarle ficheros vía F*EX +Ten que dar estes URL aos seus subusuarios para que poidan enviarlle ficheiros vía F*EX +Devi dare questi URL ai tuoi sotto-utenti per spedirti file +Aby vám mohli poduživatelé odesílat soubory, sdělte jim tyto URL +Vous devez donner ces URLs à vos utilisateurs pour qu'ils puissent vous envoyer des fichiers + +Or click on the subuser's e-mail address link to send him an +Oder klicken Sie auf den E-Mail Adressen-Link des Subusers, um ihm eine +Oddr klick halt uff de E-Mail Adresse-Link von Deim Onderbenutzr, no kosch ihm a +O pinche en el enlace a la dirección de correo electrónico del subusuario para enviarle un +Ou prema sobre a ligazón do enderezo de correo do subusuario para enviarlle un +O clicca nel link dell'indirizzo e-mail del sotto-utente per spedirgli un +Nebo klikněte na odkaz s e-mailovou adresou poduživatele k odeslání +Ou cliquer sur l'adresse de messagerie de votre sous-utilisateurs pour lui envoyer un + +information e-mail by the F*EX server +Benachrichtigungs-E-Mail mit Hilfe des F*EX-Servers zu senden +Benochrichdigongs-E-Mail ieber de F*EX-Server schicke +correo electrónico informativo del servidor de F*EX +correo electrónico informativo vía servidor do F*EX +informazione spedita dal server F*EX +informačního e-mailu pomocí F*EX serveru +message d'information du server F*EX + +Your F*EX account: +Ihr F*EX Account: +Dei F*EX Konto: +Su cuenta en F*EX: +A súa conta no F*EX: +Il tuo utente F*EX: +Váš F*EX účet: +Votre compte F*EX: + +New auth-ID: +Neue auth-ID: +Neie auth-ID: +Nuevo auth-ID: +Novo auth-ID: +Nuovo auth-ID: +Nové ověřovací ID: +Nouvel auth-ID: + +(Remember your auth-ID when you change it!) +(Unbedingt die auth-ID merken wenn sie geändert wird!) +(Merk Dir obedingd Dei auth-ID wenn Du se gändert hosch!) +(Recuerde su auth-ID cuando lo cambie) +(Lembre o seu auth-ID cando o cambie) +(Ricordati il tuo auth-ID quando lo cambi!) +(Zapamatujte si své ověřovací ID, pokud jej změníte!) +(Vous devez vous souvenir de votre auth-ID lorsque vous le changez) + +Allow special senders (= subusers) to fex files to you: +Ihren ausgewählten Partnern (= Subusers) erlauben, Daten an Sie zu senden: +Deim erlesene Freindeskreis (= Onderbenutzr) erlaube, Data an Di zom schicka: +Permitir a remitentes especiales (= subusuario) que le envín vía F*EX ficheros a usted: +Permitirlles a remitentes especiais (= subusuarios) enviarlle a vostede ficheiros por F*EX: +Permetti a utenti speciali (= sotto-utenti) di spedirti file: +Povolit speciální odesilatele (= poduživatelé), kteří vám mohou zasílat soubory: +Autoriser des expéditeurs particuliers (= sous-utilisateurs) à vous envoyer des fichiers: + +Allow +Erlaube +Erlaub +Permitir +Permitir +Permetti +Povolit +Autoriser + +save and show upload URLs +speichern und upload URLs anzeigen +abschpeichra ond nufflad URLs ozeiga +guardar y mostrar las direcciones URL de carga +gardar e amosar URL enviado +salva e mostra gli indirizzi di upload +uložit a zobrazit URL pro nahrání +sauvegarder et lister les URLs d'upload + +This list has entries in format:<e-mail address>:<encryption-ID> +Diese Liste besteht aus Einträgen im Format:<E-Mail Adresse>:<encryption-ID> +Sell Lischt beschdoht aus Eidragonge vom Format:<E-Mail Adress>:<encryption-ID> +Esta lista tiene las entradas en formato:<e-mail address>:<encryption-ID> +Esta lista ten entradas co formato :<enderezo de correo>:<ID-cifrado> +Questa lista ha i contenuti nel formato: <e-mail address>:<encryption-ID> +Položky seznamu jsou ve formátu:<e-mailová adresa>:<Å¡ifrovacíID> +Les entrées de cette liste ont comme format:<adresse e-mail>:<encryption-ID> + +These special senders may fex files only to you! +Diese besonderen Sender können Dateien nur an Sie fexen! +Selle Absender send was Bsonders ond kenne Dateia bloß an dich fexe! +¡Estos remitentes especiales pueden enviar ficheros vía F*EX solo a usted! +Estes remitentes especiais poden enviar ficheiros vía F*EX a vostede! +Questi utenti speciali potrebbero spedire file solo a te! +Tito speciální odesilatelé mohou odesílat soubory pouze vám! +Ces expéditeurs particuliers peuvent seulement vous envoyer des fichiers + +It is not necessary to add regular fex users to your list, +Es ist nicht notwendig, reguläre FEX Benutzer zu Ihrer Liste hinzuzufügen +'S isch net nedich, daß de reguläre F*EX Benutzr uff Dei Lischde setzsch +No es necesario añadir usarios de F*EX normales a su lista, +Non é necesario engadir usuarios de F*EX normais á súa lista, +Non e' necessario aggiungere utenti regolari fex alla tua lista, +Do tohoto seznamu není třeba přidávat běžné F*EX uživatele, +Il n'est pas nécessaire d'ajouter des utilisateurs de F*EX à votre liste, + +because they already can fex +weil diese bereits auch so fexen können +weil dui kenned sowieso scho fexe +porque ellos ya pueden enviar vía F*EX +porque eles xa poden enviar vía F*EX +perche' possono gia' spedire con F*EX +protože ti vždy mohou odesílat soubory +parce qu'ils peuvent déja utiliser fex + +The encryption-ID is necessary to generate a unique upload URL for this subuser +Die encryption-ID wird für um eine eindeutige upload URL für diesen Subuser zu erzeugen +Die encryption-ID isch notwendig um a eindeutig upload URL für den Subuser zom macha +Hace falta una ID de codificación para generarle a este sub-usuario un inequívoco URL para subir +Fai falta un ID de codificación para xerarlle a este subusuario un inequívoco URL para subir +L'encryption-ID e' necessario per generare un unico URL di caricamento per questo sotto-utente +Poduživatel musí mít k vytvoření unikátní URL pro nahrávání Å¡ifrovací ID +L'encryption-ID est nécessaire pour générer une URL d'upload unique pour cet utilisateur + +If you omit the encryption-ID a random one will be used +Wenn Sie die encryption-ID weglassen, wird eine zufällige gewählt +Wenn Du die encryption-ID wegläscht, no wird a zufälliga gnomma +Si se omite el cifrado-ID un nombre cualquiera se utilizará +Se omite o ID-cifrado, utilizarase un aleatorio +Se tu ometti l'ID crittato uno casuale verrà utilizzato +Vynecháte-li Å¡ifrovací ID, použije se náhodně vygerenrované +Si vous ne mentionnez pas l'encryption-ID, il sera généré aléatoirement + +A F*EX group is similar to a mailing list, but for files +Eine F*EX Gruppe ist einem E-Mail-Verteiler ähnlich, allerdings eben für Dateien +A F*EX Grupp isch so was wie en E-Mail-Verdoiler, halt fier Dateia +Un grupo F*EX es similar a una lista de correo, pero para ficheros +Un grupo F*EX seméllase a unha lista de correo, pero para ficheiros +Un gruppo F*EX e' simile ad una lista di distribuzione, ma per i file +F*EX skupina je podobná poÅ¡tovní konferenci s tím rozdílem, že se odesílají soubory +Un groupe F*EX est similaire à une adresse de diffusion (mailing-list), mais pour les fichiers + +Edit your F*EX groups: +Editieren Sie Ihre F*EX Gruppen: +Bearbeit Deine F*EX-Gruppa: +Edite sus grupos F*EX: +Edite os seus grupos F*EX: +Edita i tuoi gruppi F*EX: +Upravit F*EX skupiny: +Éditez vos groupes F*EX: + +new group +Neue Gruppe +Neie Grupp +Grupo nuevo +Novo grupo +nuovo gruppo +nová skupina +nouveau groupe + +Your F*EX account on +Ihr F*EX Account auf +Dei F*EX Konto auf +Su cuenta F*EX +A súa conta F*EX +Il tuo utente F*EX +Váš účet pro F*EX +Votre compte F*EX sur + +Your upload URL +Ihre upload URL +Dei nufflad URL +su URL de subir +O seu enderezo URL de carga +Il tuo URL di caricamento +URL pro nahrání +Votre URL d'upload + +to upload one file to $user +um eine Datei an $user zu schicken +om a Datei an $user zom schicka +para subir un fichero a $user +para cargarlle un ficheiro a $user +per caricare un file per $user +jednoho souboru uživateli $user +pour uploader un fichier à $user + +to upload files to $user +um Dateien an $user zu schicken +om Dateia an $user zom schicka +para subir ficheros a $user +para subir ficheiros a $user +per caricare file a $user +pro nahrávání souborů uživateli $user +pour uploader des fichiers à $user + +to upload files to F*EX group "$group" +um Dateien fuer F*EX-Gruppe "$group" bereitzustellen +wenn De Dateia fier dui F*EX-Grupp "$group" nufflade willsch +para subir ficheros al grupo F*EX "$group" +para subir ficheiros ao grupo de F*EX "$group" +per caricare file al gruppo F*EX "$group" +pro nahrávání souborů F*EX skupině "$group" +pour uploader des fichiers au groupe F*EX "$group" + +See http://$ENV{HTTP_HOST}/index.html for more information about +Siehe http://$ENV{HTTP_HOST}/index.html fuer mehr Informationen ueber +Guck halt uff http://$ENV{HTTP_HOST}/index.html wenn De meh wisse willsch ieber +Vea http://$ENV{HTTP_HOST}/index.html para obtener más información sobre +Véxase http://$ENV{HTTP_HOST}/index.html para obter más información sobre +Vedi http://$ENV{HTTP_HOST}/index.html per ulteriori informazioni +Více informací o svém účtu získáte na http://$ENV{HTTP_HOST}/index.html +Voir http://$ENV{HTTP_HOST}/index.html pour plus d'informations sur + +Questions? ==> F*EX admin: $admin +Fragen? ==> Kontaktieren Sie den F*EX Administrator: $admin +Froga? ==> Belaeschtig ruhig dr F*EX Adminischdrator: $admin +Preguntas? ==> Administrador de F*EX: $admin +Preguntas? ==> Administrador do F*EX: $admin +Domande? ==> Amministratore F*EX: $admin +Máte otázky? ==> Kontaktujte F*EX správce: $admin +Questions? ==> Administrateur F*EX: $admin + +Your F*EX account on +Ihr F*EX Account auf +Dei F*EX Konto auf +Su cuenta F*EX en +A sú conta F*EX en +Il tuo account F*EX su +Váš F*EX účet na +Votre compte F*EX sur + +A F*EX (File EXchange) account has been created for you on +Ein F*EX (File EXchange) Account ist fuer Sie angelegt worden auf +Du hosch jetzt a F*EX (File EXchange) Konto auf +Una cuenta F*EX (File EXchange) se ha creado para usted en +Creóuselle a vostede unha conta F*EX (File EXchange) +Un account F*EX (File EXchange) e' stato creato per te su +Byl vám vytvořen F*EX (File EXchange) účet na +Un compte F*EX a été créé pour vous sur + +'Use +'Bitte benutzen Sie +'Nemm +'Usa +'Use +'Usa +'Používání +'Utilisez + +See http://$ENV{HTTP_HOST}/ for more information about +Siehe http://$ENV{HTTP_HOST}/ fuer mehr Informationen ueber +Guck halt uff http://$ENV{HTTP_HOST}/index.html wenn De meh wisse willsch ieber +Vea http://$ENV{HTTP_HOST}/ para obtener más información sobre +Véxase http://$ENV{HTTP_HOST}/ para obter más información sobre +Vedi http://$ENV{HTTP_HOST}/ per ulteriori informazioni +Informace, jak používat F*EX, naleznete na http://$ENV{HTTP_HOST}/ +Voir http://$ENV{HTTP_HOST}/ pour plus d'informations sur + +$notify not found in $gf +$notify nicht gefunden in $gf +$notify net gfonda in $gf +$notify no se encontró en $gf +$notify non se atopou en $gf +$notify non trovato in $gf +$notify nebyl v $gf nalezen +$notify non trouvé dans $gf + +Notification e-mail to $notify has been sent +Benachrichtigungs-E-Mail an $notify wurde gesendet +Benochrichdigongs-E-Mail an $notify isch verschickt worda +Correo electrónico de notificación enviado a $notify +Enviouse un correo de notificación a $notify +E-mail di notifica e' stata spedita a $notify +E-mail s oznámením pro $notify byl odeslán +Un message d'information a été envoyé à $notify + +bad addresses:

\n
    +Fehlerhafte Adressen:

\n
    +Was send au des fier Adresse? Die send grottefalsch::

\n
    +dirección errónea:

\n
    +Os enderezos son incorrectos:

\n
    +indirizzo errato:

\n
    +chybné adresy:

\n
    +mauvaises adresses:

\n
    + +you are already in group \@$group owned by $user +Sie sind bereits in der Gruppe \@$group welche dem Benutzer $user gehört +Du bisch doch scho längscht in derra Grupp \@$group von dem Benutzr $user +ya pertenece al grupo \@$group propiedad de $user +xa pertence ao grupo \@$group propiedade de $user +sei gia' nel gruppo \@$group di proprieta' di $user +ve skupině \@$group vlastněné uživatelem $user se již nacházíte +vous êtes déja dans le groupe \@$group de l'utilisateur $user + +Go back +Zurück +No mol von vorne +Volver +Volver +Torna indietro +Vrátit se +Retour + +and enter another group name +und geben Sie einen anderen Namen für die Gruppe ein +ond geb en andra Noma fier dui Grupp ei +y introduzca un nuevo grupo +e introduza un novo grupo +e inserisci un'altro nome del gruppo +a zadat jiný název skupiny +et saisissez un autre nom de groupe + +Group \@$group has members: +Die Gruppe \@$group hat folgende Mitglieder: +Zur Grupp \@$group ghered: +Los miembros del grupo \@$group son: +Os membros do grupo \@$group son: +Il gruppo \@$group ha i componenti: +Členové skupiny \@$group: +Le groupe \@$group a comme membres: + +(click address to send a notification e-mail to this user) +(Klicken Sie auf die Adresse um eine Benachrichtigungs-E-Mail an diesen Benutzer zu senden) +(Schieb Dei Maus uff d' Adress ond klick. Dann wird a Benochrichdigongs-E-Mail an den Benutzr gschickt) +(pinche en la dirección para enviar correo electrónico de notificación a este usuario) +(prema sobre o enderezo de correo electrónico de notificación a este usuario) +(clicca l'indirizzo per spedire una e-mail di notifica a questo utente) +(pro odeslání oznamovacího e-mailu uživateli, klikněte na jeho adresu) +(cliquer sur l'adresse pour prevenir l'utilisateur avec un message) + +Edit F*EX group +F*EX-Gruppe editieren +F*EX-Grupp bearbeide +Editar el grupo F*EX +Editar o grupo F*EX +Edita il gruppo F*EX +Upravit F*EX skupinu +Éditez le groupe F*EX + +A F*EX group is similar to a mailing list, but for files: +Eine F*EX-Gruppe ist einem E-Mail-Verteiler ähnlich, hier geht es jedoch um Daten-Verteilung: +A F*EX-Grupp isch so was wie en E-Mail-Verdoiler, allerdengs werde do Date verdoilt: +Un grupo F*EX es similar a una lista de correo, pero para ficheros: +Un grupo F*EX é semellante a unha lista de correo, pero para ficheiros: +Un gruppo F*EX e' simile ad una lista di distribuzione, ma per i file: +F*EX skupina je podobná poÅ¡tovní konferenci s tím rozdílem, že se odesílají soubory: +Un groupe F*EX est similaire à une liste de diffusion (mailing-list), mais pour des fichiers + +When a member fexes a file to this list, +Wenn ein Mitglied eine Datei für die Gruppe bereitstellt, +Wenn oi Mitglied a Datei fier die reschdlich Grupp nuffläd +Cuando un miembro envía vía F*EX un fichero a esta lista, +Cando un membro envía vía F*EX un ficheiro a esta lista, +Quando un componente spedisce un file a questa lista, +OdeÅ¡le-li člen soubor do konference, +Lorsque un membre envoie un fichier à cette liste + +then all other members will receive it +dann werden alle anderen Mitglieder diese Datei erhalten +no krieget älle andere wo in derre Grupp send, selle Datei +entonces todos los demás miembros lo recibirán +entón todos os demáis membros o recibirán +allora tutti gli altri componenti la riceveranno +obdrží jej vÅ¡ichni členové +tous les autres membres vont le recevoir + +New group name: (You MUST fill out this field!) +Neuer Name für die Gruppe: (Sie MÜSSEN dieses Feld ausfüllen!) +Neier Nome fier d' Grupp: (Des Feld MUSCH Du ausfille!) +Nuevo nombre de grupo: (¡DEBE rellenar este campo!) +Novo nome de grupo: (DEBE cubrir este campo!) +Nuovo nome del gruppo: (DEVI compilare questo campo!) +Název nové skupiny: (Toto políčko MUSÍTE vyplnit!) +Nouveau nom du groupe: (Ce champ ne peut pas être vide) + +This list has entries in format:<e-mail address> +Diese Liste besteht aus Einträge in folgendem Format haben:<E-Mail Adresse> +Die Lischde bschdohd aus Eiträg em Format:<E-Mail Adresse> +Esta lista debe tener las entradas en el formato: <dirección de correo electrónico> +Esta lista debe ter as entradas no formato: enderezo de correo electrónico> +Questa lista deve avere le righe in questo formato:<indirizzo e-mail> +Položky seznamu musí být ve formátu:<e-mailová adresa> +Cette liste doit avoir des entrées de la forme:<Adresse e-mail> + +You can name any existing e-mail address +Sie können hier eine beliebige gültige E-Mail Adresse angeben +Du kosch do a giltige E-Mail-Adress nach Deim Guschto eigebba +Puede nombrar cualquier dirección de correo electrónico +Pode nomear calquera enderezo de correo electrónico +Puoi nominare qualsiasi indirizzo e-mail esistente +Jakoukoli existující e-mailovou adresu můžete pojmenovat +Vous pouvez désigner n'importe quelle adresse e-mail existante + +delete file after download +Datei nach dem Download löschen +Datei nochm Ronderlada löscha +borrar el fichero tras su descarga +borrar o ficheiro trala súa descarga +cancella il file dopo il download +smazat soubor po stažení +effacer le fichier après le téléchargement + +do not delete file after download +Datei nach dem Download nicht löschen +Datei nochm Ronderlada net löscha +no borrar el fichero tras su descarga +non eliminar o ficheiro despois da descarga +non cancellare il file dopo il download +nemazat soubor po stažení +ne pas supprimer le fichier après le téléchargement + +delete file after download with delay +Datei nach dem Download mit Verzögerung löschen +Datei nochm Ronderlada erscht schpäter löscha +borrar el fichero tras su descarga con retardo +borrar o ficheiro tras a súa descarga con atraso +cancella il file dopo il download con ritardo +smazat soubor po stažení až po +effacer le fichier après un délai à la suite du téléchargement + +delete file $autodelete days after download +Lösche Datei $autodelete Tage nach dem Download +Lösch Datei $autodelete Dag nochm ronderlada +borrar archivo $autodelete dias despues del descargar +delete file $autodelete days after download +cancella file $autodelete giorni dopo il download +smazat soubor po $autodelete dnech po stažení +effacer $autodelete jours après le téléchargement + +F*EX service +F*EX-Service +F*EX-Dienscht +Servicio F*EX +Servizo F*EX +servizio F*EX +Služba F*EX +Service F*EX + +Your reqested F*EX auth-ID for $fup?from=$from is: +Ihre angefragte F*EX auth-ID fuer $fup?from=$from ist: +Dei nochgfrogte F*EX auth-ID fir $fup?from=$from isch: +Su auth-ID de F*EX solicitada para $fup?from=$from es: +O seu auth-ID de F*EX solicitado para $fup?from=$from é: +Il tuo auth-ID di F*EX che hai richiesto per $fup?from=$from e': +Požadované ověřovací ID pro $fup?from=$from je: +Votre auth-ID F*EX pour $fup?from=$from est: + +Or use: +Oder Sie verwenden: +Odr du nemsch: +O use: +Or use: +Oppure usa +Nebo pou¾ijte: +Ou utilisez: + +Your reqested F*EX login is: +Ihr angefragter F*EX login ist: +Dei agfragte F*EX login isch: +Su solicitada login de F*EX es: +A seu login solicitado de de F*EX é: +Il tuo login F*EX richiesto e': +Požadované přihlaÅ¡ovací údaje pro F*EX: +Votre login F*EX est: + +Mail has been sent to you +Mail wurde gesendet an Sie +Mail isch an Dich gschickt worde +El mensaje de correo se le ha enviado +A mensaxe de correo xa se lle enviou +Ti e' stata spedita una e-mail +Zpráva vám byla odeslána +Le message vous a été envoyé + +You are not in this group +Sie sind nicht in dieser Gruppe +Du ghersch net zu derra Grupp +Nos es miembro de este grupo +Non é membro deste grupo +Non sei in questo gruppo +Nejste členem této skupiny +Vous n'êtes pas dans ce groupe + +Recipient group has no members +Empfänger-Gruppe hat keine Mitglieder +Dui Grupp wo des no soll hot koine Miglieder +El grupo destinatario no tiene miembros +O grupo de destinatarios non ten membros +I gruppi di distribuzione non hanno membri +Skupina příjemců nemá žádné členy +Le groupe destinataire n'a pas de membre + +No such group +Diese Gruppe existiert nicht +Selle Grupp gibt's net. Huatsempel +No existe tal grupo +Non existe tal grupo +Non esiste questo gruppo +Tato skupina neexistuje +Groupe non trouvé + +unknown dkey +Unbekannter dkey +Den dkey kenn i net +dkey desconocido +dkey descoñecido +dkey sconosciuto +neznámý dkey +dkey inconnue + +has been deleted by %s at %s +wurde gelöscht von %s um %s +isch glöscht worde von %s um %s +ha sido borrado por %s a las %s +eliminado por %s és %s +e' stato cancellato da %s a %s +byl smazán uživatelem %s dne %s +a été effacé par %s le %s + +$filename deleted +$filename gelöscht +$filename glöscht +$filename borrado +$filename eliminado +$filename cancellato +$filename byl smazán +$filename effacé + +$filename not deleted ($s) +$filename nicht gelöscht ($s) +$filename net glöscht +$filename no borrado ($s) +$filename non eliminado ($s) +$filename non cancellato ($s) +$filename nebyl smazán ($s) +$filename non effacé ($s) + +>continue +>weiter +>Weiterschaffe +>continuar +>continuar +>continua +>pokračovat +>continuer + +Files from +Dateien von +Dateia von +Ficheros de +Ficheiros de +File da +Soubory od +Fichiers de + +notification e-mail has been resent +Benachrichtigungs-E-Mail wurde erneut verschickt +no amole Bscheid gsagt +Email de notificación reenviado +notification e-mail has been resent +E-mail di notifica è stata rispedita +Zpráva s upozorněním byla obnovena +l'email de notification a été réémis + +click on the file name to resend a notification e-mail +klicken Sie auf den Dateinamen um die Benachrichtigungs-E-Mail erneut zu verschicken +klick uf dr Dateinama, om dem Empfängr no amole Bscheid saga +haga clic en el nombre de archivo para reenviar +click on the file name to resend a notification e-mail +clicca sul nome del file per rispedire un'e-mail di notifica +pro opětovné odeslání zprávy s upozorněním klikněte na název souboru +cliquer sur le nom du fichier pour envoyer à nouveau un email de notification + +Files for $to (*): +Dateien für $to (*): +Dateia fier $to (*): +Ficheros para %to (*): +Ficheiros para %to (*): +File per $to (*): +Soubory pro $to (*): +Fichiers pour $to (*): + +\nfrom $from +\nVon $from +\nVon $from +\nde $from +\nde $from +\nda $from +\nod $from +\nde $from + +>delete< +>löschen< +>löscha< +>borrar< +>eliminar< +>cancella< +>smazat< +>effacer< + +>forward< +>weiterleiten< +>weiterleita< +>reenviar< +>forward< +>prosegui< +>pøedat< +>faire suivre< + +Files for other e-mail addresses you own will not be listed here! +Dateien für Ihre andere E-Mail Adressen werden hier nicht aufgelistet! +Dateia fier Deine andre E-Mail Adressa werded dohanne net uffglischtet! +¡Los ficheros para otras direcciones de correo electrónico suyas no son listadas aquí! +Os ficheiros para outros enderezos de correo electrónico que teñ non se listan aquí! +File per altri indirizzi di e-mail che ti appartengono non saranno elencati qui! +Soubory pro další e-mailové adresy, které vlastníte, zde nebudou uvedeny! +Les fichiers associés à vos autres adresses ne vont pas être listés ici! + +you are overquota +Sie haben Ihr Speichervolumen überzogen +Dei Schbeicherplatz isch rappelvoll +ha excedido su cuota +sobrepasou a sú cota +Hai superato la quota +překročili jste limit +vous avez dépassé votre quota + +cannot receive files: is overquota +Kann Dateien nicht annehmen: Speichervolumen überzogen +I ko die Dateia net onemme: Dein Schbeicher isch scho vollgschdopft +no puede recibir ficheros: ha excedido su cuota +non pode recibir ficheiros: sobrepasou a súa cota +non e' possibile ricevere il file: eccede la quota assegnata +soubory nelze přijmout: překračují limit +ne peut pas recevoir de fichiers: quota dépassé + +You ($from) are not allowed to fex to $to +Sie ($from) dürfen nicht fexen an $to +Du ($from) derfsch net fexa an $to +Usted ($from) no puede enviar vía F*EX a $to +Vostede ($from) non está autorizado para enviar, vía F*EX, a $to +Tu ($from) non hai il permesso di spedire via F*EX a $to +Vy ($from), nemáte dovoleno odesílat soubory pro $to +Vous ($from) n'êtes pas autorisé à envoyer un fichier à $to + +recipient $to is not a registered F*EX full or sub user +Empänger $to ist kein registrierter F*EX Voll- oder Subuser +Dr Empfänger $to isch koin regischtrierder F*EX Voll- oddr Onderbenutzr +el destinatario $to no es un usuario normal de F*EX registrado o un subusuario +o destinatario $to non é un usuario normal de F*EX rexistrado ou un subusuario +il destinatario $to non e' un utente o sotto-utente F*EX registrato +příjemce $to není zaregistrovaným plnohodnotným uživatelem či poduživatelem F*EX +le destinataire $to n'est pas un utilisateur ou un sous-utilisateur F*EX + +no upload key +kein upload-Einmalschlüssel +koi nufflad-Oimolschlissel +ningun llave para subir +non se cargou a chave +no chiave di caricamento +žádný klíč pro nahrání +pas de clé d'upload + +request another one from +fordern Sie einen neuen an von +frog noch'm Neua bei +pida otro de +solicitar outra en +richiedine un altro da +požádat o jiný uživatele +demander un autre de + +Your client seems to be "$1" which is incompatible with F*EX and will probably not work +Ihr Client scheint "$1" zu sein, das ist aber inkompatibel mit F*EX und wird vermutlich nicht funktionieren +Dein Client isch scheints "$1", des isch abbr inkomatibel mit F*EX ond so wird des wahrscheinlich nix +Su cliente parece ser "$1" que es incompatible con F*EX y probablemente no funcionará +O seu cliente parece ser "$1" que é incompatíbel con F*EX e probablemente non funcionará +Il vostro client sembra essere "$1", che e' incompatibile con F*EX e probabilmente non funzionera' +Zřejmě používáte prohlížeč "$1", který není kompatibilní s F*EX a pravděpodobně nebude správně fungovat +Votre client semble être "$1" qui est incompatible avec F*EX et ne va sans doute pas fonctionner + +We recommend firefox +Wir empfehlen \"Firefox\" +Mir empfehled \"Firefox\" +Recomendamos firefox +Recomendamos firefox +Raccomandiamo firefox +Doporučujeme používat Firefox +Nous recommandons firefox + +sender: +Absender: +Absendr: +remitente: +remitente: +mittente: +odesilatel: +expéditeur: + +recipient: +Empfänger: +Empfängr: +destinatario: +destinatario: +destinatario: +příjemce: +destinataire: + +recipient(s): +Empfänger: +Empfängr: +destinatario(s): +destinatario(s): +destinatario(i): +příjemce(i): +destinataire(s): + +recipient(s)< +Empfänger< +Empfängr< +destinatario(s)< +destinatario(s)< +destinatario(i)< +příjemce(i)< +destinataire(s)< + +e-mail address or alias +E-Mail Adresse oder Alias +E-Mail Adress oddr Alias +dirección de correo electrónico o alias +enderezo de correo electrónico ou alias +indirizzo e-mail o alias +e-mailová adresa či alias +adresse e-mail ou alias + +or select from your address book +oder aus Ihrem Adressbuch wählen +oddr aus Deim Adressbüchle raussuche +o seleccione de su libro de direcciones +ou seleccione da súa axenda de enderezos +o seleziona dal tuo rubrica +nebo si vyberte ze svého adresáře +ou sélectionner de votre carnet d'adresses + +and' +und' +ond' +y' +e' +e +a' +et' + +add to recipients list +zur Empfänger-Liste hinzufügen +uff d' Empfängerlischte setze +añada a la lista de destinatarios +engadir á lista de destinatarios +aggiungi alla lista di distribuzione +přidejte jej (je) do seznamu příjemců +ajouter à la liste des destinataires + +check recipient(s) and continue +Empfänger überprüfen und fortsetzen +Empfänger ieberpriafe ond weitermache +compruebe el/los destinatario(s) y continúe +comprobe o/os destinatario(s) e continúe +controlla i/il destinatari(o) e continua +zkontrolovat příjemce a pokračovat +vérifier le ou les destinataires et continuer + +>or< +>oder< +>odr< +>o< +>or< +>oppure< +>nebo< +>ou< + + or < + oder < + odr < + o < + or < + oppure < + nebo < + ou < + +and < +und < +ond < +y < +e < +e < +a < +et < + +You are a restricted user and may only fex to these recipients: +Sie sind ein eingeschränkter Benutzer und können nur an diese Empfänger fexen: +Du bisch a eigeschränktr Benutzr ond kosch bloss an die Empfängr fexa: +Usted es un usuario restringido y solo puede enviar a estos destinatarios: +You are a restricted user and may only fex to these recipients: +Sei un utente limitato e puoi inviare solo a questi destinatari: +Jste uživatel s omezením a můžete odesílat pouze těmto příjemcům: +Vous êtes un utilisateur restreint et vous ne pouvez utiliser fex que pour ces destinataires: + +fex yourself +eigene Adresse verwenden +fex dir selbr +usar la propria dirección +fex yourself +fex te stesso +zaslat sobě +à votre adresse + +>user config & operation control +>Benutzer Bedienungssteuerung +>Benutzr Bdienongssteierong +>configuración de usuario y control de operación +>configuración de usuario e control de operación +>configurazion utente & controllo operazioni +>nastavení uživatele a řízení provozu +>configuration utilisateur et gestion + +Alternate Java client (for files > 2 GB or sending of more than one file) +Alternativer Java Client (für Dateien größer als 2 GB oder zum Senden von mehr als einer Datei) +Alternativer Java Client (fier Dateia wo größer send als 2 GB oder zum Sende von meh als oiner Datei) +Cliente java alternativo (par ficheros > 2 GB o envío de más de un fichero) +Cliente java alternativo (para ficheiros > 2 GB ou envío de más dun fichero) +Client java alternativo (per file > 2 GB o per spedizioni di piu' di un file) +Alternativní Java klient (pro soubory větší než 2 GB či pro odesílání více než jednoho souboru) +Client Java alternatif (pour les fichiers > 2 GB ou envoyer plusieurs fichiers d'un coup) + +You have to fill out this form completely to continue +Sie müssen dieses Formular komplett ausfüllen um fortzufahren +Du musch des Formular ganz ausffülla sonsch kosch ned weitrmacha +Hace falta cumplimentar este formulario completamente antes de continuar +Fai falta cubrir este formulario completamente antes de continuar +Devi riempire completamente questo form per continuare +Pro pokračování musíte kompletně vyplnit formulář +Merci de compléter ce formulaire pour continuer + +sender quota (used):$quota ($du) MB +Absender Quota (benutzt):$quota ($du) MB +Absendr Quota (benutzt):$quota ($du) MB +cuota de remitente (usada):$quota ($du) MB +cota de remitente (usada):$quota ($du) MB +quota utente (usata):$quota ($du) MB +limit pro odesílání (used):$quota ($du) MB +quota expéditeur (utilisé):$quota ($du) MB + +autodelete: +Automatisches Löschen: +Automadischs Lösche: +autoborrar: +autoeliminación: +autocancellazione: +automatické mazání: +suppression automatique + +keep file max $keep days, then delete it +Behalte die Datei für max. $keep Tage, dann lösche sie +Bhalt die Datei fier höchschdens $keep Tage, dann kosch se lösche +conserve el fichero un máximo de $keep días, a continuación borrelo +conserve o ficheiro un máximo de $keep días, a seguir bórreo +conserva il file al massimo per $keep giorni, quindi cancellalo +uchovat soubor maximálně $keep dnů, pak jej smazat +garder les fichiers au maximum $keep jours et les supprimer + +keep: +Bleibt auf Server: +Bleibt uffm Server: +conserve: +gardar: +mantieni: +uchovat: +conserver: + +$keep days +$keep Tage +$keep Dag +$keep días +$keep días +$keep giorni +$keep dnů +$keep jours + +comment: +Kommentar: +Kommendar: +comentario: +comentario: +commento: +komentář: +commentaire: + +bandwith limit +Bandbreitenbeschränkung +Bandbroidebschränkong +anchura de banda +largo de banda +limite di banda +omezení rychlosti +limite de bande passante + +optional, full speed if empty +optional, volle Geschwindigkeit wenn leer +optional, volle Lotte wenn leer +opcional, velocidad maximal en caso de vacia +opcional, velocidade máxima cando baleira +opzionale, massima velocita' se vuoto +volitelné, je-li prázdné, využije se plná rychlost +optionnel, pas de limite si non renseignée + +optional, will be included in notification e-mail +optional, wird in Benachrichtigungs-E-Mail mitgeschickt +optional, isch no en dr Benochrichtigongs-Mail mit drbei +opcional, será enviado por email de notificación +optional, will be included in notification e-mail +opzionale, sarà incluso nell'e-mail di notifica +volitelné, připojí se ke zprávě s upozorněním +optionnel, sera inclus dans votre email de notification + +no notification e-mail will be send +es wird keine Benachrichtigungs-E-Mail verschickt +s\'wird koi Benochrichtigongs-Mail verschickt +No se enviará ningún correo de notificación +non se enviará notificación de correo +nessuna notificazione via e-mail verrà spedita +žádný e-mail s upozorněním se neodeÅ¡le +aucun message de notification ne sera envoyé + +If you want to send more than one file, then put them in a zip or tar archive +Wenn Sie mehr als eine Datei senden möchten, dann erzeugen Sie ein zip oder tar Archiv +Wenn De meh als oi Datei verschigge willsch, no mach a zip oddr a tar Archiv +Si desea enviar más de un fichero póngalos en un archivo zip +De querer enviar más dun fichero póñaos nun arquivo zip +Se vuoi spedire piu' di un file, mettili in un archivio zip o tar +Chcete-li odeslat více jak jeden soubor, zkomprimujte jej do zip nebo tar archivu +Si vous voulez envoyer plus d'un fichier, mettez les dans un zip ou une archive tar + +file: +Datei: +Datei: +fichero: +ficheiro: +file: +soubor: +fichier: + +user config & operation control +Benutzer Konfigurations- und Bedienungssteuerung +Benutzr Konfigurations- ond Bedienongssteierong +configuración de usuario & control de operaciones +configuración de usuario e control de operacións +configurazione utente & controllo operazioni +nastavení uživatele a řízení provozu +configuration utilisateur & gestion + +I have lost my auth-ID! Send it to me by e-mail! +Habe meine auth-ID vergessen! Bitte mir diese per E-Mail zuschicken! +I hann mei auth-ID vrschlampt! Schick se mir no mol per E-Mail! +¡He perdido mi auth-ID! ¡Envíemelo por correo electrónico! +Perdín o meu auth-ID! ¡Envíemo por correo electrónico! +Ho perso il mio auth-ID! Spediscimelo via e-mail! +Zapomněl jsem své ověřovací ID! OdeÅ¡li mi jej na e-mail! +J'ai perdu mon auth-ID ! Le recevoir par e-mail ! + +I have lost my auth-ID +Habe meine auth-ID vergessen +I hann mei auth-ID vrschlampt +He perdido mi auth-ID +Perdín o meu auth-ID +Ho perso il mio auth-ID +Zapomněl jsem své ověřovací ID +J'ai perdu mon auth-ID + +you must fill out sender field above +Sie müssen oben dazu das \"Absender\"-Feld ausfüllen +Du musch drzu do obe des \"Absendr\"-Feld ausfille +debe rellenar el campo remitente anterior +debe cubrir o campo remitente anterior +devi riempire il campo mittente sopra +musíte vyplnit políčko odesilatel výše +vous devez renseigner le champ expéditeur + +check ID and continue +weiter +weider +comprobar el ID y continuar +comprobar o ID e continuar +controlla ID e continua +ověřit ID a pokračovat +vérifier l'ID et continuer + +no file specified +Keine Datei angegeben +Koi Datei ogebbe +no se espcificó el fichero +non se espcificóu o ficheiro +nessun file specificato +nebyl uveden soubor +aucun fichier spécifié + +no sender specified +Kein Absender angegeben +Koin Absendr ogebbe +no se especificó el remitente +non se especificóu o remitente +nessun mittente specificato +nebyl uveden odesilatel +aucun expéditeur spécifié + +no recipient specified +Kein Empfänger angegeben +Koin Empfängr ogebbe +no se especificó el destinatario +non se especificó o destinatario +nessun destinatario specificato +nebyl uveden příjemce +aucun destinataire spécifié + +wrong auth-ID specified +Falsche auth-ID angegeben +Falsch auth-ID ogebbe +auth-ID especificado erróneo +o auth-ID especificado é incorrecto +auth-ID indicato sbagliato +bylo uvedeno chybné ověřovací ID +auth-ID erroné + +address book updated +Adressbuch aktualisiert +Adressbüchle isch uffm neueschte Schdand +libro de direcciones actualizado +axenda de enderezos actualizada +rubrica aggiornata +adresář byl aktualizován +carnet d'adresses mis à jour + +cannot rename $upload to +Konnte $upload nicht umbenennen in +I hab $upload net umbenenne könne in +no se puede renombrar $upload a +non se pode renomear $upload como +non posso rinominare $upload in +nepodařilo se přejmenovat $upload na +ne peut pas renommer $upload en + +No file data received +Keine Daten erhalten +Koine Date kriegt +No se ha recibido ningún fichero de datos +Non se recibiu ningún ficheiro de datos +Nessun file di dati ricevuto +Data souboru nebyla přijata +aucune donnée reçue + +File name correct? +Stimmt der Dateiname? +Isch der Dateinome richdig? +¿Nombre de fichero correcto? +Nome de ficheiro correcto? +Nome file corretto? +Je název souboru správný? +Est-ce que le nom du fichier est correct ? + +File too big (browser-limit: 2 GB!)? +Datei zu groß (Browser-Limit: 2 GB!)? +Die Datei isch zu groß (Browser-Limit: 2 GB!)? +¿Fichero demasiado grande (límite del navegador: ¡2GB!)? +Ficheiro demasiado grande (límite do navegador: 2GB!)? +File troppo grande (limite-browser: 2 GB!)? +Není soubor příliÅ¡ velký (limit prohlížeče: 2 GB!)? +Fichier trop volumineux (limite du navigateur: 2GB!)? + +is not allowed at beginning of +ist nicht erlaubt am Anfang von +des derfsch net mache am Ofang von +no se permite al principio de +non se permite ao principio de +non e' consentito all'inizio di +není povoleno na začátku +n'est pas autorisé au début de + +is not allowed in +ist nicht erlaubt in +des derfsch net mache in +no se permite en +non se permite en +non e' consentito in +není povoleno v +n'est pas autorisé dans + +is not allowed +ist nicht erlaubt +des derfsch net mache +no se permite +non se permite +non e' consentito +není povoleno +n'est pas autorisé + +is not allowed at end of +ist nicht erlaubt am Ende von +des derfsch net mache am End von +no se permite al final de +non se permite ao final de +non e' consentito alla fine di +není povoleno na konci +n'est pas autorisé à la fin de + +invalid Content-Length +Ungültiger Content-Length +Ungültiger Content-Length +Content-Length inválido +O Content-Length é incorrecto +Content-Length non valido +Content-Length není platné +Content-Length invalide + +not enough free space for this upload +Nicht genug freier Speicher für diesen Upload +'S isch net gnug Schbeicher frei om des nuffzulade +no hay espacio libre suficiente para la subida +non hai espazo libre suficiente para a subida +non c'e' abbastanza spazio per questo caricamento +pro nahrání není dost místa +pas assez d'espace libre pour cet upload + +missing sender e-mail address +E-Mail Adresse vom Sender fehlt +koi E-Mail Adress vom Sender +falta la dirección del remitente +falt o enderezo do remitente +manca l'indirizzo e-mail del mittente +chybí e-mailová adresa odesilatele +e-mail de l'expéditeur manquant + +is not a valid e-mail address +ist keine gültige E-Mail Adresse +des isch koi giltige E-Mail Adress +no es una dirección de correo electrónico válido +non é un enderezo de correo electrónico correcto +non e' un indirizzo e-mail di posta valido +není platná e-mailová adresa +n'est pas une adresse e-mail valide + +no file data received - does your file exist or is it >2GB +Keinen Datensatz erhalten - existiert die Datei wirklich oder ist es größer als 2 GB +I hab koine Date kriegt - Gibt's dui Datei ieberhaupt oddr isch se größer als 2 GB +no se ha recibido ningún fichero - existe su fichero o es >2GB +non se recibiu ningún ficheiro - existe o seu ficheiro ou é >2GB +non e' stato ricevuto nessun file - il tuo file esiste o e' >2GB +data souboru nebyla přijata - zkontrolujte, zda soubor existuje nebo není větší než 2 GB +pas de donnée reçue - est-ce que votre fichier existe or est-il >2GB + +file size unknown +Dateigröße unbekannt +Koi Ohnung, wie groß dui Datei isch +tamaño del fichero desconocido +tamaño do ficheiro descoñecido +dimensione file sconosciuta +neznámá velikost souboru +taille du fichier inconnue + +file size +Dateigröße +So fett isch des Doil +tamaño del fichero +tamaño do ficheiro +dimensione file +velikost souboru +taille du fichier + +No file selected +Keine Datei ausgewählt +Koi Datei ausgwählt +Ningún archivo seleccionado +No file selected +Nessun file selezionato +Žádný soubor nebyl vybrán +Aucun fichier sélectionné + +no filename?! +Kein Dateiname?! +Koin Dateinome?! +¡¿no hay nombre de fichero?! +non hai nome de ficheiro?! +manca il nome del file ?! +zadali jste název souboru?! +pas de nom de fichier ?! + +transfer is already in progress +ein Transfer läuft gerade +'S isch grad en Transfer am laufe +la transferencia ya está en curso +a transferencia xa está en marcha +il trasferimento e' gia' in corso +přenos již probíhá +le transfert est déjà en cours. + +a download is currently in progress +ein Download läuft gerade +'S wird grad was ronderglade +una descarga está ahora en curso +unha descarga está agora en marcha +un download e' al momento in corso +probíhá stahování +un téléchargement est en cours + +no file data for +Keine Datei-Daten für +Koine Datei-Date fier +no ha fichero para +non hai ficheiro para +nessun file per +žádná data souboru pro +pas de données pour + +File "$filename" copy-forwarded to $to and notified +Datei "$filename" wurde kopiert und an $to weitergeleitet. $to wurde benachrichtigt +Datei "$filename" isch kopiert ond an $to weitergleided worde. $to isch benochrichdigt +Fichero "$filename" copiada reenviada a $to y notificado +Ficheiro "$filename" copiada reenviada a $to e notificada +File "$filename" copia inoltrata a $to e notificata +Soubor "$filename" kopie byla předána na $to a oznamovací e-mail byl odeslán +Le fichier "$filename" a été retransmis à $to et un message a été envoyé + +forward a copy of "$filename" to: +Eine Kopie von "$filename" weiterleiten an: +A Kopie von "$filename" weiterschicke an: +reenviada una copia de "$filename" a: +reenviada unha copia de "$filename" a: +inoltra una copia di "$filename" a: +předat kopii souboru "$filename" na: +Transmettre une copie de "$filename" à: + +F*EX user registration ERROR +F*EX-Benutzer Registrierungsfehler +F*EX-Benutzr Regischdrierongsfehler +ERROR en el registro del usuario F*EX +ERRO no rexistro do usuario F*EX +ERRORE di registrazione utente F*EX +Chyba při registraci F*EX uživatele +ERREUR lors de l'enregistrement de l'utilisateur F*EX + +F*EX user registration +F*EX-Benutzer Registrierung +F*EX-Benutzr Regischdrierong +registro del usuario de F*EX +rexistro do usuario de F*EX +registrazione utente F*EX +registrace F*EX uživatele +Enregistrement d'un utilisateur F*EX + +illegal registration key +Illegaler Registrierungs-Schlüssel +Der Regischdrierongsschlissel gildet net +clave de registro ilegal +chave de rexistro ilegal +chiave di registrazione illegale +neplatný registrační klíč +Clé d'enregistrement illégale + +no registration key +Kein Registrierungs-Schlüssel +Koin Regischdrierongsschlissel +sin clave de registro +sen chave de rexistro +non c'e' la chiave di registrazione +žádný registrační klíč +pas de clé d'enregistrement + +no registration data for key +Keine Registrierungs-Daten für Schlüssel +Koine Regischdrierongsdate fier den Schlissel +no hay datos de registro para la clave +non hai datos de rexistro para a chave +non ci sono dati di registrazione per la chiave +žádná registrační data pro klíč +pas de données d'enregistrement pour la clé + +Your registration was successful. Your new F*EX account is: +Ihre Registrierung war erfolgreich. Ihr neuer F*EX-Account ist: +Du hoschs gschafft. Dein neies F*EX-Konto isch: +Su registro tuvo existo. Su nueva cuenta F*EX es: +O rexistro foi correcto. A súa nova conta F*EX é: +La tua registrazione e' stata eseguita con successo. Il tuo nuovo utente F*EX e': +Registrace proběhla úspěšně. Váš nový F*EX účet je: +Votre enregistrement s'est bien déroulé. Votre nouveau compte F*EX est: + +bookmark this URL +nehmen Sie diese URL in ihre Bookmarks auf +des musch en deine Bookmarks aufnehma +Crear marcador de este URL +engadir este enderezo URL aos marcadores +inserisci questo URL nei preferiti +přidat URL k oblíbeným +sauvegarder cette URL + +or you can use +oder Sie verwenden +oder du nemsch +o puede usar +ou pode utilizar +o puoi usare +nebo můžete +ou vous pouvez utiliser + +Your domain $exd is not allowed for registration +Ihre Domain $exd ist nicht zugelassen für Registrierung +Dei Domain $exd ghod ned for d'Regischtrierong +Su dominio $exd no está permitido a registrar +Your domain $exd is not allowed for registration +Il tuo dominio $exd non è permesso per la registrazione +Registrace z domény $exd není povolena +Votre domaine $exd n'est pas autorisé à l'enregistrement + +Registrations from your host ($ra) are not allowed +Registrierungen von Ihrem Host ($ra) sind nicht erlaubt +Regischdrieronga von Deim Host ($ra) send net geschdaddet +Los registros desde su equipo ($ra) no están permitidos +Os rexistros desde o seu equipo ($ra) non están permitidos +Registrazioni dal tuo host ($ra) non sono permesse +Registrace z vaÅ¡eho počítače ($ra) nejsou povoleny +Les enregistrements à partir de votre poste ($ra) ne sont pas autorisés + +Contact $ENV{SERVER_ADMIN} for details +Kontaktieren Sie $ENV{SERVER_ADMIN} für Details +Wend De an $ENV{SERVER_ADMIN}, wenn De Näheres wisse willsch +Contacte con $ENV{SERVER_ADMIN} para obtner más detalles +Contacte con $ENV{SERVER_ADMIN} para obter más detalles +Contatta $ENV{SERVER_ADMIN} per i dettagli +Pro více informací kontaktujte $ENV{SERVER_ADMIN} +Contacter $ENV{SERVER_ADMIN} pour des détails supplémentaires + +$user is disabled +$user ist gesperrt +$user isch gschperrt +$user está bloqueado +$user is disabled +$user è disabilitato +$user je zakázán +$user est désactivé + +or

    +oder

    +odr

    +o

    +ou

    +o

    +nebo

    +ou

    + +you are already registered +Sie sind bereits registriert +Du bisch doch scho längscht regischdriert +ya está registrado +xa está rexistrado +sei gia' registrato +již jste zaregistrovaní +Vous êtes déjà enregistré + +new user (may send to internal or external users) +neuer Benutzer (darf an interne oder externe Benutzer senden) +neur Benutzr (darf an intern odr extern Benutzr senda) +nuevo usuario (permitido a enviar a usuarios internos o externos) +novo usuario (permitido enviar a usuarios internos ou externos) +nuovo utente (potresti spedire ad utenti interni o esterni) +nový uživatel (může odesílat interním či externím uživatelům) +nouvel utilisateur (peut envoyer à des utilisateurs internes ou externes) + +new external user (may send only to internal users) +neuer externer Benutzer (darf nur an interne Benutzer senden) +neur externer Benutzr (darf bloss an interne Benutzr senda) +nuevo usuario externo (solamente permitido a enviar a usuarios internos) +novo usuario externo (soamente pode enviar a usuarios internos) +nuovo utente esterno (potrebbe spedire solo a utenti interni) +nový externí uživatel (může odesílat pouze interním uživatelům) +nouvel utilisateur externe (peut seulement envoyer à des utilisateurs internes) + +internal domains are +interne Domains sind +interne Domains senn +dominio internos +son dominios internos +domini interni sono +interní domény jsou +les domaines internes sont + +allowed domains are: +zugelassene Domains sind: +die Domains darfsch benutza: +domínios permitidos son: +allowed domains are: +domini consentiti sono: +povolené domény jsou: +les domaines autorisés sont: + +you must enter your e-mail address and +Sie müssen Ihre E-Mail Adresse eingeben +Du musch dei E-Mail Adress ogeba +hace falta introducir su dirección de correo electrónico +debe escribir o seu enderezo de correo electrónico e +devi inserire un indirizzo e-mail e +musíte zadat svou e-mailovou adresu a +vous devez donner votre adresse e-mail et + +your e-mail address +Ihre E-Mail Adresse +dei E-Mail Adress +sú dirección de correo electrónico +o séu enderezo de correo electrónico +il tuo indirizzo e-mail +vaÅ¡e e-mailová adresa +votre adresse e-mail + +F*EX user registration +F*EX-Benutzer Registrierung +F*EX-Benutzrregischdrierong +Registro del usuario de F*EX +Rexistro do usuario de F*EX +Registrazione utente F*EX +Registrace F*EX uživatele +Enregistrement F*EX + +$user has been auto-registrated with +$user wurde auto-registriert mit +$user isch auto-regischdriert worde mit +$user ha sido autoregistrado con +$user foi autorexistrado con +$user e' stato autoregistrato con +$user byl automaticky zaregistrován s +l'utilisateur $user a été automatiquement enregistré avec + +F*EX user registration request +F*EX-Benutzer Registrierungs-Anfrage +F*EX-Benutzrregischdrierongsofrog +Petición de registro de usuario F*EX +Petición de rexistro de usuario F*EX +Richiesta registrazione utente F*EX +Požadavek na zaregistrování F*EX uživatele +Demande d'enregistrement d'utilisateur F*EX + +To activate your new F*EX account go to this URL: +Um Ihren neuen F*EX-Account zu aktivieren oeffnen Sie diese URL: +Om Die neis F*EX-Konto zu aktiviere, gang uff die URL: +Para activar su nueva cuenta en F*EX vaya a esta URL: +Para activar a súa nova conta en F*EX vaia a este URL: +Per attivare il tuo nuovo utente F*EX vai a questo URL: +Pro aktivaci svého nového F*EX účtu přejděte na tuto URL: +Pour activer votre nouveau compte F*EX, rendez vous à cette URL: + +The conditions of usage are: +Die Benutzungsbedingungen sind: +Die Mitmachregla senn: +Los términos de uso son: +The conditions of usage are: +Le condizioni d'uso sono: +Podmínky používání jsou: +Les conditions d'usage sont: + +confirmation e-mail has been sent to $user +Bestätigungs-E-Mail wurde gesendet an Benutzer $user +Beschdädigongs-E-Mail isch gschickt worde an Benutzr $user +Un correo electrónico de confirmación se le ha enviado a $user +Envióuselle un correo electrónico de confirmación a $user +e-mail di conferma e' stata spedita a $user +potvrzovací e-mail byl odeslán uživateli $user +Un message de confirmation a été envoyé à $user + +This is an automatically generated e-mail +Dies ist eine maschinell generierte E-Mail +Des isch a Automata-E-Mail +Este e-mail ha sido generado automaticamente +Este correo foi xerado automaticamente +Questa e' una e-mail generata automaticamente +Toto je automaticky vytvořený e-mail +Ceci est un message généré automatiquement + +Illegal domain for username +Illegale Domain fuuml;r Benutzernamen +Illegale Domain fier de Benutzrnome +Dominio ilegal para el nombre de usuario +O dominio deste nome de usuario é irregular +Dominio illegale per l'utente +Neplatná doména pro uživatelské jméno +Domaine invalide pour l'utilisateur + +is not an email address +ist keine E-Mail-Adresse +isch koi E-Mail-Adress +no es una dirección email +is not an email address +non è un indirizzo e-mail +není e-mailová adresa +n'est pas une adresse électronique + +F*EX redirect ERROR +F*EX Umadressierungs-FEHLER +F*EX Bei der Omadressierong isch was schiefgloffe +ERROR de redirección de F*EX +Produciuse un ERRO de redirección de F*EX +ERRORE di inoltro F*EX +CHYBA při přesměrování F*EX +ERREUR de redirection F*EX + +wrong user or auth-ID +Falscher Benutzer oder falsche auth-ID +Benutzr oddr auth-ID send falsch +usuario o auth-ID erróneo +o usuario ou o auth-ID son incorrectos +utente o auth-ID sbagliato +chybný uživatel nebo ověřovací ID +utilisateur ou auth-ID invalide + +has no no files in spool from you +hat keine Dateien in spool von Ihnen +hat von Dir koine Dateia em spool +no hay ficheros en la cola que haya enviado usted +non hai ficheiros na cola da súa parte +non ci sono file nello spool per te +nemá od vás ve frontě žádné soubory +n'a pas de fichiers venant de vous + +F*EX redirect +F*EX Umadressierung +F*EX Omadressierong +redirección F*EX +redirección F*EX +inoltro F*EX +Přesměrování F*EX +Redirection F*EX + +old (wrong) recipient: +Alter (falscher) Empfänger: +Alder (falscher) Empfängr: +viejo (erróneo) destinatario: +antigo (incorrecto) destinatario: +vecchio (sbagliato) destinatario: +původní (chybný) příjemce: +ancien (invalide) destinataire: + +new recipient: +Neuer Empfänger: +Neier Empfängr: +nuevo destinatario: +novo destinatario: +nuovo destinatario: +nový příjemce: +nouveau destinataire: + +filename: +Dateiname: +Nome von der Datei: +nombre de fichero: +nome de fichero: +nome file: +název souboru: +nom de fichier: + +no upload data found for $file for $oto +Keine bereitgestellen Daten gefunden für $file für $oto +Koine nuffgladene Date gefonde fierr $file fier $oto +no hay datos subidos para $file para $oto +non se cargaron datos de $file para $oto +nessun file di dati da caricare per $file per $oto +u $oto nebyla pro soubor $file nalezena žádná nahraná data +pas de données trouvées pour le fichier $file pour $oto + +notification of file upload \"$filename\" sent to $nto +Benachrichtigung vom Datei-Upload \"$filename\" gesendet an $nto +Benochrichdigong iber die nuffgladene Datei \"$filename\" gschickt an $nto +notificación de las subida del fichero \"$filename\" enviado a $nto +enviada a notificación da carga do ficheiro \"$filename\" enviado a $nto +notifica del file caricato \"$filename\" spedita a $nto +oznámení o nahrání souboru \"$filename\" odesláno na $nto +un message d'information concernant le fichier uploadé \"$filename\" a été envoyé à $nto + +redirect $nto/$from/$fkey failed +Umadressierung $nto/$from/$fkey fehlgeschlagen +Bei dr omadressierung $nto/$from/$fkey isch was schiefgloffe +redirección a $nto/$from/$fkey falló +fallou a redirección a $nto/$from/$fkey +inoltro $nto/$from/$fkey fallito +přesměrování $nto/$from/$fkey selhalo +la redirection vers $nto/$from/$fkey a échouée + +Please avoid download with Internet Explorer, +Falls Sie zum Download Internet Explorer benutzen, koennte es +Falls Du zom Ronderlada Internet Explorer nemmsch, waer's meglich, dass +Por favor, evite usar Internet Explorer para las descargas, +Por favor, evite usar Internet Explorer para as descargas, +Per favore evita di fare il download con Internet Explorer +Nestahujte prosím pomocí prohlížeče Internet Explorer, +Merci d'éviter d'utiliser Internet Explorer, + +because it has too many bugs +unter Umstaenden zu Problemen kommen +Du a Problem hosch +porque tiene demasiados errores +porque ten demasiados defectos +perche' ha troppi bug +protože má příliÅ¡ mnoho chyb +parce qu'il a beaucoup trop de problèmes + +We recommend Firefox or wget +Wir empfehlen Ihnen Firefox oder wget +Nemm lieber Firefox oder wget +Recomendamos Firefox o wget +Recomendámoslle Firefox ou wget +Raccomandiamo di usare Firefox o wget +Doporučujeme použít Firefox či wget +Nous reconmmandons Firefox ou wget + +After download (or view with a web browser!), +Nach Download (oder Ansicht mit dem Web Browser!) +Nachm Ronderlada (oddr wenn Du se mit Deim Webbrowser oguckt hosch!) +Tras la descarga, +Tras a descarga, +Dopo il download (o dopo essere stato visto con un browser WEB!) +Po stažení (či zobrazení v prohlížeči!), +Après le téléchargement (ou visualisation avec un navigateur web) + +the file will be deleted! +wird die Datei geloescht! +wird dui Datei gloescht! +¡el fichero se borrará! +o ficheiro borrarase! +il file sara' cancellato +bude soubor smazán! +le fichier a été effacé ! + +When you download the file it will be deleted +Wenn Sie die Datei herunterladen dann wird diese eine kurze Zeit +Wenn Du die Datei ronderlaedsch, wird se bald drnoch +Cuando descargue el fichero se borrará +Cando descargue o fichero, este borrarase; +Quando scarichi il file sara' cancellato +Jakmile si soubor stáhnete, bude po té +Lorsque vous téléchargez un fichier, celui-ci sera effacé + +soon afterwards! +danach geloescht werden! +gloescht! +en breve! +moi axiña! +poco dopo! +ihned smazán! +dans les instants qui suivent ! + +is a container file +ist ein Container +isch a Schachtel +es un archivo contenedor +é un ficheiro contedor +e' un archivio +je soubor archivu +est une archive + +You can unpack it for example with 7zip +Sie koennen es z.B. mit 7zip oeffnen +Du kosch's z.B. mit 7zip aufmacha +Se puede descompactarlo con 7zip +Pódese descomprimir con 7zip +Puoi decomprimerlo con 7zip +Rozbalit jej můžete pomocí programu 7zip +Vous pourrez l'ouvrir avec 7zip par exemple + +This download link only works for you, you cannot distribute it +Dieser Download Link funktioniert nur fuer Sie, Sie koennen ihn nicht weitergeben +Sell Ronderlad Link isch fei bloss fir Di, du kosch\'n ned weitergaeba +Este hipervínculo funciona solamente para tí, no puedes compartirlo +Esta ligazón de descarga só funciona para vostede, non a difunda +Questo link di download funziona solo per voi, non è possibile distribuire +Odkaz je určen pouze vám, nemůžete jej dále šířit +le lien de téléchargement ne fonctionnera que vous pour vous, vous ne pourrez pas le diffuser + +$receiver = 'you +$receiver = 'Sie +$receiver = 'Di +$receiver = 'usted +$receiver = 'vostede +$receiver = 'te +$receiver = 'vy +$receiver = 'vous + +Comment: +Kommentar: +Kommendar: +Comentario: +Comentario: +Commento: +Komentář: +Commentaire: + +" day" +" Tag" +" Dag" +" día" +" día" +" giorno" +" den" +" jour" + +" days" +" Tagen" +" Dag" +" días" +" días" +" giorni" +" dnů" +" jours" + +> days< +> Tagen< +> Dag< +> días< +> días< +> giorni< +> dnů< +> jours< + +has uploaded the file +hat die Datei +hod dui Datei +ha subido el fichero +cargou o ficheiro +ha caricato il file +nahrál soubor +a uploadé un fichier + +for $receiver. Use +fuer $receiver bereitgestellt. Verwenden Sie die URL +fier $receiver bereitgschdellt. Nemm +para $receiver. Use +para $receiver. Use +per $receiver. Usa +pro $receiver. Stáhnout si jej můžete zde +pour $receiver. Utilisez + +to download this file within $days +um die Datei innerhalb von $days herunterzuladen +damit Du dui Datei ennerhalb von $days ronderlade kosch +para descargar este fichero antes de $days +para descargar este fichero antes de $days +per scaricare questo file entro $days +během $days +pour télécharger ce fichier d'ici $days + +F*EX is not an archive, it is a transfer system for personal files +F*EX ist kein Archiv, sondern ein Dateien-Uebertragungssystem +F*EX isch koi Archiv sondern a Syschtem zom Dateia iebertraga +F*EX no es un archivo, es un sistema personal de transferencia de ficheros +F*EX non é un arquivo, é un sistema persoal de transferencia de ficheiros +F*EX non e' un sistema di archiviazione, e' un sistema personale di trasferimento di file +F*EX není archiv, je to systém pro přenos souborů pro osobní použití +F*EX n'est pas un système d'archivage, c'est un système de transfert de fichiers personnels + +For more information see $index +Weitere Informationen finden Sie unter $index +Gugsch au do: $index +Para más informaciones vir a $index +Para máis información, vexa $index +Per ulteriori informazioni, vedere $index +Pro více informací se podívejte na $index +Voir $index pour plus d'informations + +No notification e-mail has been sent to $to +Es wurde keine Benachrichtigungs-E-Mail an $to verschickt +$to isch ned benochritigt worda +No se ha enviado ningún correo electrónico de notificación a $to +No notification e-mail has been sent to $to +Nessuna e-mail di notifica è stata inviata a $to +Žádný e-mail s oznámením nebyl $to odeslán +Aucun email de notification n'a été envoyé à $to + +Ehh... $ndata BYTES?! You are kidding +Moment... $ndata BYTES?! Das ist wohl ein Witz +Moment amole $ndata BYTES?! Wilsch me verarsche +Un momento... ¡¿$ndata BYTES?! Está bromeando +Un intreo... BYTES?! Está de broma +Ehh... $ndata BYTES?! Stai scherzando +Moment... $ndata BYTÅ®?! Děláte si legraci +Eh... $ndata BYTES?! Vous rigolez + +Using F*EX for less than +Verwendung von F*EX für weniger als +Du nemsch F*EX fir wenigr als +Usar F*EX por menos de +Usar F*EX para menos de +Usare F*EX per meno di +Používat F*EX pro tak malý soubor +Utiliser F*EX pour moins de + +ever heard of MIME e-mail +Schon mal was von MIME E-Mail gehört +Hosch scho mol was von MIME E-Mail ghört +ha oído hablar del correo electrónico MIME +non lle será mellor usar o correo electrónico MIME? +mai sentito parlare delle e-mail MIME +určitě jste někdy slyÅ¡eli o e-mailu +Vous avez déja entendu parlé de l'e-mail + +received and saved +empfangen und abgespeichert +empfanga ond abgschpeichert +recibido y guardado +recibido e gardado +ricevuto e salvato +přijato a uloženo +reçu et sauvegardé + +Download URL for copy & paste +Download URL zum Kopieren +Nonderlad URL zom Kopiera +URL de descarga para copiar y pegar +Descargar o URL para copiar e pegar +Scarica l'URL per il copia ed incolla +URL pro stažení okopírovat a vložit +URL de téléchargement pour copier/coller + +Link is valid for $keep{$to} days +Dieser Link ist für $keep{$to} Tage gültig +Sell Link isch fir $keep{$to} Dag giltig +El enlace es válido durante $keep{$to} días +A ligazón é válida durante $keep{$to} días +Il link è valido per $keep{$to} giorni +Odkaz je platný $keep{$to} dny(ů) +Le lien restera valide $keep{$to} jours + +old $file for $to overwritten +vorhandenes $file für $to überschrieben +alts $file fir $to iberschrieba +El anterior $file para $to se ha sobreescrito +Sobrescribiuse o anterior $file para $to +vecchio file $file per $to sovrascritto +původní soubor $file pro $to byl nahrazen +$file pour $to reécrit. + +$to notified +$to benachrichtigt +$to bscheid gsagt +$to ha sido notificado +$to foi notificado +$to notificato +$to byl informován +$to prévenu + +$file removed because you are a restricted user +$file wurde gelöscht weil Sie ein eingeschränkter Benutzer sind +$file isch wieder glöscht worda weil du a bschränkter Benutzer bisch +$file se ha borrado porque usted es un usuario restringido +$file removed because you are a restricted user +$file rimosso perchè sei un utente limitato +$file odstraněn, protože jste uživatel s omezením +$file supprimé car vous êtes un utilisateur restreint + +and recipient $to cannot receive e-mail +und Empfänger $to keine E-Mail empfangen kann +ond Empfängr $to ko koi E-Mail empfanga +y el destinatario $to no puede recibir correos electrónicos +and recipient $to cannot receive e-mail +ed il destinatario $to non può ricevere e-mail +a příjemce $to nemůže přijímat poÅ¡tu +et le destinataire $to ne peut pas recevoir d'email + +send another file +eine weitere Datei schicken +a weitere Datei schicka +enviar otro fichero +enviar outro fichero +spedire un altro file +odeslat další soubor +envoyer un autre fichier + +Upload Status for +Upload Status für +Nufflad Schtatus fier +Estado del proceso de subida para +Estado do proceso de carga de +Stato del processo di caricamento per +Stav nahrávání pro +Status d'upload pour + +file successfully transferred +Datei erfolgreich übertragen +Datei nufflada hot klappt +fichero transferido con &ecaute;xito +o ficheiro transferiuse correctamente +file trasferito con successo +soubor byl úspěšně přenesen +fichier transféré avec succès + +>close< +>schließen< +>fertig< +>cerrar< +>cerrar< +>chiudi< +>zavřít< +>fermer< + +"upload" +"upload" +"nufflada" +"subir" +"cargar" +"caricamento" +"nahrát" +"upload" + +value="logout" +value="logout" +value="adele" +value="salir" +value="saír" +value="uscita" +value="odhlásit" +value="déconnexion" + +Using Microsoft Internet Explorer for download will probably +Die Verwendung von Microsoft Internet Explorer für den Download wird wahrscheinlich +Des Verwenda vom Microsoft Internet Explorer fier dr Download wird wahrscheinlich +Usar Microsoft Internet Explorer para realizar las descargas probablemente +Usar Microsoft Internet Explorer para realizar as descargas probablemente +Usare Microsoft Internet Explorer per il download probabilmente +Používání aplikace Microsoft Internet Explorer pro stahování pravděpodobně +Utiliser Microsoft Internet Explorer pour le téléchargement + +lead to problems, because it is not Internet compatible (RFC 2616) +zu Problemen führen, weil er nicht Internet kompatibel (RFC 2616) ist +zu Problem fiehra, weil der hald ned Internet kompatibel (RFC 2616) isch +le puede dar problemas, porque no es compatible con el estándar de Internet (RFC 2616) +traerá problemas porque non é compatíbel co estándar de Internet (RFC 2616) +genera problemi in quanto non e' compatibile con Internet (RFC 2616) +povede k problémům, protože není Internetově kompatibilní (RFC 2616) +entraînera probablement des problèmes, parce qu'il n'est pas compatible avec Internet (RFC 2616) + +We recommend +Wir empfehlen +Mir empfehlad +Recomendamos +Recomendámoslle +Si raccomanda +Doporučujeme +Nous recommandons + +WARNING: +WARNUNG: +OBACHT: +ADVERTIMIENTO: +ATENCIÓN: +ATTENZIONE: +UPOZORNĚNÍ: +ATTENTION: + +If you really want to continue with Internet Explorer, then +Wenn Sie wirklich mit Internet Explorer weitermachen wollen, dann +Wenn wirklich mitm Internet Explorer weiterwurschtla wilsch, no +Si de verdad quiere continuar con Internet Explorer, +Si de todas maneiras quere continuar co Internet Explorer, +Se vuoi davvero continuare con Internet Explorer allora, +Chcete-li skutečně pokračovat s aplikací Internet Explorer, potom +Si vous souhaitez vraiment continuer avec Internet Explorer, alors + +click here with your right mouse button and select "save as" +klicken Sie hier mit der rechten Maustaste und wählen Sie an "speichern unter" +klicksch hier mit dr rechta Maustascht ond wählsch "speichern unter" aus +pulse aquí con el botón derecho del ratón y seleccione "guardar como" +prema aquí co botón dereito do ratón e seleccione "gardar como" +cliccare qui con il tasto destro del mouse e selezionare "salva come" +zde klikněte pravým tlačítkem myÅ¡i a vyberte "Uložit jako" +cliquez ici avec le bouton droit de la souris et sélectionner "save as" + +Meta questions +Meta Fragen +Meta Froga +Meta Preguntas +Meta Preguntas +Meta Domande +VÅ¡eobecné Máte otázky +Questions générales + +User questions +Benutzer Fragen +Benutzr Froga +Usario Preguntas +Usuario Preguntas +Utente Domande +Uživatel Máte otázky +Questions utilisateurs + +Admin questions +Administratoren Fragen +Adminischdrator Froga +Admin Preguntas +Admin Preguntas +Amministratore Domande +Správce Máte otázky +Questions administrateur + +Misc questions +Sonstige Fragen +Vermischte Froga +Misc Preguntas +Misc Preguntas +Misc Domande +Misc Máte otázky +Questions diverses + +Your F*EX account has been inactive for $expire days +Ihr F*EX Account ist seit $expire Tagen inaktiv +Du hosch dei F*EX Konto seit $expire Tag nemme bnutzt +Su cuenta de F*EX ha estado inactivo $expire dias +A súa conta F*EX estivo inactiva durante $expire día +Il tuo account F*EX è stato inattivo per $expire giorni +Váš F*EX účet byl neaktivní $expire dnů +Votre compte F*EX a été inactif pendant $expire days + +you must download this file to reactivate it +Sie muessen diese Datei herunterladen um ihn zu reaktivieren +Du musch sell Datei ronderlada drmit weiter mitmacha derfsch +hace falta descargar este fichero para reactivarla +debe descargar este ficheiro para reactivala +devi scaricare questo file per riattivarlo +pro jeho opětovnou aktivaci si musíte stáhnout tento soubor +vous devez télécharger ce fichier pour le réactiver + +Otherwise your account will be deleted +Ansonsten wird Ihr Account geloescht +Ansoschda bisch den Account los +De lo contrario, su cuenta será eliminada +Otherwise your account will be deleted +Altrimenti il tuo account verrà eliminato +Jinak bude váš účet smazán +Sinon votre compte sera supprimé + +Account created: +Account angelegt: +Konto oglegt: +Cuenta creada: +Account created: +Account creato: +Účet vytvořen: +Compte créé: + +(De)activate e-mail encryption +E-Mail Verschlüsselung (de)aktivieren +E-Mail Verschlüsslong (de)aktiviera +(Des)activar codificación de email +(De)activate e-mail encryption +(Dis)attiva la crittografia delle e-mail +Deaktivovat Å¡ifrování poÅ¡ty +(Dés)activer le chiffrement des emails + +PGP/GPG key deleted +PGP/GPG key gelöscht +PGP/GPG key glöscht +Código PGP/GPG borrado +PGP/GPG key deleted +PGP/GPG chiave cancellata +PGP/GPG klíč byl smazán +Clé PGP/GPG supprimé + +E-mails to you will be sent not encrypted +E-Mails an Sie werden nun unverschlüsslt verschickt +Du kriegsch E-Mails jetzt overschlüsslt +Emails para usted son enviados no codificado a partir de ahora +E-mails to you will be sent not encrypted +E-mail verso di te saranno spedite non crittografate +Zprávy vám budou odesílány v neÅ¡ifrované podobě +Les emails que vous recevrez ne seront pas chiffrés + +E-mails to you will be encrypted with the PGP/GPG key: +E-Mails an Sie werden nun verschlüsslt mit dem PGP/GPG key: +Du kriegsch E-Mails jetzt verschlüsslt mit dem PGP/GPG key: +Emails para usted son enviados codificado por código PGP/GPG: +E-mails to you will be encrypted with the PGP/GPG key: +E-mail verso di te saranno crittografate con una chiave PGP/GPG: +Zprávy vám budou odesílány Å¡ifrované s PGP/GPG klíčem: +Les emails que vous recevrez seront chiffrés avec la clé PGP/GPG: + +Your uploaded file does not contain a PGP/GPG public key for +Die hochgeladene Datei enthält keinen PGP/GPG public key für +En der nuffgladana Datei isch koi PGP/GPG public key fir +El archivo cargado no contiene ningún código PGP/GPG público +Your uploaded file does not contain a PGP/GPG public key for +Il tuo file caricato non contiene una chiave pubblica PGP/GPG per +Nahraný soubor neobsahuje veřejný PGP/GPG klíč pro +Votre fichier uploadé ne contient pas de clé publique PGP/GPG pour + +Select your PGP/GPG public key file +Wählen Sie Ihre PGP/GPG public key Datei aus +Wähl Dei PGP/GPG public key Datei aus +Elija su archivo con el código público +Select your PGP/GPG public key file +Seleziona il tuo file della chiave pubblica PGP/GPG +Vyberte soubor s PGP/GPG veřejným klíčem +Sélectionnez le fichier contenant votre clé publique PGP/GPG + +delete your already uploaded public key +löschen Sie Ihren abgelegten public key +lösch Dein abglegta public key +borre su código público guardado +delete your already uploaded public key +cancella la tua chiave pubblica già caricata +smazat předchozí nahraný veřejný klíč +suprrimer votre clé publique déjà uploadée + +To extract and verify your GPG public key use: +Um Ihren GPG public key zu extrahieren und verifizieren benutzen Sie: +Om dein GPG public key zom extrahiera ond nochgucka nemsch am beschta: +Para extraer y verificar su código publico use: +To extract and verify your GPG public key use: +Per estrarre e verificare la tua chiave pubblica GPG usa: +K rozbalení a ověření svého PGP/GPG veřejného klíče použijte: +Pour extraire et vérifier votre clé publique GPG, utilisez: + +ERROR: no upload received +FEHLER: es wurde kein Upload empfangen +FEHLER: do isch fei nix okomma +ERROR: ningún subir recibido +ERROR: no upload received +ERRORE: nessun caricamento ricevuto +CHYBA: žádný soubor nebyl nahrán +ERREUR: aucun upload reçu + +You cannot send to more than one group +Sie können nicht an mehrere Gruppen senden +Du kansch net an mehrere Gruppa senda +No puede enviar a varios grupos +You cannot send to more than one group +Non puoi spedire a più di un gruppo +Nemůžete odesílat více než jedné skupině +Vous ne pouvez pas envoyer à plus d'un groupe + +file transfer aborted +Dateitransfer abgebrochen +Dateitransfer abbrocha +Trasmisión del archivo aborto +file transfer aborted +trasferimento file interrotto +přenos souboru přeruÅ¡en +transfert de fichier abandonné + +$from is not allowed to upload from IP $ra +$from darf nicht von IP-Adresse $ra hochladen +$from darf ned von IP-Adress $ra hochlada +$from no está permitido a subir de esta dirección IP $ra +$from is not allowed to upload from IP $ra +$from non è consentito caricarlo da IP $ra +$from z IP adresy $ra není dovoleno nahrávat soubory +$from n'est pas autorisé à uploader vers l'IP $ra + +Group $to does not exist +Gruppe $to existiert nicht +Grupp $to gibts net +Grupo $to no existe +Group $to does not exist +Il gruppo $to non esiste +Skupina $to neexistuje +Le groupe $to n'existe pas + +server runs in NOMAIL mode - groups ($to) are not allowed +Server läuft im NOMAIL Modus - Gruppen ($to) sind nicht erlaubt +Server läuft em NOMAIL Modus - Gruppa ($to) senn net erlaubt +Servidor está en modo NOMAIL - grupos ($to) no están permitidos +server runs in NOMAIL mode - groups ($to) are not allowed +server eseguto in modalità NOMAIL - i gruppi ($to) non sono permessi +Server běží v režimu NOMAIL - skupiny ($to) nejsou povoleny +Le serveur tourne en mode NOMAIL - les groupes ($to) ne sont pas autorisés + +File not found +Datei nicht gefunden +Datei net gfonda +Archivo no encontrado +File not found +File non trovato +Soubor nenalezen +Fichier introuvable + +$to is not a valid recipient +$to ist kein gültiger Empfänger +$to isch koi gültigr Empfängr +$to no es un destinario válido +$to is not a valid recipient +$to non è un destinatario valido +$to není platný příjemce +$to n'est pas un destinataire valide + +File $file already exists in your outgoing spool +Datei $file existiert bereits im ausgehenden Spool +Datei $file gibts fei scho em nausganganda Spool +Archivo $file ya existe en sú spool saliente +File $file already exists in your outgoing spool +Il file $file esiste già nel tuo spool in uscita +Soubor $file se již ve frontě k odeslání nachází +Le fichier $file exite déjà dans votre spool sortant diff --git a/upgrade b/upgrade new file mode 120000 index 0000000..f7ffc47 --- /dev/null +++ b/upgrade @@ -0,0 +1 @@ +install \ No newline at end of file -- 2.39.2