Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
72292bb3
Commit
72292bb3
authored
Feb 14, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Write COMEDIA MRLs properly (host is the remote rather than the local part)
- Validate and canonicalize source-filter address
parent
aba6c4cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
27 deletions
+62
-27
modules/services_discovery/sap.c
modules/services_discovery/sap.c
+62
-27
No files found.
modules/services_discovery/sap.c
View file @
72292bb3
...
...
@@ -894,26 +894,13 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
"
\0
"
;
const
char
*
vlc_proto
=
NULL
;
uint8_t
flags
=
0
;
for
(
const
char
*
proto
=
proto_match
;
*
proto
;)
{
if
(
strcasecmp
(
proto
,
sdp_proto
))
{
vlc_proto
=
proto
+
strlen
(
proto
)
+
1
;
if
(
vlc_proto
[
strlen
(
vlc_proto
)
+
1
]
&
1
)
{
/* COMEDIA check */
const
char
*
setup
=
FindAttribute
(
p_sdp
,
0
,
"setup"
);
if
(
setup
==
NULL
)
setup
=
"active"
;
/* default value */
if
(
strcmp
(
setup
,
"actpass"
)
&&
strcmp
(
setup
,
"passive"
))
{
msg_Dbg
(
p_obj
,
"unsupported COMEDIA mode: %s"
,
setup
);
free
(
sdp_proto
);
return
VLC_EGENERIC
;
}
}
flags
=
vlc_proto
[
strlen
(
vlc_proto
)
+
1
];
break
;
}
proto
+=
strlen
(
proto
)
+
1
;
...
...
@@ -928,24 +915,72 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
return
VLC_EGENERIC
;
}
/* handle SSM case */
const
char
*
sfilter
=
FindAttribute
(
p_sdp
,
0
,
"source-filter"
);
char
psz_source
[
258
]
=
""
;
if
(
sfilter
!=
NULL
)
if
(
flags
&
1
)
{
char
psz_source_ip
[
256
];
/* Connection-oriented media */
const
char
*
setup
=
FindAttribute
(
p_sdp
,
0
,
"setup"
);
if
(
setup
==
NULL
)
setup
=
"active"
;
/* default value */
if
(
s
scanf
(
sfilter
,
" incl IN IP%*c %*s %255s "
,
psz_source_ip
)
==
1
)
if
(
s
trcmp
(
setup
,
"actpass"
)
&&
strcmp
(
setup
,
"passive"
)
)
{
if
(
strchr
(
psz_source_ip
,
':'
)
!=
NULL
)
sprintf
(
psz_source
,
"[%s]"
,
psz_source_ip
);
else
strcpy
(
psz_source
,
psz_source_ip
);
msg_Dbg
(
p_obj
,
"unsupported COMEDIA mode: %s"
,
setup
);
return
VLC_EGENERIC
;
}
if
(
asprintf
(
&
p_sdp
->
psz_uri
,
"%s://%s:%d"
,
vlc_proto
,
host
,
port
)
==
-
1
)
return
VLC_ENOMEM
;
}
else
{
/* Non-connected (normally multicast) media */
char
psz_source
[
258
]
=
""
;
const
char
*
sfilter
=
FindAttribute
(
p_sdp
,
0
,
"source-filter"
);
if
(
sfilter
!=
NULL
)
{
char
psz_source_ip
[
256
];
unsigned
ipv
;
asprintf
(
&
p_sdp
->
psz_uri
,
"%s://%s@%s:%i"
,
vlc_proto
,
psz_source
,
host
,
port
);
if
(
sscanf
(
sfilter
,
" incl IN IP%u %*s %255s "
,
&
ipv
,
psz_source_ip
)
==
2
)
{
/* According to RFC4570, FQDNs can be used for source-filters,
* but -seriously- this is impractical */
switch
(
ipv
)
{
#ifdef AF_INET6
case
6
:
{
struct
in6_addr
addr
;
if
((
inet_pton
(
AF_INET6
,
psz_source_ip
,
&
addr
)
>
0
)
&&
(
inet_ntop
(
AF_INET6
,
&
addr
,
psz_source
+
1
,
sizeof
(
psz_source
)
-
2
)
!=
NULL
))
{
psz_source
[
0
]
=
'['
;
psz_source
[
strlen
(
psz_source
)]
=
']'
;
}
break
;
}
#endif
case
4
:
{
struct
in_addr
addr
;
if
((
inet_pton
(
AF_INET
,
psz_source_ip
,
&
addr
)
>
0
)
&&
(
inet_ntop
(
AF_INET
,
&
addr
,
psz_source
,
sizeof
(
psz_source
))
==
NULL
))
*
psz_source
=
'\0'
;
break
;
}
}
}
}
if
(
asprintf
(
&
p_sdp
->
psz_uri
,
"%s://%s@%s:%i"
,
vlc_proto
,
psz_source
,
host
,
port
)
==
-
1
)
return
VLC_ENOMEM
;
}
return
VLC_SUCCESS
;
}
...
...
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