-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure
rdpdr.rs
into a multi file module (#12530)
- Loading branch information
Isaiah Becker-Mayer
authored
May 9, 2022
1 parent
dde7bb7
commit fd750dd
Showing
10 changed files
with
244 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//go:build !directory_sharing | ||
// +build !directory_sharing | ||
|
||
/* | ||
Copyright 2022 Gravitational, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package desktop | ||
|
||
func allowDirectorySharing() bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//go:build directory_sharing | ||
// +build directory_sharing | ||
|
||
/* | ||
Copyright 2022 Gravitational, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package desktop | ||
|
||
func allowDirectorySharing() bool { | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright 2022 Gravitational, Inc | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
pub const CHANNEL_NAME: &str = "rdpdr"; | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum Component { | ||
RDPDR_CTYP_CORE = 0x4472, | ||
RDPDR_CTYP_PRN = 0x5052, | ||
} | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum PacketId { | ||
PAKID_CORE_SERVER_ANNOUNCE = 0x496E, | ||
PAKID_CORE_CLIENTID_CONFIRM = 0x4343, | ||
PAKID_CORE_CLIENT_NAME = 0x434E, | ||
PAKID_CORE_DEVICELIST_ANNOUNCE = 0x4441, | ||
PAKID_CORE_DEVICE_REPLY = 0x6472, | ||
PAKID_CORE_DEVICE_IOREQUEST = 0x4952, | ||
PAKID_CORE_DEVICE_IOCOMPLETION = 0x4943, | ||
PAKID_CORE_SERVER_CAPABILITY = 0x5350, | ||
PAKID_CORE_CLIENT_CAPABILITY = 0x4350, | ||
PAKID_CORE_DEVICELIST_REMOVE = 0x444D, | ||
PAKID_PRN_CACHE_DATA = 0x5043, | ||
PAKID_CORE_USER_LOGGEDON = 0x554C, | ||
PAKID_PRN_USING_XPS = 0x5543, | ||
} | ||
|
||
pub const VERSION_MAJOR: u16 = 0x0001; | ||
pub const VERSION_MINOR: u16 = 0x000c; | ||
|
||
pub const SMARTCARD_CAPABILITY_VERSION_01: u32 = 0x00000001; | ||
#[allow(dead_code)] | ||
pub const GENERAL_CAPABILITY_VERSION_01: u32 = 0x00000001; | ||
pub const GENERAL_CAPABILITY_VERSION_02: u32 = 0x00000002; | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum CapabilityType { | ||
CAP_GENERAL_TYPE = 0x0001, | ||
CAP_PRINTER_TYPE = 0x0002, | ||
CAP_PORT_TYPE = 0x0003, | ||
CAP_DRIVE_TYPE = 0x0004, | ||
CAP_SMARTCARD_TYPE = 0x0005, | ||
} | ||
|
||
// If there were multiple redirected devices, they would need unique IDs. In our case there is only | ||
// one permanent smartcard device, so we hardcode an ID 1. | ||
pub const SCARD_DEVICE_ID: u32 = 1; | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum DeviceType { | ||
RDPDR_DTYP_SERIAL = 0x00000001, | ||
RDPDR_DTYP_PARALLEL = 0x00000002, | ||
RDPDR_DTYP_PRINT = 0x00000004, | ||
RDPDR_DTYP_FILESYSTEM = 0x00000008, | ||
RDPDR_DTYP_SMARTCARD = 0x00000020, | ||
} | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum MajorFunction { | ||
IRP_MJ_CREATE = 0x00000000, | ||
IRP_MJ_CLOSE = 0x00000002, | ||
IRP_MJ_READ = 0x00000003, | ||
IRP_MJ_WRITE = 0x00000004, | ||
IRP_MJ_DEVICE_CONTROL = 0x0000000E, | ||
IRP_MJ_QUERY_VOLUME_INFORMATION = 0x0000000A, | ||
IRP_MJ_SET_VOLUME_INFORMATION = 0x0000000B, | ||
IRP_MJ_QUERY_INFORMATION = 0x00000005, | ||
IRP_MJ_SET_INFORMATION = 0x00000006, | ||
IRP_MJ_DIRECTORY_CONTROL = 0x0000000C, | ||
IRP_MJ_LOCK_CONTROL = 0x00000011, | ||
} | ||
|
||
#[derive(Debug, FromPrimitive, ToPrimitive)] | ||
#[allow(non_camel_case_types)] | ||
pub enum MinorFunction { | ||
IRP_MN_NONE = 0x00000000, | ||
IRP_MN_QUERY_DIRECTORY = 0x00000001, | ||
IRP_MN_NOTIFY_CHANGE_DIRECTORY = 0x00000002, | ||
} |
Oops, something went wrong.