#7374·mumble

Runtime setConf("username"/"channelname") skips anchoredPattern — same config validates differently before vs after restart

Author: Jerry-FaGeCreated Sep 24, 2026Updated Sep 24, 2026
Labelsserverbug

Description

In 1.6.870, validateUserName() / validateChannelName() are implemented as:

cpp
// Server.cpp (~line 2258)
bool Server::validateUserName(const QString &name) {
    // ...
    return qrUserName.match(name).hasMatch();   // substring match!
}

QRegularExpression::match().hasMatch() is only a full match if the pattern is anchored. There are two code paths that construct qrUserName, and only one of them anchors:

cpp
// Path A: startup load (~line 468) — correctly anchored ✅
QString regex = qrUserName.pattern();
m_dbWrapper.getConfigurationTo(iServerNum, "username", regex);
qrUserName = QRegularExpression(QRegularExpression::anchoredPattern(std::move(regex)));

// Path B: runtime setConf handler (~line 604) — NOT anchored ❌
else if (key == "username")
    qrUserName = !v.isNull() ? QRegularExpression(v) : Meta::mp->qrUserName;
// same for "channelname" (~line 606)

The default pattern constructed in Meta.cpp (~line 110) is also unanchored; it only becomes effectively full-match because Path A re-wraps it at startup.

Result: the same configured value validates differently depending on how/when it was applied. A pattern set at runtime via ICE/DBUS setConf() accepts any name containing a matching substring; after a restart, the identical value from the database becomes a full-string match. Semantics silently change across a restart.

This discrepancy did not exist in 1.5, where validation used QRegExp::exactMatch() — inherently a full-string match regardless of anchoring.

Steps to reproduce

  1. Start Murmur 1.6.870 with default config
  2. At runtime, set the username pattern via ICE: srv.setConf("username", "abc")
  3. Use a name that only contains the pattern as a substring, e.g. xxabcxx → accepted (substring match)
  4. Restart the server (the value persists in the DB config)
  5. Try xxabcxx again → rejected (startup path anchored the pattern → full match now enforced)

Mumble version

1.6.870

Mumble component

Server

OS

Linux

Reproducible?

Yes

Additional information

  • Affects both username and channelname (identical handling in the setConf handler).
  • The v.isNull() fallback to Meta::mp->qrUserName is unanchored as well (Meta.cpp ~line 110), so the "reset to default via setConf" path has the same issue.
  • Suggested fix: wrap the Path B construction with QRegularExpression::anchoredPattern(...) exactly as Path A does, or anchor centrally inside validateUserName()/validateChannelName().
  • Practical context: we set username/channelname at runtime via ICE setConf as the documented workaround for the 1.5→1.6 non-ASCII regression (#7373), and discovered this anchoring discrepancy while auditing why a runtime-set config behaves differently from the same config after a restart. Same code area as #7373, but a distinct defect (per-path inconsistency rather than default-pattern semantics).

Relevant log output

# Path A (startup) wraps with anchoredPattern -> full match:
qrUserName = QRegularExpression(QRegularExpression::anchoredPattern(std::move(regex)));

# Path B (runtime setConf) does not -> substring match:
qrUserName = !v.isNull() ? QRegularExpression(v) : Meta::mp->qrUserName;

# validateUserName() relies on the pattern being anchored:
return qrUserName.match(name).hasMatch();

Related to #7373.