<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 06/13/2014 04:58 AM, Aline Manera
wrote:<br>
</div>
<blockquote cite="mid:539A147D.4050204@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 06/12/2014 08:19 AM, <a
moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a>
wrote:<br>
</div>
<blockquote
cite="mid:1402571942-6157-1-git-send-email-shaohef@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: ShaoHe Feng <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
Both '-' and '_' are allowed by libvirt, so we should not put extra
restrictions.
Signed-off-by: ShaoHe Feng <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
---
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) {
</pre>
</blockquote>
<br>
<font face="DejaVu Sans Mono">I agree with Cristian.<br>
You should remove the whole line:<br>
</font><br>
$("#networkName").toggleClass("invalid-field",
!$("#networkName").val().match(/^[a-zA-Z0-9_]+$/));<br>
<br>
</blockquote>
what about some little restrictions than libvirt. <br>
such as wildcard "*", "?" and "/", [], {} ! are not allowed. <br>
<br>
for wildcard can be used in shell. such as:<br>
$ ls dat*<br>
debugreports objectstore screenshots sessions<br>
$ ls dat?<br>
debugreports objectstore screenshots sessions<br>
$ ls data<br>
debugreports objectstore screenshots sessions<br>
$ ls [d]ata<br>
debugreports objectstore screenshots sessions<br>
<br>
shell meta characters and control operator should we support?<br>
" ' ` = $ < > | & ( ) { } ; && || !<br>
I have do some test as follow:<br>
<br>
1. <br>
I rename the network as "dd/ddd", libvirt will report an error:<br>
create file '/etc/libvirt/qemu/networks/dd/ddd.xml.new': No such
file or directory <br>
We do can help libvirt to escape "/". And seems linux support every
character. <br>
<br>
2.<br>
I also create a <span class="column column-name cell"
title="*.efault">network named "*.efault", kimchi can work works
well, that's kimchi UI's problem. <br>
it report: "Error: Syntax error, unrecognized expression:
#*.efault</span>". <br>
I can also fix this problem.<br>
<br>
virsh # net-list --all<br>
Name State Autostart Persistent<br>
----------------------------------------------------------<br>
*.efault inactive yes yes<br>
brg20 active yes yes<br>
dddd active yes yes<br>
default active yes yes<br>
test_abc active yes yes<br>
<br>
strangely, I can not list the persistent network *.efault.xml file.
<br>
$ sudo ls /var/lib/libvirt/network/<br>
dddd.xml default.xml test_abc.xml<br>
<br>
<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Thanks and best regards!
Sheldon Feng(冯少合)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
IBM Linux Technology Center</pre>
</body>
</html>