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
4a623b24
Commit
4a623b24
authored
Aug 20, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory handling
parent
35c9bc4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
src/network/httpd.c
src/network/httpd.c
+32
-30
No files found.
src/network/httpd.c
View file @
4a623b24
...
...
@@ -1375,19 +1375,19 @@ void httpd_MsgAdd( httpd_message_t *msg, const char *name, const char *psz_value
char
*
value
=
NULL
;
va_start
(
args
,
psz_value
);
#if defined(HAVE_VASPRINTF) && !defined(__APPLE__) && !defined(SYS_BEOS)
vasprintf
(
&
value
,
psz_value
,
args
);
#else
{
int
i_size
=
strlen
(
psz_value
)
+
4096
;
/* FIXME stupid system */
value
=
calloc
(
i_size
,
sizeof
(
char
)
);
vsnprintf
(
value
,
i_size
,
psz_value
,
args
);
value
[
i_size
-
1
]
=
0
;
}
#endif
if
(
vasprintf
(
&
value
,
psz_value
,
args
)
==
-
1
)
value
=
NULL
;
va_end
(
args
);
if
(
value
==
NULL
)
return
;
name
=
strdup
(
name
);
if
(
name
==
NULL
)
{
free
(
value
);
return
;
}
TAB_APPEND
(
msg
->
i_name
,
msg
->
name
,
(
char
*
)
name
);
TAB_APPEND
(
msg
->
i_value
,
msg
->
value
,
value
);
...
...
@@ -2134,49 +2134,51 @@ static void httpd_HostThread( httpd_host_t *host )
{
char
ip
[
NI_MAXNUMERICHOST
];
if
(
httpd_ClientIP
(
cl
,
ip
)
!=
NULL
)
if
(
(
httpd_ClientIP
(
cl
,
ip
)
==
NULL
)
||
ACL_Check
(
url
->
p_acl
,
ip
)
)
{
if
(
ACL_Check
(
url
->
p_acl
,
ip
)
)
{
b_hosts_failed
=
VLC_TRUE
;
break
;
}
}
else
b_hosts_failed
=
VLC_TRUE
;
break
;
}
}
if
(
answer
&&
(
*
url
->
psz_user
||
*
url
->
psz_password
)
)
{
/* create the headers */
const
char
*
b64
=
httpd_MsgGet
(
query
,
"Authorization"
);
/* BASIC id */
char
*
auth
=
NULL
;
char
*
id
;
char
*
user
=
NULL
,
*
pass
=
NULL
;
asprintf
(
&
id
,
"%s:%s"
,
url
->
psz_user
,
url
->
psz_password
);
if
(
b64
!=
NULL
&&
!
strncasecmp
(
b64
,
"BASIC"
,
5
)
)
&&
!
strncasecmp
(
b64
,
"BASIC"
,
5
)
)
{
b64
+=
5
;
while
(
*
b64
==
' '
)
{
b64
++
;
user
=
vlc_b64_decode
(
b64
);
if
(
user
!=
NULL
)
{
pass
=
strchr
(
user
,
':'
);
if
(
pass
!=
NULL
)
*
pass
++
=
'\0'
;
}
auth
=
vlc_b64_decode
(
b64
);
}
if
(
(
auth
==
NULL
)
||
strcmp
(
id
,
auth
)
)
if
((
user
==
NULL
)
||
(
pass
==
NULL
)
||
strcmp
(
user
,
url
->
psz_user
)
||
strcmp
(
pass
,
url
->
psz_password
))
{
httpd_MsgAdd
(
answer
,
"WWW-Authenticate"
,
"Basic realm=
\"
%s
\"
"
,
url
->
psz_user
);
httpd_MsgAdd
(
answer
,
"WWW-Authenticate"
,
"Basic realm=
\"
%s
\"
"
,
url
->
psz_user
);
/* We fail for all url */
b_auth_failed
=
VLC_TRUE
;
free
(
id
);
free
(
auth
);
free
(
user
);
break
;
}
free
(
id
);
free
(
auth
);
free
(
user
);
}
if
(
!
url
->
catch
[
i_msg
].
cb
(
url
->
catch
[
i_msg
].
p_sys
,
cl
,
answer
,
query
)
)
...
...
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