Oppdaterte bruker- og passordbehandling til MySQL V5.7.
Korrigerte e-postadr. ("Report bugs").
This commit is contained in:
parent
63d34a6e15
commit
20ffd6693d
|
@ -81,7 +81,7 @@ usage()
|
||||||
printf(" Run '%s --help-editperm' for more\n"
|
printf(" Run '%s --help-editperm' for more\n"
|
||||||
" information.\n",program_name);
|
" information.\n",program_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Report bugs to drift@stud.ntnu.no\n");
|
printf("Report bugs to orakel@ntnu.no\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ usage_editperm()
|
||||||
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("\n");
|
printf("\n");
|
||||||
printf("Report bugs to drift@stud.ntnu.no\n");
|
printf("Report bugs to orakel@ntnu.no\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ usage()
|
||||||
printf(" show give information about the USERS(s), or, if\n");
|
printf(" show give information about the USERS(s), or, if\n");
|
||||||
printf(" none are given, all the users you have.\n");
|
printf(" none are given, all the users you have.\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Report bugs to drift@stud.ntnu.no\n");
|
printf("Report bugs to orakel@ntnu.no\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ is_password_set(MYSQL *pmysql, const char *user)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
int check = 0;
|
int check = 0;
|
||||||
|
|
||||||
end = strmov(query, "SELECT password FROM user WHERE user='");
|
end = strmov(query, "SELECT authentication_string FROM user WHERE user='");
|
||||||
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
||||||
*end++ = '\'';
|
*end++ = '\'';
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
@ -77,9 +77,9 @@ create(MYSQL *pmysql, const char *user)
|
||||||
{
|
{
|
||||||
char query[1024], *end;
|
char query[1024], *end;
|
||||||
|
|
||||||
end = strmov(query, "INSERT INTO user (host, user) VALUES ('%', '");
|
end = strmov(query, "CREATE USER '");
|
||||||
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
||||||
end = strmov(end, "')");
|
end = strmov(end, "'");
|
||||||
|
|
||||||
if (mysql_query(pmysql, query))
|
if (mysql_query(pmysql, query))
|
||||||
return dberror(pmysql, "Failed to create user '%s'.", user);
|
return dberror(pmysql, "Failed to create user '%s'.", user);
|
||||||
|
@ -93,7 +93,7 @@ delete(MYSQL *pmysql, const char *user)
|
||||||
{
|
{
|
||||||
char query[1024], *end;
|
char query[1024], *end;
|
||||||
|
|
||||||
end = strmov(query, "DELETE FROM user WHERE user='");
|
end = strmov(query, "DROP USER '");
|
||||||
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
||||||
*end++ = '\'';
|
*end++ = '\'';
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
@ -128,10 +128,10 @@ passwd(MYSQL *pmysql, const char *user)
|
||||||
}
|
}
|
||||||
free(confirm_password);
|
free(confirm_password);
|
||||||
|
|
||||||
end = strmov(query, "UPDATE user SET password = PASSWORD('");
|
end = strmov(query, "ALTER user '");
|
||||||
end += mysql_real_escape_string(pmysql, end, password, strlen(password));
|
|
||||||
end = strmov(end, "') WHERE user='");
|
|
||||||
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
end += mysql_real_escape_string(pmysql, end, user, strlen(user));
|
||||||
|
end = strmov(end, "' IDENTIFIED BY '");
|
||||||
|
end += mysql_real_escape_string(pmysql, end, password, strlen(password));
|
||||||
*end++ = '\'';
|
*end++ = '\'';
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue