Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
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
unique-xids
Commits
b7175b38
Commit
b7175b38
authored
Jun 13, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Priv-sep vcc and cc also.
Fixes #1153
parent
94fe4dab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+16
-1
No files found.
bin/varnishd/mgt/mgt_vcc.c
View file @
b7175b38
...
...
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include "common/params.h"
#include "mgt/mgt.h"
#include "libvcl.h"
...
...
@@ -136,6 +137,7 @@ run_vcc(void *priv)
int
fd
,
i
,
l
;
CAST_OBJ_NOTNULL
(
vp
,
priv
,
VCC_PRIV_MAGIC
);
mgt_sandbox
();
sb
=
VSB_new_auto
();
XXXAN
(
sb
);
VCC_VCL_dir
(
vcc
,
mgt_vcl_dir
);
...
...
@@ -174,6 +176,7 @@ run_vcc(void *priv)
static
void
run_cc
(
void
*
priv
)
{
mgt_sandbox
();
(
void
)
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
priv
,
NULL
);
}
...
...
@@ -241,8 +244,10 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag)
VSB_printf
(
sb
,
"Failed to create %s: %s"
,
sf
,
strerror
(
errno
));
return
(
NULL
);
}
(
void
)
fchown
(
sfd
,
mgt_param
.
uid
,
mgt_param
.
gid
);
AZ
(
close
(
sfd
));
/* Run the VCC compiler in a sub-process */
memset
(
&
vp
,
0
,
sizeof
vp
);
vp
.
magic
=
VCC_PRIV_MAGIC
;
...
...
@@ -267,6 +272,16 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag)
of
[
sizeof
sf
-
1
]
=
'o'
;
of
[
sizeof
sf
]
=
'\0'
;
i
=
open
(
of
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0600
);
if
(
i
<
0
)
{
VSB_printf
(
sb
,
"Failed to create %s: %s"
,
of
,
strerror
(
errno
));
(
void
)
unlink
(
sf
);
return
(
NULL
);
}
(
void
)
fchown
(
i
,
mgt_param
.
uid
,
mgt_param
.
gid
);
AZ
(
close
(
i
));
/* Build the C-compiler command line */
cmdsb
=
mgt_make_cc_cmd
(
sf
,
of
);
...
...
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