Commit a2ed27b2 authored by Ghislain MARY's avatar Ghislain MARY

Ensure username, domain, route and email are lowercase in the account creator.

parent 960681ed
......@@ -201,7 +201,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccou
} else if ((status = validate_uri(username, NULL, NULL, NULL)) != LinphoneAccountCreatorOk) {
return status;
}
set_string(&creator->username, username);
set_string(&creator->username, username, TRUE);
return LinphoneAccountCreatorOk;
}
......@@ -214,7 +214,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccou
if (min_length > 0 && strlen(password) < min_length) {
return LinphoneAccountCreatorPasswordTooShort;
}
set_string(&creator->password, password);
set_string(&creator->password, password, FALSE);
return LinphoneAccountCreatorOk;
}
......@@ -238,7 +238,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_domain(LinphoneAccount
if (validate_uri(NULL, domain, NULL, NULL) != 0) {
return LinphoneAccountCreatorDomainInvalid;
}
set_string(&creator->domain, domain);
set_string(&creator->domain, domain, TRUE);
return LinphoneAccountCreatorOk;
}
......@@ -250,7 +250,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_route(LinphoneAccountC
if (validate_uri(NULL, NULL, route, NULL) != 0) {
return LinphoneAccountCreatorRouteInvalid;
}
set_string(&creator->route, route);
set_string(&creator->route, route, TRUE);
return LinphoneAccountCreatorOk;
}
......@@ -262,7 +262,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_display_name(LinphoneA
if (validate_uri(NULL, NULL, NULL, display_name) != 0) {
return LinphoneAccountCreatorDisplayNameInvalid;
}
set_string(&creator->display_name, display_name);
set_string(&creator->display_name, display_name, FALSE);
return LinphoneAccountCreatorOk;
}
......@@ -274,7 +274,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_email(LinphoneAccountC
if (!is_matching_regex(email, "^.+@.+\\.[A-Za-z]{2}[A-Za-z]*$")) {
return LinphoneAccountCreatorEmailInvalid;
}
set_string(&creator->email, email);
set_string(&creator->email, email, TRUE);
return LinphoneAccountCreatorOk;
}
......
......@@ -39,6 +39,8 @@ extern "C" {
#include <belle-sip/object.h>
#include <belle-sip/dict.h>
#include <ctype.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -407,13 +409,18 @@ static MS2_INLINE int get_remaining_bandwidth_for_video(int total, int audio){
return ret;
}
static MS2_INLINE void set_string(char **dest, const char *src){
static MS2_INLINE void set_string(char **dest, const char *src, bool_t lowercase){
if (*dest){
ms_free(*dest);
*dest=NULL;
}
if (src)
if (src) {
*dest=ms_strdup(src);
if (lowercase) {
char *cur = *dest;
for (; *cur; cur++) *cur = tolower(*cur);
}
}
}
#define PAYLOAD_TYPE_ENABLED PAYLOAD_TYPE_USER_FLAG_0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment