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
a1cb6511
Commit
a1cb6511
authored
Oct 02, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix my brainfart in PRIV_SESS and PRIV_REQ: We want one variable for
each VMOD which asks. Patch by: mithrandir Fixes #1600
parent
0107b32f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
cache_vrt_priv.c
bin/varnishd/cache/cache_vrt_priv.c
+9
-6
vrt.h
include/vrt.h
+2
-2
vcc_expr.c
lib/libvcc/vcc_expr.c
+10
-2
No files found.
bin/varnishd/cache/cache_vrt_priv.c
View file @
a1cb6511
...
...
@@ -47,26 +47,29 @@ struct vrt_privs {
struct
vmod_priv
priv
[
1
];
const
struct
VCL_conf
*
vcl
;
uintptr_t
id
;
uintptr_t
vmod_id
;
};
/*--------------------------------------------------------------------
*/
static
struct
vmod_priv
*
VRT_priv_dynamic
(
VRT_CTX
,
uintptr_t
id
)
VRT_priv_dynamic
(
VRT_CTX
,
uintptr_t
id
,
uintptr_t
vmod_id
)
{
struct
vrt_privs
*
vps
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
VTAILQ_FOREACH
(
vps
,
&
ctx
->
req
->
sp
->
privs
,
list
)
{
CHECK_OBJ_NOTNULL
(
vps
,
VRT_PRIVS_MAGIC
);
if
(
vps
->
vcl
==
ctx
->
vcl
&&
vps
->
id
==
id
)
if
(
vps
->
vcl
==
ctx
->
vcl
&&
vps
->
id
==
id
&&
vps
->
vmod_id
==
vmod_id
)
return
(
vps
->
priv
);
}
ALLOC_OBJ
(
vps
,
VRT_PRIVS_MAGIC
);
AN
(
vps
);
vps
->
vcl
=
ctx
->
vcl
;
vps
->
id
=
id
;
vps
->
vmod_id
=
vmod_id
;
VTAILQ_INSERT_TAIL
(
&
ctx
->
req
->
sp
->
privs
,
vps
,
list
);
return
(
vps
->
priv
);
}
...
...
@@ -91,15 +94,15 @@ VRTPRIV_dynamic_kill(struct sess *sp, uintptr_t id)
}
struct
vmod_priv
*
VRT_priv_req
(
VRT_CTX
)
VRT_priv_req
(
VRT_CTX
,
void
*
vmod_id
)
{
return
(
VRT_priv_dynamic
(
ctx
,
(
uintptr_t
)
ctx
->
req
));
return
(
VRT_priv_dynamic
(
ctx
,
(
uintptr_t
)
ctx
->
req
,
(
uintptr_t
)
vmod_id
));
}
struct
vmod_priv
*
VRT_priv_sess
(
VRT_CTX
)
VRT_priv_sess
(
VRT_CTX
,
void
*
vmod_id
)
{
return
(
VRT_priv_dynamic
(
ctx
,
(
uintptr_t
)
NULL
));
return
(
VRT_priv_dynamic
(
ctx
,
(
uintptr_t
)
NULL
,
(
uintptr_t
)
vmod_id
));
}
/*--------------------------------------------------------------------
...
...
include/vrt.h
View file @
a1cb6511
...
...
@@ -246,8 +246,8 @@ struct vmod_priv {
typedef
int
vmod_init_f
(
struct
vmod_priv
*
,
const
struct
VCL_conf
*
);
void
VRT_priv_fini
(
const
struct
vmod_priv
*
p
);
struct
vmod_priv
*
VRT_priv_sess
(
VRT_CTX
);
struct
vmod_priv
*
VRT_priv_req
(
VRT_CTX
);
struct
vmod_priv
*
VRT_priv_sess
(
VRT_CTX
,
void
*
vmod_id
);
struct
vmod_priv
*
VRT_priv_req
(
VRT_CTX
,
void
*
vmod_id
);
/* Stevedore related functions */
int
VRT_Stv
(
const
char
*
nm
);
...
...
lib/libvcc/vcc_expr.c
View file @
a1cb6511
...
...
@@ -567,10 +567,18 @@ vcc_func(struct vcc *tl, struct expr **e, const char *cfunc,
e2
=
vcc_mk_expr
(
VOID
,
"&%s"
,
buf
);
p
+=
strlen
(
p
)
+
1
;
}
else
if
(
fmt
==
VOID
&&
!
strcmp
(
p
,
"PRIV_REQ"
))
{
e2
=
vcc_mk_expr
(
VOID
,
"VRT_priv_req(ctx)"
);
r
=
strchr
(
name
,
'.'
);
AN
(
r
);
e2
=
vcc_mk_expr
(
VOID
,
"VRT_priv_req(ctx, &VGC_vmod_%.*s)"
,
(
int
)
(
r
-
name
),
name
);
p
+=
strlen
(
p
)
+
1
;
}
else
if
(
fmt
==
VOID
&&
!
strcmp
(
p
,
"PRIV_SESS"
))
{
e2
=
vcc_mk_expr
(
VOID
,
"VRT_priv_sess(ctx)"
);
r
=
strchr
(
name
,
'.'
);
AN
(
r
);
e2
=
vcc_mk_expr
(
VOID
,
"VRT_priv_sess(ctx, &VGC_vmod_%.*s)"
,
(
int
)
(
r
-
name
),
name
);
p
+=
strlen
(
p
)
+
1
;
}
else
if
(
fmt
==
ENUM
)
{
ExpectErr
(
tl
,
ID
);
...
...
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