File tree Expand file tree Collapse file tree
crates/system-reinstall-bootc/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ impl<'a> SshdConfig<'a> {
125125 let config = sshd_output
126126 . lines ( )
127127 . filter_map ( |line| line. split_once ( ' ' ) )
128- . collect :: < BTreeMap < & str , & str > > ( ) ;
128+ . map ( |( k, v) | ( k. to_ascii_lowercase ( ) , v) )
129+ . collect :: < BTreeMap < String , & str > > ( ) ;
129130
130131 let authorized_keys_files: Vec < & str > = config
131132 . get ( "authorizedkeysfile" )
@@ -259,6 +260,20 @@ pub(crate) fn get_all_users_keys() -> Result<Vec<UserKeys>> {
259260mod test {
260261 use super :: * ;
261262
263+ #[ test]
264+ fn test_parse_sshd_config_lowercase ( ) {
265+ let input = "authorizedkeysfile .ssh/authorized_keys" ;
266+ let config = SshdConfig :: parse ( input) . unwrap ( ) ;
267+ assert_eq ! ( config. authorized_keys_files, vec![ ".ssh/authorized_keys" ] ) ;
268+ }
269+
270+ #[ test]
271+ fn test_parse_sshd_config_mixedcase ( ) {
272+ let input = "AuthorizedKeysFile .ssh/authorized_keys" ;
273+ let config = SshdConfig :: parse ( input) . unwrap ( ) ;
274+ assert_eq ! ( config. authorized_keys_files, vec![ ".ssh/authorized_keys" ] ) ;
275+ }
276+
262277 #[ test]
263278 pub ( crate ) fn test_parse_lsblk ( ) {
264279 let fixture = include_str ! ( "../tests/fixtures/loginctl.json" ) ;
You can’t perform that action at this time.
0 commit comments