[MDEV-31611] mariadb-setpermission: Can't use string as an ARRAY ref while "strict refs" in use Created: 2023-07-03  Updated: 2023-11-22  Resolved: 2023-11-22

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 11.2.0
Fix Version/s: 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3

Type: Bug Priority: Minor
Reporter: Ian Gilfillan Assignee: Anel Husakovic
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-23015 mariadb-setpermission seems incompati... Closed
relates to MDEV-26474 Fix mysql_setpermission hostname logic Closed

 Description   

Running mariadb-setpermission and attempting to change a user's password, I get the following:

Make your choice [1,2,3,4,5,6,7,0]: 1
 
 
Setting a (new) password for a user.
 
For which user do you want to specify a password: foo2
Username = foo2
Would you like to set a password for foo2 [y/n]: y
What password do you want to specify for foo2: 
Type the password again: 
We now need to know which host for foo2 we have to change.
Choose from the following hosts: 
  - localhost 
The host please (case sensitive): localhost
The following host will be used: localhost.
######################################################################
 
That was it ... here is an overview of what you gave to me:
The username 		: foo2
The host		: localhost
######################################################################
 
Are you pretty sure you would like to implement this [yes/no]: yes
Okay ... let's go then ...
 
Can't use string ("'localhost'") as an ARRAY ref while "strict refs" in use at ./mariadb-setpermission line 232, <STDIN> line 7.

I haven't checked other MariaDB versions. Trying the same on an old MySQL 5.6.49 works.



 Comments   
Comment by Anel Husakovic [ 2023-11-20 ]
  • Tested different privileges

    #  No grants for user
    $ ./scripts/mysql_setpermission --user=test --password=pass123 --host=localhost
    ...
    Setting a (new) password for a user.
    ...
    For which user do you want to specify a password: test
    DBD::MariaDB::st execute failed: SELECT command denied to user 'test'@'localhost' for table `mysql`.`user` at ./scripts/mysql_setpermission line 438, <STDIN> line 2.
     
    # No update grants
    Are you pretty sure you would like to implement this [yes/no]: yes
    Okay ... let's go then ...
     
    DBD::MariaDB::st execute failed: Access denied for user 'test'@'localhost' to database 'mysql' at ./scripts/mysql_setpermission line 231, <STDIN> line 7.
    

  • User has grants and can change password after patch

    $ ./scripts/mysql_setpermission --user=test --password=pass1 --host=localhost
    WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.
    ######################################################################
    ## Welcome to the permission setter 1.4 for MariaDB.
    ## made by Luuk de Boer
    ######################################################################
    What would you like to do:
      1. Set password for an existing user.
      2. Create a database + user privilege for that database
         and host combination (user can only do SELECT)
      3. Create/append user privilege for an existing database
         and host combination (user can only do SELECT)
      4. Create/append broader user privileges for an existing
         database and host combination
         (user can do SELECT,INSERT,UPDATE,DELETE)
      5. Create/append quite extended user privileges for an
         existing database and host combination (user can do
         SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
         LOCK TABLES,CREATE TEMPORARY TABLES)
      6. Create/append full privileges for an existing database
         and host combination (user has FULL privilege)
      7. Remove all privileges for for an existing database and
         host combination.
         (user will have all permission fields set to N)
      0. exit this program
     
    Make your choice [1,2,3,4,5,6,7,0]: 1
     
     
    Setting a (new) password for a user.
     
    For which user do you want to specify a password: test
    Username = test
    Would you like to set a password for test [y/n]: y
    What password do you want to specify for test: 
    Type the password again: 
    We now need to know which host for test we have to change.
    Choose from the following hosts: 
      - localhost 
    The host please (case sensitive): localhost
    The following host will be used: localhost.
    ######################################################################
     
    That was it ... here is an overview of what you gave to me:
    The username 		: test
    The host		: localhost
    ######################################################################
     
    Are you pretty sure you would like to implement this [yes/no]: yes
    Okay ... let's go then ...
     
    The password is set for user 'test'@'localhost'.
    

Comment by Daniel Black [ 2023-11-22 ]

Good for me. TheLinuxJedi for your second review.

Generated at Thu Feb 08 10:25:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.