Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-gcrypt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-gcrypt
Commits
aefa6489
Commit
aefa6489
authored
Apr 13, 2017
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a gcrypt log handler
parent
47b8f79f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletion
+44
-1
vmod_gcrypt.c
src/vmod_gcrypt.c
+44
-1
No files found.
src/vmod_gcrypt.c
View file @
aefa6489
...
...
@@ -95,6 +95,45 @@ errmsg(VRT_CTX, const char *fmt, ...)
/* Event function */
static
void
__match_proto__
(
gcry_handler_log_t
)
gcrypt_logger
(
void
*
priv
,
int
level
,
const
char
*
fmt
,
va_list
args
)
{
enum
VSL_tag_e
tag
=
SLT_Debug
;
const
char
*
lvl
=
"INFO"
;
(
void
)
priv
;
switch
(
level
)
{
case
GCRY_LOG_CONT
:
lvl
=
"continuation"
;
break
;
case
GCRY_LOG_INFO
:
lvl
=
"INFO"
;
break
;
case
GCRY_LOG_WARN
:
lvl
=
"WARN"
;
break
;
case
GCRY_LOG_ERROR
:
lvl
=
"ERROR"
;
tag
=
SLT_Error
;
break
;
case
GCRY_LOG_FATAL
:
lvl
=
"FATAL"
;
tag
=
SLT_Error
;
break
;
case
GCRY_LOG_BUG
:
lvl
=
"BUG"
;
tag
=
SLT_Error
;
break
;
case
GCRY_LOG_DEBUG
:
lvl
=
"DEBUG"
;
break
;
default:
VSL
(
SLT_Error
,
0
,
"Unknown gcrypt log level %d"
,
level
);
}
VSL
(
tag
,
0
,
"libgcrypt log message follows (%s):"
,
lvl
);
VSLv
(
tag
,
0
,
fmt
,
args
);
}
int
__match_proto__
(
vmod_event_f
)
event
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
enum
vcl_event_e
e
)
{
...
...
@@ -102,9 +141,13 @@ event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
(
void
)
priv
;
if
(
e
==
VCL_EVENT_LOAD
)
{
if
(
gcrypt_version
!=
NULL
)
return
0
;
gcry_set_log_handler
(
gcrypt_logger
,
NULL
);
gcrypt_version
=
gcry_check_version
(
MIN_GCRYPT_VERSION
);
if
(
gcrypt_version
==
NULL
)
{
// XXX log error
VSL
(
SLT_VCL_Error
,
0
,
"libgcrypt initialization failed"
);
return
1
;
}
/* XXX other initialization */
...
...
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