Commit ee439631 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Force file permissions 0755 on compiled vcl .so file to make sure it

is readable by the unprivileged user.

Fixes: #1072
parent 0d036490
......@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "mgt/mgt.h"
......@@ -272,6 +273,14 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag)
if (!i)
i = VSUB_run(sb, run_dlopen, of, "dlopen", 10);
/* Ensure the file is readable to the unprivileged user */
if (!i) {
i = chmod(of, 0755);
if (i)
VSB_printf(sb, "Failed to set permissions on %s: %s",
of, strerror(errno));
}
if (i) {
(void)unlink(of);
return (NULL);
......
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