Prepare for local/remote admin users
Local admins are the ones accessing MaxScale on the same host over a Unix domain socket, and who are strongly identified), and optional remote admins are the ones accessing MaxScale potentially over a tcp socket (potentially over the network), and who are weakly identified. These are completely separate and a different set of functions will be needed for managing them. This initial change merely renames the functions.
This commit is contained in:
@ -49,12 +49,12 @@
|
||||
static int
|
||||
test1()
|
||||
{
|
||||
if (admin_verify("admin", "mariadb") == 0)
|
||||
if (admin_remote_verify("admin", "mariadb") == 0)
|
||||
{
|
||||
fprintf(stderr, "admin_verify: test 1.1 (default user) failed.\n");
|
||||
return 1;
|
||||
}
|
||||
if (admin_verify("bad", "user"))
|
||||
if (admin_remote_verify("bad", "user"))
|
||||
{
|
||||
fprintf(stderr, "admin_verify: test 1.2 (wrong user) failed.\n");
|
||||
return 1;
|
||||
@ -73,15 +73,15 @@ test1()
|
||||
static int
|
||||
test2()
|
||||
{
|
||||
char *err;
|
||||
const char *err;
|
||||
|
||||
if ((err = admin_add_user("user0")) != NULL)
|
||||
if ((err = admin_local_add_user("user0")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 2.1 (add user) failed, %s.\n", err);
|
||||
|
||||
return 1;
|
||||
}
|
||||
if (admin_add_user("user0") == NULL)
|
||||
if (admin_local_add_user("user0") == NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 2.2 (add user) failed, duplicate.\n");
|
||||
|
||||
@ -89,7 +89,7 @@ test2()
|
||||
}
|
||||
|
||||
/* Deleting the last user is not forbidden so we expect this to succeed */
|
||||
if ((err = admin_remove_user("user0")) != NULL)
|
||||
if ((err = admin_local_remove_user("user0")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_remove_user: test 2.3 (add user) failed, %s.\n", err);
|
||||
|
||||
@ -97,7 +97,7 @@ test2()
|
||||
}
|
||||
|
||||
/* Add the user back, for test5. */
|
||||
if ((err = admin_add_user("user0")) != NULL)
|
||||
if ((err = admin_local_add_user("user0")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 2.4 (add user) failed, %s.\n", err);
|
||||
|
||||
@ -119,37 +119,37 @@ test2()
|
||||
static int
|
||||
test3()
|
||||
{
|
||||
char *err;
|
||||
const char *err;
|
||||
|
||||
if ((err = admin_add_user("user1")) != NULL)
|
||||
if ((err = admin_local_add_user("user1")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 3.1 (add user) failed, %s.\n", err);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (admin_search_user("user1") == 0)
|
||||
if (admin_local_search_user("user1") == 0)
|
||||
{
|
||||
fprintf(stderr, "admin_search_user: test 3.2 (search user) failed.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (admin_search_user("user2") != 0)
|
||||
if (admin_local_search_user("user2") != 0)
|
||||
{
|
||||
fprintf(stderr, "admin_search_user: test 3.3 (search user) failed, unexpeted user found.\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((err = admin_remove_user("user1")) != NULL)
|
||||
if ((err = admin_local_remove_user("user1")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_remove_user: test 3.4 (add user) failed, %s.\n", err);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (admin_search_user("user1"))
|
||||
if (admin_local_search_user("user1"))
|
||||
{
|
||||
fprintf(stderr, "admin_search_user: test 3.5 (search user) failed - user was deleted.\n");
|
||||
|
||||
@ -172,13 +172,14 @@ test3()
|
||||
static int
|
||||
test4()
|
||||
{
|
||||
char *err, user[40], passwd[40];
|
||||
const char *err;
|
||||
char user[40], passwd[40];
|
||||
int i, n_users = 50;
|
||||
|
||||
for (i = 1; i < n_users; i++)
|
||||
{
|
||||
sprintf(user, "user%d", i);
|
||||
if ((err = admin_add_user(user)) != NULL)
|
||||
if ((err = admin_local_add_user(user)) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 4.1 (add user) failed, %s.\n", err);
|
||||
|
||||
@ -189,7 +190,7 @@ test4()
|
||||
for (i = 1; i < n_users; i++)
|
||||
{
|
||||
sprintf(user, "user%d", i);
|
||||
if (admin_search_user(user) == 0)
|
||||
if (admin_local_search_user(user) == 0)
|
||||
{
|
||||
fprintf(stderr, "admin_search_user: test 4.2 (search user) failed.\n");
|
||||
|
||||
@ -200,7 +201,7 @@ test4()
|
||||
for (i = 1; i < n_users; i++)
|
||||
{
|
||||
sprintf(user, "user%d", i);
|
||||
if ((err = admin_remove_user(user)) != NULL)
|
||||
if ((err = admin_local_remove_user(user)) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_remove_user: test 4.3 (add user) failed, %s.\n", err);
|
||||
|
||||
@ -220,16 +221,16 @@ test4()
|
||||
static int
|
||||
test5()
|
||||
{
|
||||
char *err;
|
||||
const char *err;
|
||||
|
||||
if ((err = admin_add_user("user")) != NULL)
|
||||
if ((err = admin_local_add_user("user")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_add_user: test 5.1 (add user) failed, %s.\n", err);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((err = admin_remove_user("user0")) != NULL)
|
||||
if ((err = admin_local_remove_user("user0")) != NULL)
|
||||
{
|
||||
fprintf(stderr, "admin_remove_user: test 5.2 (add user) failed, %s.\n", err);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user