Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8528
Modified Files:
Tag: Release_0_9_5_stable
refdbda.c
Log Message:
fixed LOCK issue for MySQL4.0.2 and later
Index: refdbda.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/refdbda.c,v
retrieving revision 1.41
retrieving revision 1.41.2.1
diff -u -U2 -r1.41 -r1.41.2.1
--- refdbda.c 4 Feb 2004 21:07:21 -0000 1.41
+++ refdbda.c 3 Jun 2004 21:29:52 -0000 1.41.2.1
@@ -1199,8 +1199,10 @@
}
- /* MySQL 4.02 introduced a new privilege "LOCK TABLES". As older
+ /* MySQL 4.0.2 introduced a new privilege "LOCK TABLES". As older
versions will barf at it, add it only if we use a newer
version */
- if (ver.major >= 4 && ver.minor >= 2) {
+ if ((ver.major == 4 && ver.minor == 0 && ver.minuscule >=2)
+ || (ver.major == 4 && ver.minor > 0)
+ || ver.major > 4) {
strcpy(lockstring, ",LOCK TABLES ");
}
@@ -1313,14 +1315,14 @@
a new user with the given password. If the user already
exists, the password will be changed to the one given */
- sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s IDENTIFIED BY \'%s\'", MAIN_DB, userathost, newuser_passwd);
+ sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s IDENTIFIED BY \'%s\'", lockstring, MAIN_DB, userathost, newuser_passwd);
}
else if (create_new) {
/* avoid possible security risk: we provide a default
password to avoid creating users with no passwords */
- sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s IDENTIFIED BY \'refdb\'", MAIN_DB, userathost);
+ sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s IDENTIFIED BY \'refdb\'", lockstring, MAIN_DB, userathost);
}
else {
/* the user already exists and we don't touch the password */
- sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE ON %s.* TO %s", MAIN_DB, userathost);
+ sprintf(sql_command, "GRANT SELECT, INSERT, UPDATE, DELETE%s ON %s.* TO %s", lockstring, MAIN_DB, userathost);
}
LOG_PRINT(LOG_DEBUG, sql_command);
|