Correct the NetworkVatlib ATIS and password regular expressions

The password one was not matching if the integers had multiple digits.
The ATIS one was matching on every random 'z' in any ATIS line.

ref T380
This commit is contained in:
Roland Winklmeier
2018-10-02 21:42:56 +02:00
committed by Klaus Basan
parent b140e0e193
commit ed80bc90a8

View File

@@ -1096,7 +1096,7 @@ namespace BlackCore
{ {
if (fsdMessageFiltered.startsWith("FSD Sent=>#AP")) if (fsdMessageFiltered.startsWith("FSD Sent=>#AP"))
{ {
thread_local const QRegularExpression re("^(FSD Sent=>#AP\\w+:SERVER:\\d+:)[^:]+(:\\d:\\d+:\\d:.+)$"); thread_local const QRegularExpression re("^(FSD Sent=>#AP\\w+:SERVER:\\d+:)[^:]+(:\\d+:\\d+:\\d+:.+)$");
fsdMessageFiltered.replace(re, "\\1<password>\\2"); fsdMessageFiltered.replace(re, "\\1<password>\\2");
m_filterPasswordFromLogin = false; m_filterPasswordFromLogin = false;
} }
@@ -1198,7 +1198,7 @@ namespace BlackCore
// 4 digits followed by z (e.g. 0200z) is always the last atis line. // 4 digits followed by z (e.g. 0200z) is always the last atis line.
// Some controllers leave the logoff time empty. Hence we accept anything // Some controllers leave the logoff time empty. Hence we accept anything
// between 0-4 digits. // between 0-4 digits.
thread_local const QRegularExpression reLogoff("\\d{0,4}z"); thread_local const QRegularExpression reLogoff("^\\d{0,4}z$");
if (reLogoff.match(message).hasMatch()) if (reLogoff.match(message).hasMatch())
{ {
emit atisLogoffTimeReplyReceived(sender, message); emit atisLogoffTimeReplyReceived(sender, message);