Addition of users_update
Fixed warning in service_alloc Correct comment in gateway.c
This commit is contained in:
parent
6b0220a468
commit
1d3da6d18f
@ -334,7 +334,8 @@ service.o: service.c /usr/include/stdio.h /usr/include/features.h \
|
||||
../include/service.h ../include/spinlock.h ../include/thread.h \
|
||||
/usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
|
||||
/usr/include/bits/setjmp.h ../include/dcb.h ../include/buffer.h \
|
||||
../include/server.h ../include/router.h ../include/modules.h
|
||||
../include/server.h ../include/router.h ../include/modules.h \
|
||||
../include/users.h ../include/hashtable.h ../include/atomic.h
|
||||
server.o: server.c /usr/include/stdio.h /usr/include/features.h \
|
||||
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
|
||||
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \
|
||||
|
@ -242,7 +242,7 @@ char buf[1024], *home, *cnf_file = NULL;
|
||||
poll_init();
|
||||
|
||||
/*
|
||||
* Start the service that was created above
|
||||
* Start the services that were created above
|
||||
*/
|
||||
printf("Started %d services\n", serviceStartAll());
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <spinlock.h>
|
||||
#include <modules.h>
|
||||
#include <dcb.h>
|
||||
#include <users.h>
|
||||
|
||||
static SPINLOCK service_spin = SPINLOCK_INIT;
|
||||
static SERVICE *allServices = NULL;
|
||||
|
17
core/users.c
17
core/users.c
@ -130,3 +130,20 @@ char
|
||||
atomic_add(&users->stats.n_fetches, 1);
|
||||
return hashtable_fetch(users->data, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the password data associated with a user in the users
|
||||
* table.
|
||||
*
|
||||
* @param users The users table
|
||||
* @param user The user name
|
||||
* @param auth The new authentication details
|
||||
* @return Number of users updated
|
||||
*/
|
||||
int
|
||||
users_update(USERS *users, char *user, char *auth)
|
||||
{
|
||||
if (hashtable_delete(users->data, user) == 0)
|
||||
return 0;
|
||||
return hashtable_add(users->data, user, auth);
|
||||
}
|
||||
|
@ -56,4 +56,5 @@ extern void users_free(USERS *); /**< Free a users table */
|
||||
extern int users_add(USERS *, char *, char *); /**< Add a user to the users table */
|
||||
extern int users_delete(USERS *, char *); /**< Delete a user from the users table */
|
||||
extern char *users_fetch(USERS *, char *); /**< Fetch the authentication data for a user */
|
||||
extern int users_update(USERS *, char *, char *); /**< Change the password data for a user in the users table */
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user