chiark / gitweb /
wip errors from introducing accounts
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Nov 2020 23:17:33 +0000 (23:17 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Nov 2020 23:17:33 +0000 (23:17 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/cmdlistener.rs

index 895533cfcd5abcbf72e4ed6c356ff81901328f8e..36866f5997d5d0928ad45f50c3725ccc21d7a13b 100644 (file)
@@ -154,12 +154,13 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse {
       let acl = default();
       let gref = Instance::new(game, gs, acl, auth)?;
       let ig = gref.lock()?;
-      let mut igu = Unauthorised::of(ig);
+      let mut ig = Unauthorised::of(ig);
 
       let resp =
-      execute_for_game(cs, &ag, &mut igu,
+      execute_for_game(cs, &ag, &mut ig,
                        insns, MgmtGameUpdateMode::Bulk)
         .map_err(|e|{
+          let ig = ig.by(Authorisation::authorise_any());
           let name = ig.name.clone();
           let InstanceGuard { c, .. } = ig;
           Instance::destroy_game(c, auth)
@@ -1007,8 +1008,12 @@ mod authproofs {
   #[error("internal AuthorisationError {0}")]
   pub struct AuthorisationError(pub String);
 
-  #[derive(Debug,Copy,Clone)]
+  #[derive(Debug)]
   pub struct Authorisation<A> (PhantomData<*const A>);
+  impl<A> Clone for Authorisation<A> { fn clone(&self) -> Self {
+    Self(PhantomData)
+  } }
+  impl<A> Copy for Authorisation<A> { }
 
   impl<T> Authorisation<T> {
     pub const fn authorised(_v: &T) -> Authorisation<T> {
@@ -1058,3 +1063,5 @@ mod authproofs {
     type Output = (A, B, C);
   }
 }
+
+