Skip to content

Commit

Permalink
Fixed VM name validation in GUI tools (Create VM, Settings, Manager)
Browse files Browse the repository at this point in the history
VM name validation in various places in Manager did not allow
perfectly legal otherwise '_' and '.' characters.

references QubesOS/qubes-issues#2422
fixes QubesOS/qubes-issues#3301
  • Loading branch information
marmarta committed Jul 13, 2018
1 parent 812c71f commit c3414c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions qubesmanager/create_new_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, app, qvm_collection, trayIcon, parent = None):
from qubes.qubes import QubesHVm
except ImportError:
pass
else:
else:
self.hvm_radio.setEnabled(True)
self.hvmtpl_radio.setEnabled(True)

Expand All @@ -74,7 +74,7 @@ def __init__(self, app, qvm_collection, trayIcon, parent = None):
self.fill_template_list()
self.fill_netvm_list()

self.vmname.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-]*", Qt.CaseInsensitive), None))
self.vmname.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9_-.]*", Qt.CaseInsensitive), None))
self.vmname.selectAll()
self.vmname.setFocus()

Expand Down Expand Up @@ -132,7 +132,7 @@ def on_allow_networking_toggled(self, checked):
if checked:
self.fill_netvm_list()
self.netvm_name.setEnabled(True)
else:
else:
self.netvm_name.clear()
self.netvm_name.setEnabled(False)

Expand Down Expand Up @@ -194,7 +194,7 @@ def accept(self):
return

label = self.label_list[self.vmlabel.currentIndex()]

template_vm = None
if self.template_name.isEnabled():
if len(self.template_vm_list) == 0:
Expand Down
2 changes: 1 addition & 1 deletion qubesmanager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def __init__(self, qvm_collection, blk_manager, parent=None):
self.blk_watch_thread.start()

self.searchbox = SearchBox()
self.searchbox.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-]*", Qt.CaseInsensitive), None))
self.searchbox.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9_-.]*", Qt.CaseInsensitive), None))
self.searchContainer.addWidget(self.searchbox)

self.connect(self.table, SIGNAL("itemSelectionChanged()"),
Expand Down
2 changes: 1 addition & 1 deletion qubesmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def current_tab_changed(self, idx):

def __init_basic_tab__(self):
self.vmname.setText(self.vm.name)
self.vmname.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-]*", Qt.CaseInsensitive), None))
self.vmname.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9_-.]*", Qt.CaseInsensitive), None))
self.vmname.setEnabled(not self.vm.is_running())

#self.qvm_collection.lock_db_for_reading()
Expand Down

0 comments on commit c3414c0

Please sign in to comment.