Implement Time Machine xattr support (Phase 4.1 complete)
This commit is contained in:
25
vendor/smb-server/src/handlers/tree_connect.rs
vendored
25
vendor/smb-server/src/handlers/tree_connect.rs
vendored
@@ -94,6 +94,31 @@ pub async fn handle(
|
||||
Access::Read => FILE_GENERIC_READ | FILE_GENERIC_EXECUTE,
|
||||
Access::ReadWrite => FILE_ALL_ACCESS,
|
||||
};
|
||||
|
||||
// Time Machine: set xattr on share root directory
|
||||
if share.time_machine {
|
||||
use crate::path::SmbPath;
|
||||
let root_path = SmbPath::root();
|
||||
|
||||
// Generate UUID for this Time Machine backup
|
||||
let uuid = uuid::Uuid::new_v4();
|
||||
let uuid_bytes = uuid.as_bytes();
|
||||
|
||||
// Set com.apple.TimeMachine.SupportedFilesStoreUUID
|
||||
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.SupportedFilesStoreUUID", uuid_bytes).await.ok();
|
||||
|
||||
// Set com.apple.TimeMachine.SupportsThisDevice (1 = true)
|
||||
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.SupportsThisDevice", &[1]).await.ok();
|
||||
|
||||
// Set max_size if specified
|
||||
if let Some(max_size) = share.time_machine_max_size {
|
||||
let max_size_bytes = max_size.to_le_bytes();
|
||||
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.MaxSize", &max_size_bytes).await.ok();
|
||||
}
|
||||
|
||||
tracing::info!(share = %share.name, uuid = %uuid, "Time Machine enabled");
|
||||
}
|
||||
|
||||
let resp = TreeConnectResponse {
|
||||
structure_size: 16,
|
||||
share_type: if share.is_ipc {
|
||||
|
||||
Reference in New Issue
Block a user