mirror of
https://github.com/fluencelabs/redis
synced 2025-05-07 08:22:13 +00:00
Merge pull request #6257 from JohnSully/ModuleSecurity
Modules must have execute permissions to load
This commit is contained in:
commit
c227f5e7bd
10
src/module.c
10
src/module.c
@ -31,6 +31,7 @@
|
||||
#include "cluster.h"
|
||||
#include "rdb.h"
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
@ -6984,6 +6985,15 @@ int moduleLoad(const char *path, void **module_argv, int module_argc) {
|
||||
int (*onload)(void *, void **, int);
|
||||
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_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user