Skip to content

Commit 4d46499

Browse files
committed
address review feedback
1 parent d4470dc commit 4d46499

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

build.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ $filesForWindowsPackage = @(
6060
'RunCommandOnSet.dsc.resource.json',
6161
'RunCommandOnSet.exe',
6262
'sshdconfig.exe',
63-
'sshd.dsc.resource.json',
63+
'sshd-windows.dsc.resource.json',
6464
'sshd_config.dsc.resource.json',
6565
'windowspowershell.dsc.resource.json',
6666
'wmi.dsc.resource.json',
@@ -88,7 +88,6 @@ $filesForLinuxPackage = @(
8888
'RunCommandOnSet.dsc.resource.json',
8989
'runcommandonset',
9090
'sshdconfig',
91-
'sshd.dsc.resource.json',
9291
'sshd_config.dsc.resource.json'
9392
)
9493

@@ -111,7 +110,6 @@ $filesForMacPackage = @(
111110
'RunCommandOnSet.dsc.resource.json',
112111
'runcommandonset',
113112
'sshdconfig',
114-
'sshd.dsc.resource.json',
115113
'sshd_config.dsc.resource.json'
116114
)
117115

@@ -176,7 +174,7 @@ if ($null -ne $packageType) {
176174

177175
& $rustup default stable
178176

179-
## Test if Node is installed
177+
## Test if Node is installed
180178
## Skipping upgrade as users may have a specific version they want to use
181179
if (!(Get-Command 'node' -ErrorAction Ignore)) {
182180
Write-Verbose -Verbose "Node.js not found, installing..."

sshdconfig/locales/en-us.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ parseInt = "Parse Integer"
1414
registry = "Registry"
1515

1616
[get]
17-
notImplemented = "get not yet implemented for Microsoft.OpenSSH.SSHD/sshd_config"
18-
defaultShellMustBeString = "shell must be a string"
1917
defaultShellCmdOptionMustBeString = "cmdOption must be a string"
2018
defaultShellEscapeArgsMustBe0Or1 = "'%{input}' must be a 0 or 1"
2119
defaultShellEscapeArgsMustBeDWord = "escapeArguments must be a DWord"
20+
defaultShellMustBeString = "shell must be a string"
21+
notImplemented = "get not yet implemented for Microsoft.OpenSSH.SSHD/sshd_config"
2222
windowsOnly = "Microsoft.OpenSSH.SSHD/Windows is only applicable to Windows"
2323

2424
[set]
2525
failedToParseInput = "failed to parse input as DefaultShell with error: '%{error}'"
26-
shellPathMustNotBeRelative = "shell path must not be relative"
2726
shellPathDoesNotExist = "shell path does not exist: '%{shell}'"
27+
shellPathMustNotBeRelative = "shell path must not be relative"
2828

2929
[parser]
3030
failedToParse = "failed to parse: '%{input}'"
31-
failedToParseRoot = "failed to parse root: '%{input}'"
32-
invalidConfig = "invalid config: '%{input}'"
33-
unknownNodeType = "unknown node type: '%{node}'"
34-
failedToParseChildNode = "failed to parse child node: '%{input}'"
35-
missingValueInChildNode = "missing value in child node: '%{input}'"
36-
missingKeyInChildNode = "missing key in child node: '%{input}'"
3731
failedToParseAsArray = "value is not an array"
32+
failedToParseChildNode = "failed to parse child node: '%{input}'"
3833
failedToParseNode = "failed to parse '%{input}'"
34+
failedToParseRoot = "failed to parse root: '%{input}'"
35+
invalidConfig = "invalid config: '%{input}'"
36+
invalidValue = "operator is an invalid value for node"
3937
keyNotFound = "key '%{key}' not found"
4038
keyNotRepeatable = "key '%{key}' is not repeatable"
41-
invalidValue = "operator is an invalid value for node"
39+
missingKeyInChildNode = "missing key in child node: '%{input}'"
40+
missingValueInChildNode = "missing value in child node: '%{input}'"
4241
unknownNode = "unknown node: '%{kind}'"
42+
unknownNodeType = "unknown node type: '%{node}'"
4343

4444
[util]
4545
sshdElevation = "elevated security context required"

sshdconfig/src/args.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ pub enum Command {
3535

3636
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
3737
pub struct DefaultShell {
38+
#[serde(skip_serializing_if = "Option::is_none")]
3839
pub shell: Option<String>,
40+
#[serde(rename = "cmdOption", skip_serializing_if = "Option::is_none")]
3941
pub cmd_option: Option<String>,
42+
#[serde(rename = "escapeArguments", skip_serializing_if = "Option::is_none")]
4043
pub escape_arguments: Option<bool>,
4144
}
4245

sshdconfig/src/get.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ fn get_default_shell() -> Result<(), SshdConfigError> {
7878
#[cfg(not(windows))]
7979
fn get_default_shell() -> Result<(), SshdConfigError> {
8080
Err(SshdConfigError::InvalidInput(t!("get.windowsOnly").to_string()))
81-
}
81+
}

sshdconfig/tests/defaultshell.tests.ps1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
6767

6868
$result = $output | ConvertFrom-Json
6969
$result.shell | Should -Be $testShell
70-
$result.cmd_option | Should -BeNullOrEmpty
71-
$result.escape_arguments | Should -BeNullOrEmpty
70+
$result.cmdOption | Should -BeNullOrEmpty
71+
$result.escapeArguments | Should -BeNullOrEmpty
7272
}
7373

7474
It 'Should get default shell with args when registry value exists' {
@@ -83,8 +83,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
8383

8484
$result = $output | ConvertFrom-Json
8585
$result.shell | Should -Be $testShell
86-
$result.cmd_option | Should -Be "/c"
87-
$result.escape_arguments | Should -Be $false
86+
$result.cmdOption | Should -Be "/c"
87+
$result.escapeArguments | Should -Be $false
8888
}
8989

9090
It 'Should handle empty default shell registry values' -Skip:(!$IsWindows) {
@@ -93,8 +93,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
9393

9494
$result = $output | ConvertFrom-Json
9595
$result.shell | Should -BeNullOrEmpty
96-
$result.cmd_option | Should -BeNullOrEmpty
97-
$result.escape_arguments | Should -BeNullOrEmpty
96+
$result.cmdOption | Should -BeNullOrEmpty
97+
$result.escapeArguments | Should -BeNullOrEmpty
9898
}
9999
}
100100

@@ -104,8 +104,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
104104

105105
$inputConfig = @{
106106
shell = $testShell
107-
cmd_option = "/c"
108-
escape_arguments = $false
107+
cmdOption = "/c"
108+
escapeArguments = $false
109109
} | ConvertTo-Json
110110

111111
sshdconfig set --input $inputConfig
@@ -157,8 +157,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
157157
It 'Should maintain configuration consistency between set and get' {
158158
$originalConfig = @{
159159
shell = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
160-
cmd_option = "/c"
161-
escape_arguments = $true
160+
cmdOption = "/c"
161+
escapeArguments = $true
162162
}
163163
$inputJson = $originalConfig | ConvertTo-Json
164164

@@ -171,8 +171,8 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
171171
$retrievedConfig = $getOutput | ConvertFrom-Json
172172

173173
$retrievedConfig.shell | Should -Be $originalConfig.shell
174-
$retrievedConfig.cmd_option | Should -Be $originalConfig.cmd_option
175-
$retrievedConfig.escape_arguments | Should -Be $originalConfig.escape_arguments
174+
$retrievedConfig.cmdOption | Should -Be $originalConfig.cmdOption
175+
$retrievedConfig.escapeArguments | Should -Be $originalConfig.escapeArguments
176176
}
177177
}
178178

0 commit comments

Comments
 (0)