mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Fix regex matching issue in the account creator
This commit is contained in:
parent
fed9e2532a
commit
0f5bc15211
1 changed files with 8 additions and 2 deletions
|
|
@ -170,8 +170,14 @@ static bool_t is_matching_regex(const char *entry, const char* regex) {
|
|||
return TRUE;
|
||||
#else
|
||||
regex_t regex_pattern;
|
||||
char err_msg[256];
|
||||
int res;
|
||||
regcomp(®ex_pattern, regex, 0);
|
||||
res = regcomp(®ex_pattern, regex, REG_EXTENDED | REG_NOSUB);
|
||||
if(res != REG_NOERROR) {
|
||||
regerror(res, ®ex_pattern, err_msg, sizeof(err_msg));
|
||||
ms_error("Could not compile regex '%s: %s", regex, err_msg);
|
||||
return FALSE;
|
||||
}
|
||||
res = regexec(®ex_pattern, entry, 0, NULL, 0);
|
||||
regfree(®ex_pattern);
|
||||
return (res != REG_NOMATCH);
|
||||
|
|
@ -265,7 +271,7 @@ const char * linphone_account_creator_get_display_name(const LinphoneAccountCrea
|
|||
}
|
||||
|
||||
LinphoneAccountCreatorStatus linphone_account_creator_set_email(LinphoneAccountCreator *creator, const char *email) {
|
||||
if (!is_matching_regex(email, ".+@.+\\.[A-Za-z]{2}[A-Za-z]*")) {
|
||||
if (!is_matching_regex(email, "^.+@.+\\.[A-Za-z]{2}[A-Za-z]*$")) {
|
||||
return LinphoneAccountCreatorEmailInvalid;
|
||||
}
|
||||
set_string(&creator->email, email);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue