Resolve the per-user DAX FIFO directory. Creates it 0700 if missing. Returns empty QString on irrecoverable failure (caller logs and bails). Path precedence: $XDG_RUNTIME_DIR → /run/user/ / → /tmp/aethersdr- /. See GHSA-x8xf-4g5v-ppf9 — pre-fix code created world-writable FIFOs in /tmp/aethersdr-dax-*.pipe, exposing the operator's TX path to local-user audio injection (an FCC liability fo
| 28 | // /tmp/aethersdr-dax-*.pipe, exposing the operator's TX path to local-user |
| 29 | // audio injection (an FCC liability for licensed stations). |
| 30 | QString daxFifoDir() |
| 31 | { |
| 32 | QString base = QString::fromLocal8Bit(qgetenv("XDG_RUNTIME_DIR")); |
| 33 | if (base.isEmpty()) { |
| 34 | const QString runUser = QStringLiteral("/run/user/%1").arg(::getuid()); |
| 35 | base = QDir(runUser).exists() |
| 36 | ? runUser |
| 37 | : QStringLiteral("/tmp/aethersdr-%1").arg(::getuid()); |
| 38 | } |
| 39 | const QString dir = base + QStringLiteral("/aethersdr"); |
| 40 | if (::mkdir(dir.toUtf8().constData(), 0700) != 0 && errno != EEXIST) { |
| 41 | qCWarning(lcDax) << "PipeWireAudioBridge: mkdir failed for" |
| 42 | << dir << ":" << strerror(errno); |
| 43 | return {}; |
| 44 | } |
| 45 | // Tighten perms in case the dir pre-existed with looser settings. |
| 46 | ::chmod(dir.toUtf8().constData(), 0700); |
| 47 | return dir; |
| 48 | } |
| 49 | |
| 50 | // Atomic-ish owner-only FIFO creation. Tries mkfifo(0600) first; on EEXIST, |
| 51 | // verifies the existing entry is our FIFO before unlinking and retrying. |
no test coverage detected