Modules must have execute permissions to load
This commit is contained in:
parent
5f450e4928
commit
70534846d1
10
src/module.c
10
src/module.c
@ -30,6 +30,7 @@
|
|||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "cluster.h"
|
#include "cluster.h"
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define REDISMODULE_CORE 1
|
#define REDISMODULE_CORE 1
|
||||||
#include "redismodule.h"
|
#include "redismodule.h"
|
||||||
@ -5159,6 +5160,15 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
|
|||||||
int (*onload)(void *, void **, int);
|
int (*onload)(void *, void **, int);
|
||||||
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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user