diff --git a/plugins/storage/bin/chown-storage-dir b/plugins/storage/bin/chown-storage-dir index 4be58586c..3ce7c5c7b 100755 --- a/plugins/storage/bin/chown-storage-dir +++ b/plugins/storage/bin/chown-storage-dir @@ -16,13 +16,15 @@ main() { exit 1 fi - case "$CHOWN_ID" in - 0 | 1000 | 2000 | 32767 | 165536 | 166536 | 167536 | 198303) ;; - *) - echo " ! Unsupported chown permissions. Supported values: 0, 1000, 2000, 32767 (and user namespace offset variants)" 1>&2 - exit 1 - ;; - esac + if [[ ! "$CHOWN_ID" =~ ^[0-9]+$ ]]; then + echo " ! Unsupported chown permissions. Value must be a non-negative integer." 1>&2 + exit 1 + fi + + if ((CHOWN_ID > 65535 && (CHOWN_ID < 165536 || CHOWN_ID > 231071))); then + echo " ! Unsupported chown permissions. Supported values: 0-65535 (and user namespace offset variants, 165536-231071)" 1>&2 + exit 1 + fi chown -R "$CHOWN_ID:$CHOWN_ID" "${DOKKU_LIB_ROOT}/data/storage/$DIRECTORY" }