Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
263364ac
Commit
263364ac
authored
Nov 05, 2013
by
Sylvain Berfini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix find auth info algorithm
parent
2db728a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
coreapi/authentication.c
coreapi/authentication.c
+17
-16
No files found.
coreapi/authentication.c
View file @
263364ac
...
...
@@ -256,25 +256,27 @@ static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *user
MSList
*
elem
;
const
LinphoneAuthInfo
*
ret
=
NULL
;
for
(
elem
=
lc
->
auth_info
;
elem
!=
NULL
;
elem
=
elem
->
next
){
LinphoneAuthInfo
*
pinfo
=
(
LinphoneAuthInfo
*
)
elem
->
data
;
if
(
username
&&
pinfo
->
username
&&
strcmp
(
username
,
pinfo
->
username
)
==
0
){
for
(
elem
=
lc
->
auth_info
;
elem
!=
NULL
;
elem
=
elem
->
next
)
{
LinphoneAuthInfo
*
pinfo
=
(
LinphoneAuthInfo
*
)
elem
->
data
;
if
(
username
&&
pinfo
->
username
&&
strcmp
(
username
,
pinfo
->
username
)
==
0
)
{
if
(
realm
&&
domain
){
if
(
pinfo
->
realm
&&
strcmp
(
realm
,
pinfo
->
realm
)
==
0
&&
pinfo
->
domain
&&
strcmp
(
domain
,
pinfo
->
domain
)
==
0
){
&&
pinfo
->
domain
&&
strcmp
(
domain
,
pinfo
->
domain
)
==
0
)
{
return
pinfo
;
}
}
else
if
(
realm
){
if
(
pinfo
->
realm
&&
realm_match
(
realm
,
pinfo
->
realm
)){
if
(
ret
!=
NULL
){
}
else
if
(
realm
)
{
if
(
pinfo
->
realm
&&
realm_match
(
realm
,
pinfo
->
realm
))
{
if
(
ret
!=
NULL
)
{
ms_warning
(
"Non unique realm found for %s"
,
username
);
return
NULL
;
}
ret
=
pinfo
;
}
}
else
if
(
domain
&&
pinfo
->
domain
&&
strcmp
(
domain
,
pinfo
->
domain
)
==
0
){
}
else
if
(
domain
&&
pinfo
->
domain
&&
strcmp
(
domain
,
pinfo
->
domain
)
==
0
)
{
return
pinfo
;
}
else
return
pinfo
;
}
else
if
(
!
domain
)
{
return
pinfo
;
}
}
}
return
ret
;
...
...
@@ -291,14 +293,13 @@ static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *user
**/
const
LinphoneAuthInfo
*
linphone_core_find_auth_info
(
LinphoneCore
*
lc
,
const
char
*
realm
,
const
char
*
username
,
const
char
*
domain
){
const
LinphoneAuthInfo
*
ai
=
NULL
;
if
(
domain
){
ai
=
find_auth_info
(
lc
,
username
,
realm
,
domain
);
if
(
ai
==
NULL
){
ai
=
find_auth_info
(
lc
,
username
,
NULL
,
domain
);
}
}
if
(
ai
==
NULL
&&
realm
)
{
if
(
realm
){
ai
=
find_auth_info
(
lc
,
username
,
realm
,
NULL
);
if
(
ai
==
NULL
&&
domain
){
ai
=
find_auth_info
(
lc
,
username
,
realm
,
domain
);
}
}
else
if
(
domain
!=
NULL
)
{
ai
=
find_auth_info
(
lc
,
username
,
NULL
,
domain
);
}
if
(
ai
==
NULL
){
ai
=
find_auth_info
(
lc
,
username
,
NULL
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment