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
ebb0cf44
Commit
ebb0cf44
authored
Jun 16, 2016
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't exit if creating the VCL directory fails
Test by scn@. OK by @phk. Fixes #1963.
parent
3e72fdbb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
20 deletions
+35
-20
mgt.h
bin/varnishd/mgt/mgt.h
+3
-3
mgt_jail.c
bin/varnishd/mgt/mgt_jail.c
+12
-12
mgt_jail_unix.c
bin/varnishd/mgt/mgt_jail_unix.c
+7
-2
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+3
-1
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+9
-2
b00032.vtc
bin/varnishtest/tests/b00032.vtc
+1
-0
No files found.
bin/varnishd/mgt/mgt.h
View file @
ebb0cf44
...
...
@@ -91,7 +91,7 @@ enum jail_master_e {
typedef
int
jail_init_f
(
char
**
);
typedef
void
jail_master_f
(
enum
jail_master_e
);
typedef
void
jail_subproc_f
(
enum
jail_subproc_e
);
typedef
void
jail_make_dir_f
(
const
char
*
dname
);
typedef
int
jail_make_dir_f
(
const
char
*
dname
);
typedef
void
jail_fixfile_f
(
int
fd
);
struct
jail_tech
{
...
...
@@ -110,8 +110,8 @@ struct jail_tech {
void
VJ_Init
(
const
char
*
j_arg
);
void
VJ_master
(
enum
jail_master_e
jme
);
void
VJ_subproc
(
enum
jail_subproc_e
jse
);
void
VJ_make_workdir
(
const
char
*
dname
);
void
VJ_make_vcldir
(
const
char
*
dname
);
int
VJ_make_workdir
(
const
char
*
dname
);
int
VJ_make_vcldir
(
const
char
*
dname
);
void
VJ_fix_vsm_file
(
int
fd
);
void
VJ_fix_storage_file
(
int
fd
);
...
...
bin/varnishd/mgt/mgt_jail.c
View file @
ebb0cf44
...
...
@@ -133,17 +133,15 @@ VJ_subproc(enum jail_subproc_e jse)
vjt
->
subproc
(
jse
);
}
void
int
VJ_make_workdir
(
const
char
*
dname
)
{
int
fd
;
AN
(
dname
);
CHECK_OBJ_NOTNULL
(
vjt
,
JAIL_TECH_MAGIC
);
if
(
vjt
->
make_workdir
!=
NULL
)
{
vjt
->
make_workdir
(
dname
);
return
;
}
if
(
vjt
->
make_workdir
!=
NULL
)
return
(
vjt
->
make_workdir
(
dname
));
VJ_master
(
JAIL_MASTER_FILE
);
if
(
mkdir
(
dname
,
0755
)
<
0
&&
errno
!=
EEXIST
)
...
...
@@ -162,22 +160,24 @@ VJ_make_workdir(const char *dname)
AZ
(
close
(
fd
));
AZ
(
unlink
(
"_.testfile"
));
VJ_master
(
JAIL_MASTER_LOW
);
return
(
0
);
}
void
int
VJ_make_vcldir
(
const
char
*
dname
)
{
AN
(
dname
);
CHECK_OBJ_NOTNULL
(
vjt
,
JAIL_TECH_MAGIC
);
if
(
vjt
->
make_vcldir
!=
NULL
)
{
vjt
->
make_vcldir
(
dname
);
return
;
}
if
(
vjt
->
make_vcldir
!=
NULL
)
return
(
vjt
->
make_vcldir
(
dname
));
if
(
mkdir
(
dname
,
0755
)
<
0
&&
errno
!=
EEXIST
)
ARGV_ERR
(
"Cannot create VCL directory '%s': %s
\n
"
,
if
(
mkdir
(
dname
,
0755
)
<
0
&&
errno
!=
EEXIST
)
{
MGT_complain
(
C_ERR
,
"Cannot create VCL directory '%s': %s
"
,
dname
,
strerror
(
errno
));
return
(
1
);
}
return
(
0
);
}
void
...
...
bin/varnishd/mgt/mgt_jail_unix.c
View file @
ebb0cf44
...
...
@@ -236,14 +236,19 @@ vju_subproc(enum jail_subproc_e jse)
#endif
}
static
void
__match_proto__
(
jail_make_dir_f
)
static
int
__match_proto__
(
jail_make_dir_f
)
vju_make_vcldir
(
const
char
*
dname
)
{
AZ
(
seteuid
(
0
));
assert
((
mkdir
(
dname
,
0755
)
==
0
)
||
errno
==
EEXIST
);
if
(
mkdir
(
dname
,
0755
)
<
0
&&
errno
!=
EEXIST
)
{
MGT_complain
(
C_ERR
,
"Cannot create VCL directory '%s': %s"
,
dname
,
strerror
(
errno
));
return
(
1
);
}
AZ
(
chown
(
dname
,
vju_uid
,
vju_gid
));
AZ
(
seteuid
(
vju_uid
));
return
(
0
);
}
...
...
bin/varnishd/mgt/mgt_main.c
View file @
ebb0cf44
...
...
@@ -743,7 +743,9 @@ main(int argc, char * const *argv)
identify
(
i_arg
);
VJ_make_workdir
(
dirname
);
if
(
VJ_make_workdir
(
dirname
))
ARGV_ERR
(
"Cannot create working directory (%s): %s
\n
"
,
dirname
,
strerror
(
errno
));
/* XXX: should this be relative to the -n arg ? */
VJ_master
(
JAIL_MASTER_FILE
);
...
...
bin/varnishd/mgt/mgt_vcc.c
View file @
ebb0cf44
...
...
@@ -276,7 +276,14 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc,
AZ
(
VSB_finish
(
sb
));
vp
.
dir
=
strdup
(
VSB_data
(
sb
));
AN
(
vp
.
dir
);
VJ_make_vcldir
(
vp
.
dir
);
if
(
VJ_make_vcldir
(
vp
.
dir
))
{
free
(
vp
.
dir
);
VSB_destroy
(
&
sb
);
VCLI_Out
(
cli
,
"VCL compilation failed"
);
VCLI_SetResult
(
cli
,
CLIS_PARAM
);
return
(
NULL
);
}
VSB_clear
(
sb
);
VSB_printf
(
sb
,
"%s/%s"
,
vp
.
dir
,
VGC_SRC
);
...
...
@@ -310,7 +317,7 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc,
VCLI_Out
(
cli
,
"VCL compilation failed"
);
VCLI_SetResult
(
cli
,
CLIS_PARAM
);
}
return
(
NULL
);
return
(
NULL
);
}
free
(
vp
.
dir
);
...
...
bin/varnishtest/tests/b00032.vtc
View file @
ebb0cf44
...
...
@@ -26,3 +26,4 @@ varnish v1 -clierr 106 {vcl.load vcl3 ./nonexistent.vcl}
varnish v1 -cliok "vcl.discard vcl2"
varnish v1 -clierr 106 {vcl.load /invalid/name.vcl vcl4}
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