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)
This commit is contained in:
+2
-2
@@ -251,11 +251,11 @@ get_cpanel_user_domains() {
|
|||||||
local username="$1"
|
local username="$1"
|
||||||
|
|
||||||
# Primary domain (format: domain: user)
|
# 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
|
# Addon domains
|
||||||
if [ -f "/etc/userdatadomains" ]; then
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user