From 5ee8906fa5482b7fac8752c2bb6533b500c70b23 Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Tue, 26 Apr 2022 23:44:44 +0000
Subject: [PATCH] Fix auth switch renegotiation and fix issue on deletes of
 sent requests

---
 auth/receivedRequest.go | 2 +-
 auth/store/deletion.go  | 4 ++--
 auth/store/store.go     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/auth/receivedRequest.go b/auth/receivedRequest.go
index 22a94b064..d5be826d5 100644
--- a/auth/receivedRequest.go
+++ b/auth/receivedRequest.go
@@ -197,7 +197,7 @@ func (rrs *receivedRequestService) Process(message format.Message,
 			if !cAuth.VerifyOwnershipProof(state.e2e.GetHistoricalDHPrivkey(),
 				partnerPubKey, state.e2e.GetGroup(), ownershipProof) {
 				jww.WARN.Printf("Invalid ownership proof from %s to %s "+
-					"received, discarding msdDigest: %s, fp: %s",
+					"received, discarding msgDigest: %s, fp: %s",
 					partnerID, receptionID.Source,
 					format.DigestContents(message.GetContents()),
 					base64.StdEncoding.EncodeToString(fp))
diff --git a/auth/store/deletion.go b/auth/store/deletion.go
index c02e39571..d5fb746a7 100644
--- a/auth/store/deletion.go
+++ b/auth/store/deletion.go
@@ -89,7 +89,7 @@ func (s *Store) DeleteReceivedRequest(partner *id.ID) error {
 
 	rr.mux.Lock()
 	s.mux.Lock()
-	_, exist = s.receivedByID[*partner]
+	rr, exist = s.receivedByID[*partner]
 	delete(s.receivedByID, *partner)
 	rr.mux.Unlock()
 	s.mux.Unlock()
@@ -116,7 +116,7 @@ func (s *Store) DeleteSentRequest(partner *id.ID) error {
 	s.mux.Lock()
 	_, exist = s.sentByID[*partner]
 	s.srh.Delete(sr)
-	delete(s.receivedByID, *partner)
+	delete(s.sentByID, *partner)
 	s.mux.Unlock()
 	sr.mux.Unlock()
 
diff --git a/auth/store/store.go b/auth/store/store.go
index d38510933..e5496b2d7 100644
--- a/auth/store/store.go
+++ b/auth/store/store.go
@@ -316,7 +316,7 @@ func (s *Store) HandleSentRequest(partner *id.ID, handler func(request *SentRequ
 		return errors.WithMessage(handleErr, "Received error from handler")
 	}
 
-	delete(s.receivedByID, *partner)
+	delete(s.sentByID, *partner)
 	s.save()
 	sr.delete()
 
-- 
GitLab