master - pv_vg_name: do not expose internal orphans to lvm2 users
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=506091be70b3ebaed02c5d9c1c8fa991f4382182 Commit: 506091be70b3ebaed02c5d9c1c8fa991f4382182 Parent: 5b69bfb6f867944e7831a653f6aa4b17853fbbe5 Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Mar 18 23:54:46 2014 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Mar 19 00:57:59 2014 +0100
pv_vg_name: do not expose internal orphans to lvm2 users
Check for orphan VG name and return just empty string, Use internally pv->vg_name if the real orphan name is needed.
--- WHATS_NEW | 1 + lib/display/display.c | 2 +- lib/metadata/metadata.c | 2 +- lib/metadata/pv.c | 3 ++- lib/metadata/pv_manip.c | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.106 - ==================================== + Do not report internal orphan VG names when reporting pvdisplay/pvscan. Fix pvdisplay -c man page referencing KB instead of sectors. Skip redundant synchronization calls on local clvmd. Use correct PATH_MAX for locking dir path.
lib/display/display.c +1 -1
@@ -362,7 +362,7 @@ void pvdisplay_colons(const struct physical_volume *pv) } log_print("%s:%s:%" PRIu64 ":-1:%" PRIu64 ":%" PRIu64 ":-1:%" PRIu32 ":%u:%u:%u:%s", - pv_dev_name(pv), pv->vg_name, pv->size, + pv_dev_name(pv), pv_vg_name(pv), pv->size, /* FIXME pv->pv_number, Derive or remove? */ pv->status, /* FIXME Support old or new format here? */ pv->status & ALLOCATABLE_PV, /* FIXME remove? */
lib/metadata/metadata.c +1 -1
@@ -3947,7 +3947,7 @@ int pv_write(struct cmd_context *cmd __attribute__((unused)),if (!allow_non_orphan && (!is_orphan_vg (pv->vg_name) || pv->pe_alloc_count)) {log_error ("Assertion failed: can't _pv_write non-orphan PV " -"(in VG %s)" , pv->vg_name); +"(in VG %s)" ,pv_vg_name (pv));return 0 ; }
lib/metadata/pv.c +2 -1
@@ -69,7 +69,8 @@ struct device *pv_dev(const struct physical_volume *pv)const char *pv_vg_name (const struct physical_volume *pv) { -return pv_field (pv, vg_name); +/* Avoid exposing internal orphan names to users */ +return (!is_orphan (pv)) ?pv_field (pv, vg_name) :"" ; }const char *pv_dev_name (const struct physical_volume *pv)
lib/metadata/pv_manip.c +1 -1
@@ -558,7 +558,7 @@ int pv_resize_single(struct cmd_context *cmd,uint64_t size =0 ;int r =0 ;const char *pv_name =pv_dev_name (pv); -const char *vg_name =pv_vg_name (pv); +const char *vg_name = pv->vg_name;struct volume_group *old_vg = vg;int vg_needs_pv_write =0 ;