From 8cc3a8a109e05dad08fb62f40a268a2090c4d298 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Fri, 15 Oct 2021 16:01:53 -0700 Subject: [PATCH] unquote quota in case of NULL --- bin/vmail-domains-mod.sh | 4 ++-- bin/vmail-mboxes-mod.sh | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/vmail-domains-mod.sh b/bin/vmail-domains-mod.sh index 8f99efe..2a9ac74 100755 --- a/bin/vmail-domains-mod.sh +++ b/bin/vmail-domains-mod.sh @@ -44,7 +44,7 @@ if [[ -n $quota ]]; then # make quota uppercase in case it is set to NULL quota=`echo $quota | tr [:lower:] [:upper:]` if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then - dbset=" mbox_quota_default=\"$quota\"" + dbset=" mbox_quota_default=$quota" else echo "ERROR: quota (-q) must numeric or NULL" exit 1 @@ -59,7 +59,7 @@ if [[ -n $limit ]]; then if [ ! -z "$dbset" ]; then dbset="$dbset," fi - dbset="$dbset mbox_limit=\"$limit\"" + dbset="$dbset mbox_limit=$limit" else echo "ERROR: limit (-l) must numeric or NULL" exit 1 diff --git a/bin/vmail-mboxes-mod.sh b/bin/vmail-mboxes-mod.sh index b372606..4f68561 100755 --- a/bin/vmail-mboxes-mod.sh +++ b/bin/vmail-mboxes-mod.sh @@ -47,7 +47,7 @@ if [ -n "$quota" ]; then # make quota uppercase in case it is set to NULL quota=`echo $quota | tr [:lower:] [:upper:]` if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then - dbset=" quota=\"$quota\"" + dbset=" quota=$quota" else echo "ERROR: quota (-q) must numeric or NULL" exit 1 @@ -74,9 +74,8 @@ fi if [ -n "$dbset" ]; then # build query - dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'UPDATE vm_mboxes SET $dbset WHERE mbox.id=\"$mbox_id\";'" -# eval $dbcmd - echo $dbcmd + dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'UPDATE vm_mboxes SET $dbset WHERE id=\"$mbox_id\";'" + eval $dbcmd else