Explorar o código

Forbid creating VM with name 'none' or 'default'

Those were special names in Qubes 3.x, don't allow such VMs to avoid
(potentially fatal) confusion.

Fixes QubesOS/qubes-issues#3002
Marek Marczykowski-Górecki %!s(int64=6) %!d(string=hai) anos
pai
achega
9f7915d998
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      qubes/vm/__init__.py

+ 3 - 0
qubes/vm/__init__.py

@@ -60,6 +60,9 @@ def validate_name(holder, prop, value):
         else:
             raise qubes.exc.QubesValueError(
                 'VM name contains illegal characters')
+    if value in ('none', 'default'):
+        raise qubes.exc.QubesValueError(
+            'VM name cannot be \'none\' nor \'default\'')
 
 
 class Features(dict):