mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-08-09 16:41:19 +02:00
2022-10-06 Fred Gleason <fredg@paravelsystems.com>
* Changed the type of the 'MATRICES.PASSWORD` field in the database to 'text'. * Changed the type of the 'MATRICES.PASSWORD_2` field in the database to 'text'. * Applied Base64 encoding to the 'MATRICES.PASSWORD' field in the database. * Applied Base64 encoding to the 'MATRICES.PASSWORD_2' field in the database. * Incremented the database version to 362. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
f212c99a83
commit
844e10e1b6
10
ChangeLog
10
ChangeLog
@ -23477,3 +23477,13 @@
|
|||||||
* Applied Base64 encoding to the 'SWITCHER_NODES.PASSWORD' field in
|
* Applied Base64 encoding to the 'SWITCHER_NODES.PASSWORD' field in
|
||||||
the database.
|
the database.
|
||||||
* Incremented the database version to 361.
|
* Incremented the database version to 361.
|
||||||
|
2022-10-06 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Changed the type of the 'MATRICES.PASSWORD` field in the
|
||||||
|
database to 'text'.
|
||||||
|
* Changed the type of the 'MATRICES.PASSWORD_2` field in the
|
||||||
|
database to 'text'.
|
||||||
|
* Applied Base64 encoding to the 'MATRICES.PASSWORD' field in
|
||||||
|
the database.
|
||||||
|
* Applied Base64 encoding to the 'MATRICES.PASSWORD_2' field in
|
||||||
|
the database.
|
||||||
|
* Incremented the database version to 362.
|
||||||
|
@ -21,8 +21,8 @@ IP_PORT int(11)
|
|||||||
IP_PORT_2 int(11)
|
IP_PORT_2 int(11)
|
||||||
USERNAME varchar(32)
|
USERNAME varchar(32)
|
||||||
USERNAME_2 varchar(32)
|
USERNAME_2 varchar(32)
|
||||||
PASSWORD varchar(32)
|
PASSWORD text Base64 encoded
|
||||||
PASSWORD_2 varchar(32)
|
PASSWORD_2 text Base64 encoded
|
||||||
START_CART int(10) unsigned
|
START_CART int(10) unsigned
|
||||||
STOP_CART int(10) unsigned
|
STOP_CART int(10) unsigned
|
||||||
START_CART_2 int(10) unsigned
|
START_CART_2 int(10) unsigned
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/*
|
/*
|
||||||
* Current Database Version
|
* Current Database Version
|
||||||
*/
|
*/
|
||||||
#define RD_VERSION_DATABASE 361
|
#define RD_VERSION_DATABASE 362
|
||||||
|
|
||||||
|
|
||||||
#endif // DBVERSION_H
|
#endif // DBVERSION_H
|
||||||
|
@ -459,10 +459,10 @@ QString RDMatrix::password(RDMatrix::Role role) const
|
|||||||
{
|
{
|
||||||
switch(role) {
|
switch(role) {
|
||||||
case RDMatrix::Primary:
|
case RDMatrix::Primary:
|
||||||
return GetRow("PASSWORD").toString();
|
return QByteArray::fromBase64(GetRow("PASSWORD").toString().toUtf8());
|
||||||
|
|
||||||
case RDMatrix::Backup:
|
case RDMatrix::Backup:
|
||||||
return GetRow("PASSWORD_2").toString();
|
return QByteArray::fromBase64(GetRow("PASSWORD_2").toString().toUtf8());
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@ -472,10 +472,10 @@ void RDMatrix::setPassword(RDMatrix::Role role,const QString &passwd) const
|
|||||||
{
|
{
|
||||||
switch(role) {
|
switch(role) {
|
||||||
case RDMatrix::Primary:
|
case RDMatrix::Primary:
|
||||||
SetRow("PASSWORD",passwd);
|
SetRow("PASSWORD",passwd.toUtf8().toBase64());
|
||||||
|
|
||||||
case RDMatrix::Backup:
|
case RDMatrix::Backup:
|
||||||
SetRow("PASSWORD_2",passwd);
|
SetRow("PASSWORD_2",passwd.toUtf8().toBase64());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -985,6 +985,26 @@ void RDMatrix::SetRow(const QString ¶m,const QString &value) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDMatrix::SetRow(const QString ¶m,const QByteArray &value) const
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
|
||||||
|
if(value.size()==0) {
|
||||||
|
sql=QString("update `MATRICES` set `")+
|
||||||
|
param+"`=NULL where "+
|
||||||
|
"`STATION_NAME`='"+RDEscapeString(mx_station)+"' && "+
|
||||||
|
QString::asprintf("`MATRIX`=%d",mx_number);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sql=QString("update `MATRICES` set `")+
|
||||||
|
param+"`='"+RDEscapeString(value)+"' where "+
|
||||||
|
"`STATION_NAME`='"+RDEscapeString(mx_station)+"' && "+
|
||||||
|
QString::asprintf("`MATRIX`=%d",mx_number);
|
||||||
|
}
|
||||||
|
RDSqlQuery::apply(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDMatrix::SetRow(const QString ¶m,int value) const
|
void RDMatrix::SetRow(const QString ¶m,int value) const
|
||||||
{
|
{
|
||||||
QString sql;
|
QString sql;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Abstract a Rivendell Switcher Matrix
|
// Abstract a Rivendell Switcher Matrix
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
@ -21,9 +21,8 @@
|
|||||||
#ifndef RDMATRIX_H
|
#ifndef RDMATRIX_H
|
||||||
#define RDMATRIX_H
|
#define RDMATRIX_H
|
||||||
|
|
||||||
#include <qsqldatabase.h>
|
#include <QDateTime>
|
||||||
#include <qdatetime.h>
|
#include <QHostAddress>
|
||||||
#include <qhostaddress.h>
|
|
||||||
|
|
||||||
class RDMatrix
|
class RDMatrix
|
||||||
{
|
{
|
||||||
@ -122,6 +121,7 @@ class RDMatrix
|
|||||||
QString GetEndpointName(int pointnum,const QString &table) const;
|
QString GetEndpointName(int pointnum,const QString &table) const;
|
||||||
QVariant GetRow(const QString ¶m) const;
|
QVariant GetRow(const QString ¶m) const;
|
||||||
void SetRow(const QString ¶m,const QString &value) const;
|
void SetRow(const QString ¶m,const QString &value) const;
|
||||||
|
void SetRow(const QString ¶m,const QByteArray &value) const;
|
||||||
void SetRow(const QString ¶m,int value) const;
|
void SetRow(const QString ¶m,int value) const;
|
||||||
void SetRow(const QString ¶m,unsigned value) const;
|
void SetRow(const QString ¶m,unsigned value) const;
|
||||||
int mx_id;
|
int mx_id;
|
||||||
|
@ -41,6 +41,51 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
// NEW SCHEMA REVERSIONS GO HERE...
|
// NEW SCHEMA REVERSIONS GO HERE...
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Revert 362
|
||||||
|
//
|
||||||
|
if((cur_schema==362)&&(set_schema<cur_schema)) {
|
||||||
|
sql=QString("select ")+
|
||||||
|
"`ID`,"+ // 00
|
||||||
|
"`PASSWORD`,"+ // 01
|
||||||
|
"`PASSWORD_2` "+ // 02
|
||||||
|
"from `MATRICES`";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
if(!q->value(1).isNull()) {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD`='"+
|
||||||
|
RDEscapeString(QByteArray::fromBase64(q->value(1).toString().toUtf8()))+"' "+
|
||||||
|
QString::asprintf("where `ID`=%d",q->value(0).toInt());
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!q->value(2).isNull()) {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD_2`='"+
|
||||||
|
RDEscapeString(QByteArray::fromBase64(q->value(2).toString().toUtf8()))+"' "+
|
||||||
|
QString::asprintf("where `ID`=%d",q->value(0).toInt());
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
sql=QString("alter table `MATRICES` ")+
|
||||||
|
"modify column `PASSWORD` varchar(64)";
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sql=QString("alter table `MATRICES` ")+
|
||||||
|
"modify column `PASSWORD_2` varchar(64)";
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteSchemaVersion(--cur_schema);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Revert 361
|
// Revert 361
|
||||||
//
|
//
|
||||||
|
@ -160,7 +160,7 @@ void MainObject::InitializeSchemaMap() {
|
|||||||
global_version_map["3.4"]=317;
|
global_version_map["3.4"]=317;
|
||||||
global_version_map["3.5"]=346;
|
global_version_map["3.5"]=346;
|
||||||
global_version_map["3.6"]=347;
|
global_version_map["3.6"]=347;
|
||||||
global_version_map["4.0"]=361;
|
global_version_map["4.0"]=362;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11146,6 +11146,57 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
WriteSchemaVersion(++cur_schema);
|
WriteSchemaVersion(++cur_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((cur_schema<362)&&(set_schema>cur_schema)) {
|
||||||
|
sql=QString("alter table `MATRICES` ")+
|
||||||
|
"modify column `PASSWORD` text";
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sql=QString("alter table `MATRICES` ")+
|
||||||
|
"modify column `PASSWORD_2` text";
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sql=QString("select ")+
|
||||||
|
"`ID`,"+ // 00
|
||||||
|
"`PASSWORD`,"+ // 01
|
||||||
|
"`PASSWORD_2` "+ // 02
|
||||||
|
"from `MATRICES`";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
if(q->value(1).toString().isEmpty()) {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD`=null ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD`='"+
|
||||||
|
RDEscapeString(q->value(1).toString().toUtf8().toBase64())+"' ";
|
||||||
|
}
|
||||||
|
sql+=QString::asprintf("where `ID`=%d",q->value(0).toInt());
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(q->value(2).toString().isEmpty()) {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD_2`=null ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sql=QString("update `MATRICES` set ")+
|
||||||
|
"`PASSWORD_2`='"+
|
||||||
|
RDEscapeString(q->value(2).toString().toUtf8().toBase64())+"' ";
|
||||||
|
}
|
||||||
|
sql+=QString::asprintf("where `ID`=%d",q->value(0).toInt());
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
|
||||||
|
WriteSchemaVersion(++cur_schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NEW SCHEMA UPDATES GO HERE...
|
// NEW SCHEMA UPDATES GO HERE...
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user