r214@um: micah | 2005-12-27 09:35:03 -0500
authormicah <micah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Tue, 27 Dec 2005 17:36:32 +0000 (17:36 +0000)
committermicah <micah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Tue, 27 Dec 2005 17:36:32 +0000 (17:36 +0000)
 Added vserver functionality to the user authentication method

git-svn-id: http://code.autistici.org/svn/backupninja/trunk@275 758a04ac-41e6-0310-8a23-8373a73cc35d

handlers/mysql

index 49f80a8545816fedb760fe1d148745f5bc8526eb..9cf3c3d3f595e3281bd7837952fc5080f84a5264 100644 (file)
@@ -52,8 +52,25 @@ if [ "$user" == "" ]; then
        user=root;
 else
        userset=true;
-       userhome=`getent passwd "$user" | awk -F: '{print $6}'`
-       [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
+       if [ $usevserver ]
+       then
+           userhome=`$VSERVER $vsname exec getent passwd "$user" | awk -F: '{print $6}'`
+           if [ $? -eq 2 ]
+           then
+               fatal "User $user not found in /etc/passwd"
+           fi
+           userhome="$VROOTDIR/$vsname$userhome"
+           info "User home set to: $userhome"
+           [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
+       else
+           userhome=`getent passwd "$user" | awk -F: '{print $6}'`
+           if [ $? -eq 2 ]
+           then
+               fatal "User $user not found in /etc/passwd"
+           fi
+                   info "User home set to: $userhome"
+           [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
+       fi
 fi
 
 ## Prepare ignore part of the command