mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Add a few missing pieces of vgname command line validation.
This commit is contained in:
parent
9397354a33
commit
b9b260119f
@ -1,5 +1,6 @@
|
||||
Version 2.02.24 -
|
||||
====================================
|
||||
Add a few missing pieces of vgname command line validation.
|
||||
Support the /dev/mapper prefix on most command lines.
|
||||
|
||||
Version 2.02.23 - 8th March 2007
|
||||
|
@ -41,6 +41,12 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (!validate_name(vg_name)) {
|
||||
log_error("Volume group name \"%s\" is invalid",
|
||||
vg_name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
log_verbose("Checking for volume group \"%s\"", vg_name);
|
||||
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
|
||||
unlock_vg(cmd, ORPHAN);
|
||||
|
@ -465,6 +465,12 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
||||
argv++;
|
||||
argc--;
|
||||
|
||||
if (!validate_name(vg_name)) {
|
||||
log_error("Volume group name \"%s\" is invalid",
|
||||
vg_name);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
log_verbose("Finding volume group \"%s\"", vg_name);
|
||||
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
|
||||
log_error("Can't get lock for %s", vg_name);
|
||||
|
@ -219,11 +219,17 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
vg_name_from = argv[0];
|
||||
vg_name_to = argv[1];
|
||||
vg_name_from = skip_dev_dir(cmd, argv[0], NULL);
|
||||
vg_name_to = skip_dev_dir(cmd, argv[1], NULL);
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
|
||||
if (!validate_name(vg_name_from)) {
|
||||
log_error("Volume group name \"%s\" is invalid",
|
||||
vg_name_from);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (!strcmp(vg_name_to, vg_name_from)) {
|
||||
log_error("Duplicate volume group name \"%s\"", vg_name_from);
|
||||
return ECMD_FAILED;
|
||||
|
Loading…
Reference in New Issue
Block a user