From f389d82c51bc5edcd0801c0898af68c82a4d6188 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 3 Dec 2025 01:08:08 -0500 Subject: [PATCH] CRITICAL: Fix domain detection bug in get_cpanel_user_domains Root cause: grep -F with regex anchor - grep -F means 'fixed string' (no regex) - Pattern 'grep -F "$username\$"' was looking for literal backslash-dollar - Changed to 'grep "${username}$"' (regex mode with end-of-line anchor) Impact: - PHP optimizer showed 0 domains analyzed - Server memory check showed 0MB required - ALL domain-based functionality was broken This is why the script appeared to work but returned no data. Files fixed: - lib/user-manager.sh:254,258 (2 lines changed) --- lib/user-manager.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/user-manager.sh b/lib/user-manager.sh index 85d095a..ee42324 100755 --- a/lib/user-manager.sh +++ b/lib/user-manager.sh @@ -251,11 +251,11 @@ get_cpanel_user_domains() { local username="$1" # Primary domain (format: domain: user) - grep -F ": ${username}" /etc/trueuserdomains 2>/dev/null | grep -F "$username\$" 2>/dev/null | cut -d: -f1 || true + grep -F ": ${username}" /etc/trueuserdomains 2>/dev/null | grep "${username}$" 2>/dev/null | cut -d: -f1 || true # Addon domains if [ -f "/etc/userdatadomains" ]; then - grep -F "==${username}" /etc/userdatadomains 2>/dev/null | grep -F "$username\$" 2>/dev/null | cut -d: -f1 || true + grep -F "==${username}" /etc/userdatadomains 2>/dev/null | grep "${username}$" 2>/dev/null | cut -d: -f1 || true fi }