Source: zoneminder
Version: 1.34.21-1
Severity: important
tags: patch
Hello, Ubuntu people crafted a patch that is now part of upstream git
repository, to make the package compatible
with mysql8, bu correctly escaping some "Function" references.
Can you please consider applying it?
Also, there are some README additions/fixes that should be incorporated (or
changed, because referencing a specific php version
breaks each time php bumps its default)
zoneminder (1.34.16-3) UNRELEASED; urgency=medium
[ Joseph Yasi, Gianfranco Costamagna, Andreas Hasenack
* Import Ubuntu delta (Closes: #-1)
* MySQL8 runtime fixes (LP: #1859295):
- d/p/mysql8-reserved-keywords.patch: quote MySQL8 reserved keywords
* d/README.Debian: quick update for MySQL8 and Focal
-- Gianfranco Costamagna <[email protected]> Mon, 13 Jul 2020 09:18:51
+0200
The full patch is here:
http://launchpadlibrarian.net/498944033/zoneminder_1.34.21-1_1.34.21-1ubuntu1.diff.gz
and attached a version without the changelog entries.
Please consider moving the lines
/etc/php/7.4/fpm/php.ini
/etc/php/7.4/apache2/php.ini
into something more "versionless", even if I'm unsure about a way to do it...
maybe using *?
thanks
Gianfranco
diff -pruN 1.34.16-2/debian/patches/mysql8-reserved-keywords.patch 1.34.16-2ubuntu1/debian/patches/mysql8-reserved-keywords.patch
--- 1.34.16-2/debian/patches/mysql8-reserved-keywords.patch 1970-01-01 00:00:00.000000000 +0000
+++ 1.34.16-2ubuntu1/debian/patches/mysql8-reserved-keywords.patch 2020-07-10 20:31:12.000000000 +0000
@@ -0,0 +1,63 @@
+Description: Quote MySQL8 reserved keywords
+Author: Joseph Yasi <[email protected]>
+Origin: other, https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/1859295/comments/1
+Bug: https://github.com/ZoneMinder/zoneminder/issues/2659
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/1859295
+Last-Update: 2020-02-21
+
+--- zoneminder-1.34.16.orig/scripts/ZoneMinder/lib/ZoneMinder/Database.pm
++++ zoneminder-1.34.16/scripts/ZoneMinder/lib/ZoneMinder/Database.pm
+@@ -146,15 +146,15 @@ sub zmDbGetMonitors {
+
+ if ( $function ) {
+ if ( $function == DB_MON_CAPT ) {
+- $sql .= " where Function >= 'Monitor'";
++ $sql .= " where `Function` >= 'Monitor'";
+ } elsif ( $function == DB_MON_ACTIVE ) {
+- $sql .= " where Function > 'Monitor'";
++ $sql .= " where `Function` > 'Monitor'";
+ } elsif ( $function == DB_MON_MOTION ) {
+- $sql .= " where Function = 'Modect' or Function = 'Mocord'";
++ $sql .= " where `Function` = 'Modect' or Function = 'Mocord'";
+ } elsif ( $function == DB_MON_RECORD ) {
+- $sql .= " where Function = 'Record' or Function = 'Mocord'";
++ $sql .= " where `Function` = 'Record' or Function = 'Mocord'";
+ } elsif ( $function == DB_MON_PASSIVE ) {
+- $sql .= " where Function = 'Nodect'";
++ $sql .= " where `Function` = 'Nodect'";
+ }
+ }
+ my $sth = $dbh->prepare_cached( $sql );
+--- zoneminder-1.34.16.orig/src/zm_rtsp.cpp
++++ zoneminder-1.34.16/src/zm_rtsp.cpp
+@@ -94,7 +94,7 @@ int RtspThread::requestPorts() {
+ if ( !smMinDataPort ) {
+ char sql[ZM_SQL_SML_BUFSIZ];
+ //FIXME Why not load specifically by Id? This will get ineffeicient with a lot of monitors
+- strncpy( sql, "select Id from Monitors where Function != 'None' and Type = 'Remote' and Protocol = 'rtsp' and Method = 'rtpUni' order by Id asc", sizeof(sql) );
++ strncpy( sql, "select Id from Monitors where `Function` != 'None' and Type = 'Remote' and Protocol = 'rtsp' and Method = 'rtpUni' order by Id asc", sizeof(sql) );
+ if ( mysql_query( &dbconn, sql ) ) {
+ Error( "Can't run query: %s", mysql_error( &dbconn ) );
+ exit( mysql_errno( &dbconn ) );
+--- zoneminder-1.34.16.orig/utils/zm-alarm.pl
++++ zoneminder-1.34.16/utils/zm-alarm.pl
+@@ -16,7 +16,7 @@ my @monitors;
+ my $dbh = zmDbConnect();
+
+ my $sql = "SELECT * FROM Monitors
+- WHERE find_in_set( Function, 'Modect,Mocord,Nodect' )".
++ WHERE find_in_set( `Function`, 'Modect,Mocord,Nodect' )".
+ ( $Config{ZM_SERVER_ID} ? 'AND ServerId=?' : '' )
+ ;
+
+--- zoneminder-1.34.16.orig/web/ajax/status.php
++++ zoneminder-1.34.16/web/ajax/status.php
+@@ -19,7 +19,7 @@ $statusData = array(
+ 'limit' => 1,
+ 'elements' => array(
+ 'MonitorCount' => array( 'sql' => 'count(*)' ),
+- 'ActiveMonitorCount' => array( 'sql' => 'count(if(Function != \'None\',1,NULL))' ),
++ 'ActiveMonitorCount' => array( 'sql' => 'count(if(`Function` != \'None\',1,NULL))' ),
+ 'State' => array( 'func' => 'daemonCheck()?'.translate('Running').':'.translate('Stopped') ),
+ 'Load' => array( 'func' => 'getLoad()' ),
+ 'Disk' => array( 'func' => 'getDiskPercent()' ),
diff -pruN 1.34.16-2/debian/patches/series 1.34.16-2ubuntu1/debian/patches/series
--- 1.34.16-2/debian/patches/series 2020-03-11 01:53:42.000000000 +0000
+++ 1.34.16-2ubuntu1/debian/patches/series 2020-07-10 20:30:45.000000000 +0000
@@ -6,3 +6,4 @@
0009-Allow-generation-of-random-seeds-on-install-time-not.patch
0010-Use-mootools-shipped-by-debian-rather-than-the-zonem.patch
include_path.patch
+mysql8-reserved-keywords.patch
diff -pruN 1.34.16-2/debian/README.Debian 1.34.16-2ubuntu1/debian/README.Debian
--- 1.34.16-2/debian/README.Debian 2020-03-11 01:53:42.000000000 +0000
+++ 1.34.16-2ubuntu1/debian/README.Debian 2020-07-10 17:54:40.000000000 +0000
@@ -11,6 +11,13 @@ OR
echo 'grant lock tables,alter,create,select,insert,update,delete,index on zm.* to 'zmuser'@localhost identified by "zmpass";'\
| sudo mysql --defaults-file=/etc/mysql/debian.cnf mysql
+With MySQL8:
+
+ echo "CREATE USER 'zmuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zmpass';"\
+ | sudo mysql --defaults-file=/etc/mysql/debian.cnf
+ echo 'grant lock tables,alter,create,select,insert,update,delete,index on zm.* to 'zmuser'@localhost;'\
+ | sudo mysql --defaults-file=/etc/mysql/debian.cnf
+
Hint: generate secure password with `pwgen` and update "/etc/zm/zm.conf"
accordingly.
@@ -128,8 +135,8 @@ System time zone can be set by the follo
PHP time zone can be configured by changing value of "date.timezone" in one
of the following files:
- /etc/php/7.3/fpm/php.ini
- /etc/php/7.3/apache2/php.ini
+ /etc/php/7.4/fpm/php.ini
+ /etc/php/7.4/apache2/php.ini
Please note that MariaDB/MySQL time zone should be identical to system and
PHP time zones. By default MariaDB uses system time zone but it might be