Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
84674be7
Commit
84674be7
authored
Sep 10, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We should validate correctly all local/remote candidate combinations
parent
5576d7e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
23 deletions
+39
-23
agent/conncheck.c
agent/conncheck.c
+32
-22
stun/stunagent.c
stun/stunagent.c
+7
-1
No files found.
agent/conncheck.c
View file @
84674be7
...
...
@@ -1840,7 +1840,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
StunMessage
msg
;
StunValidationStatus
valid
;
stun_validater_data
*
validater_data
=
NULL
;
GSList
*
i
;
GSList
*
i
,
*
ri
;
int
j
,
k
;
NiceCandidate
*
remote_candidate
=
NULL
;
NiceCandidate
*
local_candidate
=
NULL
;
...
...
@@ -1855,20 +1855,27 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
}
}
/* TODO : if we get a peer reflexive, we should check all local:remote possibilities */
/* if we get a peer reflexive, we should check all local:remote possibilities
also, we could receive from the external interface the username used
with the internal interface, so the remote_candidate is not the
same remote candidate used by the peer */
validater_data
=
g_new0
(
stun_validater_data
,
g_slist_length
(
component
->
local_candidates
)
+
1
);
g_slist_length
(
component
->
local_candidates
)
*
g_slist_length
(
component
->
remote_candidates
));
/* We have to check all the local candidates into our validater_data because a
server reflexive candidate shares the same socket as the host candidate,
so we have no idea the user/pass is coming from which candidate */
j
=
0
;
for
(
ri
=
component
->
remote_candidates
;
ri
;
ri
=
ri
->
next
)
{
NiceCandidate
*
rcand
=
ri
->
data
;
for
(
i
=
component
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
cand
=
i
->
data
;
uname_len
=
priv_create_username
(
agent
,
stream
,
component
->
id
,
remote_candidate
,
cand
,
component
->
id
,
rcand
,
cand
,
uname
,
sizeof
(
uname
),
TRUE
);
validater_data
[
j
].
username
=
g_memdup
(
uname
,
uname_len
);
...
...
@@ -1888,8 +1895,11 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
g_base64_decode
((
gchar
*
)
validater_data
[
j
].
password
,
&
validater_data
[
j
].
password_len
);
}
nice_debug
(
"Agent %p : Adding to validater data '%s' : '%s'"
,
agent
,
validater_data
[
j
].
username
,
validater_data
[
j
].
password
);
j
++
;
}
}
/* note: contents of 'buf' already validated, so it is
...
...
stun/stunagent.c
View file @
84674be7
...
...
@@ -76,11 +76,17 @@ bool stun_agent_default_validater (StunAgent *agent,
int
i
;
for
(
i
=
0
;
val
&&
val
[
i
].
username
;
i
++
)
{
stun_debug
(
"Comparing username '"
);
stun_debug_bytes
(
username
,
username_len
);
stun_debug
(
"' (%d) with '"
,
username_len
);
stun_debug_bytes
(
val
[
i
].
username
,
val
[
i
].
username_len
);
stun_debug
(
"' (%d) : %d
\n
"
,
val
[
i
].
username_len
,
memcmp
(
username
,
val
[
i
].
username
,
username_len
));
if
(
username_len
==
val
[
i
].
username_len
&&
memcmp
(
username
,
val
[
i
].
username
,
username_len
)
==
0
)
{
*
password
=
(
uint8_t
*
)
val
[
i
].
password
;
*
password_len
=
val
[
i
].
password_len
;
stun_debug
(
"Found valid username, returning password : '%s'
\n
"
,
*
password
);
return
true
;
}
}
...
...
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