summaryrefslogtreecommitdiffstats
path: root/scripts/gen-hostnqn.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-08-12 12:01:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-08-12 12:01:09 +0000
commitfb32fdeba1f428a3f6c30c8951e82f2a2eec23a8 (patch)
tree36d82f6126d57ee3049109591b3ea9e805bca867 /scripts/gen-hostnqn.sh
parentReleasing debian version 1.14-4. (diff)
downloadnvme-cli-fb32fdeba1f428a3f6c30c8951e82f2a2eec23a8.tar.xz
nvme-cli-fb32fdeba1f428a3f6c30c8951e82f2a2eec23a8.zip
Merging upstream version 1.15.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/gen-hostnqn.sh')
-rw-r--r--scripts/gen-hostnqn.sh18
1 files changed, 0 insertions, 18 deletions
diff --git a/scripts/gen-hostnqn.sh b/scripts/gen-hostnqn.sh
index 5138f0c..563aa60 100644
--- a/scripts/gen-hostnqn.sh
+++ b/scripts/gen-hostnqn.sh
@@ -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