Skip to content

lowercase hostname values in qualified usernames #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2014

Conversation

larsks
Copy link
Contributor

@larsks larsks commented May 1, 2014

MySQL/MariaDB automatically downcase hostnames:

MariaDB [mysql]> create user 'testuser'@'HOSTNAME';
MariaDB [mysql]> select user,host from user where host = 'hostname';
+----------+----------+
| user     | host     |
+----------+----------+
| testuser | hostname |
+----------+----------+

This causes problems when a mysql_user or datbase_user has an hostname
with non-lowercase characters:

database_user { "root@HOSTNAME":
  ensure => absent,
}

The SELECT statements used to determine if the user exists will fail
because the comparisons use "HOSTNAME" but the database has "hostname".
This patch forces the hostname part of "user@hostname" to lower case in
the custom type definitions.

@igalic
Copy link
Contributor

igalic commented May 2, 2014

Hi @larsks, thank you very much for this patch!

Please note that database_user is deprecated in favour of mysql_user.

Could you please add unit tests as well as acceptance tests

@larsks
Copy link
Contributor Author

larsks commented May 13, 2014

The unit tests in the above commit work for sure. I haven't actually run the acceptance tests locally.

class { 'mysql::server': }
EOS
EOS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened here with the spacing?

@larsks
Copy link
Contributor Author

larsks commented May 19, 2014

It was apparently attacked by vim's Ruby formatter.

@igalic
Copy link
Contributor

igalic commented May 19, 2014

ACK. more spacing issues in spec/acceptance/types/mysql_user_spec.rb - we use 2 spaces in .rb, too

@igalic
Copy link
Contributor

igalic commented May 19, 2014

actually, all ruby files (your commits touch) are now reformatted to 4 spaces

@igalic
Copy link
Contributor

igalic commented Jun 4, 2014

@larsks I'm very sorry for neglecting this so long ._. I was pulled into an AIX project somewhere in a cave :(

Could you please rebase and squash this so we can merge it?

MySQL/MariaDB automatically downcase hostnames:

  MariaDB [mysql]> create user 'testuser'@'HOSTNAME';
  MariaDB [mysql]> select user,host from user where host = 'hostname';
  +----------+----------+
  | user     | host     |
  +----------+----------+
  | testuser | hostname |
  +----------+----------+

This causes problems when a mysql_user or datbase_user has an hostname
with non-lowercase characters:

  database_user { "root@HOSTNAME":
    ensure => absent,
  }

The SELECT statements used to determine if the user exists will fail
because the comparisons use "HOSTNAME" but the database has "hostname".
This patch forces the hostname part of "user@hostname" to lower case in
the custom type definitions.
@larsks
Copy link
Contributor Author

larsks commented Jun 4, 2014

Should be all set.

@igalic
Copy link
Contributor

igalic commented Jun 4, 2014

Except for travis which is dead. Everything is yellow forever.

I hope we didn't kill it.

igalic added a commit that referenced this pull request Jun 5, 2014
lowercase hostname values in qualified usernames
@igalic igalic merged commit b39ebdc into puppetlabs:master Jun 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants