1
0
Fork 0

Merging upstream version 1.15.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:11:43 +01:00
parent 14665a711e
commit d975eb29d0
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
116 changed files with 6031 additions and 2284 deletions

View file

@ -23,24 +23,6 @@ if ! [[ $UUID =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
exit 2
fi
# HEURISTIC:
# (1) if any one given character occurs more than 50% of the time, it is likely
# that the UUID is fake.
# (2) if the first or the last group consists of mostly the same character, it
# is likely that the UUID is fake.
FIRST_GROUP="$(echo $UUID | cut -d'-' -f1)"
LAST_GROUP="$(echo $UUID | cut -d'-' -f5)"
for i in {{0..9},{a..f}} ; do
COUNT_TOTAL="${UUID//[^$i]}"
COUNT_FIRST="${FIRST_GROUP//[^$i]}"
COUNT_LAST="${LAST_GROUP//[^$i]}"
if [ ${#COUNT_TOTAL} -ge 16 ] || [ ${#COUNT_FIRST} -ge 7 ] || [ ${#COUNT_LAST} -ge 11 ] ; then
>&2 echo "UUID is too repetitive. This may be a false alert."
>&2 echo "Repetitive UUID: ${UUID}"
exit 3
fi
done
HOSTNQN="nqn.2014-08.org.nvmexpress:uuid:${UUID}"
echo $HOSTNQN