summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-01-10 16:39:32 +0100
committerantirez <antirez@gmail.com>2019-01-10 16:39:32 +0100
commit29c88a9ce593639599076bd1f564306e38ea7428 (patch)
tree58c4c835ced9df0f016af237ba867fb3b29451ca
parente9a902a95802367462cf42d9f950498ccf00b74b (diff)
downloadredis-29c88a9ce593639599076bd1f564306e38ea7428.tar.gz
ACL: initialization function.
-rw-r--r--src/acl.c11
-rw-r--r--src/server.c1
-rw-r--r--src/server.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/acl.c b/src/acl.c
index 2202f293c..269e4b40d 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -30,6 +30,12 @@
#include "server.h"
/* =============================================================================
+ * Global state for ACLs
+ * ==========================================================================*/
+
+rax *Users; /* Table mapping usernames to user structures. */
+
+/* =============================================================================
* Helper functions for the rest of the ACL implementation
* ==========================================================================*/
@@ -79,6 +85,11 @@ int time_independent_strcmp(char *a, char *b) {
* Low level ACL API
* ==========================================================================*/
+/* Initialization of the ACL subsystem. */
+void ACLInit(void) {
+ Users = raxNew();
+}
+
/* Check the username and password pair and return C_OK if they are valid,
* otherwise C_ERR is returned and errno is set to:
*
diff --git a/src/server.c b/src/server.c
index c297e9122..48b4cdb47 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2185,6 +2185,7 @@ void initServer(void) {
if (server.cluster_enabled) clusterInit();
replicationScriptCacheInit();
scriptingInit(1);
+ ACLInit();
slowlogInit();
latencyMonitorInit();
bioInit();
diff --git a/src/server.h b/src/server.h
index 22224f292..e120e9894 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1682,6 +1682,7 @@ void sendChildInfo(int process_type);
void receiveChildInfo(void);
/* acl.c -- Authentication related prototypes. */
+void ACLInit(void);
int ACLCheckUserCredentials(robj *username, robj *password);
unsigned long ACLGetCommandID(const char *cmdname);
user *ACLGetUserByName(const char *name, size_t namelen);