Compare commits
No commits in common. "bf2a95d8dbbad9b57e57183137e13f517c31f689" and "6698faef350b9f38ee1cad2c5a2f04c2eba28b16" have entirely different histories.
bf2a95d8db
...
6698faef35
3 changed files with 7 additions and 40 deletions
|
@ -171,7 +171,6 @@ fn handle_request_or_event(
|
|||
{
|
||||
let mut name: Option<String> = None;
|
||||
let mut tt: Option<WlArgType> = None;
|
||||
let mut interface_name: Option<String> = None;
|
||||
|
||||
for attr in e.attributes() {
|
||||
let attr = attr.expect("attr parsing error");
|
||||
|
@ -187,32 +186,6 @@ fn handle_request_or_event(
|
|||
tt = Some(WlArgType::parse(
|
||||
str::from_utf8(&attr.value).expect("utf8 encoding error"),
|
||||
));
|
||||
} else if attr_name == "interface" {
|
||||
interface_name = Some(
|
||||
str::from_utf8(&attr.value)
|
||||
.expect("utf8 encoding error")
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(WlArgType::NewId) = tt {
|
||||
if interface_name.is_none() {
|
||||
// Unspecified interface for new_id; special serialization format!
|
||||
args.push((
|
||||
format!(
|
||||
"{}_interface_name",
|
||||
name.as_ref().expect("needs an arg name!")
|
||||
),
|
||||
WlArgType::String,
|
||||
));
|
||||
args.push((
|
||||
format!(
|
||||
"{}_interface_version",
|
||||
name.as_ref().expect("needs an arg name!")
|
||||
),
|
||||
WlArgType::Uint,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ pub async fn handle_conn(
|
|||
s2c_msg = upstream_read.read() => {
|
||||
match s2c_msg? {
|
||||
codec::DecoderOutcome::Decoded(wl_raw_msg) => {
|
||||
debug!(obj_id = wl_raw_msg.obj_id, opcode = wl_raw_msg.opcode, num_fds = wl_raw_msg.fds.len(), "s2c event");
|
||||
debug!(obj_id = wl_raw_msg.obj_id, opcode = wl_raw_msg.opcode, "s2c event");
|
||||
|
||||
if state.on_s2c_event(&wl_raw_msg) {
|
||||
downstream_write.queue_write(wl_raw_msg);
|
||||
|
@ -106,7 +106,7 @@ pub async fn handle_conn(
|
|||
c2s_msg = downstream_read.read() => {
|
||||
match c2s_msg? {
|
||||
codec::DecoderOutcome::Decoded(wl_raw_msg) => {
|
||||
debug!(obj_id = wl_raw_msg.obj_id, opcode = wl_raw_msg.opcode, num_fds = wl_raw_msg.fds.len(), "c2s request");
|
||||
debug!(obj_id = wl_raw_msg.obj_id, opcode = wl_raw_msg.opcode, "c2s request");
|
||||
|
||||
if state.on_c2s_request(&wl_raw_msg) {
|
||||
upstream_write.queue_write(wl_raw_msg);
|
||||
|
|
16
src/state.rs
16
src/state.rs
|
@ -1,6 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use tracing::{debug, error, info};
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::{
|
||||
codec::WlRawMsg,
|
||||
|
@ -29,10 +29,9 @@ impl WlMitmState {
|
|||
pub fn on_c2s_request(&mut self, raw_msg: &WlRawMsg) -> bool {
|
||||
let msg = crate::proto::decode_request(&self.objects, raw_msg);
|
||||
if let crate::proto::WaylandProtocolParsingOutcome::MalformedMessage = msg {
|
||||
error!(
|
||||
debug!(
|
||||
obj_id = raw_msg.obj_id,
|
||||
opcode = raw_msg.opcode,
|
||||
num_fds = raw_msg.fds.len(),
|
||||
"Malformed request"
|
||||
);
|
||||
return false;
|
||||
|
@ -48,11 +47,6 @@ impl WlMitmState {
|
|||
return false;
|
||||
};
|
||||
|
||||
if interface != msg.id_interface_name {
|
||||
error!("Client binding to interface {}, but the interface name {} should correspond to {}", msg.id_interface_name, msg.name, interface);
|
||||
return false;
|
||||
}
|
||||
|
||||
info!(
|
||||
interface = interface,
|
||||
obj_id = msg.id,
|
||||
|
@ -60,7 +54,7 @@ impl WlMitmState {
|
|||
);
|
||||
|
||||
if let Some(t) = crate::proto::lookup_known_object_type(interface) {
|
||||
self.objects.record_object(t, msg.id);
|
||||
//self.objects.record_object(t, msg.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +67,7 @@ impl WlMitmState {
|
|||
pub fn on_s2c_event(&mut self, raw_msg: &WlRawMsg) -> bool {
|
||||
let msg = crate::proto::decode_event(&self.objects, raw_msg);
|
||||
if let crate::proto::WaylandProtocolParsingOutcome::MalformedMessage = msg {
|
||||
error!(
|
||||
debug!(
|
||||
obj_id = raw_msg.obj_id,
|
||||
opcode = raw_msg.opcode,
|
||||
"Malformed event"
|
||||
|
@ -104,7 +98,7 @@ impl WlMitmState {
|
|||
WlDisplayDeleteIdEvent => {
|
||||
// When an object is acknowledged to be deleted, remove it from our
|
||||
// internal cache of all registered objects
|
||||
self.objects.remove_object(msg.id);
|
||||
//self.objects.remove_object(msg.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue