Release 0.52.
- mysql-dbadm editperm failed silently when too few Y/N-values were given. - added more information on editperm (--help-editperm)
This commit is contained in:
parent
7176eca90b
commit
daff9bc988
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.19 2007-02-27 14:10:08 geirha Exp $
|
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007-06-04 08:40:54 geirha Exp $
|
||||||
*
|
*
|
||||||
* mysql-dbadm.c
|
* mysql-dbadm.c
|
||||||
*
|
*
|
||||||
|
@ -64,6 +64,7 @@ strtok_whitespace(char *s)
|
||||||
int
|
int
|
||||||
valid_priv(const char *s)
|
valid_priv(const char *s)
|
||||||
{
|
{
|
||||||
|
if (s == NULL) return 0;
|
||||||
#define ACCEPT(x) if (strcmp(s, x) == 0) return 1
|
#define ACCEPT(x) if (strcmp(s, x) == 0) return 1
|
||||||
ACCEPT("Y");
|
ACCEPT("Y");
|
||||||
ACCEPT("N");
|
ACCEPT("N");
|
||||||
|
@ -88,6 +89,36 @@ usage()
|
||||||
printf(" editperm change permissions for the DATABASE(s). Your\n");
|
printf(" editperm change permissions for the DATABASE(s). Your\n");
|
||||||
printf(" favorite editor will be started, allowing you\n");
|
printf(" favorite editor will be started, allowing you\n");
|
||||||
printf(" to make changes to the permission table.\n");
|
printf(" to make changes to the permission table.\n");
|
||||||
|
printf(" Run '%s --help-editperm' for more\n"
|
||||||
|
" information.\n",program_name);
|
||||||
|
printf("\n");
|
||||||
|
printf("Report bugs to drift@stud.ntnu.no\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
usage_editperm()
|
||||||
|
{
|
||||||
|
printf("Usage: %s editperm [DATABASE]\n", program_name);
|
||||||
|
printf("Edit permissions for the DATABASE. Running this command will\n");
|
||||||
|
printf("spawn the editor stored in the $EDITOR environment variable.\n");
|
||||||
|
printf("(pico will be used if the variable is unset)\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("The file should contain one line per user, starting with the\n");
|
||||||
|
printf("username and followed by ten Y/N-values seperated by whitespace.\n");
|
||||||
|
printf("Lines starting with # are ignored.\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("The Y/N-values corresponds to the following mysql privileges:\n");
|
||||||
|
printf(" Select - Enables use of SELECT\n");
|
||||||
|
printf(" Insert - Enables use of INSERT\n");
|
||||||
|
printf(" Update - Enables use of UPDATE\n");
|
||||||
|
printf(" Delete - Enables use of DELTE\n");
|
||||||
|
printf(" Create - Enables use of CREATE TABLE\n");
|
||||||
|
printf(" Drop - Enables use of DROP TABLE\n");
|
||||||
|
printf(" Alter - Enables use of ALTER TABLE\n");
|
||||||
|
printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n");
|
||||||
|
printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n");
|
||||||
|
printf(" Lock - Enables use of LOCK TABLE\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Report bugs to drift@stud.ntnu.no\n");
|
printf("Report bugs to drift@stud.ntnu.no\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -372,7 +403,10 @@ editperm(MYSQL *pmysql, const char *db)
|
||||||
|
|
||||||
#define CHECK_PRIV(PRIV) \
|
#define CHECK_PRIV(PRIV) \
|
||||||
if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \
|
if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \
|
||||||
"in grant line %d.", PRIV, lines + 1)
|
"in grant line %d.\nMake sure you fill in a value (Y or N) for " \
|
||||||
|
"all ten privileges.\nRun '%s --help-editerm' for more " \
|
||||||
|
"information.\nNo permissions have been set.", PRIV, lines + 1, \
|
||||||
|
program_name)
|
||||||
|
|
||||||
STRTOK_WHITESPACE(select_priv, NULL);
|
STRTOK_WHITESPACE(select_priv, NULL);
|
||||||
CHECK_PRIV(select_priv);
|
CHECK_PRIV(select_priv);
|
||||||
|
@ -453,6 +487,9 @@ main(int argc, char *argv[])
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
if (strcmp(argv[i], "--help") == 0)
|
if (strcmp(argv[i], "--help") == 0)
|
||||||
return usage();
|
return usage();
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
if (strcmp(argv[i], "--help-editperm") == 0)
|
||||||
|
return usage_editperm();
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
if (strcmp(argv[i], "--version") == 0)
|
if (strcmp(argv[i], "--version") == 0)
|
||||||
return version();
|
return version();
|
||||||
|
|
Loading…
Reference in New Issue