changed echo to eval

This commit is contained in:
Matthew Saunders Brown 2021-02-19 17:03:56 -08:00
parent 519aa57df2
commit e54fcfdab1
3 changed files with 24 additions and 25 deletions

View File

@ -61,14 +61,14 @@ if [ "$rowcount" -eq '1' ] ; then
# domain exists, delete from all vmail tables
# singled delete should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM vm_domains WHERE domain='$domain';"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username LIKE '%@$domain'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '%@$domain'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username LIKE '%@$domain';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '%@$domain';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
# this should be sufficient for rc due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM rc_users WHERE username LIKE '%@$domain'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM rc_users WHERE username LIKE '%@$domain';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
elif [ "$rowcount" -eq '0' ] ; then
echo "ERROR: $domain does not exist in vmail database."
exit 1
@ -78,5 +78,5 @@ else
fi
if [ -d "$VMAIL_DIR/$domain" ] ; then
echo "/usr/bin/rm -r $VMAIL_DIR/$domain"
/usr/bin/rm -r $VMAIL_DIR/$domain
fi

View File

@ -117,19 +117,18 @@ else
fi
# add mbox
# evail $dbcmd
echo $dbcmd
eval $dbcmd
# create all required vmail dirs
if [ ! -d "/var/vmail/$domain" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain"
install -o vmail -g vmail -m 750 -d /var/vmail/$domain
fi
if [ ! -d "/var/vmail/$domain/$mbox" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox"
install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox
fi
if [ ! -d "/var/vmail/$domain/$mbox/Maildir" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir"
install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir
fi
if [ ! -d "/var/vmail/$domain/$mbox/Maildir/cur" ] ; then
echo "install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir/cur"
install -o vmail -g vmail -m 750 -d /var/vmail/$domain/$mbox/Maildir/cur
fi

View File

@ -72,19 +72,19 @@ if [ -z "$mboxes_id" ]; then
elif [ "$mboxes_id" -gt '0' ]; then
if [ -n "$force" ] || vmail::yesno "Delete $email now?"; then
# this should be sufficient for vm_* tables due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM vm_mboxes WHERE vm_mboxes.id='$mboxes_id'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username='$email'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient='$email'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '$mbox+%@$domain'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_mboxes WHERE vm_mboxes.id='$mboxes_id';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM sa_userpref WHERE username='$email';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient='$email';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM vm_greylisting WHERE recipient LIKE '$mbox+%@$domain';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
# this should be sufficient for rc due to ON DELETE CASCADE foreign key references
dbquery="DELETE FROM rc_users WHERE username='$email'"
echo $dbcmd $dbcmdopts "\"$dbquery\""
dbquery="DELETE FROM rc_users WHERE username='$email';"
eval $dbcmd $dbcmdopts "\"$dbquery\""
if [ -d "$VMAIL_DIR/$domain/$mbox" ]; then
echo "rm -r $VMAIL_DIR/$domain/$mbox"
rm -r $VMAIL_DIR/$domain/$mbox
fi
echo "SUCCESS: $email removed from system."
exit 0