Am 12-02-2014 13:12, schrieb Pradeep K Surisetty:
For ex: If user try to create directory "/home/sp/&",
it never
proceeds, Since this directory cannont be created. So i feel we need
to have path checker.
Yes, that directory can be created. And also a storage pool
using that
directory.
Take a look at the output below.
And even if the character '&' was not allowed we should block that
character only. Checking for a wrong '&' is very different than allowing
a few characters (like [A-Za-z0-9-_\.]).
vianac@kitkat ~ $ mkdir -v ~/\&
mkdir: created directory '/home/vianac/&'
vianac@kitkat ~ $ cat pool.xml
<pool type="dir">
<name>test</name>
<target>
<path>/home/vianac/&/</path>
</target>
</pool>
vianac@kitkat ~ $ sudo virsh pool-list
Name State Autostart
-----------------------------------------
default active yes
home active yes
vianac@kitkat ~ $ sudo virsh pool-create pool.xml
Pool test created from pool.xml
vianac@kitkat ~ $ sudo virsh pool-list
Name State Autostart
-----------------------------------------
default active yes
home active yes
test active no
vianac@kitkat ~ $ sudo virsh pool-dumpxml test
<pool type='dir'>
<name>test</name>
<uuid>176b8579-002d-4ed9-95aa-5875840cc56b</uuid>
<capacity unit='bytes'>253606490112</capacity>
<allocation unit='bytes'>80020393984</allocation>
<available unit='bytes'>173586096128</available>
<source>
</source>
<target>
<path>/home/vianac/&</path>
<permissions>
<mode>0755</mode>
<owner>-1</owner>
<group>-1</group>
</permissions>
</target>
</pool>