chatstates, ping, presence: Check for extraneous attributes.

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-21 16:44:35 +01:00
commit 80695edb72
4 changed files with 20 additions and 7 deletions

View file

@ -26,6 +26,9 @@ impl<'a> TryFrom<&'a Element> for Ping {
for _ in elem.children() {
return Err(Error::ParseError("Unknown child in ping element."));
}
for _ in elem.attrs() {
return Err(Error::ParseError("Unknown attribute in ping element."));
}
Ok(Ping)
}
}
@ -60,7 +63,6 @@ mod tests {
}
#[test]
#[ignore]
fn test_invalid_attribute() {
let elem: Element = "<ping xmlns='urn:xmpp:ping' coucou=''/>".parse().unwrap();
let error = Ping::try_from(&elem).unwrap_err();