Skip to content

Commit 3f6a2f2

Browse files
committed
improved backup ownership verification
1 parent e2d9c4b commit 3f6a2f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

func/main.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ is_type_valid() {
160160

161161
# Check if backup is available for user
162162
is_backup_available() {
163-
if [ "$user" != "$(echo $backup | cut -f 1 -d '.')" ]; then
163+
b_owner=$(echo $user |\
164+
sed -e "s/\.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].tar//")
165+
if [ "$user" != "$b_owner" ]; then
164166
echo "Error: User $user don't have permission to use $backup"
165167
log_event "$E_FORBIDEN" "$EVENT"
166168
exit $E_FORBIDEN

0 commit comments

Comments
 (0)