[MDEV-32142] mariadb-install-db shows warning on missing directory $pamtooldir/auth_pam_tool_dir Created: 2023-09-10  Updated: 2023-10-18  Resolved: 2023-10-18

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.4, 10.5, 10.6, 10.10, 10.11, 11.0
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3

Type: Bug Priority: Minor
Reporter: Karol Roslaniec Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: beginner-friendly


 Description   

The problem shows up if you compile MariaDB without PAM.
The fix is trivial. Before doing chown, the script should check if directory exists.
Inside the file ./scripts/mysql_install_db.sh
change line 496 from

  if test -z "$srcdir" -a "$in_rpm" -eq 0

to

  if test -z "$srcdir" -a "$in_rpm" -eq 0 -a -d "$pamtooldir/auth_pam_tool_dir"



 Comments   
Comment by Yingquan He [ 2023-09-17 ]

I would love to fix this.

Comment by Yingquan He [ 2023-09-17 ]

https://github.com/MariaDB/server/pull/2761

Do I need to provide a test case for this PR?
There are 6 affected versions, but currently, I've only created a PR for version 10.4 because I'm not sure if I need a test case for this PR.

Comment by Sergei Golubchik [ 2023-09-17 ]

Thanks!
I think it's fine without a test case. 10.4 is correct. But, please, explain in the commit comment why there can be no auth_pam_tool_dir — bug report suggest that it happens when one compiles without PAM plugin

Comment by Yingquan He [ 2023-09-19 ]

Hi Sergei,

I've looked up a lot of documentation and even read the PAM source code, and I just learned that the auth_pam_tool_dir directory is created by the Linux distribution's package manager when installing PAM-related packages, but I don't know exactly which program or script creates it.

I see the specified program path in the plugin/auth_pam/auth_pam.c file:

static const char *tool_name= "auth_pam_tool_dir/auth_pam_tool";

This program is started in the pam_auth function via the posix_spawn function.

I'm wondering if the person who wrote this code might have more insight into why the auth_pam_tool_dir directory is missing. Would it be a good idea to reach out to them for advice?

Comment by Karol Roslaniec [ 2023-09-19 ]

To create test case, remove pam-devel package from your build server.
Alternatively, pass these params to cmake (build):

-DPLUGIN_AUTH_PAM=NO -DPLUGIN_AUTH_PAM_V1=NO 

Actually I didn't test second option. I just build without pam-devel.

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