Skisse for endring slik at References kan settes.
This commit is contained in:
parent
20ffd6693d
commit
63b59e05df
|
@ -108,6 +108,7 @@ usage_editperm()
|
||||||
printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n");
|
printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n");
|
||||||
printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n");
|
printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n");
|
||||||
printf(" Lock - Enables use of LOCK TABLE\n");
|
printf(" Lock - Enables use of LOCK TABLE\n");
|
||||||
|
printf(" References - Enables use of REFERENCES\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Report bugs to orakel@ntnu.no\n");
|
printf("Report bugs to orakel@ntnu.no\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -309,7 +310,8 @@ writeperm(FILE *f, MYSQL *pmysql, const char *db)
|
||||||
end = strmov(query, "SELECT user,select_priv,insert_priv,update_priv,"
|
end = strmov(query, "SELECT user,select_priv,insert_priv,update_priv,"
|
||||||
"delete_priv,create_priv,drop_priv,"
|
"delete_priv,create_priv,drop_priv,"
|
||||||
"alter_priv,index_priv,"
|
"alter_priv,index_priv,"
|
||||||
"create_tmp_table_priv,lock_tables_priv "
|
"create_tmp_table_priv,lock_tables_priv,"
|
||||||
|
"References_priv "
|
||||||
"FROM db WHERE db = '");
|
"FROM db WHERE db = '");
|
||||||
end += mysql_real_escape_string(pmysql, end, db, strlen(db));
|
end += mysql_real_escape_string(pmysql, end, db, strlen(db));
|
||||||
*end++ = '\'';
|
*end++ = '\'';
|
||||||
|
@ -324,18 +326,18 @@ writeperm(FILE *f, MYSQL *pmysql, const char *db)
|
||||||
rows = mysql_num_rows(res);
|
rows = mysql_num_rows(res);
|
||||||
fprintf(f, "# User "
|
fprintf(f, "# User "
|
||||||
"Select Insert Update Delete Create Drop Alter Index "
|
"Select Insert Update Delete Create Drop Alter Index "
|
||||||
" Temp Lock\n");
|
" Temp Lock References\n");
|
||||||
fprintf(f, "# ---------------- "
|
fprintf(f, "# ---------------- "
|
||||||
"------ ------ ------ ------ ------ ---- ----- ----- "
|
"------ ------ ------ ------ ------ ---- ----- ----- "
|
||||||
" ---- ----\n");
|
" ---- ---- ----------\n");
|
||||||
|
|
||||||
if (rows == 0)
|
if (rows == 0)
|
||||||
fprintf(f, "# (no permissions currently granted to any users)\n");
|
fprintf(f, "# (no permissions currently granted to any users)\n");
|
||||||
else {
|
else {
|
||||||
for (i = 0; i < rows; i++) {
|
for (i = 0; i < rows; i++) {
|
||||||
row = mysql_fetch_row(res);
|
row = mysql_fetch_row(res);
|
||||||
fprintf(f, " %-16s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %s\n",
|
fprintf(f, " %-16s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %-7s %s\n",
|
||||||
row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10]);
|
row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
@ -368,7 +370,7 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
char *cp; /* used to interate through a line */
|
char *cp; /* used to interate through a line */
|
||||||
char *user, *select_priv, *insert_priv, *update_priv, *delete_priv,
|
char *user, *select_priv, *insert_priv, *update_priv, *delete_priv,
|
||||||
*create_priv, *drop_priv, *alter_priv, *index_priv, *create_tmp_table_priv,
|
*create_priv, *drop_priv, *alter_priv, *index_priv, *create_tmp_table_priv,
|
||||||
*lock_tables_priv;
|
*lock_tables_priv, *References_priv;
|
||||||
char query[4096], *end; /* used to build a query */
|
char query[4096], *end; /* used to build a query */
|
||||||
char *queries[MAX_GRANTS]; /* insert queries */
|
char *queries[MAX_GRANTS]; /* insert queries */
|
||||||
int lines; /* number of grant lines processed */
|
int lines; /* number of grant lines processed */
|
||||||
|
@ -484,6 +486,8 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
CHECK_PRIV(create_tmp_table_priv);
|
CHECK_PRIV(create_tmp_table_priv);
|
||||||
STRTOK_WHITESPACE(lock_tables_priv, NULL);
|
STRTOK_WHITESPACE(lock_tables_priv, NULL);
|
||||||
CHECK_PRIV(lock_tables_priv);
|
CHECK_PRIV(lock_tables_priv);
|
||||||
|
STRTOK_WHITESPACE(References_priv, NULL);
|
||||||
|
CHECK_PRIV(References_priv);
|
||||||
|
|
||||||
#undef STRTOK_WHITESPACE
|
#undef STRTOK_WHITESPACE
|
||||||
#undef CHECK_PRIV
|
#undef CHECK_PRIV
|
||||||
|
@ -492,7 +496,8 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
"host,db,user,select_priv,insert_priv,"
|
"host,db,user,select_priv,insert_priv,"
|
||||||
"update_priv,delete_priv,create_priv,"
|
"update_priv,delete_priv,create_priv,"
|
||||||
"drop_priv,alter_priv,index_priv,"
|
"drop_priv,alter_priv,index_priv,"
|
||||||
"create_tmp_table_priv,lock_tables_priv"
|
"create_tmp_table_priv,lock_tables_priv,"
|
||||||
|
"References_priv"
|
||||||
") VALUES (");
|
") VALUES (");
|
||||||
|
|
||||||
end = strmov(end, "'%'");
|
end = strmov(end, "'%'");
|
||||||
|
@ -516,6 +521,7 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
APPEND(index_priv);
|
APPEND(index_priv);
|
||||||
APPEND(create_tmp_table_priv);
|
APPEND(create_tmp_table_priv);
|
||||||
APPEND(lock_tables_priv);
|
APPEND(lock_tables_priv);
|
||||||
|
APPEND(References_priv);
|
||||||
*end++ = ')';
|
*end++ = ')';
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue