From: Ian Jackson Date: Sun, 26 Jul 2020 01:29:46 +0000 (+0100) Subject: auth reorg nfc good X-Git-Tag: otter-0.2.0~1249 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f7cf4396c728ff471f2bcd38d61e8658730b1d7e;p=otter.git auth reorg nfc good --- diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 2f6c51d5..bd83b506 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -106,6 +106,7 @@ fn authorise_scope(cs: &CommandStream, wanted: &ManagementScope) type AS = (T, ManagementScope); match &wanted { + ManagementScope::XXX => { let y : AS< Authorised<(Passwd,uid_t)>, @@ -116,6 +117,7 @@ fn authorise_scope(cs: &CommandStream, wanted: &ManagementScope) }; return y.into() }, + ManagementScope::Unix { user: wanted } => { let y : AS< Authorised<(Passwd,uid_t)>, @@ -133,7 +135,7 @@ fn authorise_scope(cs: &CommandStream, wanted: &ManagementScope) )) )?; - let (in_userlist, xinfo) = (||{ ),anyhow::Error>>::Ok({ + let (in_userlist, xinfo) = (||{ >::Ok({ let allowed = BufReader::new(match File::open(USERLIST) { Err(e) if e.kind() == ErrorKind::NotFound => { return Ok(( @@ -153,7 +155,7 @@ fn authorise_scope(cs: &CommandStream, wanted: &ManagementScope) )) ), Ok(_) => None, - Err(e) => Some(>::Err(e.into())), + Err(e) => Some(>::Err(e.into())), }) .next() .unwrap_or_else( @@ -172,7 +174,8 @@ fn authorise_scope(cs: &CommandStream, wanted: &ManagementScope) ManagementScope::Unix { user: pwent.name }) }; y.into() - } + }, + } } @@ -190,7 +193,8 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { ?; cs.scope = Some(authorised.into_inner()); Fine { } - } + }, + /* CreateGame(game) => { @@ -256,7 +260,7 @@ impl CommandListener { let show_username = pwent.map_or_else(|| format!("", euid), |p| p.name); - >::Ok(show_username) + >::Ok(show_username) })().unwrap_or_else(|e| format!("", e)); write!(&mut desc, " user={}", user_desc)?;