Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/srv/db/mysql/autousers.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func getCreateProcedureCommand(conn *clientConn, procedureName string) (string,
const (
// procedureVersion is a hard-coded string that is set as procedure
// comments to indicate the procedure version.
procedureVersion = "teleport-auto-user-v2"
procedureVersion = "teleport-auto-user-v3"

// mysqlMaxUsernameLength is the maximum username/role length for MySQL.
//
Expand Down
7 changes: 6 additions & 1 deletion lib/srv/db/mysql/sql/mariadb_delete_user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ BEGIN
CALL teleport_deactivate_user(username);
ELSE
SET state = 'TP003';
SET @sql := CONCAT('DROP USER ', username);
SET @sql := CONCAT('DROP ROLE ', QUOTE(CONCAT("tp-role-", username)));
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SET @sql := CONCAT('DROP USER ', QUOTE(username));
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/db/mysql/sql/mysql_delete_user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BEGIN
-- Throw a custom error code when user is still active from other sessions.
SIGNAL SQLSTATE 'TP000' SET MESSAGE_TEXT = 'User has active connections';
ELSE
SET @sql := CONCAT('DROP USER ', username);
SET @sql := CONCAT('DROP USER ', QUOTE(username));
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
Expand Down