Commit 071c4ce8 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru Committed by Sergei Golubchik

Removed no longer needed RoleHostFK as it is not used to link to a Role.

Also removed code that loads that column into memory.
parent ee1e6646
......@@ -44,10 +44,7 @@ set @had_user_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS roles_mapping (
HostFk char(60) binary DEFAULT '' NOT NULL,
UserFk char(16) binary DEFAULT '' NOT NULL,
RoleHostFK char(60) 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)
RoleFk char(16) binary DEFAULT '' NOT NULL
);
......
......@@ -539,7 +539,6 @@ typedef struct st_role_grant
char *u_uname;
char *u_hname;
char *r_uname;
char *r_hname;
LEX_STRING hashkey;
} ROLE_GRANT_PAIR;
......@@ -1237,28 +1236,24 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
sizeof(ROLE_GRANT_PAIR));
mapping->u_hname= get_field(&mem, table->field[0]);
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[3]);
mapping->r_uname= get_field(&mem, table->field[2]);
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->r_hname ? strlen(mapping->r_hname) : 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 + 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[3]);
buff[len[0] + len[1] + len[2] + len[3]] = '\0';
memcpy(buff + len[0] + len[1] + len[2], mapping->r_uname, len[2]);
buff[len[0] + len[1] + len[2]] = '\0';
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) {
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_hname ? mapping->u_hname : "",
mapping->r_uname ? mapping->r_uname : "",
mapping->r_hname ? mapping->r_hname : "");
mapping->r_uname ? mapping->r_uname : "");
continue;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment