Skip to content

Commit 3e7fb13

Browse files
committed
Make rm more restrictive
1 parent 95a20a8 commit 3e7fb13

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

func/domain.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,9 +802,7 @@ add_webmail_config() {
802802
fi
803803

804804
# Remove old configurations
805-
rm -rf $HOMEDIR/$user/conf/mail/$domain.*
806-
rm -rf $HOMEDIR/$user/conf/mail/ssl.$domain.*
807-
rm -rf $HOMEDIR/$user/conf/mail/*nginx.$domain.*
805+
find $HOMEDIR/$user/conf/mail/ -maxdepth 1 -type f \( -name "$domain.*" -o -name "ssl.$domain.*" -o -name "*nginx.$domain.*" \) -exec rm {} \;
808806
else
809807
if [ ! -z "$WEB_SYSTEM" ]; then
810808
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
@@ -815,7 +813,7 @@ add_webmail_config() {
815813
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
816814
fi
817815
# Clear old configurations
818-
rm -rf $HOMEDIR/$user/conf/mail/$domain.*
816+
find $HOMEDIR/$user/conf/mail/ -maxdepth 1 -type f \( -name "$domain.*" \) -exec rm {} \;
819817
fi
820818
}
821819

0 commit comments

Comments
 (0)