Path: | flashpolicyd.rb |
Last Update: | Wed Oct 07 21:43:09 +0100 2009 |
flashpolicyd: Serve Adobe Flash Policy XML files to clients
Server to serve up flash policy xml files for flash clients since player version 9,0,124,0. (Player 9 update 3)
See www.adobe.com/devnet/flashplayer/articles/fplayer9_security_04.html for more information, this needs to run as root since it should listen on port 843 which on a unix machine needs root to listen on that socket.
flashpolicyd [OPTIONS]
—help, -h:
Show Help
—verbose
Turns on verbose logging to log file - can also be turned on and off at runtime using -HUP signals
—xml
XML File to Serve to clients, read at startup only
—timeout, -t
If a request does not complete within this time, close the socket, default is 10 seconds
—logfreq, -l
How often to log stats to log file, default 1800 seconds
—logfile
Where to write log lines too
Latest versions, installation documentation and other related info can be found at www.devco.net/pubwiki/FlashPolicyd
R.I.Pienaar <rip@devco.net>
Goes into the background, chdir‘s to /tmp, and redirect all input/output to null Beginning Ruby p. 489-490
# File flashpolicyd.rb, line 353 353: def daemonize 354: fork do 355: Process.setsid 356: exit if fork 357: Dir.chdir('/tmp') 358: STDIN.reopen('/dev/null') 359: STDOUT.reopen('/dev/null', 'a') 360: STDERR.reopen('/dev/null', 'a') 361: 362: trap("TERM") { 363: @logger.debug("Caught TERM signal") 364: exit 365: } 366: yield 367: end 368: end
Returns an array of days, hrs, mins and seconds given a second figure The Ruby Way - Page 227
# File flashpolicyd.rb, line 372 372: def sec2dhms(secs) 373: time = secs.round 374: sec = time % 60 375: time /= 60 376: 377: mins = time % 60 378: time /= 60 379: 380: hrs = time % 24 381: time /= 24 382: 383: days = time 384: [days, hrs, mins, sec] 385: end