2022-10-06 Fred Gleason <fredg@paravelsystems.com>

* Changed the type of the 'SWITCHER_NODES.PASSWORD` field in the
	database to 'text'.
	* Applied Base64 encoding to the 'SWITCHER_NODES.PASSWORD' field in
	the database.
	* Incremented the database version to 361.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-10-06 17:25:26 -04:00
parent ddd62c10ed
commit ef4930caf9
8 changed files with 82 additions and 12 deletions

View File

@ -23470,3 +23470,9 @@
database to 'text'.
* Applied Base64 encoding to the 'REPLICATORS.URL_PASSWORD' field in
the database.
2022-10-06 Fred Gleason <fredg@paravelsystems.com>
* Changed the type of the 'SWITCHER_NODES.PASSWORD` field in the
database to 'text'.
* Applied Base64 encoding to the 'SWITCHER_NODES.PASSWORD' field in
the database.
* Incremented the database version to 361.

View File

@ -10,6 +10,6 @@ STATION_NAME varchar(64)
MATRIX int(11)
BASE_OUTPUT int(11)
HOSTNAME varchar(64)
PASSWORD varchar(64)
PASSWORD text Base64 encoded
TCP_PORT int(11)
DESCRIPTION varchar(191)

View File

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 360
#define RD_VERSION_DATABASE 361
#endif // DBVERSION_H

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell LiveWire Node
//
// (C) Copyright 2002-2021 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
// it under the terms of the GNU General Public License version 2 as
@ -149,7 +149,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent)
edit_hostname_edit->setText(q->value(0).toString());
edit_tcpport_spin->setValue(q->value(1).toInt());
edit_description_edit->setText(q->value(2).toString());
edit_password=q->value(3).toString();
edit_password=QByteArray::fromBase64(q->value(3).toString().toUtf8());
edit_output_spin->setValue(q->value(4).toInt());
}
delete q;
@ -229,7 +229,7 @@ void EditNode::okData()
QString::asprintf("`TCP_PORT`=%d,",edit_tcpport_spin->value())+
"`DESCRIPTION`='"+RDEscapeString(edit_description_edit->text())+"',"+
QString::asprintf("`BASE_OUTPUT`=%d,",edit_output_spin->value())+
"`PASSWORD`='"+RDEscapeString(edit_password)+"'";
"`PASSWORD`='"+RDEscapeString(edit_password.toUtf8().toBase64())+"'";
RDSqlQuery::apply(sql);
}
else {
@ -238,7 +238,8 @@ void EditNode::okData()
QString::asprintf("`TCP_PORT`=%d,",edit_tcpport_spin->value())+
"`DESCRIPTION`='"+RDEscapeString(edit_description_edit->text())+"',"+
QString::asprintf("`BASE_OUTPUT`=%d,",edit_output_spin->value())+
"`PASSWORD`='"+RDEscapeString(edit_password)+"' where "+
"`PASSWORD`='"+RDEscapeString(edit_password.toUtf8().toBase64())+
"' where "+
QString::asprintf("`ID`=%d",*edit_id);
q=new RDSqlQuery(sql);
delete q;

View File

@ -2,7 +2,7 @@
//
// A Rivendell LWRP audio switcher driver for LiveWire networks.
//
// (C) Copyright 2002-2021 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
// it under the terms of the GNU General Public License version 2 as
@ -64,10 +64,11 @@ LiveWireLwrpAudio::LiveWireLwrpAudio(RDMatrix *matrix,QObject *parent)
connect(livewire_nodes.back(),
SIGNAL(watchdogStateChanged(unsigned,const QString &)),
this,SLOT(watchdogStateChangedData(unsigned,const QString &)));
livewire_nodes.back()->connectToHost(q->value(0).toString(),
q->value(1).toInt(),
q->value(2).toString(),
q->value(3).toUInt());
livewire_nodes.back()->
connectToHost(q->value(0).toString(),
q->value(1).toInt(),
QByteArray::fromBase64(q->value(2).toString().toUtf8()),
q->value(3).toUInt());
}
delete q;
}

View File

@ -41,6 +41,36 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
// NEW SCHEMA REVERSIONS GO HERE...
//
// Revert 361
//
if((cur_schema==361)&&(set_schema<cur_schema)) {
sql=QString("select ")+
"`ID`,"+ // 00
"`PASSWORD` "+ // 01
"from `SWITCHER_NODES`";
q=new RDSqlQuery(sql);
while(q->next()) {
if(!q->value(1).isNull()) {
sql=QString("update `SWITCHER_NODES` 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;
}
}
}
delete q;
sql=QString("alter table `REPLICATORS` ")+
"modify column `URL_PASSWORD` varchar(64)";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
WriteSchemaVersion(--cur_schema);
}
//
// Revert 360
//

View File

@ -160,7 +160,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["3.4"]=317;
global_version_map["3.5"]=346;
global_version_map["3.6"]=347;
global_version_map["4.0"]=360;
global_version_map["4.0"]=361;
}

View File

@ -11114,6 +11114,38 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<361)&&(set_schema>cur_schema)) {
sql=QString("alter table `SWITCHER_NODES` ")+
"modify column `PASSWORD` text";
if(!RDSqlQuery::apply(sql,err_msg)) {
return false;
}
sql=QString("select ")+
"`ID`,"+ // 00
"`PASSWORD` "+ // 01
"from `SWITCHER_NODES`";
q=new RDSqlQuery(sql);
while(q->next()) {
if(q->value(1).toString().isEmpty()) {
sql=QString("update `SWITCHER_NODES` set ")+
"`PASSWORD`=null ";
}
else {
sql=QString("update `SWITCHER_NODES` 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;
}
}
delete q;
WriteSchemaVersion(++cur_schema);
}
// NEW SCHEMA UPDATES GO HERE...