Modules must have execute permissions to load
Former-commit-id: a4efcd35af52227a22daf7f882e8e14db3f8bf57
This commit is contained in:
parent
ebc50797a0
commit
5404d6f6bb
@ -32,6 +32,7 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define REDISMODULE_CORE 1
|
#define REDISMODULE_CORE 1
|
||||||
#include "redismodule.h"
|
#include "redismodule.h"
|
||||||
@ -5227,6 +5228,15 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
|
|||||||
void *handle;
|
void *handle;
|
||||||
RedisModuleCtx ctx = REDISMODULE_CTX_INIT;
|
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);
|
handle = dlopen(path,RTLD_NOW|RTLD_LOCAL);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
serverLog(LL_WARNING, "Module %s failed to load: %s", path, dlerror());
|
serverLog(LL_WARNING, "Module %s failed to load: %s", path, dlerror());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user