diff --git a/CMakeLists.txt b/CMakeLists.txt index d6ce67d48..7969689d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,12 @@ if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "f20") OR (ZM set(ZM_SOCKDIR "/var/lib/zoneminder/sock") set(ZM_TMPDIR "/var/lib/zoneminder/temp") set(ZM_LOGDIR "/var/log/zoneminder") +elseif(ZM_TARGET_DISTRO STREQUAL "el7") + set(ZM_RUNDIR "/var/run/zoneminder") + set(ZM_SOCKDIR "/var/lib/zoneminder/sock") + set(ZM_TMPDIR "/var/lib/zoneminder/temp") + set(ZM_LOGDIR "/var/log/zoneminder") + set(ZM_CONFIG_DIR "/etc/zm") elseif(ZM_TARGET_DISTRO STREQUAL "OS13") set(ZM_RUNDIR "/var/run/zoneminder") set(ZM_TMPDIR "/var/run/zoneminder") @@ -492,7 +498,6 @@ endif(NOT POLKIT_FOUND) # Some variables that zm expects set(ZM_PID "${ZM_RUNDIR}/zm.pid") set(ZM_CONFIG "${ZM_CONFIG_DIR}/zm.conf") -set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf") set(VERSION "${zoneminder_VERSION}") set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder") set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}") @@ -521,7 +526,7 @@ add_subdirectory(misc) # Process distro subdirectories if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "f20")) add_subdirectory(distros/fedora) -elseif(ZM_TARGET_DISTRO STREQUAL "el6") +elseif((ZM_TARGET_DISTRO STREQUAL "el6") OR (ZM_TARGET_DISTRO STREQUAL "el7")) add_subdirectory(distros/redhat) elseif(ZM_TARGET_DISTRO STREQUAL "OS13") add_subdirectory(distros/opensuse) diff --git a/INSTALL b/INSTALL index f334cd30e..3a5b3630e 100644 --- a/INSTALL +++ b/INSTALL @@ -27,11 +27,15 @@ cmake by default does not require any parameters, but its possible to override t Configuration can be done in 4 ways: 1) As a command line parameter, e.g. cmake -DCMAKE_VERBOSE_MAKEFILE=ON . 2) Using cmake-gui -4) Providing cmake with an initial cache file with the -C option +3) Providing cmake with an initial cache file with the -C option + IMPORTANT: Do not use the -C option if any major part of your system, excluding the version of zoneminder, has changed. + For example, do not use this option if: you have upgraded your distro to a new version, have gone from 32 to 64 bits, + or have migrated from one machine to another. 4) By editing the cache file CMakeCache.txt (after it has been generated) - Not recommended Possible configuration options: ZM_RUNDIR Location of transient process files, default: /var/run/zm + ZM_SOCKDIR Location of Unix domain socket files, default /var/run/zm ZM_TMPDIR Location of temporary files, default: /tmp/zm ZM_LOGDIR Location of generated log files, default: /var/log/zm ZM_WEBDIR Location of the web files, default: /share/zoneminder/www @@ -52,7 +56,6 @@ Advanced: ZM_PERL_SUBPREFIX Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. /lib will be turned into /lib, default: /perl5 ZM_PERL_USE_PATH Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: / - Useful configuration options provided by cmake: CMAKE_VERBOSE_MAKEFILE - Set this to ON (default OFF) to see what cmake is doing. Very useful for troubleshooting. CMAKE_BUILD_TYPE - Set this to Debug (default Release) to build ZoneMinder with debugging enabled. @@ -90,7 +93,8 @@ NOTE: The database server, database name, user and password can be different and 8) Create an apache virtual host for ZoneMinder. Make sure to use the same paths as ZM_WEBDIR and ZM_CGIDIR in /etc/zm.conf 9) Create other config if desired (e.g. rsyslog, logrotate and such). Some of this can be found in /share/zoneminder/misc or project/misc directory 10) Setup an appropriate startup script for your system. A generic sys v init script is here: /scripts/zm while a generic systemd service file is here: /misc/zoneminder.service -You must determine which file to use, verify it is correct, and then copy it to the correct location. Consult your distro's documentation. +You must determine which file to use, verify it is correct, and then copy it to the correct location. Consult your distro's documentation. Note that distros using systemd also +require /misc/zoneminder-tmpfiles.conf to be copied into the system's tmpfiles.d folder. Basic steps for upgrading ZoneMinder ------------------------------------ diff --git a/configure.ac b/configure.ac index 197d105eb..44abec42b 100644 --- a/configure.ac +++ b/configure.ac @@ -355,6 +355,7 @@ PATH_NETPBM=`dirname $PATH_NETPBM` fi # Checks for libraries. +AC_CHECK_LIB(rt,clock_gettime,,AC_MSG_ERROR(zm requires librt)) AC_SEARCH_LIBS(mysql_init,[mysqlclient mariadbclient],,AC_MSG_ERROR(zm requires libmysqlclient.a or libmariadbclient.a)) AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(zm requires libjpeg.a)) AC_CHECK_LIB(pthread,pthread_create,,AC_MSG_ERROR(zm requires libpthread.a)) diff --git a/distros/fedora/zoneminder.f21.spec b/distros/fedora/zoneminder.f21.spec new file mode 100644 index 000000000..9997b9f74 --- /dev/null +++ b/distros/fedora/zoneminder.f21.spec @@ -0,0 +1,400 @@ +%define zmuid $(id -un) +%define zmgid $(id -gn) +%define zmuid_final apache +%define zmgid_final apache + +%global _hardened_build 1 + +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + +Name: zoneminder +Version: 1.28.1 +Release: 1%{?dist} +Summary: A camera monitoring and analysis tool +Group: System Environment/Daemons +# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/ +# Mootools is inder the MIT license: http://mootools.net/ +License: GPLv2+ and LGPLv2+ and MIT +URL: http://www.zoneminder.com/ + +#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz +Source: ZoneMinder-%{version}.tar.gz + +BuildRequires: cmake gnutls-devel systemd-units bzip2-devel +BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel +BuildRequires: perl(Archive::Tar) perl(Archive::Zip) +BuildRequires: perl(Date::Manip) perl(DBD::mysql) +BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) +BuildRequires: perl(MIME::Entity) perl(MIME::Lite) +BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) +BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) +BuildRequires: perl(Expect) perl(Sys::Syslog) +BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} +# cmake needs the following installed at build time due to the way it auto-detects certain parameters +BuildRequires: httpd polkit-devel +%{!?_without_ffmpeg:BuildRequires: ffmpeg} + +Requires: httpd php php-mysql cambozola polkit net-tools +Requires: libjpeg-turbo vlc-core libcurl +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) +Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) +Requires: perl(LWP::Protocol::https) +%{!?_without_ffmpeg:Requires: ffmpeg} + +Requires(post): systemd-units systemd-sysv +Requires(post): /usr/bin/gpasswd +Requires(post): /usr/bin/less +Requires(preun): systemd-units +Requires(postun): systemd-units + +%description +ZoneMinder is a set of applications which is intended to provide a complete +solution allowing you to capture, analyse, record and monitor any cameras you +have attached to a Linux based machine. It is designed to run on kernels which +support the Video For Linux (V4L) interface and has been tested with cameras +attached to BTTV cards, various USB cameras and IP network cameras. It is +designed to support as many cameras as you can attach to your computer without +too much degradation of performance. + +%prep +%setup -q -n ZoneMinder-%{version} + +# Change the following default values +./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin/zm/nph-zms +./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes +./utils/zmeditconfigdata.sh ZM_PATH_SWAP /dev/shm +./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR /var/spool/zoneminder-upload +./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes +./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no +./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no + +%build +%cmake \ + -DZM_TARGET_DISTRO="f20" \ + -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` \ +%{?_without_ffmpeg:-DZM_NO_FFMPEG=ON} \ +%{?_without_x10:-DZM_NO_X10=ON} \ + . + +make %{?_smp_mflags} + +%install +export DESTDIR=%{buildroot} +make install + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout + +# Display the README for post installation instructions +/usr/bin/less %{_docdir}/%{name}/README.Fedora + +%preun +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || : + /bin/systemctl stop zoneminder.service > /dev/null 2>&1 || : +fi + +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : +fi + +%triggerun -- zoneminder < 1.25.0-4 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply zoneminder +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save zoneminder >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del zoneminder >/dev/null 2>&1 || : +/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : + + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING README.md distros/fedora/README.Fedora distros/fedora/jscalendar-doc +%config %attr(640,root,%{zmgid_final}) /etc/zm.conf +%config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf +%config(noreplace) /etc/tmpfiles.d/zoneminder.conf +%config(noreplace) /etc/logrotate.d/zoneminder + +%{_unitdir}/zoneminder.service + +%{_bindir}/zma +%{_bindir}/zmaudit.pl +%{_bindir}/zmc +%{_bindir}/zmcontrol.pl +%{_bindir}/zmdc.pl +%{_bindir}/zmf +%{_bindir}/zmfilter.pl +%{_bindir}/zmpkg.pl +%{_bindir}/zmstreamer +%{_bindir}/zmtrack.pl +%{_bindir}/zmtrigger.pl +%{_bindir}/zmu +%{_bindir}/zmupdate.pl +%{_bindir}/zmvideo.pl +%{_bindir}/zmwatch.pl +%{_bindir}/zmcamtool.pl +%{_bindir}/zmsystemctl.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} + +%{perl_vendorlib}/ZoneMinder* +%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* +#%{perl_archlib}/ZoneMinder* +%{_mandir}/man*/* +%dir %{_libexecdir}/zoneminder +%{_libexecdir}/zoneminder/cgi-bin +%dir %{_datadir}/zoneminder +%{_datadir}/zoneminder/db +%{_datadir}/zoneminder/www + +%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy +%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules + +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/events +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/images +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/sock +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/swap +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/temp +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/log/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/spool/zoneminder-upload +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /run/zoneminder + + +%changelog +* Sat Feb 14 2015 Andrew Bauer - 1.28.1 +- Bump version for 1.28.1 release on Fedora 21. + +* Sun Oct 5 2014 Andrew Bauer - 1.28.0 +- Bump version for 1.28.0 release. + +* Fri Mar 14 2014 Andrew Bauer - 1.27 +- Tweak build requirements for cmake + +* Sat Feb 01 2014 Andrew Bauer - 1.27 +- Add zmcamtool.pl. Bump version for 1.27 release. + +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + +* Mon Oct 07 2013 Andrew Bauer - 1.26.4 +- Initial cmake build. + +* Sat Oct 05 2013 Andrew Bauer - 1.26.4 +- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch +- All files are now part of the zoneminder source tree. Update specfile accordingly. + +* Sat Sep 21 2013 Andrew Bauer - 1.26.3 +- Initial rebuild for ZoneMinder 1.26.3 release. + +* Fri Feb 15 2013 Fedora Release Engineering - 1.25.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Adam Tkac - 1.25.0-12 +- rebuild due to "jpeg8-ABI" feature drop + +* Mon Jan 7 2013 Remi Collet - 1.25.0-11 +- fix configuration file for httpd 2.4, #871502 + +* Fri Dec 21 2012 Adam Tkac - 1.25.0-10 +- rebuild against new libjpeg + +* Thu Aug 09 2012 Jason L Tibbitts III - 1.25.0-9 +- Add patch to work around v4l2 api breakage in 3.5 kernel. + +* Sun Jul 22 2012 Fedora Release Engineering - 1.25.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jun 23 2012 Petr Pisar - 1.25.0-7 +- Perl 5.16 rebuild + +* Wed Mar 21 2012 Jason L Tibbitts III - 1.25.0-6 +- Fix stupid thinko in sql modifications. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-5 +- Clean up macro usage. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-4 +- Convert to systemd. +- Add tmpfiles.d configuration since the initscript isn't around to create + /run/zoneminder. +- Remove some pointless executable permissions. +- Add logrotate file. + +* Wed Feb 22 2012 Jason L Tibbitts III - 1.25.0-3 +- Update README.Fedora to reference systemctl and mention timezone info in + php.ini. +- Add proper default for EYEZM_LOG_TO_FILE. + + +* Thu Feb 09 2012 Jason L Tibbitts III - 1.25.0-2 +- Rebuild for new pcre. + +* Thu Jan 19 2012 Jason L Tibbitts III - 1.25.0-1 +- Update to 1.25.0 +- Fix gcc4.7 build problems. +- Drop gcc4.4 build fixes; for whatever reason they now break the build. +- Clean up old patches. +- Force setting of ZM_TMPDIR and ZM_RUNDIR. + +* Sat Jan 14 2012 Fedora Release Engineering - 1.24.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-3 +- Re-add the dist-tag that somehow got lost. + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-2 +- Add patch for bug 711780 - fix syntax issue in Mapped.pm. +- Undo that patch, and undo another which was the cause of the whole mess. +- Fix up other patches so ZM_PATH_BUILD is both defined and useful. +- Make sure database creation mods actually take. +- Update Fedora-specific docs with some additional info. +- Use bundled mootools (javascript, so no guideline violation). +- Update download location. +- Update the gcrypt patch to actually work. +- Upstream changed the tarball without changing the version to patch a + vulnerability, so redownload. + +* Sun Aug 14 2011 Jason L Tibbitts III - 1.24.4-1 +- Initial attempt to upgrade to 1.24.4. +- Add patch from BZ 460310 to build against libgcrypt instead of requiring the + gnutls openssl libs. + +* Thu Jul 21 2011 Petr Sabata - 1.24.3-7.20110324svn3310 +- Perl mass rebuild + +* Wed Jul 20 2011 Petr Sabata - 1.24.3-6.20110324svn3310 +- Perl mass rebuild + +* Mon May 09 2011 Jason L Tibbitts III - 1.24.3-5.20110324svn3310 +- Bump for gnutls update. + +* Thu Mar 24 2011 Jason L Tibbitts III - 1.24.3-4.20110324svn3310 +- Update to latest 1.24.3 subversion. Turns out that what upstream was calling + 1.24.3 is really just an occasionally updated devel snapshot. +- Rebase various patches. + +* Wed Mar 23 2011 Dan Horák - 1.24.3-3 +- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.24.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jan 25 2011 Jason L Tibbitts III - 1.24.3-1 +- Update to latest upstream version. +- Rebase patches. +- Initial incomplete attempt to disable v4l1 support. + +* Fri Jan 21 2011 Jason L Tibbitts III - 1.24.2-6 +- Unbundle cambozola; instead link to the separately pacakged copy. +- Remove BuildRoot:, %%clean and buildroot cleaning in %%install. +- Git rid of mixed space/tab usage by removing all tabs. +- Remove unnecessary Conflicts: line. +- Attempt to force short_open_tag on for the code directories. +- Move default location of sockets, swaps, logfiles and some temporary files to + make more sense and allow things to work better with a future selinux policy. +- Fix errors in README.Fedora. + +* Wed Jun 02 2010 Marcela Maslanova - 1.24.2-5 +- Mass rebuild with perl-5.12.0 + +* Fri Dec 4 2009 Stepan Kasal - 1.24.2-4 +- rebuild against perl 5.10.1 +- use Perl vendorarch and archlib variables correctly + +* Mon Jul 27 2009 Fedora Release Engineering - 1.24.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-2 +- Bump release since 1.24.2-1 was mistakenly tagged a few months ago. + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-1 +- Initial update to 1.24.2. +- Rebase patches. +- Update mootools download location. +- Update to mootools 1.2.3. +- Add additional dependencies for some optional features. + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-3 +- Remove unused Sys::Mmap perl dependency RPM is finding + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-2 +- Update gcc44 patch to disable -frepo, seems to be broken with gcc44 +- Added noffmpeg patch to make building outside mock easier + +* Sat Mar 21 2009 Martin Ebourne - 1.24.1-1 +- Patch for gcc 4.4 compilation errors +- Upgrade to 1.24.1 + +* Wed Feb 25 2009 Fedora Release Engineering - 1.23.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Jan 24 2009 Caolán McNamara - 1.23.3-3 +- rebuild for dependencies + +* Mon Dec 15 2008 Martin Ebourne - 1.23.3-2 +- Fix permissions on zm.conf + +* Fri Jul 11 2008 Jason L Tibbitts III - 1.23.3-1 +- Initial attempt at packaging 1.23. + +* Tue Jul 1 2008 Martin Ebourne - 1.22.3-15 +- Add perl module compat dependency, bz #453590 + +* Tue May 6 2008 Martin Ebourne - 1.22.3-14 +- Remove default runlevel, bz #441315 + +* Mon Apr 28 2008 Jason L Tibbitts III - 1.22.3-13 +- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3. + +* Tue Feb 19 2008 Fedora Release Engineering - 1.22.3-12 +- Autorebuild for GCC 4.3 + +* Thu Jan 3 2008 Martin Ebourne - 1.22.3-11 +- Fix compilation on gcc 4.3 + +* Thu Dec 6 2007 Martin Ebourne - 1.22.3-10 +- Rebuild for new openssl + +* Thu Aug 2 2007 Martin Ebourne - 1.22.3-8 +- Fix licence tag + +* Thu Jul 12 2007 Martin Ebourne - 1.22.3-7 +- Fixes from testing by Jitz including missing dependencies and database creation + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-6 +- Disable crashtrace on ppc + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-5 +- Fix uid for directories in /var/lib/zoneminder + +* Tue Jun 26 2007 Martin Ebourne - 1.22.3-4 +- Added perl Archive::Tar dependency +- Disabled web interface due to lack of access control on the event images + +* Sun Jun 10 2007 Martin Ebourne - 1.22.3-3 +- Changes recommended in review by Jason Tibbitts + +* Mon Apr 2 2007 Martin Ebourne - 1.22.3-2 +- Standardised on package name of zoneminder + +* Thu Dec 28 2006 Martin Ebourne - 1.22.3-1 +- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index 63e742d68..84b5a6a74 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -1,7 +1,11 @@ # CMakeLists.txt for the Redhat/CentOS Target Distro. # Create the zoneminder service file -configure_file(zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) +if(ZM_TARGET_DISTRO STREQUAL "el7") + configure_file(zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) +else(ZM_TARGET_DISTRO STREQUAL "el7") + configure_file(zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder @ONLY) +endif(ZM_TARGET_DISTRO STREQUAL "el7") # Download jscalendar & move files into position file(DOWNLOAD http://softlayer-dal.dl.sourceforge.net/project/jscalendar/jscalendar/1.0/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip LOG jsc_log STATUS download_jsc) @@ -41,10 +45,17 @@ install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/imag install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/temp\")") # Install auxillary files required to run zoneminder on CentOS -install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) -install(FILES zm-logrotate_d DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -install(FILES zoneminder.service DESTINATION /etc/rc.d/init.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +if(ZM_TARGET_DISTRO STREQUAL "el7") + install(FILES zoneminder.el7.conf DESTINATION /etc/httpd/conf.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + install(FILES zoneminder.el7.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + install(FILES zoneminder.tmpfiles DESTINATION /etc/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +else(ZM_TARGET_DISTRO STREQUAL "el7") + install(FILES zoneminder.el6.conf DESTINATION /etc/httpd/conf.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + install(FILES zoneminder.el6.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) + install(FILES zoneminder DESTINATION /etc/rc.d/init.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +endif(ZM_TARGET_DISTRO STREQUAL "el7") # Install jscalendar if(unzip_jsc STREQUAL "") diff --git a/distros/redhat/README.Centos7 b/distros/redhat/README.Centos7 new file mode 100644 index 000000000..ce7d9af51 --- /dev/null +++ b/distros/redhat/README.Centos7 @@ -0,0 +1,127 @@ + +What's New +========== + +1. The Apache ScriptAlias has been changed from "/cgi-bin/zm/zms" to + "/cgi-bin-zm/zms". This has been to done to avoid this bug: + https://bugzilla.redhat.com/show_bug.cgi?id=973067 + + IMPORTANT: ZoneMinder will not update this value during an upgrade. You must + manually update ZM_PATH_ZMS yourself under Options. This does not affect + new installs. + +2. During an rpm package upgrade, zmupdate.pl will now auto-update the database + and the zonemidner service will restart automatically. + +3. The ZoneMinder config file, zm.conf, has been moved under /etc/zm. + +4. Systemd. CentOS 7 uses Systemd instead of the legacy Sys V Init. Under the + hood, Systemd does things quite a bit differently. Prepare to go through a + learning curve if you have not done so already. + +New installs +============ + +1. Unless you are already using MariaDB server, you need to ensure that + the server is configured to start during boot and properly secured + by running: + + sudo systemctl enable mariadb + sudo systemctl start mariadb + sudo mysql_secure_installation + +2. Using the password for the root account set during the previous step, you + will need to create the ZoneMinder database and configure a database + account for ZoneMinder to use: + + mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql + mysql -u root -p + mysql> grant select,insert,update,delete,lock tables,alter on zm.* to + 'zmuser'@localhost identified by 'zmpass'; + mysql> exit; + mysqladmin -u root -p reload + + The database account credentials, zmuser/zmpass, are arbitrary. Set them to + anything that suits your envinroment. + +3. If you have chosen to change the zoneminder database account credentials to + something other than zmuser/zmpass, you must now edit /etc/zm/zm.conf. + Change ZM_DB_USER and ZM_DB_PASS to the values you created in the previous + step. + +4. Edit /etc/php.ini, uncomment the date.timezone line, and add your local + timezone. For whatever reason, PHP will complain loudly if this is not set, + or if it is set incorrectly, and these complaints will show up in the + zoneminder logging system as errors. + + If you are not sure of the proper timezone specification to use, look at + http://php.net/date.timezone + +5. This package will automatically configure and install an SELinux policy + called local_zoneminder. A copy of this policy is in the documentation + folder. + + Maintaining an accurate SELinux policy file that does not create issues has + been a struggle. If SELinux blocks nortmal ZoneMinder acitivity, or you + feel you just don't need it, SELinux can be disabled for the current running + session with the following command: + + sudo setenforce 0 + + To permanently disable SELinux, edit /etc/selinux/config and change the + SELINUX line from "enforcing" to "disabled". This change will take + effect after a reboot. + +6. Now start the web server: + + sudo systemctl enable httpd + sudo systemctl start httpd + +7. Now start zoneminder: + + sudo systemctl enable zoneminder + sudo systemctl start zoneminder + +Upgrades +======== + +1. Verify /etc/zm/zm.conf. + + If zm.conf was manually edited before running the upgrade, the installation + may not overwrite it. In this case, it will create the file + /etc/zm/zm.conf.rpmnew. + + For example, this will happen if you are using database account credentials + other than zmuser/zmpass. + + Compare /etc/zm/zm.conf to /etc/zm/zm.conf.rpmnew. Verify that zm.conf + contains any new config settings that may be in zm.conf.rpmnew. + +2. Verify permissions of the zmuser account. + + Overtime, the database account permissions required for normal operation + have changed. Verify the zmuser database account has been granted select, + insert, update, delete, lock tables, and alter permission to the ZoneMinder + database: + + mysql -u root -p + mysql> show grants for zmuser@localhost; + mysql> exit; + +3. Verify the database was upgraded automatically. + + From the web console, ZoneMinder should show a status of "Running", and the + version number should have incremented. + + If it is not running, then try to start it. The web console will indicate + if there is a database version conflict. If this is the case, then you may + need to manually update the database from the command line: + + sudo zmupdate.pl + + Modern versions of ZoneMinder don't require any parameters added to the + zmupdate command. However, if ZoneMinder complains, you may need to call + zmupdate in the following manner: + + sudo zmupdate.pl --user=root --pass= --version= + diff --git a/distros/redhat/zm-init b/distros/redhat/archive/zm-init similarity index 100% rename from distros/redhat/zm-init rename to distros/redhat/archive/zm-init diff --git a/distros/redhat/zoneminder-1.28.0-defaults.patch b/distros/redhat/archive/zoneminder-1.28.0-defaults.patch similarity index 100% rename from distros/redhat/zoneminder-1.28.0-defaults.patch rename to distros/redhat/archive/zoneminder-1.28.0-defaults.patch diff --git a/distros/redhat/redalert.wav b/distros/redhat/redalert.wav old mode 100755 new mode 100644 diff --git a/distros/redhat/zoneminder.conf b/distros/redhat/zoneminder.el6.conf similarity index 79% rename from distros/redhat/zoneminder.conf rename to distros/redhat/zoneminder.el6.conf index 4a4d93261..081eccfb3 100644 --- a/distros/redhat/zoneminder.conf +++ b/distros/redhat/zoneminder.el6.conf @@ -1,6 +1,3 @@ -# The Zoneminder web interface has been disabled by default due to a small -# security issue in the default install. -# # When using Zoneminder's own authentication, recorded CCTV images are # accessible from the web directly without passing the authentication. This # means any attacker could see your CCTV images without a password. In order @@ -18,10 +15,8 @@ Alias /zm "/usr/share/zoneminder/www" AllowOverride All Order allow,deny Allow from all - # The code unfortunately uses short tags in many places - php_value short_open_tag 1 - -Deny from all # DELETE THIS LINE + # ZoneMinder no longer uses short tags so this is safe to leave disabled + # php_value short_open_tag 1 ScriptAlias /cgi-bin/zm "/usr/libexec/zoneminder/cgi-bin" diff --git a/distros/redhat/zm-logrotate_d b/distros/redhat/zoneminder.el6.logrotate similarity index 100% rename from distros/redhat/zm-logrotate_d rename to distros/redhat/zoneminder.el6.logrotate diff --git a/distros/redhat/zoneminder.el7.conf b/distros/redhat/zoneminder.el7.conf new file mode 100644 index 000000000..ab4abbbcb --- /dev/null +++ b/distros/redhat/zoneminder.el7.conf @@ -0,0 +1,42 @@ +# When using Zoneminder's own authentication, recorded CCTV images are +# accessible from the web directly without passing the authentication. This +# means any attacker could see your CCTV images without a password. In order +# to avoid this you can disable Zoneminder's authentication and configure +# standard Apache authentication (see the Apache documentation for details on +# this). +# +# If you still wish to use Zoneminder's own authentication, or have an +# internal site which needs no authentication, you need to delete the line +# marked below and restart Apache. + +Alias /zm "/usr/share/zoneminder/www" + + Options -Indexes +MultiViews +FollowSymLinks + AllowOverride All + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + Order deny,allow + Allow from all + + # ZoneMinder no longer uses short tags so this is safe to leave disabled + # php_value short_open_tag 1 + + +ScriptAlias /cgi-bin-zm "/usr/libexec/zoneminder/cgi-bin" + + AllowOverride All + Options ExecCGI + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + Order deny,allow + Allow from all + + diff --git a/distros/redhat/zoneminder.el7.logrotate b/distros/redhat/zoneminder.el7.logrotate new file mode 100644 index 000000000..7bd1d189b --- /dev/null +++ b/distros/redhat/zoneminder.el7.logrotate @@ -0,0 +1,8 @@ +/var/log/zoneminder/*.log { + missingok + notifempty + sharedscripts + postrotate + /usr/bin/zmpkg.pl logrot 2> /dev/null > /dev/null || : + endscript +} diff --git a/distros/redhat/zoneminder.el7.spec b/distros/redhat/zoneminder.el7.spec new file mode 100644 index 000000000..ec35e692e --- /dev/null +++ b/distros/redhat/zoneminder.el7.spec @@ -0,0 +1,402 @@ +%define zmuid $(id -un) +%define zmgid $(id -gn) +%define zmuid_final apache +%define zmgid_final apache + +%global _hardened_build 1 + +Name: zoneminder +Version: 1.28.1 +Release: 1%{?dist} +Summary: A camera monitoring and analysis tool +Group: System Environment/Daemons +# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/ +# Mootools is inder the MIT license: http://mootools.net/ +License: GPLv2+ and LGPLv2+ and MIT +URL: http://www.zoneminder.com/ + +#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz +Source: ZoneMinder-%{version}.tar.gz + +BuildRequires: cmake gnutls-devel systemd-units bzip2-devel +BuildRequires: mariadb-devel pcre-devel libjpeg-turbo-devel +BuildRequires: perl(Archive::Tar) perl(Archive::Zip) +BuildRequires: perl(Date::Manip) perl(DBD::mysql) +BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) +BuildRequires: perl(MIME::Entity) perl(MIME::Lite) +BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) +BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) +BuildRequires: perl(Expect) perl(Sys::Syslog) +BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel +BuildRequires: ffmpeg ffmpeg-devel perl(X10::ActiveHome) perl(Astro::SunTime) +# cmake needs the following installed at build time due to the way it auto-detects certain parameters +BuildRequires: httpd polkit-devel + +Requires: httpd php php-mysql mariadb-server polkit net-tools +Requires: libjpeg-turbo vlc-core libcurl +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) +Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) +Requires: perl(LWP::Protocol::https) ffmpeg + +Requires(post): systemd-units systemd-sysv +Requires(post): /usr/bin/gpasswd +Requires(post): /usr/bin/less +Requires(preun): systemd-units +Requires(postun): systemd-units + +%description +ZoneMinder is a set of applications which is intended to provide a complete +solution allowing you to capture, analyse, record and monitor any cameras you +have attached to a Linux based machine. It is designed to run on kernels which +support the Video For Linux (V4L) interface and has been tested with cameras +attached to BTTV cards, various USB cameras and IP network cameras. It is +designed to support as many cameras as you can attach to your computer without +too much degradation of performance. + +%prep +%setup -q -n ZoneMinder-%{version} + +# Change the following default values +./utils/zmeditconfigdata.sh ZM_PATH_ZMS /cgi-bin-zm/nph-zms +./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes +./utils/zmeditconfigdata.sh ZM_PATH_SWAP /dev/shm +./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR /var/spool/zoneminder-upload +./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes +./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no +./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no + +%build +%cmake \ + -DZM_TARGET_DISTRO="el7" \ + -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` \ + . + +make %{?_smp_mflags} + +%install +export DESTDIR=%{buildroot} +make install + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout + +# Create and load zoneminder selinux policy module +echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n" +/usr/bin/checkmodule -M -m -o %{_docdir}/%{name}-%{version}/local_zoneminder.mod %{_docdir}/%{name}-%{version}/local_zoneminder.te > /dev/null +/usr/bin/semodule_package -o %{_docdir}/%{name}-%{version}/local_zoneminder.pp -m %{_docdir}/%{name}-%{version}/local_zoneminder.mod > /dev/null +/usr/sbin/semodule -i %{_docdir}/%{name}-%{version}/local_zoneminder.pp > /dev/null + +# Upgrade from a previous version of zoneminder +if [ $1 -eq 2 ] ; then + # Run zmupdate non-interactively + /usr/bin/zmupdate.pl --nointeractive +fi + +# Display the README for post installation instructions +/usr/bin/less %{_docdir}/%{name}-%{version}/README.Centos7 + +%preun +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || : + /bin/systemctl stop zoneminder.service > /dev/null 2>&1 || : +fi + +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : +fi + +%triggerun -- zoneminder < 1.25.0-4 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply zoneminder +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save zoneminder >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del zoneminder >/dev/null 2>&1 || : +/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || : + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING README.md distros/redhat/README.Centos7 distros/redhat/jscalendar-doc +%config %attr(640,root,%{zmgid_final}) /etc/zm/zm.conf +%config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf +%config(noreplace) /etc/tmpfiles.d/zoneminder.conf +%config(noreplace) /etc/logrotate.d/zoneminder + +%{_unitdir}/zoneminder.service + +%{_bindir}/zma +%{_bindir}/zmaudit.pl +%{_bindir}/zmc +%{_bindir}/zmcontrol.pl +%{_bindir}/zmdc.pl +%{_bindir}/zmf +%{_bindir}/zmfilter.pl +%{_bindir}/zmpkg.pl +%{_bindir}/zmstreamer +%{_bindir}/zmtrack.pl +%{_bindir}/zmtrigger.pl +%{_bindir}/zmu +%{_bindir}/zmupdate.pl +%{_bindir}/zmvideo.pl +%{_bindir}/zmwatch.pl +%{_bindir}/zmcamtool.pl +%{_bindir}/zmsystemctl.pl +%{_bindir}/zmx10.pl + +%{perl_vendorlib}/ZoneMinder* +%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* +#%{perl_archlib}/ZoneMinder* +%{_mandir}/man*/* +%dir %{_libexecdir}/zoneminder +%{_libexecdir}/zoneminder/cgi-bin +%dir %{_datadir}/zoneminder +%{_datadir}/zoneminder/db +%{_datadir}/zoneminder/www + +%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy +%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules + +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/events +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/images +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/sock +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/swap +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/temp +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/log/zoneminder +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/spool/zoneminder-upload +%dir %attr(755,%{zmuid_final},%{zmgid_final}) /run/zoneminder + + +%changelog +* Sun Feb 8 2015 Andrew Bauer - 1.28.1 +- Initial release for CentOS 7. + +* Sun Oct 5 2014 Andrew Bauer - 1.28.0 +- Bump version for 1.28.0 release. + +* Fri Mar 14 2014 Andrew Bauer - 1.27 +- Tweak build requirements for cmake + +* Sat Feb 01 2014 Andrew Bauer - 1.27 +- Add zmcamtool.pl. Bump version for 1.27 release. + +* Mon Dec 16 2013 Andrew Bauer - 1.26.5 +- This is a bug fixe release +- RTSP fixes, cmake enhancements, couple other misc fixes + +* Mon Oct 07 2013 Andrew Bauer - 1.26.4 +- Initial cmake build. + +* Sat Oct 05 2013 Andrew Bauer - 1.26.4 +- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch +- All files are now part of the zoneminder source tree. Update specfile accordingly. + +* Sat Sep 21 2013 Andrew Bauer - 1.26.3 +- Initial rebuild for ZoneMinder 1.26.3 release. + +* Fri Feb 15 2013 Fedora Release Engineering - 1.25.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Jan 21 2013 Adam Tkac - 1.25.0-12 +- rebuild due to "jpeg8-ABI" feature drop + +* Mon Jan 7 2013 Remi Collet - 1.25.0-11 +- fix configuration file for httpd 2.4, #871502 + +* Fri Dec 21 2012 Adam Tkac - 1.25.0-10 +- rebuild against new libjpeg + +* Thu Aug 09 2012 Jason L Tibbitts III - 1.25.0-9 +- Add patch to work around v4l2 api breakage in 3.5 kernel. + +* Sun Jul 22 2012 Fedora Release Engineering - 1.25.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jun 23 2012 Petr Pisar - 1.25.0-7 +- Perl 5.16 rebuild + +* Wed Mar 21 2012 Jason L Tibbitts III - 1.25.0-6 +- Fix stupid thinko in sql modifications. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-5 +- Clean up macro usage. + +* Sat Feb 25 2012 Jason L Tibbitts III - 1.25.0-4 +- Convert to systemd. +- Add tmpfiles.d configuration since the initscript isn't around to create + /run/zoneminder. +- Remove some pointless executable permissions. +- Add logrotate file. + +* Wed Feb 22 2012 Jason L Tibbitts III - 1.25.0-3 +- Update README.Fedora to reference systemctl and mention timezone info in + php.ini. +- Add proper default for EYEZM_LOG_TO_FILE. + + +* Thu Feb 09 2012 Jason L Tibbitts III - 1.25.0-2 +- Rebuild for new pcre. + +* Thu Jan 19 2012 Jason L Tibbitts III - 1.25.0-1 +- Update to 1.25.0 +- Fix gcc4.7 build problems. +- Drop gcc4.4 build fixes; for whatever reason they now break the build. +- Clean up old patches. +- Force setting of ZM_TMPDIR and ZM_RUNDIR. + +* Sat Jan 14 2012 Fedora Release Engineering - 1.24.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-3 +- Re-add the dist-tag that somehow got lost. + +* Thu Sep 15 2011 Jason L Tibbitts III - 1.24.4-2 +- Add patch for bug 711780 - fix syntax issue in Mapped.pm. +- Undo that patch, and undo another which was the cause of the whole mess. +- Fix up other patches so ZM_PATH_BUILD is both defined and useful. +- Make sure database creation mods actually take. +- Update Fedora-specific docs with some additional info. +- Use bundled mootools (javascript, so no guideline violation). +- Update download location. +- Update the gcrypt patch to actually work. +- Upstream changed the tarball without changing the version to patch a + vulnerability, so redownload. + +* Sun Aug 14 2011 Jason L Tibbitts III - 1.24.4-1 +- Initial attempt to upgrade to 1.24.4. +- Add patch from BZ 460310 to build against libgcrypt instead of requiring the + gnutls openssl libs. + +* Thu Jul 21 2011 Petr Sabata - 1.24.3-7.20110324svn3310 +- Perl mass rebuild + +* Wed Jul 20 2011 Petr Sabata - 1.24.3-6.20110324svn3310 +- Perl mass rebuild + +* Mon May 09 2011 Jason L Tibbitts III - 1.24.3-5.20110324svn3310 +- Bump for gnutls update. + +* Thu Mar 24 2011 Jason L Tibbitts III - 1.24.3-4.20110324svn3310 +- Update to latest 1.24.3 subversion. Turns out that what upstream was calling + 1.24.3 is really just an occasionally updated devel snapshot. +- Rebase various patches. + +* Wed Mar 23 2011 Dan Horák - 1.24.3-3 +- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.24.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Jan 25 2011 Jason L Tibbitts III - 1.24.3-1 +- Update to latest upstream version. +- Rebase patches. +- Initial incomplete attempt to disable v4l1 support. + +* Fri Jan 21 2011 Jason L Tibbitts III - 1.24.2-6 +- Unbundle cambozola; instead link to the separately pacakged copy. +- Remove BuildRoot:, %%clean and buildroot cleaning in %%install. +- Git rid of mixed space/tab usage by removing all tabs. +- Remove unnecessary Conflicts: line. +- Attempt to force short_open_tag on for the code directories. +- Move default location of sockets, swaps, logfiles and some temporary files to + make more sense and allow things to work better with a future selinux policy. +- Fix errors in README.Fedora. + +* Wed Jun 02 2010 Marcela Maslanova - 1.24.2-5 +- Mass rebuild with perl-5.12.0 + +* Fri Dec 4 2009 Stepan Kasal - 1.24.2-4 +- rebuild against perl 5.10.1 +- use Perl vendorarch and archlib variables correctly + +* Mon Jul 27 2009 Fedora Release Engineering - 1.24.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-2 +- Bump release since 1.24.2-1 was mistakenly tagged a few months ago. + +* Wed Jul 22 2009 Jason L Tibbitts III - 1.24.2-1 +- Initial update to 1.24.2. +- Rebase patches. +- Update mootools download location. +- Update to mootools 1.2.3. +- Add additional dependencies for some optional features. + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-3 +- Remove unused Sys::Mmap perl dependency RPM is finding + +* Sat Apr 11 2009 Martin Ebourne - 1.24.1-2 +- Update gcc44 patch to disable -frepo, seems to be broken with gcc44 +- Added noffmpeg patch to make building outside mock easier + +* Sat Mar 21 2009 Martin Ebourne - 1.24.1-1 +- Patch for gcc 4.4 compilation errors +- Upgrade to 1.24.1 + +* Wed Feb 25 2009 Fedora Release Engineering - 1.23.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Jan 24 2009 Caolán McNamara - 1.23.3-3 +- rebuild for dependencies + +* Mon Dec 15 2008 Martin Ebourne - 1.23.3-2 +- Fix permissions on zm.conf + +* Fri Jul 11 2008 Jason L Tibbitts III - 1.23.3-1 +- Initial attempt at packaging 1.23. + +* Tue Jul 1 2008 Martin Ebourne - 1.22.3-15 +- Add perl module compat dependency, bz #453590 + +* Tue May 6 2008 Martin Ebourne - 1.22.3-14 +- Remove default runlevel, bz #441315 + +* Mon Apr 28 2008 Jason L Tibbitts III - 1.22.3-13 +- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3. + +* Tue Feb 19 2008 Fedora Release Engineering - 1.22.3-12 +- Autorebuild for GCC 4.3 + +* Thu Jan 3 2008 Martin Ebourne - 1.22.3-11 +- Fix compilation on gcc 4.3 + +* Thu Dec 6 2007 Martin Ebourne - 1.22.3-10 +- Rebuild for new openssl + +* Thu Aug 2 2007 Martin Ebourne - 1.22.3-8 +- Fix licence tag + +* Thu Jul 12 2007 Martin Ebourne - 1.22.3-7 +- Fixes from testing by Jitz including missing dependencies and database creation + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-6 +- Disable crashtrace on ppc + +* Sat Jun 30 2007 Martin Ebourne - 1.22.3-5 +- Fix uid for directories in /var/lib/zoneminder + +* Tue Jun 26 2007 Martin Ebourne - 1.22.3-4 +- Added perl Archive::Tar dependency +- Disabled web interface due to lack of access control on the event images + +* Sun Jun 10 2007 Martin Ebourne - 1.22.3-3 +- Changes recommended in review by Jason Tibbitts + +* Mon Apr 2 2007 Martin Ebourne - 1.22.3-2 +- Standardised on package name of zoneminder + +* Thu Dec 28 2006 Martin Ebourne - 1.22.3-1 +- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin diff --git a/distros/redhat/zoneminder.in b/distros/redhat/zoneminder.in old mode 100755 new mode 100644 diff --git a/distros/redhat/zoneminder.service.in b/distros/redhat/zoneminder.service.in new file mode 100644 index 000000000..7afe8473a --- /dev/null +++ b/distros/redhat/zoneminder.service.in @@ -0,0 +1,18 @@ +# ZoneMinder systemd unit file for CentOS 7 + +[Unit] +Description=ZoneMinder CCTV recording and security system +After=network.target mariadb.service httpd.service +Requires=mariadb.service httpd.service + +[Service] +User=@WEB_USER@ +Type=forking +ExecStart=@BINDIR@/zmpkg.pl start +ExecReload=@BINDIR@/zmpkg.pl restart +ExecStop=@BINDIR@/zmpkg.pl stop +PIDFile="@ZM_RUNDIR@/zm.pid" + +[Install] +WantedBy=multi-user.target + diff --git a/distros/redhat/zoneminder.tmpfiles b/distros/redhat/zoneminder.tmpfiles new file mode 100644 index 000000000..a56fa54ba --- /dev/null +++ b/distros/redhat/zoneminder.tmpfiles @@ -0,0 +1 @@ +d /run/zoneminder 0755 apache apache diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index c09f630e0..1b3bd7c5a 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -7,6 +7,7 @@ configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY) configure_file(com.zoneminder.systemctl.policy.in "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.policy" @ONLY) configure_file(com.zoneminder.systemctl.rules.in "${CMAKE_CURRENT_BINARY_DIR}/com.zoneminder.systemctl.rules" @ONLY) configure_file(zoneminder.service.in "${CMAKE_CURRENT_BINARY_DIR}/zoneminder.service" @ONLY) +configure_file(zoneminder-tmpfiles.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zoneminder-tmpfiles.conf" @ONLY) # Do not install the misc files by default #install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc") diff --git a/misc/Makefile.am b/misc/Makefile.am index 53fe3a780..c6a4c5e89 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST = \ apache.conf.in \ logrotate.conf.in \ syslog.conf.in \ + zoneminder-tmpfiles.conf.in \ zoneminder.service.in \ com.zoneminder.systemctl.policy.in \ com.zoneminder.systemctl.rules.in \ diff --git a/misc/zoneminder-tmpfiles.conf.in b/misc/zoneminder-tmpfiles.conf.in new file mode 100644 index 000000000..8f55ce295 --- /dev/null +++ b/misc/zoneminder-tmpfiles.conf.in @@ -0,0 +1 @@ +d @ZM_RUNDIR@ 0755 @WEB_USER@ @WEB_GROUP@ diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index ce01b0782..f7bd18540 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -148,9 +148,7 @@ MAIN: while( $loop ) { $db_events->{$event->{Id}} = $event->{Age}; } Debug( "Got ".int(keys(%$db_events))." events\n" ); - $eventSelectSth->finish(); } - $monitorSelectSth->finish(); my $fs_monitors; foreach my $monitor ( <[0-9]*> ) @@ -332,7 +330,6 @@ MAIN: while( $loop ) { $cleaned = 1; } } - $selectOrphanedEventsSth->finish(); redo MAIN if ( $cleaned ); # Remove empty events (with no frames) @@ -349,7 +346,6 @@ MAIN: while( $loop ) { $cleaned = 1; } } - $selectEmptyEventsSth->finish(); redo MAIN if ( $cleaned ); # Remove orphaned frame records @@ -366,7 +362,6 @@ MAIN: while( $loop ) { $cleaned = 1; } } - $selectOrphanedFramesSth->finish(); redo MAIN if ( $cleaned ); # Remove orphaned stats records @@ -383,7 +378,6 @@ MAIN: while( $loop ) { $cleaned = 1; } } - $selectOrphanedStatsSth->finish(); redo MAIN if ( $cleaned ); # New audit to close any events that were left open for longer than MIN_AGE seconds @@ -400,7 +394,6 @@ MAIN: while( $loop ) { $res = $updateUnclosedEventsSth->execute( sprintf( "%s%d%s", $event->{Prefix}, $event->{Id}, RECOVER_TAG ), $event->{EndTime}, $event->{Length}, $event->{Frames}, $event->{AlarmFrames}, $event->{TotScore}, $event->{AlarmFrames}?int($event->{TotScore}/$event->{AlarmFrames}):0, $event->{MaxScore}, RECOVER_TEXT, $event->{Id} ) or Fatal( "Can't execute: ".$updateUnclosedEventsSth->errstr() ); } } - $selectUnclosedEventsSth->finish(); # Now delete any old image files if ( my @old_files = grep { -M > $max_image_age } <$image_path/*.{jpg,gif,wbmp}> ) @@ -426,7 +419,6 @@ MAIN: while( $loop ) { $res = $selectLogRowCountSth->execute() or Fatal( "Can't execute: ".$selectLogRowCountSth->errstr() ); my $row = $selectLogRowCountSth->fetchrow_hashref(); my $logRows = $row->{Rows}; - $selectLogRowCountSth->finish(); if ( $logRows > $Config{ZM_LOG_DATABASE_LIMIT} ) { my $deleteLogByRowsSql = "delete low_priority from Logs order by TimeKey asc limit ?"; diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index ac5d7b6e0..e8f8d998f 100755 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -196,10 +196,11 @@ my $last_action = 0; while( 1 ) { - if ( (time() - $last_action) > $Config{ZM_FILTER_RELOAD_DELAY} ) + my $now = time; + if ( ($now - $last_action) > $Config{ZM_FILTER_RELOAD_DELAY} ) { Debug( "Reloading filters\n" ); - $last_action = time(); + $last_action = $now; $filters = getFilters( $filter_parm ); } @@ -632,7 +633,7 @@ sub checkFilter { if ( $delete_ok ) { - Info( "Deleting event $event->{Id}\n" ); + Info( "Deleting event $event->{Id} from Monitor $event->{MonitorId}\n" ); # Do it individually to avoid locking up the table for new events my $sql = "delete from Events where Id = ?"; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 934fa2143..dc33693c6 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -1122,6 +1122,7 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) { memset(&fmtinfo, 0, sizeof(fmtinfo)); fmtinfo.index = nIndex; fmtinfo.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + // FIXME This will crash if there are more than 64 formats. while(vidioctl( enum_fd, VIDIOC_ENUM_FMT, &fmtinfo ) >= 0) { /* Got a format. Copy it to the array */ strcpy(fmt_desc[nIndex], (const char*)(fmtinfo.description)); @@ -1137,7 +1138,7 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) { /* Select format */ int nIndexUsed = -1; - int n_preferedformats = 0; + unsigned int n_preferedformats = 0; const uint32_t* preferedformats; if(p_colours == ZM_COLOUR_RGB32) { /* 32bit */ @@ -1152,12 +1153,15 @@ uint32_t LocalCamera::AutoSelectFormat(int p_colours) { preferedformats = prefered_rgb24_formats; n_preferedformats = sizeof(prefered_rgb24_formats) / sizeof(uint32_t); } - for( unsigned int i=0; i < (unsigned int)n_preferedformats && nIndexUsed < 0; i++ ) { + for( unsigned int i=0; i < n_preferedformats && nIndexUsed < 0; i++ ) { for( unsigned int j=0; j < nIndex; j++ ) { if( preferedformats[i] == fmt_fcc[j] ) { + Debug(6, "Choosing format: %s (%c%c%c%c) at index %d",fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j); /* Found a format! */ nIndexUsed = j; break; + } else { + Debug(6, "No match for format: %s (%c%c%c%c) at index %d",fmt_desc[j],fmt_fcc[j]&0xff, (fmt_fcc[j]>>8)&0xff, (fmt_fcc[j]>>16)&0xff, (fmt_fcc[j]>>24)&0xff ,j); } } } diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index b2fce5a13..dac6a3f0c 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -4088,38 +4088,38 @@ void MonitorStream::runStream() temp_read_index = temp_image_buffer_count; temp_write_index = temp_image_buffer_count; - char swap_path[PATH_MAX] = ""; + char *swap_path = 0; bool buffered_playback = false; + int swap_path_length = strlen(config.path_swap)+1; // +1 for NULL terminator - if ( connkey && playback_buffer > 0 ) - { - Debug( 2, "Checking swap image location" ); - Debug( 3, "Checking swap image path" ); - strncpy( swap_path, config.path_swap, sizeof(swap_path) ); - if ( checkSwapPath( swap_path, false ) ) - { - snprintf( &(swap_path[strlen(swap_path)]), sizeof(swap_path)-strlen(swap_path), "/zmswap-m%d", monitor->Id() ); - if ( checkSwapPath( swap_path, true ) ) - { - snprintf( &(swap_path[strlen(swap_path)]), sizeof(swap_path)-strlen(swap_path), "/zmswap-q%06d", connkey ); - if ( checkSwapPath( swap_path, true ) ) - { - buffered_playback = true; - } - } - } + if ( connkey && playback_buffer > 0 ) { - if ( !buffered_playback ) - { - Error( "Unable to validate swap image path, disabling buffered playback" ); - } - else - { - Debug( 2, "Assigning temporary buffer" ); - temp_image_buffer = new SwapImage[temp_image_buffer_count]; - memset( temp_image_buffer, 0, sizeof(*temp_image_buffer)*temp_image_buffer_count ); - Debug( 2, "Assigned temporary buffer" ); - } + if ( swap_path_length + 15 > PATH_MAX ) { + // 15 is for /zmswap-whatever, assuming max 6 digits for monitor id + Error( "Swap Path is too long. %d > %d ", swap_path_length+15, PATH_MAX ); + } else { + swap_path = (char *)malloc( swap_path_length+15 ); + Debug( 3, "Checking swap image path %s", config.path_swap ); + strncpy( swap_path, config.path_swap, swap_path_length ); + if ( checkSwapPath( swap_path, false ) ) { + snprintf( &(swap_path[swap_path_length]), sizeof(swap_path)-swap_path_length, "/zmswap-m%d", monitor->Id() ); + if ( checkSwapPath( swap_path, true ) ) { + snprintf( &(swap_path[swap_path_length]), sizeof(swap_path)-swap_path_length, "/zmswap-q%06d", connkey ); + if ( checkSwapPath( swap_path, true ) ) { + buffered_playback = true; + } + } + } + + if ( !buffered_playback ) { + Error( "Unable to validate swap image path, disabling buffered playback" ); + } else { + Debug( 2, "Assigning temporary buffer" ); + temp_image_buffer = new SwapImage[temp_image_buffer_count]; + memset( temp_image_buffer, 0, sizeof(*temp_image_buffer)*temp_image_buffer_count ); + Debug( 2, "Assigned temporary buffer" ); + } + } } float max_secs_since_last_sent_frame = 10.0; //should be > keep alive amount (5 secs) @@ -4357,6 +4357,7 @@ void MonitorStream::runStream() } } } + if ( swap_path ) free( swap_path ); closeComms(); } diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp index 60bb22c1d..2e29880ca 100644 --- a/src/zm_mpeg.cpp +++ b/src/zm_mpeg.cpp @@ -391,6 +391,9 @@ void VideoStream::OpenStream( ) // TODO: Make buffer dynamic. video_outbuf_size = 4000000; video_outbuf = (uint8_t *)malloc( video_outbuf_size ); + if ( video_outbuf == NULL ) { + Fatal("Unable to malloc memory for outbuf"); + } } #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 100, 1) @@ -419,6 +422,7 @@ VideoStream::VideoStream( const char *in_filename, const char *in_format, int bi do_streaming(true), buffer_copy(NULL), buffer_copy_lock(new pthread_mutex_t), + buffer_copy_size(0), buffer_copy_used(0), packet_index(0) { diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 3f518b1c2..fdbfd69a6 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -217,7 +217,7 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected ) } while ( total_bytes_to_read ); - Debug( 3, buffer ); + Debug( 4, buffer ); return( total_bytes_read ); } @@ -446,6 +446,13 @@ int RemoteCameraHttp::GetResponse() } case CONTENT : { + + // if content_type is something like image/jpeg;size=, this will strip the ;size= + char * semicolon = strchr( (char *)content_type, ';' ); + if ( semicolon ) { + *semicolon = '\0'; + } + if ( !strcasecmp( content_type, "image/jpeg" ) || !strcasecmp( content_type, "image/jpg" ) ) { format = JPEG; @@ -1010,7 +1017,14 @@ int RemoteCameraHttp::GetResponse() } case CONTENT : { - if ( !strcasecmp( content_type, "image/jpeg" ) || !strcasecmp( content_type, "image/jpg" ) ) + + // if content_type is something like image/jpeg;size=, this will strip the ;size= + char * semicolon = strchr( content_type, ';' ); + if ( semicolon ) { + *semicolon = '\0'; + } + + if ( !strcasecmp( content_type, "image/jpeg" ) || !strcasecmp( content_type, "image/jpg" ) ) { format = JPEG; } diff --git a/src/zm_rtp_ctrl.cpp b/src/zm_rtp_ctrl.cpp index 80495fa85..1a0604137 100644 --- a/src/zm_rtp_ctrl.cpp +++ b/src/zm_rtp_ctrl.cpp @@ -298,35 +298,42 @@ int RtpCtrlThread::run() sendReports = true; } + // The only reason I can think of why we would have a timeout period is so that we can regularly send RR packets. + // Why 10 seconds? If anything I think this should be whatever timeout value was given in the DESCRIBE response Select select( 10 ); select.addReader( &rtpCtrlServer ); unsigned char buffer[ZM_NETWORK_BUFSIZ]; + time_t last_receive = time(NULL); bool timeout = false; // used as a flag that we had a timeout, and then sent an RR to see if we wake back up. Real timeout will happen when this is true. - while ( !mStop && select.wait() >= 0 ) - { - if ( mStop ) - break; + while ( !mStop && select.wait() >= 0 ) { + + time_t now = time(NULL); Select::CommsList readable = select.getReadable(); if ( readable.size() == 0 ) { if ( ! timeout ) { + // With this code here, we will send an SDES and RR packet every 10 seconds ssize_t nBytes; unsigned char *bufferPtr = buffer; bufferPtr += generateRr( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) ); bufferPtr += generateSdes( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) ); - Debug( 4, "Sending %zd bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() ); - Debug( 5, "Sending %s", buffer ); + Debug( 3, "Preventing timeout by sending %zd bytes on sd %d. Time since last receive: %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc(), ( now-last_receive) ); if ( (nBytes = rtpCtrlServer.send( buffer, bufferPtr-buffer )) < 0 ) Error( "Unable to send: %s", strerror( errno ) ); timeout = true; continue; } else { - Error( "RTCP timed out" ); - break; + //Error( "RTCP timed out" ); + Debug(1, "RTCP timed out. Time since last receive: %d", ( now-last_receive) ); + continue; + //break; } + } else { + timeout = false; + last_receive = time(NULL); } for ( Select::CommsList::iterator iter = readable.begin(); iter != readable.end(); iter++ ) { @@ -344,14 +351,13 @@ int RtpCtrlThread::run() unsigned char *bufferPtr = buffer; bufferPtr += generateRr( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) ); bufferPtr += generateSdes( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) ); - Debug( 4, "Sending %zd bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() ); + Debug( 3, "Sending %zd bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() ); if ( (nBytes = rtpCtrlServer.send( buffer, bufferPtr-buffer )) < 0 ) Error( "Unable to send: %s", strerror( errno ) ); //Debug( 4, "Sent %d bytes on sd %d", nBytes, rtpCtrlServer.getWriteDesc() ); } - } - else - { + } else { + // Here is another case of not receiving some data causing us to terminate... why? Sometimes there are pauses in the interwebs. mStop = true; break; } diff --git a/src/zm_rtsp_auth.cpp b/src/zm_rtsp_auth.cpp index b082ace01..fd9087afa 100644 --- a/src/zm_rtsp_auth.cpp +++ b/src/zm_rtsp_auth.cpp @@ -114,9 +114,10 @@ std::string Authenticator::getAuthHeader(std::string method, std::string uri) if ( ! fQop.empty() ) { result += ", qop=" + fQop; result += ", nc=" + stringtf("%08x",nc); - result += ", cnonce=" + fCnonce; + result += ", cnonce=\"" + fCnonce + "\""; } result += ", response=\"" + computeDigestResponse(method, uri) + "\""; + result += ", algorithm=\"MD5\""; //Authorization: Digest username="zm", // realm="NC-336PW-HD-1080P", diff --git a/web/includes/actions.php b/web/includes/actions.php index 340d4ebcc..2f23e0d59 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -260,8 +260,7 @@ if ( !empty($action) ) $monitor = dbFetchOne( "SELECT * FROM Monitors WHERE Id=?", NULL, array($mid) ); $newFunction = validStr($_REQUEST['newFunction']); - $newEnabled = validStr($_REQUEST['newEnabled']); - if ($newEnabled != "1") $newEnabled = "0"; + $newEnabled = isset( $_REQUEST['newEnabled'] ) and $_REQUEST['newEnabled'] != "1" ? "0" : "1"; $oldFunction = $monitor['Function']; $oldEnabled = $monitor['Enabled']; if ( $newFunction != $oldFunction || $newEnabled != $oldEnabled ) @@ -579,9 +578,10 @@ if ( !empty($action) ) // well time out before completing, in which case zmaudit will still tidy up if ( !ZM_OPT_FAST_DELETE ) { - $markEids = dbFetchAll( "select Id from Events where MonitorId=?", 'Id', array($markMid) ); + // Slight hack, we maybe should load *, but we happen to know that the deleteEvent function uses Id and StartTime. + $markEids = dbFetchAll( "SELECT Id,StartTime FROM Events WHERE MonitorId=?", NULL, array($markMid) ); foreach( $markEids as $markEid ) - deleteEvent( $markEid ); + deleteEvent( $markEid, $markMid ); deletePath( ZM_DIR_EVENTS."/".basename($monitor['Name']) ); deletePath( ZM_DIR_EVENTS."/".$monitor['Id'] ); // I'm trusting the Id. diff --git a/web/includes/functions.php b/web/includes/functions.php index a521b52c1..44b60e5c7 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -507,42 +507,59 @@ function deletePath( $path ) } } -function deleteEvent( $eid, $mid=false ) -{ +function deleteEvent( $event, $mid=false ) { + + if ( empty($event) ) { + Error( "Empty event passed to deleteEvent."); + return; + } + + if ( gettype($event) != 'array' ) { + # $event could be an eid, so turn it into an event hash + $event = dbFetchOne( 'SELECT Id, MonitorId, StartTime FROM Events WHERE Id=?', NULL, array( $event ) ); + } + global $user; if ( !$mid ) - $mid = '*'; - if ( $user['Events'] == 'Edit' && !empty($eid) ) - { - dbQuery( 'delete from Events where Id = ?', array($eid) ); - if ( !ZM_OPT_FAST_DELETE ) - { - dbQuery( 'delete from Stats where EventId = ?', array($eid) ); - dbQuery( 'delete from Frames where EventId = ?', array($eid) ); - if ( ZM_USE_DEEP_STORAGE ) - { - if ( $id_files = glob( ZM_DIR_EVENTS.'/'.$mid.'/*/*/*/.'.$eid ) ) - $eventPath = preg_replace( "/\.$eid$/", readlink($id_files[0]), $id_files[0] ); + $mid = $event['MonitorId']; + + if ( $user['Events'] == 'Edit' ) { + + dbQuery( 'DELETE FROM Events WHERE Id = ?', array($event['Id']) ); + if ( !ZM_OPT_FAST_DELETE ) { + dbQuery( 'DELETE FROM Stats WHERE EventId = ?', array($event['Id']) ); + dbQuery( 'DELETE FROM Frames WHERE EventId = ?', array($event['Id']) ); + if ( ZM_USE_DEEP_STORAGE ) { + + # Assumption: All events haev a start time + $start_date = date_parse( $event['StartTime'] ); + $start_date['year'] = $start_date['year'] % 100; + + # So this is because ZM creates a link under teh day pointing to the time that the event happened. + $eventlink_path = sprintf('%s/%d/%02d/%02d/%02d/.%d', ZM_DIR_EVENTS, $mid, $start_date['year'], $start_date['month'], $start_date['day'], $event['Id'] ); + + if ( $id_files = glob( $eventlink_path ) ) { + # I know we are using arrays here, but really there can only ever be 1 in the array + $eventPath = preg_replace( '/\.'.$event['Id'].'$/', readlink($id_files[0]), $id_files[0] ); + deletePath( $eventPath ); + deletePath( $id_files[0] ); + $pathParts = explode( '/', $eventPath ); + for ( $i = count($pathParts)-1; $i >= 2; $i-- ) { + $deletePath = join( '/', array_slice( $pathParts, 0, $i ) ); + if ( !glob( $deletePath."/*" ) ) { + deletePath( $deletePath ); + } + } + } else { + Warning( "Found no event files under $eventlink_path" ); + } # end if found files + } else { + $eventPath = implode( '/', array( ZM_DIR_EVENTS, $mid, $event['Id'] ) ); deletePath( $eventPath ); - deletePath( $id_files[0] ); - $pathParts = explode( '/', $eventPath ); - for ( $i = count($pathParts)-1; $i >= 2; $i-- ) - { - $deletePath = join( '/', array_slice( $pathParts, 0, $i ) ); - if ( !glob( $deletePath."/*" ) ) - { - deletePath( $deletePath ); - } - } - } - else - { - $eventPath = ZM_DIR_EVENTS.'/'.$mid.'/'.$eid; - deletePath( $eventPath ); - } - } - } + } # USE_DEEP_STORAGE OR NOT + } # ! ZM_OPT_FAST_DELETE + } # CAN EDIT } function makeLink( $url, $label, $condition=1, $options="" ) diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index 2010a2f8e..fe8f06787 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -212,6 +212,7 @@ $SLANG = array( 'CanZoomRel' => 'Can Zoom Relative', 'CaptureHeight' => 'Capture Height', 'CaptureMethod' => 'Capture Method', + 'CaptureResolution' => 'Capture Resolution', 'CapturePalette' => 'Capture Palette', 'CaptureWidth' => 'Capture Width', 'Cause' => 'Cause', diff --git a/web/skins/classic/css/flat/skin.css b/web/skins/classic/css/flat/skin.css index b627fb8d0..4824e15ad 100644 --- a/web/skins/classic/css/flat/skin.css +++ b/web/skins/classic/css/flat/skin.css @@ -382,7 +382,6 @@ th.table-th-sort-rev span.table-th-sort-span { font-size:0.8em; } #headerControl { - width: 50%; text-align: center; margin: 0 auto; } diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 3320857ba..024cb18d7 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -314,6 +314,9 @@ foreach( $displayMonitors as $monitor ) '.$shortpath.'', canEdit( 'Monitors' ) ) ?> diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index b8ea83aa6..fe4559201 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -113,7 +113,7 @@ function Monitor( index, id, connKey ) function selectLayout( element ) { - var cssFile = skinPath+'/views/css/'+$(element).get('value'); + var cssFile = skinPath+'/css/'+Cookie.read('zmCSS')+'/views/'+$(element).get('value'); if ( $('dynamicStyles') ) $('dynamicStyles').destroy(); new Asset.css( cssFile, { id: 'dynamicStyles' } ); diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 4f69c1d1c..f8a8a9554 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -98,8 +98,8 @@ if ( $showControl )

- : - + : +