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
e41bccdf
Commit
e41bccdf
authored
May 28, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify, and remove racy IDN code
parent
eb43a637
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
33 deletions
+19
-33
src/network/getaddrinfo.c
src/network/getaddrinfo.c
+19
-33
No files found.
src/network/getaddrinfo.c
View file @
e41bccdf
...
@@ -60,11 +60,11 @@
...
@@ -60,11 +60,11 @@
#ifndef HAVE_GAI_STRERROR
#ifndef HAVE_GAI_STRERROR
static
struct
static
const
struct
{
{
int
code
;
char
code
;
const
char
*
msg
;
const
char
msg
[
41
]
}
const
__
gai_errlist
[]
=
}
gai_errlist
[]
=
{
{
{
0
,
"Error 0"
},
{
0
,
"Error 0"
},
{
EAI_BADFLAGS
,
"Invalid flag used"
},
{
EAI_BADFLAGS
,
"Invalid flag used"
},
...
@@ -82,18 +82,18 @@ static struct
...
@@ -82,18 +82,18 @@ static struct
{
0
,
NULL
}
{
0
,
NULL
}
};
};
static
const
char
__
gai_unknownerr
[]
=
"Unrecognized error number"
;
static
const
char
gai_unknownerr
[]
=
"Unrecognized error number"
;
/****************************************************************************
/****************************************************************************
* Converts an EAI_* error code into human readable english text.
* Converts an EAI_* error code into human readable english text.
****************************************************************************/
****************************************************************************/
const
char
*
vlc_gai_strerror
(
int
errnum
)
const
char
*
vlc_gai_strerror
(
int
errnum
)
{
{
for
(
unsigned
i
=
0
;
__
gai_errlist
[
i
].
msg
!=
NULL
;
i
++
)
for
(
unsigned
i
=
0
;
gai_errlist
[
i
].
msg
!=
NULL
;
i
++
)
if
(
errnum
==
__
gai_errlist
[
i
].
code
)
if
(
errnum
==
gai_errlist
[
i
].
code
)
return
__
gai_errlist
[
i
].
msg
;
return
gai_errlist
[
i
].
msg
;
return
__
gai_unknownerr
;
return
gai_unknownerr
;
}
}
#else
/* ifndef HAVE_GAI_STRERROR */
#else
/* ifndef HAVE_GAI_STRERROR */
const
char
*
vlc_gai_strerror
(
int
errnum
)
const
char
*
vlc_gai_strerror
(
int
errnum
)
...
@@ -622,19 +622,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
...
@@ -622,19 +622,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
if
(
hints
.
ai_family
==
AF_UNSPEC
)
if
(
hints
.
ai_family
==
AF_UNSPEC
)
{
{
vlc_value_t
val
;
var_Create
(
p_this
,
"ipv4"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ipv4"
,
&
val
);
if
(
val
.
b_bool
)
hints
.
ai_family
=
AF_INET
;
#ifdef AF_INET6
#ifdef AF_INET6
var_Create
(
p_this
,
"ipv6"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
if
(
var_CreateGetBool
(
p_this
,
"ipv6"
))
var_Get
(
p_this
,
"ipv6"
,
&
val
);
if
(
val
.
b_bool
)
hints
.
ai_family
=
AF_INET6
;
hints
.
ai_family
=
AF_INET6
;
else
#endif
#endif
if
(
var_CreateGetBool
(
p_this
,
"ipv4"
))
hints
.
ai_family
=
AF_INET
;
}
}
/*
/*
...
@@ -683,21 +677,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
...
@@ -683,21 +677,13 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
#if defined (HAVE_GETADDRINFO)
#if defined (HAVE_GETADDRINFO)
# ifdef AI_IDN
# ifdef AI_IDN
/* Run-time I18n Domain Names support */
/* Run-time I18n Domain Names support */
static
bool
b_idn
=
true
;
/* beware of thread-safety */
if
(
b_idn
)
{
hints
.
ai_flags
|=
AI_IDN
;
hints
.
ai_flags
|=
AI_IDN
;
int
ret
=
getaddrinfo
(
psz_node
,
psz_service
,
&
hints
,
res
);
int
ret
=
getaddrinfo
(
psz_node
,
psz_service
,
&
hints
,
res
);
if
(
ret
!=
EAI_BADFLAGS
)
if
(
ret
!=
EAI_BADFLAGS
)
return
ret
;
return
ret
;
/* IDN not available: disable and retry without it */
/* IDN not available: disable and retry without it */
hints
.
ai_flags
&=
~
AI_IDN
;
hints
.
ai_flags
&=
~
AI_IDN
;
b_idn
=
false
;
msg_Info
(
p_this
,
"International Domain Names not supported"
);
}
# endif
# endif
return
getaddrinfo
(
psz_node
,
psz_service
,
&
hints
,
res
);
return
getaddrinfo
(
psz_node
,
psz_service
,
&
hints
,
res
);
#else
#else
...
...
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