mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Removed no longer needed RoleHostFK as it is not used to link to a Role.
Also removed code that loads that column into memory.
This commit is contained in:
committed by
Sergei Golubchik
parent
ee1e66468f
commit
071c4ce88b
@ -44,10 +44,7 @@ set @had_user_table= @@warning_count != 0;
|
|||||||
CREATE TABLE IF NOT EXISTS roles_mapping (
|
CREATE TABLE IF NOT EXISTS roles_mapping (
|
||||||
HostFk char(60) binary DEFAULT '' NOT NULL,
|
HostFk char(60) binary DEFAULT '' NOT NULL,
|
||||||
UserFk char(16) binary DEFAULT '' NOT NULL,
|
UserFk char(16) binary DEFAULT '' NOT NULL,
|
||||||
RoleHostFK char(60) binary DEFAULT '' NOT NULL,
|
RoleFk char(16) binary DEFAULT '' NOT NULL
|
||||||
RoleUserFk char(16) binary DEFAULT '' NOT NULL,
|
|
||||||
CONSTRAINT FOREIGN KEY (HostFk, UserFk) REFERENCES user (Host, User),
|
|
||||||
CONSTRAINT FOREIGN KEY (RoleHostFk, RoleUserFk) REFERENCES user (Host, User)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,7 +539,6 @@ typedef struct st_role_grant
|
|||||||
char *u_uname;
|
char *u_uname;
|
||||||
char *u_hname;
|
char *u_hname;
|
||||||
char *r_uname;
|
char *r_uname;
|
||||||
char *r_hname;
|
|
||||||
LEX_STRING hashkey;
|
LEX_STRING hashkey;
|
||||||
} ROLE_GRANT_PAIR;
|
} ROLE_GRANT_PAIR;
|
||||||
|
|
||||||
@ -1237,28 +1236,24 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
|||||||
sizeof(ROLE_GRANT_PAIR));
|
sizeof(ROLE_GRANT_PAIR));
|
||||||
mapping->u_hname= get_field(&mem, table->field[0]);
|
mapping->u_hname= get_field(&mem, table->field[0]);
|
||||||
mapping->u_uname= get_field(&mem, table->field[1]);
|
mapping->u_uname= get_field(&mem, table->field[1]);
|
||||||
mapping->r_hname= get_field(&mem, table->field[2]);
|
mapping->r_uname= get_field(&mem, table->field[2]);
|
||||||
mapping->r_uname= get_field(&mem, table->field[3]);
|
|
||||||
|
|
||||||
size_t len[4] = {mapping->u_hname ? strlen(mapping->u_hname) : 0,
|
size_t len[3] = {mapping->u_hname ? strlen(mapping->u_hname) : 0,
|
||||||
mapping->u_uname ? strlen(mapping->u_uname) : 0,
|
mapping->u_uname ? strlen(mapping->u_uname) : 0,
|
||||||
mapping->r_hname ? strlen(mapping->r_hname) : 0,
|
|
||||||
mapping->r_uname ? strlen(mapping->r_uname) : 0};
|
mapping->r_uname ? strlen(mapping->r_uname) : 0};
|
||||||
char *buff= (char *)alloc_root(&mem, len[0] + len[1] + len[2] + len[3] + 1);
|
char *buff= (char *)alloc_root(&mem, len[0] + len[1] + len[2] + 1);
|
||||||
memcpy(buff, mapping->u_hname, len[0]);
|
memcpy(buff, mapping->u_hname, len[0]);
|
||||||
memcpy(buff + len[0], mapping->u_uname, len[1]);
|
memcpy(buff + len[0], mapping->u_uname, len[1]);
|
||||||
memcpy(buff + len[0] + len[1], mapping->r_hname, len[2]);
|
memcpy(buff + len[0] + len[1] + len[2], mapping->r_uname, len[2]);
|
||||||
memcpy(buff + len[0] + len[1] + len[2], mapping->r_uname, len[3]);
|
buff[len[0] + len[1] + len[2]] = '\0';
|
||||||
buff[len[0] + len[1] + len[2] + len[3]] = '\0';
|
|
||||||
mapping->hashkey.str = buff;
|
mapping->hashkey.str = buff;
|
||||||
mapping->hashkey.length = len[0] + len[1] + len[2] + len[3];
|
mapping->hashkey.length = len[0] + len[1] + len[2];
|
||||||
|
|
||||||
if (add_role_user_mapping(mapping) == 1) {
|
if (add_role_user_mapping(mapping) == 1) {
|
||||||
sql_print_error("Invalid roles_mapping table entry '%s@%s', '%s@%s'",
|
sql_print_error("Invalid roles_mapping table entry user:'%s@%s', rolename:'%s'",
|
||||||
mapping->u_uname ? mapping->u_uname : "",
|
mapping->u_uname ? mapping->u_uname : "",
|
||||||
mapping->u_hname ? mapping->u_hname : "",
|
mapping->u_hname ? mapping->u_hname : "",
|
||||||
mapping->r_uname ? mapping->r_uname : "",
|
mapping->r_uname ? mapping->r_uname : "");
|
||||||
mapping->r_hname ? mapping->r_hname : "");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user