On 06/13/2014 04:58 AM, Aline Manera wrote:
On 06/12/2014 08:19 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>

Both '-' and '_' are allowed by libvirt,  so we should not put extra
restrictions.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
---
 ui/js/src/kimchi.network.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 23930cd..c6e828d 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -321,7 +321,7 @@ kimchi.cleanNetworkDialog = function() {

 kimchi.setupNetworkFormEvent = function() {
     $("#networkName").on("keyup", function(event) {
-        $("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[a-zA-Z0-9_]+$/));
+        $("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[\-\w]+$/));
         kimchi.updateNetworkFormButton();
     });
     $("#networkTypeIso").on("click", function(event) {

I agree with Cristian.
You should remove the whole line:

$("#networkName").toggleClass("invalid-field", !$("#networkName").val().match(/^[a-zA-Z0-9_]+$/));

what about some little restrictions than libvirt.
such as  wildcard "*", "?" and "/", [], {} ! are not allowed. 

for  wildcard can be used in shell. such as:
$ ls dat*
debugreports  objectstore  screenshots  sessions
$ ls dat?
debugreports  objectstore  screenshots  sessions
$ ls data
debugreports  objectstore  screenshots  sessions
$ ls [d]ata
debugreports  objectstore  screenshots  sessions

shell meta characters and control operator should we support?
" ' ` = $ < > | & ( ) { } ; && || !
I have do some test as follow:

1.
I rename the network as "dd/ddd", libvirt will  report an error:
create file '/etc/libvirt/qemu/networks/dd/ddd.xml.new': No such file or directory
We do can help libvirt to escape "/". And seems linux support every character.

2.
I also create a network named "*.efault",  kimchi can work works well, that's kimchi UI's problem.
it report: "Error: Syntax error, unrecognized expression: #*.efault
".
I can also fix this problem.

virsh # net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 *.efault             inactive   yes           yes
 brg20                active     yes           yes
 dddd                 active     yes           yes
 default              active     yes           yes
 test_abc             active     yes           yes

strangely, I can not list the persistent network  *.efault.xml file.
$ sudo ls  /var/lib/libvirt/network/
dddd.xml  default.xml  test_abc.xml





-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center