Commit 70534846 authored by John Sully's avatar John Sully
Browse files

Modules must have execute permissions to load

parent 5f450e49
......@@ -30,6 +30,7 @@
#include "server.h"
#include "cluster.h"
#include <dlfcn.h>
#include <sys/stat.h>
#define REDISMODULE_CORE 1
#include "redismodule.h"
......@@ -5160,6 +5161,15 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
void *handle;
RedisModuleCtx ctx = REDISMODULE_CTX_INIT;
struct stat st;
if (stat(path, &st) == 0)
{ // this check is best effort
if (!(st.st_mode & S_IEXEC)) {
serverLog(LL_WARNING, "Module %s failed to load: It does not have execute permissions.", path);
return C_ERR;
}
}
handle = dlopen(path,RTLD_NOW|RTLD_LOCAL);
if (handle == NULL) {
serverLog(LL_WARNING, "Module %s failed to load: %s", path, dlerror());
......
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