Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
f16ebb92
Unverified
Commit
f16ebb92
authored
Nov 21, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VUS_resolver() checks also for VCC
parent
105e2b30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
9 deletions
+33
-9
v00038.vtc
bin/varnishtest/tests/v00038.vtc
+7
-1
vcc_backend.c
lib/libvcc/vcc_backend.c
+26
-8
No files found.
bin/varnishtest/tests/v00038.vtc
View file @
f16ebb92
...
...
@@ -117,12 +117,18 @@ varnish v1 -errvcl "Address redefinition at:" {
}
}
varnish v1 -errvcl "Must be a
n absolute path
:" {
varnish v1 -errvcl "Must be a
valid path or abstract socket
:" {
backend b1 {
.path = "server.sock";
}
}
varnish v1 -errvcl "Path too long for a Unix domain socket" {
backend b1 {
.path = "/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path/this/super/long/path";
}
}
varnish v1 -errvcl "Not a socket:" {
backend b1 {
.path = "${tmpdir}";
...
...
lib/libvcc/vcc_backend.c
View file @
f16ebb92
...
...
@@ -37,6 +37,7 @@
#include <sys/stat.h>
#include "vcc_compile.h"
#include "vus.h"
const
char
*
vcc_default_probe
(
struct
vcc
*
tl
)
...
...
@@ -87,10 +88,19 @@ Emit_Sockaddr(struct vcc *tl, struct vsb *vsb1, const struct token *t_host,
}
/*
* For UDS, we do not create a VSA.
Check if it's an absolute path, can
*
be accessed, and is a socket. If so, just emit the path field and set
* the IP suckaddrs to NULL.
* For UDS, we do not create a VSA.
We run the VUS_resolver() checks and, if
*
it's a path, can be accessed, and is a socket. If so, just emit the path
*
field and set
the IP suckaddrs to NULL.
*/
static
int
uds_resolved
(
void
*
priv
,
const
struct
sockaddr_un
*
uds
)
{
(
void
)
priv
;
(
void
)
uds
;
return
(
42
);
}
static
void
emit_path
(
struct
vsb
*
vsb1
,
char
*
path
)
{
...
...
@@ -104,20 +114,28 @@ Emit_UDS_Path(struct vcc *tl, struct vsb *vsb1,
const
struct
token
*
t_path
,
const
char
*
errid
)
{
struct
stat
st
;
const
char
*
vus_err
;
AN
(
t_path
);
AN
(
t_path
->
dec
);
if
(
*
t_path
->
dec
==
'@'
)
{
emit_path
(
vsb1
,
t_path
->
dec
);
if
(
!
VUS_is
(
t_path
->
dec
))
{
VSB_printf
(
tl
->
sb
,
"%s: Must be a valid path or abstract socket:
\n
"
,
errid
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
if
(
*
t_path
->
dec
!=
'/'
)
{
VSB_printf
(
tl
->
sb
,
"%s: Must be an absolute path:
\n
"
,
errid
);
if
(
VUS_resolver
(
t_path
->
dec
,
uds_resolved
,
NULL
,
&
vus_err
)
!=
42
)
{
VSB_printf
(
tl
->
sb
,
"%s: %s
\n
"
,
errid
,
vus_err
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
if
(
*
t_path
->
dec
==
'@'
)
{
emit_path
(
vsb1
,
t_path
->
dec
);
return
;
}
assert
(
*
t_path
->
dec
==
'/'
);
errno
=
0
;
if
(
stat
(
t_path
->
dec
,
&
st
)
!=
0
)
{
int
err
=
errno
;
...
...
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