From 82155cedc3182d53f7d3c87d551a3337af5caefa Mon Sep 17 00:00:00 2001 From: Geir Hauge Date: Fri, 17 Nov 2006 14:32:46 +0000 Subject: [PATCH] =?UTF-8?q?Legger=20til=20st=C3=B8tte=20for=20CREATE=20TEM?= =?UTF-8?q?PORARY=20TABLES=20og=20LOCK=20TABLES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql-dbadm.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/mysql-dbadm.c b/mysql-dbadm.c index 332e482..d4d2c11 100644 --- a/mysql-dbadm.c +++ b/mysql-dbadm.c @@ -1,5 +1,5 @@ /* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.16 2006-08-15 11:51:59 geirha Exp $ + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.17 2006-11-17 14:32:46 geirha Exp $ * * mysql-dbadm.c * @@ -264,24 +264,25 @@ writeperm(FILE *f, MYSQL *pmysql, const char *db) MYSQL_ROW row; sprintf(query, "select user,select_priv,insert_priv,update_priv," - "delete_priv,create_priv,drop_priv,alter_priv,index_priv from db where db='%s'", db); + "delete_priv,create_priv,drop_priv,alter_priv,index_priv," + "create_tmp_table_priv,lock_tables_priv from db where db='%s'", db); if (mysql_query(pmysql, query)) return dberror(pmysql, "Query for permissions failed."); res = mysql_store_result(pmysql); rows = mysql_num_rows(res); fprintf(f, "# User " - "Select Insert Update Delete Create Drop Alter Index\n"); + "Select Insert Update Delete Create Drop Alter Index Create temporary tables Lock tables\n"); fprintf(f, "# ---------------- " - "------ ------ ------ ------ ------ ---- ----- -----\n"); + "------ ------ ------ ------ ------ ---- ----- ----- ----------------------- -----------\n"); if (rows == 0) fprintf(f, "# (no permissions currently granted to any users)\n"); else { for (i = 0; i < rows; i++) { row = mysql_fetch_row(res); - fprintf(f, " %-16s %-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]); + fprintf(f, " %-16s %-7s %-7s %-7s %-7s %-6s %-6s %-6s %-15s %-18s %s\n", + row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10]); } } free(res); @@ -313,7 +314,8 @@ editperm(MYSQL *pmysql, const char *db) char line[1024]; /* buffer to hold one line */ char *cp; /* used to interate through a line */ char *user, *select_priv, *insert_priv, *update_priv, *delete_priv, - *create_priv, *drop_priv, *alter_priv, *index_priv; + *create_priv, *drop_priv, *alter_priv, *index_priv, *create_tmp_table_priv, + *lock_tables_priv; char query[1024]; /* used to build a query */ char *queries[MAX_GRANTS]; /* insert queries */ int lines; /* number of grant lines processed */ @@ -386,15 +388,20 @@ editperm(MYSQL *pmysql, const char *db) CHECK_PRIV(alter_priv); STRTOK_WHITESPACE(index_priv, NULL); CHECK_PRIV(index_priv); + STRTOK_WHITESPACE(create_tmp_table_priv, NULL); + CHECK_PRIV(create_tmp_table_priv); + STRTOK_WHITESPACE(lock_tables_priv, NULL); + CHECK_PRIV(lock_tables_priv); #undef STRTOK_WHITESPACE #undef CHECK_PRIV sprintf(query, "insert into db (host, db, user, select_priv, insert_priv, " - "update_priv, delete_priv, create_priv, drop_priv, alter_priv, index_priv) values " - "('%%', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + "update_priv, delete_priv, create_priv, drop_priv, alter_priv, index_priv, " + "create_tmp_table_priv, lock_tables_priv) values " + "('%%', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", db, user, select_priv, insert_priv, update_priv, delete_priv, - create_priv, drop_priv, alter_priv, index_priv); + create_priv, drop_priv, alter_priv, index_priv, create_tmp_table_priv, lock_tables_priv); queries[lines] = strdup(query); lines++; if (lines >= MAX_GRANTS)