Merge branch 'storageareas' of github.com:/ConnorTechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2019-02-15 10:49:06 -05:00
commit 6156aa2af9
11 changed files with 62 additions and 11 deletions

View File

@ -223,7 +223,7 @@ CREATE TABLE `Events_Hour` (
`EventId` BIGINT unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`StartTime` datetime default NULL,
`DiskSpace` bigint unsigned default NULL,
`DiskSpace` bigint default NULL,
PRIMARY KEY (`EventId`),
KEY `Events_Hour_MonitorId_idx` (`MonitorId`),
KEY `Events_Hour_StartTime_idx` (`StartTime`)
@ -234,7 +234,7 @@ CREATE TABLE `Events_Day` (
`EventId` BIGINT unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`StartTime` datetime default NULL,
`DiskSpace` bigint unsigned default NULL,
`DiskSpace` bigint default NULL,
PRIMARY KEY (`EventId`),
KEY `Events_Day_MonitorId_idx` (`MonitorId`),
KEY `Events_Day_StartTime_idx` (`StartTime`)
@ -245,7 +245,7 @@ CREATE TABLE `Events_Week` (
`EventId` BIGINT unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`StartTime` datetime default NULL,
`DiskSpace` bigint unsigned default NULL,
`DiskSpace` bigint default NULL,
PRIMARY KEY (`EventId`),
KEY `Events_Week_MonitorId_idx` (`MonitorId`),
KEY `Events_Week_StartTime_idx` (`StartTime`)
@ -256,7 +256,7 @@ CREATE TABLE `Events_Month` (
`EventId` BIGINT unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`StartTime` datetime default NULL,
`DiskSpace` bigint unsigned default NULL,
`DiskSpace` bigint default NULL,
PRIMARY KEY (`EventId`),
KEY `Events_Month_MonitorId_idx` (`MonitorId`),
KEY `Events_Month_StartTime_idx` (`StartTime`)
@ -267,7 +267,7 @@ DROP TABLE IF EXISTS `Events_Archived`;
CREATE TABLE `Events_Archived` (
`EventId` BIGINT unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`DiskSpace` bigint unsigned default NULL,
`DiskSpace` bigint default NULL,
PRIMARY KEY (`EventId`),
KEY `Events_Archived_MonitorId_idx` (`MonitorId`)
) ENGINE=@ZM_MYSQL_ENGINE@;

13
db/zm_update-1.33.2.sql Normal file
View File

@ -0,0 +1,13 @@
--
-- This updates a 1.33.0 database to 1.33.1
--
-- Add WebSite enum to Monitor.Type
-- Add Refresh column to Monitors table
--
ALTER TABLE `Events_Hour` MODIFY DiskSpace BIGINT default NULL;
ALTER TABLE `Events_Day` MODIFY DiskSpace BIGINT default NULL;
ALTER TABLE `Events_Week` MODIFY DiskSpace BIGINT default NULL;
ALTER TABLE `Events_Month` MODIFY DiskSpace BIGINT default NULL;
ALTER TABLE `Events_Archived` MODIFY DiskSpace BIGINT default NULL;

View File

@ -696,10 +696,15 @@ sub error {
}
sub Fatal( @ ) {
fetch()->logPrint(FATAL, @_, caller);
my $this = fetch();
$this->logPrint(FATAL, @_, caller);
if ( $SIG{TERM} and ( $SIG{TERM} ne 'DEFAULT' ) ) {
$SIG{TERM}();
}
if ( $$this{sth} ) {
$$this{sth}->finish();
$$this{sth} = undef;
}
# I think if we don't disconnect we will leave sockets around in TIME_WAIT
ZoneMinder::Database::zmDbDisconnect();
exit(-1);

View File

@ -245,3 +245,18 @@ User *zmLoadAuthUser( const char *auth, bool use_remote_addr ) {
Debug(1, "No user found for auth_key %s", auth );
return 0;
}
//Function to check Username length
bool checkUser ( const char *username) {
if ( strlen(username) > 32) {
return false;
}
return true;
}
//Function to check password length
bool checkPass (const char *password) {
if ( strlen(password) > 64) {
return false;
}
return true;
}

View File

@ -77,5 +77,7 @@ public:
User *zmLoadUser( const char *username, const char *password=0 );
User *zmLoadAuthUser( const char *auth, bool use_remote_addr );
bool checkUser ( const char *username);
bool checkPass (const char *password);
#endif // ZM_USER_H

View File

@ -196,9 +196,12 @@ int main( int argc, const char *argv[] ) {
User *user = 0;
if ( strcmp(config.auth_relay, "none") == 0 ) {
if ( username.length() ) {
if ( checkUser(username.c_str()) ) {
user = zmLoadUser(username.c_str());
} else {
Error("")
}
} else {
//if ( strcmp( config.auth_relay, "hashed" ) == 0 )
{

View File

@ -425,6 +425,10 @@ int main(int argc, char *argv[]) {
if ( config.opt_use_auth ) {
if ( strcmp(config.auth_relay, "none") == 0 ) {
if ( !checkUser(username)) {
fprintf(stderr, "Error, username greater than allowed 32 characters\n");
exit_zmu(-1);
}
if ( !username ) {
fprintf(stderr, "Error, username must be supplied\n");
exit_zmu(-1);
@ -438,7 +442,14 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Error, username and password or auth string must be supplied\n");
exit_zmu(-1);
}
if ( !checkUser(username)) {
fprintf(stderr, "Error, username greater than allowed 32 characters\n");
exit_zmu(-1);
}
if ( !checkPass(password)) {
fprintf(stderr, "Error, password greater than allowed 64 characters\n");
exit_zmu(-1);
}
//if ( strcmp( config.auth_relay, "hashed" ) == 0 )
{
if ( auth ) {

View File

@ -1 +1 @@
1.33.1
1.33.2

View File

@ -25,7 +25,7 @@ if ( !canEdit('Control') ) {
} // end if !canEdit Controls
if ( $action == 'controlcap' ) {
require_once('Control.php');
require_once('includes/Control.php');
$Control = new Control( !empty($_REQUEST['cid']) ? $_REQUEST['cid'] : null );
//$changes = getFormChanges( $control, $_REQUEST['newControl'], $types, $columns );

View File

@ -17,6 +17,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//
require_once('session.php');
function userLogin($username='', $password='', $passwordHashed=false) {
global $user;

View File

@ -270,7 +270,7 @@ function controlPresets( $monitor, $cmds ) {
<?php
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ ) {
?>
<input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/>
<input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?htmlentities($labels[$i]):'' ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/>
<?php
if ( $i && (($i%$presetBreak) == 0) ) {
?><br/><?php