forked from lavina/lavina
improve validation
This commit is contained in:
parent
372efc3701
commit
a16cd01a2c
|
@ -106,16 +106,19 @@ impl FromXml for BindRequest {
|
|||
match event {
|
||||
Event::Start(bytes) if bytes.name().0 == b"resource" => {
|
||||
let (namespace, event) = yield;
|
||||
if let Event::Text(text) = event {
|
||||
resource = Some(text.as_bytes().into());
|
||||
}
|
||||
let (namespace, event) = yield;
|
||||
if let Event::End(_) = event {
|
||||
} else {
|
||||
let Event::Text(text) = event else {
|
||||
return Err(ffail!("Unexpected XML event: {event:?}"));
|
||||
};
|
||||
resource = Some(text.as_bytes().into());
|
||||
let (namespace, event) = yield;
|
||||
let Event::End(bytes) = event else {
|
||||
return Err(ffail!("Unexpected XML event: {event:?}"));
|
||||
};
|
||||
if bytes.name().0 != b"resource" {
|
||||
return Err(ffail!("Unexpected XML tag: {:?}", bytes.name()));
|
||||
}
|
||||
}
|
||||
Event::End(bytes_) => {
|
||||
Event::End(bytes) if bytes.name().0 == BindRequest::NAME.as_bytes() => {
|
||||
break;
|
||||
}
|
||||
_ => return Err(ffail!("Unexpected XML event: {event:?}")),
|
||||
|
|
Loading…
Reference in New Issue