1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2014-03-18 23:54:46 +01:00
parent 5b69bfb6f8
commit 506091be70
5 changed files with 6 additions and 4 deletions

View File

@ -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.

View File

@ -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? */

View File

@ -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;
}

View File

@ -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)

View File

@ -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;