Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
dc4f7ad1
Commit
dc4f7ad1
authored
Jan 11, 2019
by
antirez
Browse files
ACL: create the default user.
parent
6bb6a6d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
dc4f7ad1
...
...
@@ -34,6 +34,10 @@
* ==========================================================================*/
rax
*
Users
;
/* Table mapping usernames to user structures. */
user
*
DefaultUser
;
/* Global reference to the default user.
Every new connection is associated to it, if no
AUTH or HELLO is used to authenticate with a
different user. */
/* =============================================================================
* Helper functions for the rest of the ACL implementation
...
...
@@ -90,7 +94,7 @@ int time_independent_strcmp(char *a, char *b) {
* the structure representing the user.
*
* If the user with such name already exists NULL is returned. */
user
*
ACL
c
reateUser
(
const
char
*
name
,
size_t
namelen
)
{
user
*
ACL
C
reateUser
(
const
char
*
name
,
size_t
namelen
)
{
if
(
raxFind
(
Users
,(
unsigned
char
*
)
name
,
namelen
)
!=
raxNotFound
)
return
NULL
;
user
*
u
=
zmalloc
(
sizeof
(
*
u
));
u
->
flags
=
0
;
...
...
@@ -108,6 +112,7 @@ user *ACLcreateUser(const char *name, size_t namelen) {
/* Initialization of the ACL subsystem. */
void
ACLInit
(
void
)
{
Users
=
raxNew
();
DefaultUser
=
ACLCreateUser
(
"default"
,
7
);
}
/* Check the username and password pair and return C_OK if they are valid,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment