Skip to content

Commit 4ec3c67

Browse files
committed
fix java probe message config
1 parent f02b590 commit 4ec3c67

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

rasp/librasp/src/manager.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ impl RASPManager {
210210
})
211211
}
212212
}
213+
let mut need_write_config = true;
213214
for m in messages.iter() {
215+
if m.message_type >= 12 && m.message_type <= 14 {
216+
need_write_config = false;
217+
}
214218
if let Some(uuid) = &m.data.uuid {
215219
if uuid == "" {
216220
valid_messages.push(PidMissingProbeConfig {
@@ -259,8 +263,10 @@ impl RASPManager {
259263
}
260264
}
261265

262-
let valid_messages_string = serde_json::to_string(&valid_messages)?;
263-
self.write_message_to_config_file(pid, nspid, valid_messages_string)?;
266+
if need_write_config {
267+
let valid_messages_string = serde_json::to_string(&valid_messages)?;
268+
self.write_message_to_config_file(pid, nspid, valid_messages_string)?;
269+
}
264270

265271
Ok(())
266272
}
@@ -903,7 +909,7 @@ impl RASPManager {
903909
if !Path::new(&config_dir).exists() {
904910
fs_extra::dir::create(&config_dir, true)?;
905911
}
906-
fs::set_permissions(&config_dir, fs::Permissions::from_mode(0o666))?;
912+
fs::set_permissions(&config_dir, fs::Permissions::from_mode(0o777))?;
907913
fs_extra::file::write_all(&config_path_bak, message.as_str())?;
908914
fs::set_permissions(&config_path_bak, fs::Permissions::from_mode(0o777))?;
909915
let mut option = fs_extra::file::CopyOptions::new();

rasp/plugin/src/operation.rs

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ impl Operator {
130130
.namespace_info.clone().ok_or(anyhow!("unable fetch namespace"))?
131131
.mnt.ok_or(anyhow!("unable fetch namespace"))?;
132132
// self.rasp_manager.write_message_to_config_file(pid, process_info.nspid, probe_message.clone());
133-
self.rasp_manager.delete_config_file(pid, process_info.nspid)?;
134133
self.rasp_manager.send_message_to_probe(pid, &mnt_namespace, probe_message)
135134
}
136135

rasp/rasp_server/src/comm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub async fn looping(
284284
}
285285
}
286286
None => {
287-
log::warn!("tx recv ctrl stop");
287+
log::warn!("tx recv ctrl stop, pid: {}", pid);
288288
let _ = tx_ctrl.stop();
289289
//drop(framed_rx.get_mut());
290290
return

0 commit comments

Comments
 (0)