Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package ifetch-tools The package uploaded to unstable closes several bugs and brings to good state for users and release. Below is the bug information: Serious (policy violations or makes package unfit for release) (2 bugs) #779532 [S| |âº] [ifetch-tools] ifetch-tools: superclass mismatch for class Monitor (TypeError) #779614 [S| |âº] [ifetch-tools] ifetch-tools: Possible tmpfile symlink attacks because of deterministic filenames in /tmp Important bugs (1 bug) #779539 [i| |âº] [ifetch-tools] ifetch-tools: Upon shutdown request camera collection does not stop. Normal bugs (2 bugs) #779536 [n| |âº] [ifetch-tools] ifetch-tools: Closing to many file descriptors in wwwifetch. #779538 [n| |âº] [ifetch-tools] ifetch-tools: Video export choppy with mpeg. Minor bugs (1 bug) #779537 [m| |âº] [ifetch-tools] ifetch-tools: Incorrect Upstream-Homepage Below is the debian/changelog: ifetch-tools (0.15.24d2-1) unstable; urgency=medium * Closing only stdin, stdout and stderr 0,1,2 on IO.for_fd() on wwwifetch (Closes: #779536). * Adjust class Monitor name to CMonitor in wwwifetch (Closes: #779532). * Adjusting VER for next release on wwwifetch. * Update copyright from 2005-2012 to 2005-2015. * Adjust Upstream-Homepage in debian/copyright (Closes: #779537). * Remove trailing whitespace on wwwifetch. * Remove unused array call in wwwifetch. * Upon a shutdown request stop camera collection as well in wwwifetch (Closes: #779539). * Minor adjustment for stop_all_cameras in wwwifetch. * Moving video export format from mpeg to mp4 in wwwifetch (Closes: #779538). * Renamed ifetch-tools.rubyforge.org ifetch-tools-html-page. * Updated url in ifetch-tools-html-pages/index.html. * Unify version number for VER in ifetch and wwwifetch for service release. * Improved video export for security of a more non deterministic structure on wwwifetch (Closes: #779614). Below is the debdiff between versions: debdiff ifetch-tools_0.15.24d-1.dsc ifetch-tools_0.15.24d2-1.dsc diff -Nru ifetch-tools-0.15.24d/changelog ifetch-tools-0.15.24d2/changelog --- ifetch-tools-0.15.24d/changelog 2014-11-03 12:50:24.000000000 -0600 +++ ifetch-tools-0.15.24d2/changelog 2015-03-02 09:57:11.000000000 -0600 @@ -1,7 +1,7 @@ #################################################################################### # ifetch-tools is a set of tools that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/debian/changelog ifetch-tools-0.15.24d2/debian/changelog --- ifetch-tools-0.15.24d/debian/changelog 2014-11-03 13:14:08.000000000 -0600 +++ ifetch-tools-0.15.24d2/debian/changelog 2015-03-02 22:38:48.000000000 -0600 @@ -1,3 +1,25 @@ +ifetch-tools (0.15.24d2-1) unstable; urgency=medium + + * Closing only stdin, stdout and stderr 0,1,2 on IO.for_fd() on + wwwifetch (Closes: #779536). + * Adjust class Monitor name to CMonitor in wwwifetch (Closes: #779532). + * Adjusting VER for next release on wwwifetch. + * Update copyright from 2005-2012 to 2005-2015. + * Adjust Upstream-Homepage in debian/copyright (Closes: #779537). + * Remove trailing whitespace on wwwifetch. + * Remove unused array call in wwwifetch. + * Upon a shutdown request stop camera collection as well in + wwwifetch (Closes: #779539). + * Minor adjustment for stop_all_cameras in wwwifetch. + * Moving video export format from mpeg to mp4 in wwwifetch (Closes: #779538). + * Renamed ifetch-tools.rubyforge.org ifetch-tools-html-page. + * Updated url in ifetch-tools-html-pages/index.html. + * Unify version number for VER in ifetch and wwwifetch for service release. + * Improved video export for security of a more non deterministic structure + on wwwifetch (Closes: #779614). + + -- Richard Nelson <unix...@gmail.com> Mon, 02 Mar 2015 22:18:41 -0600 + ifetch-tools (0.15.24d-1) unstable; urgency=low * Updating to standards version 3.9.6. diff -Nru ifetch-tools-0.15.24d/debian/copyright ifetch-tools-0.15.24d2/debian/copyright --- ifetch-tools-0.15.24d/debian/copyright 2012-04-14 16:07:53.000000000 -0500 +++ ifetch-tools-0.15.24d2/debian/copyright 2015-03-02 09:57:11.000000000 -0600 @@ -1,8 +1,8 @@ Upstream-Contact: Richard Nelson <unix...@gmail.com> -Upstream-Homepage: http://ifetch-tools.rubyforge.org/ +Upstream-Homepage: http://fyeox.com/ifetch-tools/ Files: * -Copyright: (C) 2005-2012 Richard Nelson <unix...@gmail.com> +Copyright: (C) 2005-2015 Richard Nelson <unix...@gmail.com> License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/examples/cameras/camera_number.conf ifetch-tools-0.15.24d2/examples/cameras/camera_number.conf --- ifetch-tools-0.15.24d/examples/cameras/camera_number.conf 2013-04-16 20:24:12.000000000 -0500 +++ ifetch-tools-0.15.24d2/examples/cameras/camera_number.conf 2015-03-02 09:57:11.000000000 -0600 @@ -1,7 +1,7 @@ ##################################################################################### # ifetch-tools is a set of tools that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/examples/ifetch-tools.conf ifetch-tools-0.15.24d2/examples/ifetch-tools.conf --- ifetch-tools-0.15.24d/examples/ifetch-tools.conf 2013-04-16 20:23:50.000000000 -0500 +++ ifetch-tools-0.15.24d2/examples/ifetch-tools.conf 2015-03-02 09:57:11.000000000 -0600 @@ -1,7 +1,7 @@ ##################################################################################### # ifetch-tools is a set of tools that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/htdocs/index.html ifetch-tools-0.15.24d2/htdocs/index.html --- ifetch-tools-0.15.24d/htdocs/index.html 2012-04-14 16:07:53.000000000 -0500 +++ ifetch-tools-0.15.24d2/htdocs/index.html 2015-03-02 09:57:11.000000000 -0600 @@ -9,7 +9,7 @@ #################################################################################### <BR># ifetch-tools is a set of tools that can collect images from ip based cameras, <BR># monitor collection process, and provide an interface to view collected history. -<BR># Copyright (C) 2005-2012 Richard Nelson +<BR># Copyright (C) 2005-2015 Richard Nelson <BR># <BR># This program is free software; you can redistribute it and/or <BR># modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/ifetch ifetch-tools-0.15.24d2/ifetch --- ifetch-tools-0.15.24d/ifetch 2013-11-11 10:33:51.000000000 -0600 +++ ifetch-tools-0.15.24d2/ifetch 2015-03-02 22:36:35.000000000 -0600 @@ -3,7 +3,7 @@ #################################################################################### # ifetch-tools is a set of tools in ruby that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,7 +22,7 @@ ############################################################################################## # Set the current version information. ############################################################################################## -VER = "0.15.24c" +VER = "0.15.24d2" ############################################################################################## # The below should daemonize this code. Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools-html-page/green.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools-html-page/green.jpg differ Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools-html-page/grey.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools-html-page/grey.jpg differ Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools-html-page/ifetch.png and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools-html-page/ifetch.png differ diff -Nru ifetch-tools-0.15.24d/ifetch-tools-html-page/index.html ifetch-tools-0.15.24d2/ifetch-tools-html-page/index.html --- ifetch-tools-0.15.24d/ifetch-tools-html-page/index.html 1969-12-31 18:00:00.000000000 -0600 +++ ifetch-tools-0.15.24d2/ifetch-tools-html-page/index.html 2015-03-02 09:57:11.000000000 -0600 @@ -0,0 +1,113 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> + +<head> + <title>ifetch tools</title> + <meta name="GENERATOR" content="Quanta Plus"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body> +<!--Start the description--> +<TABLE> + <TD> + <IMG src="ifetch.png" border="0"> + </TD> + <TD> + <strong>ifetch-tools </strong>- A set of tools that can +collect images from ip based cameras, monitor collection process, and provide an interface to view collected history. + The current release has two components: + <br><br> + 1.) ifetch.rb - A console tool written in ruby to collect images from ip based cameras with a conf file per camera. + <br><br> + 2.) wwwifetch.rb - A ruby servlet to view collected history from a camera and monitor the collection status of each camera. The following feedback is provided on each cameras collection status: + <br> + <br><IMG src="green.jpg" border="0"> - all well + <br><IMG src="red.jpg" border="0"> - collection in alarm mode + <br><IMG src="grey.jpg" border="0"> - collection is offline + + </TD> +</TABLE> +<HR> +<P>Cameras <b>donated/tested</b> for the project will be graded in to three categories as follows: Excellent, Average, Other. +<br> +<table border="1"> + <tr> + <td><center>Manufacturer</center></td> + <td><center>Rating</center></td> + <td><center>Model</center></td> + <td><center>Comments</center></td> + <tr> + <td><center><A href="//www.apexis.com.cn/">Apexis</A></center></td> + <td>Excellent</td> + <td>APM-J011-WS</td> + <td>Works out of the box. Camera web interface can now be utilized with Linux+Firefox so upgrading rating to Excellent.</td> + </tr> + <tr> + <td><center><A href="http://www.axis.com/">Axis</A></center></td> + <td>Excellent</td> + <td>2100, 210, 206, 207, 221</td> + <td>Easy to work with out of the box, excellent frame rates, and tech support is very good.</td> + </tr> + <tr> + <td><center><A href="http://www.dlink.com/">D-Link</A></center></td> + <td>Excellent</td> + <td>D-Link DCS-930L</td> + <td>Easy to work with out of the box and inexpensive.</td> + </tr> + <tr> + <td><center><A href="http://www.hawkingtech.com/">Hawking</A></center></td> + <td>Average</td> + <td>HNC320W</td> + <td>Works out of the box, inexpensive and sturdy. I only have a HNC320W wireless unit to test.</td> + </tr> + <tr> + <td><center><A href="http://www.iguard.com/">IGuard</A></center></td> + <td>Other</td> + <td>IP-250E</td> + <td>Low fps on jpeg pull. About 1 frame every 2 or 3 seconds.</td> + </tr> + <tr> + <td><center>IP Camera</center></td> + <td>Average</td> + <td>510</td> + <td>Works out of the box, inexpensive and sturdy.</td> + </tr> + <tr> + <td><center><A href="http://www.plustek.com/">Plustek</A></center></td> + <td>Average</td> + <td>IPcam P1000</td> + <td>Works out of the box, web interface, dome model, and tech support is very good. Camera expects to have IE for web browser and general access.</td> + </tr> + <tr> + <td><center><A href="http://www.panasonic.net">Panasonic</A></center></td> + <td>Excellent</td> + <td>BL-C210A</td> + <td>Works out of the box, inexpensive and sturdy.</td> + </tr> + <tr> + <td><center><A href="http://www.trendnet.com/">Trendnet</A></center></td> + <td>Average</td> + <td>TV-IP201(P), TV-IP301, TV-IP512(P)</td> + <td>Works out of the box, inexpensive and sturdy. Takes cctv lenses. * On the TV-IP201(P) can get duplicate frames on short padded jpeg pulls.</td> + </tr> + <tr> + <td><center><A href="http://www.toshiba.com">Toshiba</A></center></td> + <td>Average</td> + <td>IK-WR01A Orite IC301</td> + <td>Works out of the box, tested for a user.</td> + </tr> + <tr> + <td><center><A href="http://www.wanscam.com">Wanscam</A></center></td> + <td>Excellent</td> + <td>IP Camera</td> + <td>Works out of the box, inexpensive and sturdy.</td> + </tr> +</table> +<br> +<b>If you do not like the above opinions please email me for information to send a unit you want me to test.</b> +<p>Current release - <strong>0.15.24d</strong></p> + +<p>Also see <A href="http://www.fyeox.com">FYEOX.COM</A> for other ifetch-tools related information. +<p>Last updated on 20150218</p> +</body> +</html> Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools-html-page/red.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools-html-page/red.jpg differ Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/green.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/green.jpg differ Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/grey.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/grey.jpg differ Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/ifetch.png and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/ifetch.png differ diff -Nru ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/index.html ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/index.html --- ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/index.html 2014-11-03 12:48:16.000000000 -0600 +++ ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/index.html 1969-12-31 18:00:00.000000000 -0600 @@ -1,113 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> - -<head> - <title>ifetch tools</title> - <meta name="GENERATOR" content="Quanta Plus"> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -</head> -<body> -<!--Start the description--> -<TABLE> - <TD> - <IMG src="ifetch.png" border="0"> - </TD> - <TD> - <strong>ifetch-tools </strong>- A set of tools that can -collect images from ip based cameras, monitor collection process, and provide an interface to view collected history. - The current release has two components: - <br><br> - 1.) ifetch.rb - A console tool written in ruby to collect images from ip based cameras with a conf file per camera. - <br><br> - 2.) wwwifetch.rb - A ruby servlet to view collected history from a camera and monitor the collection status of each camera. The following feedback is provided on each cameras collection status: - <br> - <br><IMG src="green.jpg" border="0"> - all well - <br><IMG src="red.jpg" border="0"> - collection in alarm mode - <br><IMG src="grey.jpg" border="0"> - collection is offline - - </TD> -</TABLE> -<HR> -<P>Cameras <b>donated/tested</b> for the project will be graded in to three categories as follows: Excellent, Average, Other. -<br> -<table border="1"> - <tr> - <td><center>Manufacturer</center></td> - <td><center>Rating</center></td> - <td><center>Model</center></td> - <td><center>Comments</center></td> - <tr> - <td><center><A href="//www.apexis.com.cn/">Apexis</A></center></td> - <td>Excellent</td> - <td>APM-J011-WS</td> - <td>Works out of the box. Camera web interface can now be utilized with Linux+Firefox so upgrading rating to Excellent.</td> - </tr> - <tr> - <td><center><A href="http://www.axis.com/">Axis</A></center></td> - <td>Excellent</td> - <td>2100, 210, 206, 207, 221</td> - <td>Easy to work with out of the box, excellent frame rates, and tech support is very good.</td> - </tr> - <tr> - <td><center><A href="http://www.dlink.com/">D-Link</A></center></td> - <td>Excellent</td> - <td>D-Link DCS-930L</td> - <td>Easy to work with out of the box and inexpensive.</td> - </tr> - <tr> - <td><center><A href="http://www.hawkingtech.com/">Hawking</A></center></td> - <td>Average</td> - <td>HNC320W</td> - <td>Works out of the box, inexpensive and sturdy. I only have a HNC320W wireless unit to test.</td> - </tr> - <tr> - <td><center><A href="http://www.iguard.com/">IGuard</A></center></td> - <td>Other</td> - <td>IP-250E</td> - <td>Low fps on jpeg pull. About 1 frame every 2 or 3 seconds.</td> - </tr> - <tr> - <td><center>IP Camera</center></td> - <td>Average</td> - <td>510</td> - <td>Works out of the box, inexpensive and sturdy.</td> - </tr> - <tr> - <td><center><A href="http://www.plustek.com/">Plustek</A></center></td> - <td>Average</td> - <td>IPcam P1000</td> - <td>Works out of the box, web interface, dome model, and tech support is very good. Camera expects to have IE for web browser and general access.</td> - </tr> - <tr> - <td><center><A href="http://www.panasonic.net">Panasonic</A></center></td> - <td>Excellent</td> - <td>BL-C210A</td> - <td>Works out of the box, inexpensive and sturdy.</td> - </tr> - <tr> - <td><center><A href="http://www.trendnet.com/">Trendnet</A></center></td> - <td>Average</td> - <td>TV-IP201(P), TV-IP301, TV-IP512(P)</td> - <td>Works out of the box, inexpensive and sturdy. Takes cctv lenses. * On the TV-IP201(P) can get duplicate frames on short padded jpeg pulls.</td> - </tr> - <tr> - <td><center><A href="http://www.toshiba.com">Toshiba</A></center></td> - <td>Average</td> - <td>IK-WR01A Orite IC301</td> - <td>Works out of the box, tested for a user.</td> - </tr> - <tr> - <td><center><A href="http://www.wanscam.com">Wanscam</A></center></td> - <td>Excellent</td> - <td>IP Camera</td> - <td>Works out of the box, inexpensive and sturdy.</td> - </tr> -</table> -<br> -<b>If you do not like the above opinions please email me for information to send a unit you want me to test.</b> -<p>Current release - <strong>0.15.24d</strong></p> - -<p>Also see <A href="http://www.fyeox.com/linux">FYEOX.COM</A> for other ifetch-tools related information. -<p>Last updated on 20141103</p> -</body> -</html> Binary files /tmp/CBLuIbLZSa/ifetch-tools-0.15.24d/ifetch-tools.rubyforge.org/red.jpg and /tmp/q0WA10Ihb2/ifetch-tools-0.15.24d2/ifetch-tools.rubyforge.org/red.jpg differ diff -Nru ifetch-tools-0.15.24d/README.txt ifetch-tools-0.15.24d2/README.txt --- ifetch-tools-0.15.24d/README.txt 2012-04-14 16:07:53.000000000 -0500 +++ ifetch-tools-0.15.24d2/README.txt 2015-03-02 09:57:11.000000000 -0600 @@ -1,7 +1,7 @@ #################################################################################### # ifetch-tools is a set of tools that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ifetch-tools-0.15.24d/wwwifetch ifetch-tools-0.15.24d2/wwwifetch --- ifetch-tools-0.15.24d/wwwifetch 2013-11-22 09:26:28.000000000 -0600 +++ ifetch-tools-0.15.24d2/wwwifetch 2015-03-02 22:36:45.000000000 -0600 @@ -3,7 +3,7 @@ ##################################################################################### # ifetch-tools is a set of tools that can collect images from ip based cameras, # monitor collection process, and provide an interface to view collected history. -# Copyright (C) 2005-2012 Richard Nelson +# Copyright (C) 2005-2015 Richard Nelson # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,7 +23,7 @@ # Set some variables. ############################################################################################## # Version number -VER = "0.15.24c" +VER = "0.15.24d2" ############################################################################################## # Do the require and include stuff we need for our operations. @@ -96,7 +96,7 @@ # basicView is for the Basic Archive View. raise HTTPServerError, 'Error: basicView parameter not passed correctly.' if req.query['basicView'] == nil || /[0-2]/.match(req.query['basicView']) == nil - basicView = /[0-2]/.match(req.query['basicView']).to_s + basicView = /[0-2]/.match(req.query['basicView']).to_s # Initialize some vars. myJumpNavigation = "" # Jump navigation string. @@ -264,14 +264,17 @@ tempResponse = Magick::ImageList.new(*imgFileList) do self.delay = $video_export_delay end - # Write out temp video to default directory and set mime_type for default launch. - tempResponse.write('/tmp/tmpVideo.mpeg') - mtype = WEBrick::HTTPUtils::mime_type('/tmp/tmpVideo.mpeg', WEBrick::HTTPUtils::DefaultMimeTypes) - res['Content-Type'] = mtype - res['Content-Disposition'] = 'inline; filename="video.mpeg"' - puts mtype - res.body = File.open('/tmp/tmpVideo.mpeg',"rb") {|io| io.read} - File.delete('/tmp/tmpVideo.mpeg') + # Write out temp video to a random directory in /tmp, set mime_type for default launch, + # then destroy said temp area upon return for security. + Dir.mktmpdir(nil, "/tmp") {|dir| + # use the directory... + tempResponse.write("#{dir}/tmpVideo.mp4") + mtype = WEBrick::HTTPUtils::mime_type("#{dir}/tmpVideo.mp4", WEBrick::HTTPUtils::DefaultMimeTypes) + res['Content-Type'] = mtype + res['Content-Disposition'] = 'inline; filename="video.mp4"' + puts mtype + res.body = File.open("#{dir}/tmpVideo.mp4","rb") {|io| io.read} + } else # Now generate the page with the correct substitution. res.body = eval(File.open("/usr/share/ifetch-tools/templates/CameraHistory") {|fh| fh.read}) @@ -302,12 +305,10 @@ system_call = "/usr/bin/ifetch /etc/ifetch-tools/cameras/"+cameraName.to_s+".conf&" pid = fork { Process.setsid - (0...1024).each do |i| + (0...2).each do |i| begin - # ruby1.9x claims IO.for_fd(3) and IO.for_fd(4) is not accessible because RubyVM reserves it. - if i != 3 && i != 4 - IO.for_fd(i).close - end + #closing stdin, stdout and stderr 0,1,2 + IO.for_fd(i).close rescue Errno::EBADF end end @@ -334,7 +335,7 @@ # conf dir at the time of the servlet creation. The tool will use the listing of files with # the .conf extension. ############################################################################################## -class Monitor < HTTPServlet::AbstractServlet +class CMonitor < HTTPServlet::AbstractServlet def do_GET(req, res) HTTPAuth.basic_auth(req, res, 'Camera Monitor Realm') {|user, pass| # this block returns true if @@ -449,17 +450,14 @@ # The below def should attempt to start every camera conf it can find. ############################################################################################## def start_all_cameras - camera_array = Array.new Dir["/etc/ifetch-tools/cameras/*.conf"].each do |cam_tmp| cameraName = File.basename(cam_tmp, ".conf").to_i pid = fork { Process.setsid - (0...1024).each do |i| + (0...2).each do |i| begin - # ruby1.9x claims IO.for_fd(3) and IO.for_fd(4) is not accessible because RubyVM reserves it. - if i != 3 && i != 4 - IO.for_fd(i).close - end + #closing stdin, stdout and stderr 0,1,2 + IO.for_fd(i).close rescue Errno::EBADF end end @@ -473,6 +471,21 @@ end ############################################################################################## +# The below def should attempt to stop every camera pid it can find upon a shutdown request. +############################################################################################## +def stop_all_cameras + Dir["/var/lock/ifetch-tools/*.pid"].each do |cam_tmp| + cameraName = File.basename(cam_tmp, ".pid").to_i + # Camera running action here + # Set the camera_pid to hold the pid of the running camera process. + camera_pid = File.read("/var/run/ifetch-tools/"+cameraName.to_s+".pid").chomp + system_call = "kill -s 9 #{camera_pid} &" + Process.detach( fork { system(system_call) } ) + puts "Shutdown signal received, attempting stop on"+cameraName.to_s+".pid" + end +end + +############################################################################################## # The below should daemonize this code. # 20090124 Nelson - Remarking out since I want init.d to catch the pid correct. ############################################################################################## @@ -531,7 +544,7 @@ # Create some mount points for servlet navigation ############################################################################################## # Monitor Operations -s.mount("/monitor", Monitor) +s.mount("/monitor", CMonitor) s.mount("/camerastartstop", CameraStartStop) s.mount("/startallcameras", StartAllCameras) @@ -560,6 +573,8 @@ # Catch the INT sig to shutdown trap("INT"){ + puts "Shutdown signal received, stop all cameras." + stop_all_cameras # Stop all running camera collection processes DRb.stop_service() # Stop the DRb on the webrick session s.shutdown } unblock ifetch-tools/0.15.24d2-1 -- System Information: Debian Release: 8.0 APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Init: unable to detect -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org