Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
0e51a9e6
Commit
0e51a9e6
authored
May 20, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GnuTLS: read key material from memory - fixes #1108
parent
a2ad5ed1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
34 deletions
+45
-34
modules/misc/gnutls.c
modules/misc/gnutls.c
+45
-34
No files found.
modules/misc/gnutls.c
View file @
0e51a9e6
...
...
@@ -41,14 +41,18 @@
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
# ifdef HAVE_UNISTD_H
#endif
#ifdef WIN32
# include <io.h>
#else
# include <unistd.h>
#
endif
#
include <fcntl.h>
#endif
#include <vlc_tls.h>
#include <vlc_charset.h>
#include <vlc_block.h>
#include <gcrypt.h>
#include <gnutls/gnutls.h>
...
...
@@ -571,41 +575,48 @@ gnutls_Addx509File( vlc_object_t *p_this,
{
struct
stat
st
;
if
(
utf8_stat
(
psz_path
,
&
st
)
==
0
)
{
if
(
S_ISREG
(
st
.
st_mode
)
)
int
fd
=
utf8_open
(
psz_path
,
O_RDONLY
,
0
);
if
(
fd
==
-
1
)
goto
error
;
block_t
*
block
=
block_File
(
fd
);
if
(
block
!=
NULL
)
{
char
*
psz_localname
=
ToLocale
(
psz_path
);
int
i
=
b_priv
?
gnutls_certificate_set_x509_key_file
(
cred
,
psz_localname
,
psz_localname
,
GNUTLS_X509_FMT_PEM
)
:
gnutls_certificate_set_x509_trust_file
(
cred
,
psz_localname
,
GNUTLS_X509_FMT_PEM
);
LocaleFree
(
psz_localname
);
if
(
i
<
0
)
close
(
fd
);
gnutls_datum
data
=
{
.
data
=
block
->
p_buffer
,
.
size
=
block
->
i_buffer
,
};
int
res
=
b_priv
?
gnutls_certificate_set_x509_key_mem
(
cred
,
&
data
,
&
data
,
GNUTLS_X509_FMT_PEM
)
:
gnutls_certificate_set_x509_trust_mem
(
cred
,
&
data
,
GNUTLS_X509_FMT_PEM
);
block_Release
(
block
);
if
(
res
<
0
)
{
msg_Warn
(
p_this
,
"cannot add x509 credentials (%s): %s"
,
psz_path
,
gnutls_strerror
(
i
)
);
msg_Warn
(
p_this
,
"cannot add x509 credentials (%s): %s"
,
psz_path
,
gnutls_strerror
(
res
)
);
return
VLC_EGENERIC
;
}
else
{
msg_Dbg
(
p_this
,
"added x509 credentials (%s)"
,
psz_path
);
msg_Dbg
(
p_this
,
"added x509 credentials (%s)"
,
psz_path
);
return
VLC_SUCCESS
;
}
}
else
if
(
S_ISDIR
(
st
.
st_mode
)
)
if
(
!
fstat
(
fd
,
&
st
)
&&
S_ISDIR
(
st
.
st_mode
)
)
{
msg_Dbg
(
p_this
,
"looking recursively for x509 credentials in %s"
,
psz_path
);
return
gnutls_Addx509Directory
(
p_this
,
cred
,
psz_path
,
b_priv
);
close
(
fd
);
msg_Dbg
(
p_this
,
"looking recursively for x509 credentials in %s"
,
psz_path
);
return
gnutls_Addx509Directory
(
p_this
,
cred
,
psz_path
,
b_priv
);
}
}
else
msg_Warn
(
p_this
,
"cannot add x509 credentials (%s): %m"
,
psz_path
);
error:
msg_Warn
(
p_this
,
"cannot add x509 credentials (%s): %m"
,
psz_path
);
if
(
fd
!=
-
1
)
close
(
fd
);
return
VLC_EGENERIC
;
}
...
...
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