Commit 0d2fe019 authored by Walid Boudebouda's avatar Walid Boudebouda Committed by Nils Goroll

vmod_unix: restrict all $Functions to client and backend

parent 0ad2601b
...@@ -58,7 +58,7 @@ logexpect l1 -v v1 -d 1 -c { ...@@ -58,7 +58,7 @@ logexpect l1 -v v1 -d 1 -c {
} -run } -run
varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini} { varnish v1 -errvcl {Not available in subroutine 'vcl_init'} {
import unix; import unix;
import std; import std;
backend b None; backend b None;
...@@ -68,7 +68,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini ...@@ -68,7 +68,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini
} }
} }
varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini} { varnish v1 -errvcl {Not available in subroutine 'vcl_init'} {
import unix; import unix;
import std; import std;
backend b None; backend b None;
...@@ -78,7 +78,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini ...@@ -78,7 +78,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini
} }
} }
varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini} { varnish v1 -errvcl {Not available in subroutine 'vcl_init'} {
import unix; import unix;
import std; import std;
backend b None; backend b None;
...@@ -88,7 +88,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini ...@@ -88,7 +88,7 @@ varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini
} }
} }
varnish v1 -errvcl {vmod unix failure: may not be called in vcl_init or vcl_fini} { varnish v1 -errvcl {Not available in subroutine 'vcl_init'} {
import unix; import unix;
import std; import std;
backend b None; backend b None;
......
...@@ -49,9 +49,6 @@ ...@@ -49,9 +49,6 @@
#define VERR(ctx, fmt, ...) \ #define VERR(ctx, fmt, ...) \
VSLb((ctx)->vsl, SLT_VCL_Error, "vmod unix error: " fmt, __VA_ARGS__) VSLb((ctx)->vsl, SLT_VCL_Error, "vmod unix error: " fmt, __VA_ARGS__)
#define FAILNOINIT(ctx) \
FAIL((ctx), "may not be called in vcl_init or vcl_fini")
#define ERRNOTUDS(ctx) \ #define ERRNOTUDS(ctx) \
ERR((ctx), "not listening on a Unix domain socket") ERR((ctx), "not listening on a Unix domain socket")
...@@ -93,10 +90,7 @@ vmod_##func(VRT_CTX) \ ...@@ -93,10 +90,7 @@ vmod_##func(VRT_CTX) \
int ret; \ int ret; \
\ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
if ((ctx->method & VCL_MET_TASK_H) != 0) { \ AZ(ctx->method & VCL_MET_TASK_H); \
FAILNOINIT(ctx); \
return (-1); \
} \
\ \
sp = get_sp(ctx); \ sp = get_sp(ctx); \
if (!sp->listen_sock->uds) { \ if (!sp->listen_sock->uds) { \
......
...@@ -67,18 +67,26 @@ $Function STRING user() ...@@ -67,18 +67,26 @@ $Function STRING user()
Return the user name of the peer process owner. Return the user name of the peer process owner.
$Restrict client backend
$Function STRING group() $Function STRING group()
Return the group name of the peer process owner. Return the group name of the peer process owner.
$Restrict client backend
$Function INT uid() $Function INT uid()
Return the numeric user id of the peer process owner. Return the numeric user id of the peer process owner.
$Restrict client backend
$Function INT gid() $Function INT gid()
Return the numeric group id of the peer process owner. Return the numeric group id of the peer process owner.
$Restrict client backend
ERRORS ERRORS
====== ======
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment