File mariadb-10.4.12-fix-install-db.patch of Package mariadb.28391

Index: mariadb-10.4.12/scripts/mysql_install_db.sh
===================================================================
--- mariadb-10.4.12.orig/scripts/mysql_install_db.sh
+++ mariadb-10.4.12/scripts/mysql_install_db.sh
@@ -482,20 +482,22 @@ if test -n "$user"
 then
   if test -z "$srcdir" -a "$in_rpm" -eq 0
   then
-    chown 0 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" && \
-    chmod 04755 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool"
-    if test $? -ne 0
+    tool_ownership=`stat -c "%U:%G" "$pamtooldir/auth_pam_tool_dir/auth_pam_tool"`
+    tool_mode=`stat -c "%a" "$pamtooldir/auth_pam_tool_dir/auth_pam_tool"`
+
+    if test "$tool_ownership" != "root:root" -o "$tool_mode" != "4755"
     then
-        echo "Couldn't set an owner to '$pamtooldir/auth_pam_tool_dir/auth_pam_tool'."
-        echo "It must be root, the PAM authentication plugin doesn't work otherwise.."
+        echo "Permissions/ownership of the '$pamtooldir/auth_pam_tool_dir/auth_pam_tool' file are bad."
+        echo "It must be owned by root:root and have mode 4750."
         echo
     fi
-    chown $user "$pamtooldir/auth_pam_tool_dir" && \
-    chmod 0700 "$pamtooldir/auth_pam_tool_dir"
-    if test $? -ne 0
+
+    dir_ownership=`stat -c "%U:%G" "$pamtooldir/auth_pam_tool_dir"`
+    dir_mode=`stat -c "%a" "$pamtooldir/auth_pam_tool_dir"`
+    if test "$dir_ownership" != "root:mysql" -o "$dir_mode" != "750"
     then
-        echo "Cannot change ownership of the '$pamtooldir/auth_pam_tool_dir' directory"
-        echo "to the '$user' user. Check that you have the necessary permissions and try again."
+        echo "Permissions/ownership of the '$pamtooldir/auth_pam_tool_dir' directory are bad."
+        echo "It must be owned by root:mysql and have mode 0750, the PAM authentication plugin doesn't work otherwise.."
         echo
     fi
   fi
openSUSE Build Service is sponsored by