|
|
@ -22939,7 +22939,6 @@ static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, cons
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char authcopy[256];
|
|
|
|
char authcopy[256];
|
|
|
|
char *username=NULL, *realm=NULL, *secret=NULL, *md5secret=NULL;
|
|
|
|
char *username=NULL, *realm=NULL, *secret=NULL, *md5secret=NULL;
|
|
|
|
char *stringp;
|
|
|
|
|
|
|
|
struct sip_auth *a, *b, *auth;
|
|
|
|
struct sip_auth *a, *b, *auth;
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_strlen_zero(configuration))
|
|
|
|
if (ast_strlen_zero(configuration))
|
|
|
@ -22948,25 +22947,24 @@ static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, cons
|
|
|
|
ast_debug(1, "Auth config :: %s\n", configuration);
|
|
|
|
ast_debug(1, "Auth config :: %s\n", configuration);
|
|
|
|
|
|
|
|
|
|
|
|
ast_copy_string(authcopy, configuration, sizeof(authcopy));
|
|
|
|
ast_copy_string(authcopy, configuration, sizeof(authcopy));
|
|
|
|
stringp = authcopy;
|
|
|
|
username = authcopy;
|
|
|
|
|
|
|
|
|
|
|
|
username = stringp;
|
|
|
|
/* split user[:secret] and relm */
|
|
|
|
realm = strrchr(stringp, '@');
|
|
|
|
realm = strrchr(username, '@');
|
|
|
|
if (realm)
|
|
|
|
if (realm)
|
|
|
|
*realm++ = '\0';
|
|
|
|
*realm++ = '\0';
|
|
|
|
if (ast_strlen_zero(username) || ast_strlen_zero(realm)) {
|
|
|
|
if (ast_strlen_zero(username) || ast_strlen_zero(realm)) {
|
|
|
|
ast_log(LOG_WARNING, "Format for authentication entry is user[:secret]@realm at line %d\n", lineno);
|
|
|
|
ast_log(LOG_WARNING, "Format for authentication entry is user[:secret]@realm at line %d\n", lineno);
|
|
|
|
return authlist;
|
|
|
|
return authlist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stringp = username;
|
|
|
|
|
|
|
|
username = strsep(&stringp, ":");
|
|
|
|
/* parse username at ':' for secret, or '#" for md5secret */
|
|
|
|
if (username) {
|
|
|
|
if ((secret = strchr(username, ':'))) {
|
|
|
|
secret = strsep(&stringp, ":");
|
|
|
|
*secret++ = '\0';
|
|
|
|
if (!secret) {
|
|
|
|
} else if ((md5secret = strchr(username, '#'))) {
|
|
|
|
stringp = username;
|
|
|
|
*md5secret++ = '\0';
|
|
|
|
md5secret = strsep(&stringp, "#");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!(auth = ast_calloc(1, sizeof(*auth))))
|
|
|
|
if (!(auth = ast_calloc(1, sizeof(*auth))))
|
|
|
|
return authlist;
|
|
|
|
return authlist;
|
|
|
|
|
|
|
|
|
|
|
|