storage: Sanitize pool target paths
authorCole Robinson <crobinso@redhat.com>
Thu, 20 May 2010 15:41:31 +0000 (11:41 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 25 May 2010 16:30:44 +0000 (12:30 -0400)
commita7fb2258cac63b2420b51d5720a6e2b8734d818d
treeb0d00c69ab09422260bbfa57fe5e69f247397709
parent60881161ea7c05a80af145582fc6659e69a20ef8
storage: Sanitize pool target paths

Spurious / in a pool target path makes life difficult for apps using the
GetVolByPath, and doing other path based comparisons with pools. This
has caused a few issues for virt-manager users:

https://bugzilla.redhat.com/show_bug.cgi?id=494005
https://bugzilla.redhat.com/show_bug.cgi?id=593565

Add a new util API which removes spurious /, virFileSanitizePath. Sanitize
target paths when parsing pool XML, and for paths passed to GetVolByPath.

v2: Leading // must be preserved, properly sanitize path=/, sanitize
    away /./ -> /

v3: Properly handle starting ./ and ending /.

v4: Drop all '.' handling, just sanitize / for now.
src/conf/storage_conf.c
src/libvirt_private.syms
src/storage/storage_driver.c
src/util/util.c
src/util/util.h
tests/storagepoolxml2xmlin/pool-dir.xml