Skip to content

Commit 625dda5

Browse files
committed
Fix return values that crash D-Bus socket
It appears that returning PoolUuid::default() will crash the D-Bus socket and stratisd will fail to receive any future D-Bus messages. Returning a String fixes the problem.
1 parent 4b7ce52 commit 625dda5

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

src/dbus/manager/manager_3_2/methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ pub async fn stop_pool_method(
131131
connection: &Arc<Connection>,
132132
manager: &Lockable<Arc<RwLock<Manager>>>,
133133
pool: ObjectPath<'_>,
134-
) -> ((bool, PoolUuid), u16, String) {
135-
let default_return = (false, PoolUuid::default());
134+
) -> ((bool, String), u16, String) {
135+
let default_return = (false, String::new());
136136

137137
let pool_uuid = match manager.read().await.pool_get_uuid(&pool) {
138138
Some(u) => u,
@@ -173,7 +173,7 @@ pub async fn stop_pool_method(
173173
OK_STRING.to_string(),
174174
),
175175
Ok(StopAction::Stopped(_)) => (
176-
(true, pool_uuid),
176+
(true, pool_uuid.simple().to_string()),
177177
DbusErrorEnum::OK as u16,
178178
OK_STRING.to_string(),
179179
),

src/dbus/manager/manager_3_2/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl ManagerR2 {
153153
.await
154154
}
155155

156-
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, PoolUuid), u16, String) {
156+
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, String), u16, String) {
157157
stop_pool_method(&self.engine, &self.connection, &self.manager, pool).await
158158
}
159159

src/dbus/manager/manager_3_3/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl ManagerR3 {
152152
.await
153153
}
154154

155-
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, PoolUuid), u16, String) {
155+
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, String), u16, String) {
156156
stop_pool_method(&self.engine, &self.connection, &self.manager, pool).await
157157
}
158158

src/dbus/manager/manager_3_4/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
},
2828
types,
2929
},
30-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo, UnlockMethod},
30+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo, UnlockMethod},
3131
};
3232

3333
mod methods;
@@ -156,7 +156,7 @@ impl ManagerR4 {
156156
.await
157157
}
158158

159-
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, PoolUuid), u16, String) {
159+
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, String), u16, String) {
160160
stop_pool_method(&self.engine, &self.connection, &self.manager, pool).await
161161
}
162162

src/dbus/manager/manager_3_5/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::{
2828
},
2929
types,
3030
},
31-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo, UnlockMethod},
31+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo, UnlockMethod},
3232
};
3333

3434
pub struct ManagerR5 {
@@ -152,7 +152,7 @@ impl ManagerR5 {
152152
.await
153153
}
154154

155-
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, PoolUuid), u16, String) {
155+
async fn stop_pool(&self, pool: ObjectPath<'_>) -> ((bool, String), u16, String) {
156156
stop_pool_method(&self.engine, &self.connection, &self.manager, pool).await
157157
}
158158

src/dbus/manager/manager_3_6/methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub async fn stop_pool_method(
2424
manager: &Lockable<Arc<RwLock<Manager>>>,
2525
id: &str,
2626
id_type: &str,
27-
) -> ((bool, PoolUuid), u16, String) {
28-
let default_return = (false, PoolUuid::default());
27+
) -> ((bool, String), u16, String) {
28+
let default_return = (false, String::new());
2929

3030
let id = match id_type {
3131
"uuid" => match PoolUuid::parse_str(id) {
@@ -81,7 +81,7 @@ pub async fn stop_pool_method(
8181
OK_STRING.to_string(),
8282
),
8383
Ok(StopAction::Stopped(pool_uuid)) => (
84-
(true, pool_uuid),
84+
(true, pool_uuid.simple().to_string()),
8585
DbusErrorEnum::OK as u16,
8686
OK_STRING.to_string(),
8787
),

src/dbus/manager/manager_3_6/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::{
2828
},
2929
types,
3030
},
31-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo, UnlockMethod},
31+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo, UnlockMethod},
3232
};
3333

3434
mod methods;
@@ -156,7 +156,7 @@ impl ManagerR6 {
156156
.await
157157
}
158158

159-
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, PoolUuid), u16, String) {
159+
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, String), u16, String) {
160160
stop_pool_method(&self.engine, &self.connection, &self.manager, id, id_type).await
161161
}
162162

src/dbus/manager/manager_3_7/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::{
2929
},
3030
types,
3131
},
32-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo, UnlockMethod},
32+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo, UnlockMethod},
3333
};
3434

3535
pub struct ManagerR7 {
@@ -153,7 +153,7 @@ impl ManagerR7 {
153153
.await
154154
}
155155

156-
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, PoolUuid), u16, String) {
156+
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, String), u16, String) {
157157
stop_pool_method(&self.engine, &self.connection, &self.manager, id, id_type).await
158158
}
159159

src/dbus/manager/manager_3_8/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::{
2828
},
2929
types,
3030
},
31-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo},
31+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo},
3232
};
3333

3434
mod methods;
@@ -166,7 +166,7 @@ impl ManagerR8 {
166166
.await
167167
}
168168

169-
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, PoolUuid), u16, String) {
169+
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, String), u16, String) {
170170
stop_pool_method(&self.engine, &self.connection, &self.manager, id, id_type).await
171171
}
172172

src/dbus/manager/manager_3_9/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::{
2929
},
3030
types,
3131
},
32-
engine::{Engine, KeyDescription, Lockable, PoolUuid, StoppedPoolsInfo},
32+
engine::{Engine, KeyDescription, Lockable, StoppedPoolsInfo},
3333
};
3434

3535
mod methods;
@@ -167,7 +167,7 @@ impl ManagerR9 {
167167
.await
168168
}
169169

170-
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, PoolUuid), u16, String) {
170+
async fn stop_pool(&self, id: &str, id_type: &str) -> ((bool, String), u16, String) {
171171
stop_pool_method(&self.engine, &self.connection, &self.manager, id, id_type).await
172172
}
173173

0 commit comments

Comments
 (0)