mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-18 19:46:12 -04:00
Removed secondary DB user.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1171 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
@@ -51,10 +51,8 @@ BEGIN
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' )
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' )
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -63,7 +61,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -161,7 +159,7 @@ if ( $report && $yes )
|
||||
usage();
|
||||
}
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
chdir( EVENT_PATH );
|
||||
if ( $delay ) # Background mode
|
||||
|
||||
@@ -45,16 +45,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -63,7 +61,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
||||
@@ -43,16 +43,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -61,7 +59,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -192,7 +190,7 @@ select( LOG ); $| = 1;
|
||||
|
||||
chdir( EVENT_PATH );
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
print( "Scanning for events\n" );
|
||||
|
||||
|
||||
@@ -50,10 +50,8 @@ BEGIN
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -62,7 +60,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -94,7 +92,7 @@ my $command = $ARGV[0];
|
||||
|
||||
my $state;
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
if ( !$command || $command !~ /^(?:start|stop|restart|status)$/ )
|
||||
{
|
||||
|
||||
@@ -44,16 +44,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -62,7 +60,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -102,8 +100,8 @@ my $check = 0;
|
||||
my $rename = 0;
|
||||
my $zone_fix = 0;
|
||||
my $version = '';
|
||||
my $db_user = ZM_DB_USERA;
|
||||
my $db_pass = ZM_DB_PASSA;
|
||||
my $db_user = ZM_DB_USER;
|
||||
my $db_pass = ZM_DB_PASS;
|
||||
sub Usage
|
||||
{
|
||||
print( "
|
||||
@@ -148,7 +146,7 @@ if ( $check )
|
||||
|
||||
print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
if ( $check && ZM_CHECK_FOR_UPDATES )
|
||||
{
|
||||
@@ -236,7 +234,7 @@ if ( $zone_fix )
|
||||
{
|
||||
require DBI;
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
my $sql = "select Z.*, M.Width as MonitorWidth, M.Height as MonitorHeight from Zones as Z inner join Monitors as M on Z.MonitorId = M.Id where Z.Units = 'Percent'";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -341,7 +339,7 @@ if ( $version )
|
||||
# Rename the event directories and create a new symlink for the names
|
||||
chdir( EVENT_PATH );
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Monitors order by Id";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
||||
@@ -42,16 +42,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -60,7 +58,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERB, &ZM_DB_PASSB );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -159,7 +157,7 @@ open( STDERR, ">&LOG" ) || die( "Can't dup stderr: $!" );
|
||||
select( STDERR ); $| = 1;
|
||||
select( LOG ); $| = 1;
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERB, ZM_DB_PASSB );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
my @filters;
|
||||
my $sql = "select max(F.Delta)-min(F.Delta) as FullLength, E.*, M.Name as MonitorName, M.Width as MonitorWidth, M.Height as MonitorHeight, M.Palette from Frames as F inner join Events as E on F.EventId = E.Id inner join Monitors as M on E.MonitorId = M.Id where EventId = '$event_id' group by F.EventId";
|
||||
|
||||
@@ -41,16 +41,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -59,7 +57,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -111,7 +109,7 @@ print( "Watchdog starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n"
|
||||
print( "Watchdog pausing for ".START_DELAY." seconds\n" );
|
||||
sleep( START_DELAY );
|
||||
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Monitors";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
||||
@@ -40,16 +40,14 @@ BEGIN
|
||||
open( CONFIG, "<".ZM_CONFIG ) or die( "Can't open config file: $!" );
|
||||
foreach my $str ( <CONFIG> )
|
||||
{
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
next if ( $str =~ /^\s*$/ );
|
||||
next if ( $str =~ /^\s*#/ );
|
||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*([^=\s]+)\s*$/;
|
||||
$name =~ tr/a-z/A-Z/;
|
||||
if (( $name eq 'ZM_DB_SERVER' ) ||
|
||||
( $name eq 'ZM_DB_NAME' ) ||
|
||||
( $name eq 'ZM_DB_USERA' ) ||
|
||||
( $name eq 'ZM_DB_PASSA' ) ||
|
||||
( $name eq 'ZM_DB_USERB' ) ||
|
||||
( $name eq 'ZM_DB_PASSB' ))
|
||||
( $name eq 'ZM_DB_USER' ) ||
|
||||
( $name eq 'ZM_DB_PASS' ))
|
||||
{
|
||||
*{$name} = sub { $value };
|
||||
}
|
||||
@@ -58,7 +56,7 @@ BEGIN
|
||||
|
||||
use DBI;
|
||||
no strict 'refs';
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USERA, &ZM_DB_PASSA );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
|
||||
|
||||
my $sql = "select * from Config";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
@@ -206,7 +204,7 @@ sub runServer
|
||||
bind( SERVER, $saddr ) or die( "Can't bind: $!" );
|
||||
listen( SERVER, SOMAXCONN ) or die( "Can't listen: $!" );
|
||||
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".main::ZM_DB_NAME.";host=".main::ZM_DB_SERVER, main::ZM_DB_USERA, main::ZM_DB_PASSA );
|
||||
$dbh = DBI->connect( "DBI:mysql:database=".main::ZM_DB_NAME.";host=".main::ZM_DB_SERVER, main::ZM_DB_USER, main::ZM_DB_PASS );
|
||||
|
||||
$x10 = new X10::ActiveHome( port=>main::ZM_X10_DEVICE, house_code=>main::ZM_X10_HOUSE_CODE, debug=>1 );
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "zm_db.h"
|
||||
#include "zm_regexp.h"
|
||||
|
||||
char *ZM_DB_SERVER="", *ZM_DB_NAME="", *ZM_DB_USERA="", *ZM_DB_PASSA="", *ZM_DB_USERB="", *ZM_DB_PASSB="";
|
||||
char *ZM_DB_SERVER="", *ZM_DB_NAME="", *ZM_DB_USER="", *ZM_DB_PASS="";
|
||||
|
||||
void zmLoadConfig()
|
||||
{
|
||||
@@ -52,10 +52,8 @@ void zmLoadConfig()
|
||||
strncpy( val, keyval->MatchString( 2 ), keyval->MatchLength( 2 ));
|
||||
if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_SERVER" ) == 0 ) ZM_DB_SERVER = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_NAME" ) == 0 ) ZM_DB_NAME = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_USERA" ) == 0 ) ZM_DB_USERA = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_PASSA" ) == 0 ) ZM_DB_PASSA = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_USERB" ) == 0 ) ZM_DB_USERB = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_PASSB" ) == 0 ) ZM_DB_PASSB = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_USER" ) == 0 ) ZM_DB_USER = val;
|
||||
else if (strcasecmp( keyval->MatchString( 1 ), "ZM_DB_PASS" ) == 0 ) ZM_DB_PASS = val;
|
||||
else
|
||||
{
|
||||
Warning(( "Invalid parameter \"%s\" in %s", keyval->MatchString( 1 ), ZM_CONFIG ));
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define ZM_MAX_FPS 30 // The maximum frame rate we expect to handle
|
||||
#define ZM_SAMPLE_RATE int(1000000/ZM_MAX_FPS) // A general nyquist sample frequency for delays etc
|
||||
|
||||
extern char *ZM_DB_SERVER, *ZM_DB_NAME, *ZM_DB_USERA, *ZM_DB_PASSA, *ZM_DB_USERB, *ZM_DB_PASSB;
|
||||
extern char *ZM_DB_SERVER, *ZM_DB_NAME, *ZM_DB_USER, *ZM_DB_PASS;
|
||||
extern void zmLoadConfig();
|
||||
|
||||
class ConfigItem
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
|
||||
MYSQL dbconn;
|
||||
|
||||
void zmDbConnect( const char *user, const char*pass )
|
||||
void zmDbConnect()
|
||||
{
|
||||
if ( !mysql_init( &dbconn ) )
|
||||
{
|
||||
Error(( "Can't initialise structure: %s", mysql_error( &dbconn ) ));
|
||||
exit( mysql_errno( &dbconn ) );
|
||||
}
|
||||
if ( !mysql_real_connect( &dbconn, ZM_DB_SERVER, user, pass, 0, 0, 0, 0 ) )
|
||||
if ( !mysql_real_connect( &dbconn, ZM_DB_SERVER, ZM_DB_USER, ZM_DB_PASS, 0, 0, 0, 0 ) )
|
||||
{
|
||||
Error(( "Can't connect to server: %s", mysql_error( &dbconn ) ));
|
||||
exit( mysql_errno( &dbconn ) );
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
extern MYSQL dbconn;
|
||||
|
||||
void zmDbConnect( const char *user, const char*pass );
|
||||
void zmDbConnect();
|
||||
|
||||
#endif // ZM_DB_H
|
||||
|
||||
@@ -128,7 +128,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
zmLoadConfig();
|
||||
|
||||
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
||||
zmDbConnect();
|
||||
|
||||
Monitor *monitor = Monitor::Load( id, true, Monitor::ANALYSIS );
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
zmLoadConfig();
|
||||
|
||||
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
||||
zmDbConnect();
|
||||
|
||||
Monitor **monitors = 0;
|
||||
int n_monitors = 0;
|
||||
|
||||
@@ -195,7 +195,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
zmLoadConfig();
|
||||
|
||||
zmDbConnect( ZM_DB_USERB, ZM_DB_PASSB );
|
||||
zmDbConnect();
|
||||
|
||||
Monitor *monitor = Monitor::Load( id, false );
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ int main( int argc, char *argv[] )
|
||||
else
|
||||
{
|
||||
// Only do registered devices
|
||||
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
||||
zmDbConnect();
|
||||
|
||||
static char sql[BUFSIZ];
|
||||
//snprintf( sql, sizeof(sql), "select distinct Device from Monitors where Function != 'None' and Type = 'Local'" );
|
||||
|
||||
@@ -92,7 +92,7 @@ int main( int argc, const char *argv[] )
|
||||
}
|
||||
}
|
||||
|
||||
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
|
||||
zmDbConnect();
|
||||
|
||||
setbuf( stdout, 0 );
|
||||
if ( nph )
|
||||
|
||||
@@ -353,7 +353,7 @@ int main( int argc, char *argv[] )
|
||||
zmDbgInit();
|
||||
|
||||
zmLoadConfig();
|
||||
zmDbConnect( ZM_DB_USERB, ZM_DB_PASSB );
|
||||
zmDbConnect();
|
||||
|
||||
ValidateAccess( username, password, mon_id, function );
|
||||
|
||||
|
||||
@@ -27,29 +27,26 @@ define( "ZM_PATH_WEB", "<from zmconfig>" ); // Path to web files
|
||||
define( "ZM_PATH_CGI", "<from zmconfig>" ); // Path to cgi files
|
||||
|
||||
$cfg = fopen( ZM_CONFIG, "r") or die("Could not open config file.");
|
||||
while ( !feof($cfg) ) {
|
||||
$str = fgets( $cfg );
|
||||
if ( preg_match( '/^\s*$/', $str )) { continue; }
|
||||
elseif ( preg_match( '/^\s*#/', $str )) { continue; }
|
||||
elseif ( preg_match( '/^\s*([^=\s+)\s*=\s*([^=\s+)\s*$/', $str, $matches ))
|
||||
{
|
||||
while ( !feof($cfg) )
|
||||
{
|
||||
$str = fgets( $cfg );
|
||||
if ( preg_match( '/^\s*$/', $str )) { continue; }
|
||||
elseif ( preg_match( '/^\s*#/', $str )) { continue; }
|
||||
elseif ( preg_match( '/^\s*([^=\s+)\s*=\s*([^=\s+)\s*$/', $str, $matches ))
|
||||
{
|
||||
if (( $matches[1] == "ZM_DB_SERVER") ||
|
||||
( $matches[1] == "ZM_DB_NAME") ||
|
||||
( $matches[1] == "ZM_DB_USERA") ||
|
||||
( $matches[1] == "ZM_DB_PASSA") ||
|
||||
( $matches[1] == "ZM_DB_USERB") ||
|
||||
( $matches[1] == "ZM_DB_PASSB"))
|
||||
( $matches[1] == "ZM_DB_USER") ||
|
||||
( $matches[1] == "ZM_DB_PASS"))
|
||||
{
|
||||
define( $matches[1], $matches[2] );
|
||||
define( $matches[1], $matches[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose( $cfg );
|
||||
|
||||
// This section is options normally derived from other options or configuration
|
||||
//
|
||||
define( "ZM_DB_USER", ZM_DB_USERA ); // Database login
|
||||
define( "ZM_DB_PASS", ZM_DB_PASSA ); // Database password
|
||||
define( "ZMU_PATH", ZM_PATH_BIN."/zmu" ); // Local path to the ZoneMinder Utility
|
||||
|
||||
// These are miscellaneous options you won't normally need to change
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# ZoneMinder config
|
||||
|
||||
ZM_DB_SERVER=<from zmconfig>
|
||||
ZM_DB_NAME=<from zmconfig>
|
||||
ZM_DB_USERA=<from zmconfig>
|
||||
ZM_DB_PASSA=<from zmconfig>
|
||||
ZM_DB_USERB=<from zmconfig>
|
||||
ZM_DB_PASSB=<from zmconfig>
|
||||
ZM_DB_USER=<from zmconfig>
|
||||
ZM_DB_PASS=<from zmconfig>
|
||||
|
||||
@@ -181,34 +181,18 @@ my @options =
|
||||
category => 'core',
|
||||
},
|
||||
{
|
||||
name => "ZM_DB_USERA",
|
||||
name => "ZM_DB_USER",
|
||||
default => "",
|
||||
description => "Privileged DB user name, needs at least select, insert, update and delete privileges",
|
||||
help => "This is the username of a MySQL user that has full privileges to select, insert, update and delete data from your ZoneMinder database. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select,insert,update,delete on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
description => "DB user name, needs at least select, insert, update and delete privileges",
|
||||
help => "This is the username of the MySQL user that has privileges to select, insert, update and delete data from your ZoneMinder database. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select,insert,update,delete on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
type => $types{alphanum},
|
||||
category => 'core',
|
||||
},
|
||||
{
|
||||
name => "ZM_DB_PASSA",
|
||||
name => "ZM_DB_PASS",
|
||||
default => "",
|
||||
description => "Privileged DB user password",
|
||||
help => "This is the password of a MySQL user that has full privileges to select, insert, update and delete data from your ZoneMinder database. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select,insert,update,delete on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
type => $types{alphanum},
|
||||
category => 'core',
|
||||
},
|
||||
{
|
||||
name => "ZM_DB_USERB",
|
||||
default => "",
|
||||
description => "Unprivileged DB user name, need just select privilege.",
|
||||
help => "This is the username of a MySQL user that has only privileges to select data from your ZoneMinder database and is used in cgi programs where full access is neither necessary or desiarable. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
type => $types{alphanum},
|
||||
category => 'core',
|
||||
},
|
||||
{
|
||||
name => "ZM_DB_PASSB",
|
||||
default => "",
|
||||
description => "Unprivileged DB user password",
|
||||
help => "This is the password of a MySQL user that has only privileges to select data from your ZoneMinder database and is used in cgi programs where full access is neither necessary or desiarable. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
description => "DB user password",
|
||||
help => "This is the password of the MySQL user that has privileges to select, insert, update and delete data from your ZoneMinder database. If you have no user available yet you can create one by typing 'mysql mysql' with additional parameters as required to give you access. Then at the prompt type 'grant select,insert,update,delete on <your database name>.* to '<your username>' identified by '<your password>';'. Then type 'quit' to exit. You may also need to type 'mysqladmin reload' to ensure your changes take effect. Note that the username and passwords used here are not related to your Linux login or accounts and should not be the same.",
|
||||
type => $types{alphanum},
|
||||
category => 'core',
|
||||
},
|
||||
@@ -1485,7 +1469,7 @@ sub saveOptionsToFile
|
||||
sub saveOptionsToDB
|
||||
{
|
||||
print( "Saving config to DB\n" );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$options_hash{ZM_DB_NAME}->{value}.";host=".$options_hash{ZM_DB_SERVER}->{value}, $options_hash{ZM_DB_USERA}->{value}, $options_hash{ZM_DB_PASSA}->{value} );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$options_hash{ZM_DB_NAME}->{value}.";host=".$options_hash{ZM_DB_SERVER}->{value}, $options_hash{ZM_DB_USER}->{value}, $options_hash{ZM_DB_PASS}->{value} );
|
||||
|
||||
if ( !$dbh )
|
||||
{
|
||||
@@ -1581,7 +1565,7 @@ sub loadOptionsFromFile
|
||||
sub loadOptionsFromDB
|
||||
{
|
||||
print( "Loading config from DB\n" );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$options_hash{ZM_DB_NAME}->{value}.";host=".$options_hash{ZM_DB_SERVER}->{value}, $options_hash{ZM_DB_USERA}->{value}, $options_hash{ZM_DB_PASSA}->{value} );
|
||||
my $dbh = DBI->connect( "DBI:mysql:database=".$options_hash{ZM_DB_NAME}->{value}.";host=".$options_hash{ZM_DB_SERVER}->{value}, $options_hash{ZM_DB_USER}->{value}, $options_hash{ZM_DB_PASS}->{value} );
|
||||
|
||||
if ( !$dbh )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user