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
05292e34
Commit
05292e34
authored
Nov 06, 2019
by
Madelyn Olson
Browse files
Improved some error handling in examples
parent
75d97714
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
05292e34
...
...
@@ -5216,7 +5216,7 @@ RedisModuleUser *RM_CreateModuleUser(const char *name) {
RedisModuleUser
*
new_user
=
zmalloc
(
sizeof
(
RedisModuleUser
));
new_user
->
user
=
ACLCreateUnlinkedUser
();
/* Free the
previous
temporarily assigned name to assign the new one */
/* Free the temporarily assigned name to assign the new one */
sdsfree
(
new_user
->
user
->
name
);
new_user
->
user
->
name
=
sdsnew
(
name
);
return
new_user
;
...
...
@@ -5262,6 +5262,8 @@ RedisModuleAuthCtx *RM_CreateAuthCtx(RedisModuleUserChangedFunc callback, void *
RedisModuleAuthCtx
*
auth_ctx
=
zmalloc
(
sizeof
(
RedisModuleAuthCtx
));
auth_ctx
->
callback
=
callback
;
auth_ctx
->
privdata
=
privdata
;
auth_ctx
->
module
=
NULL
;
auth_ctx
->
authenticated_client
=
NULL
;
return
auth_ctx
;
}
...
...
src/modules/helloacl.c
View file @
05292e34
...
...
@@ -92,7 +92,11 @@ int AuthGlobalCommand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv
}
RedisModuleAuthCtx
*
auth_ctx
=
RedisModule_CreateAuthCtx
(
HelloACL_UserChanged
,
NULL
);
RedisModule_AuthClientWithUser
(
ctx
,
global
,
auth_ctx
);
if
(
RedisModule_AuthClientWithUser
(
ctx
,
global
,
auth_ctx
)
==
REDISMODULE_ERR
)
{
return
RedisModule_ReplyWithError
(
ctx
,
"Couldn't authenticate client"
);
}
global_auth_ctx
=
auth_ctx
;
return
RedisModule_ReplyWithSimpleString
(
ctx
,
"OK"
);
...
...
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