Skip to content

Commit f5291cd

Browse files
committed
add set null test
1 parent 93d7b69 commit f5291cd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

sshdconfig/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ pub struct DefaultShell {
3535
pub cmd_option: Option<String>,
3636
pub escape_arguments: Option<bool>,
3737
pub shell_arguments: Option<Vec<String>>,
38-
}
38+
}

sshdconfig/tests/defaultshell.tests.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,19 @@ Describe 'Default Shell Configuration Tests' -Skip:(!$IsWindows) {
182182
$retrievedConfig.shell_arguments | Should -Be $originalConfig.shell_arguments
183183
}
184184
}
185+
186+
Context 'Set default shell with null value' {
187+
It 'Should clear existing default shell when set to null' {
188+
$testShell = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
189+
New-ItemProperty -Path $RegistryPath -Name "DefaultShell" -Value $testShell
190+
191+
$inputConfig = @{ shell = $null } | ConvertTo-Json
192+
193+
sshdconfig set --input $inputConfig
194+
$LASTEXITCODE | Should -Be 0
195+
196+
$result = Get-ItemProperty -Path $RegistryPath -Name "DefaultShell" -ErrorAction SilentlyContinue
197+
$result | Should -BeNullOrEmpty
198+
}
199+
}
185200
}

0 commit comments

Comments
 (0)