api/ui: datastore: allow to set simple comment

for now forbid all control characters[0] in the comment value, the
section config writer cannot cope with newlines in the value, it
writes them out literally, allowing "injection" or breaking the whole
config.

In the webinterface use also a textfield, not a textarea.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2019-12-19 17:46:39 +01:00
parent e88e3c3a35
commit bca9093520
3 changed files with 11 additions and 6 deletions

View File

@ -14,13 +14,15 @@ lazy_static! {
}
const DIR_NAME_SCHEMA: Schema = StringSchema::new("Directory name").schema();
const COMMENT_SCHEMA: Schema = StringSchema::new("Datastore comment").schema();
const DATASTORE_ID_SCHEMA: Schema = StringSchema::new("DataStore ID schema.")
.min_length(3)
.schema();
const DATASTORE_PROPERTIES: ObjectSchema = ObjectSchema::new(
"DataStore properties",
&[
("path", false, &DIR_NAME_SCHEMA)
("comment", true, &COMMENT_SCHEMA),
("path", false, &DIR_NAME_SCHEMA),
]
);