From f136d490ef9214506de50a41fd17ccbd000ff96b Mon Sep 17 00:00:00 2001 From: Ioannis Dressos <96877388+idressos@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:46:56 +0300 Subject: [PATCH 1/3] Update virtuser_file.php --- plugins/virtuser_file/virtuser_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/virtuser_file/virtuser_file.php b/plugins/virtuser_file/virtuser_file.php index 1fc56c6f055..ff6c1a00238 100644 --- a/plugins/virtuser_file/virtuser_file.php +++ b/plugins/virtuser_file/virtuser_file.php @@ -68,7 +68,7 @@ public function email2user($p) $arr = preg_split('/\s+/', trim($r[$i])); if (count($arr) > 0) { - $p['user'] = trim($arr[count($arr) - 1]); + $p['user'] = trim(str_replace('\@', '@', $arr[count($arr)-1])); break; } } From b54f09f23507d5513f4cda89653acda6904584d5 Mon Sep 17 00:00:00 2001 From: Ioannis Dressos <96877388+idressos@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:18:18 +0200 Subject: [PATCH 2/3] Update virtuser_file.php Add operator spacing to fix coding style check --- plugins/virtuser_file/virtuser_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/virtuser_file/virtuser_file.php b/plugins/virtuser_file/virtuser_file.php index ff6c1a00238..7dbb2a01312 100644 --- a/plugins/virtuser_file/virtuser_file.php +++ b/plugins/virtuser_file/virtuser_file.php @@ -68,7 +68,7 @@ public function email2user($p) $arr = preg_split('/\s+/', trim($r[$i])); if (count($arr) > 0) { - $p['user'] = trim(str_replace('\@', '@', $arr[count($arr)-1])); + $p['user'] = trim(str_replace('\@', '@', $arr[count($arr) - 1])); break; } } From 4c80b862a9eecc2070b05161f7d1ba60a1d4b748 Mon Sep 17 00:00:00 2001 From: Ioannis Dressos <96877388+idressos@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:20:34 +0200 Subject: [PATCH 3/3] Add comment for changed line --- plugins/virtuser_file/virtuser_file.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/virtuser_file/virtuser_file.php b/plugins/virtuser_file/virtuser_file.php index 7dbb2a01312..5f483cddb6e 100644 --- a/plugins/virtuser_file/virtuser_file.php +++ b/plugins/virtuser_file/virtuser_file.php @@ -68,6 +68,8 @@ public function email2user($p) $arr = preg_split('/\s+/', trim($r[$i])); if (count($arr) > 0) { + // Replace '\@' with '@' to handle cases where internal usernames include an '@' character. + // Sometimes usernames with '@' are saved with a leading '\' to avoid conflicts. $p['user'] = trim(str_replace('\@', '@', $arr[count($arr) - 1])); break; }