ACL: create the default user.
This commit is contained in:
parent
6bb6a6d3a8
commit
dc4f7ad106
@ -34,6 +34,10 @@
|
|||||||
* ==========================================================================*/
|
* ==========================================================================*/
|
||||||
|
|
||||||
rax *Users; /* Table mapping usernames to user structures. */
|
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
|
* 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.
|
* the structure representing the user.
|
||||||
*
|
*
|
||||||
* If the user with such name already exists NULL is returned. */
|
* If the user with such name already exists NULL is returned. */
|
||||||
user *ACLcreateUser(const char *name, size_t namelen) {
|
user *ACLCreateUser(const char *name, size_t namelen) {
|
||||||
if (raxFind(Users,(unsigned char*)name,namelen) != raxNotFound) return NULL;
|
if (raxFind(Users,(unsigned char*)name,namelen) != raxNotFound) return NULL;
|
||||||
user *u = zmalloc(sizeof(*u));
|
user *u = zmalloc(sizeof(*u));
|
||||||
u->flags = 0;
|
u->flags = 0;
|
||||||
@ -108,6 +112,7 @@ user *ACLcreateUser(const char *name, size_t namelen) {
|
|||||||
/* Initialization of the ACL subsystem. */
|
/* Initialization of the ACL subsystem. */
|
||||||
void ACLInit(void) {
|
void ACLInit(void) {
|
||||||
Users = raxNew();
|
Users = raxNew();
|
||||||
|
DefaultUser = ACLCreateUser("default",7);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the username and password pair and return C_OK if they are valid,
|
/* Check the username and password pair and return C_OK if they are valid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user