Opened 5 years ago
Closed 5 years ago
#1485207 closed Bugs (fixed)
rcube_user::email2user and rcube_user::user2email select incorrect address from virtuser file
| Reported by: | markscarbrough | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.2-beta |
| Component: | Core functionality | Version: | 0.2-alpha |
| Severity: | major | Keywords: | |
| Cc: |
Description
The regular expressions used in the functions rcube_user::email2user and rcube_user::user2email are too simplistic and can return the wrong value. Consider the following table:
btest@… btest
test@… test
If I log in as user 'test' for the first time, my email will be set incorrectly to 'btest@…'. The regular expressions must also test for the whitespace that delimits values. The attached patch fixes the problem for me.
Attachments (1)
Change History (6)
Changed 5 years ago by markscarbrough
comment:1 Changed 5 years ago by markscarbrough
comment:2 Changed 5 years ago by alec
- Milestone changed from later to 0.2-beta
comment:3 Changed 5 years ago by dan
came across the same thing
suggest using rcmail_findinvirtual("$email\s") and
rcmail_findinvirtual("\s$user$") for consistency with the regex that separates the email/username
comment:4 Changed 5 years ago by dan
- $r = rcmail_findinvirtual("$user$");
+ $r = rcmail_findinvirtual("\s$user$");
- $r = rcmail_findinvirtual("^$email");
+ $r = rcmail_findinvirtual("^$email\s");
comment:5 Changed 5 years ago by alec
- Resolution set to fixed
- Status changed from new to closed
Fixed in [e2003306].

Sorry, formatting of example virtuser table fixed: