diff --git a/ChangeLog b/ChangeLog index 487d220c..87632cbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19941,3 +19941,8 @@ 'ripcd/local_macros.cpp'. 2020-08-10 Fred Gleason * Documented the '%%' filepath wildcard in the Operations Guide. +2020-08-10 Fred Gleason + * Added a check in 'RDSvc::create()' to disallow creation of a + service with a name containing whitespace. + * Added whitespace to the set of banned characters for service names + in the 'Add Service' dialog in rdadmin(1). diff --git a/lib/librd_cs.ts b/lib/librd_cs.ts index c9d65548..71d8f0fe 100644 --- a/lib/librd_cs.ts +++ b/lib/librd_cs.ts @@ -809,6 +809,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_de.ts b/lib/librd_de.ts index ef8ade64..1661b0b5 100644 --- a/lib/librd_de.ts +++ b/lib/librd_de.ts @@ -805,6 +805,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_es.ts b/lib/librd_es.ts index 7aeb5e97..6c61edf3 100644 --- a/lib/librd_es.ts +++ b/lib/librd_es.ts @@ -805,6 +805,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_fr.ts b/lib/librd_fr.ts index 8406357b..14aab15a 100644 --- a/lib/librd_fr.ts +++ b/lib/librd_fr.ts @@ -775,6 +775,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_nb.ts b/lib/librd_nb.ts index ef0f877a..f53a9dcd 100644 --- a/lib/librd_nb.ts +++ b/lib/librd_nb.ts @@ -805,6 +805,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_nn.ts b/lib/librd_nn.ts index ef0f877a..f53a9dcd 100644 --- a/lib/librd_nn.ts +++ b/lib/librd_nn.ts @@ -805,6 +805,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/librd_pt_BR.ts b/lib/librd_pt_BR.ts index 4a5ae0d9..87d5290a 100644 --- a/lib/librd_pt_BR.ts +++ b/lib/librd_pt_BR.ts @@ -805,6 +805,10 @@ Results Report + + whitespace is not permitted in service names + + RDAddCart diff --git a/lib/rdsvc.cpp b/lib/rdsvc.cpp index f801379c..659daa6f 100644 --- a/lib/rdsvc.cpp +++ b/lib/rdsvc.cpp @@ -2,7 +2,7 @@ // // Abstract a Rivendell Service. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2020 Fred Gleason // // 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 @@ -1096,6 +1096,11 @@ bool RDSvc::create(const QString &name,QString *err_msg, RDSqlQuery *q; RDSqlQuery *q1; + if(name.simplified()!=name) { + *err_msg=QObject::tr("whitespace is not permitted in service names"); + return false; + } + sql=QString("select NAME from SERVICES where ")+ "NAME=\""+RDEscapeString(name)+"\""; q=new RDSqlQuery(sql); diff --git a/lib/rdtextvalidator.cpp b/lib/rdtextvalidator.cpp index d2efe56f..e66b818a 100644 --- a/lib/rdtextvalidator.cpp +++ b/lib/rdtextvalidator.cpp @@ -37,7 +37,7 @@ QValidator::State RDTextValidator::validate(QString &input,int &pos) const if(input.length()==0) { return QValidator::Acceptable; } - for(unsigned i=0;i - -#include +#include +#include +#include class RDTextValidator : public QValidator { @@ -31,10 +31,12 @@ class RDTextValidator : public QValidator RDTextValidator(QObject *parent=0,const char *name=0,bool allow_quote=false); QValidator::State validate(QString &input,int &pos) const; void addBannedChar(char c); + void addBannedChar(const QChar &c); static QString stripString(QString str); private: - std::vector banned_chars; + QList banned_chars; + // std::vector banned_chars; }; diff --git a/rdadmin/add_svc.cpp b/rdadmin/add_svc.cpp index 1532cce5..c68f349a 100644 --- a/rdadmin/add_svc.cpp +++ b/rdadmin/add_svc.cpp @@ -48,10 +48,8 @@ AddSvc::AddSvc(QString *svcname,QWidget *parent) // // Fix the Window Size // - setMinimumWidth(sizeHint().width()); - setMaximumWidth(sizeHint().width()); - setMinimumHeight(sizeHint().height()); - setMaximumHeight(sizeHint().height()); + setMinimumSize(sizeHint()); + setMaximumSize(sizeHint()); setWindowTitle("RDAdmin - "+tr("Add Service")); @@ -59,6 +57,8 @@ AddSvc::AddSvc(QString *svcname,QWidget *parent) // Text Validator // RDTextValidator *validator=new RDTextValidator(this); + validator->addBannedChar(QChar(' ')); + validator->addBannedChar(QChar('\t')); // // Service Name