Skip to content
Snippets Groups Projects
Commit 7bd24eda authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Don't replay sent requests on a reset

parent b2b7d48e
No related branches found
No related tags found
2 merge requests!510Release,!207WIP: Client Restructure
...@@ -50,8 +50,8 @@ func (rcs *receivedConfirmService) Process(msg format.Message, ...@@ -50,8 +50,8 @@ func (rcs *receivedConfirmService) Process(msg format.Message,
baseFmt.GetEcrPayload(), msg.GetMac(), state.e2e.GetGroup()) baseFmt.GetEcrPayload(), msg.GetMac(), state.e2e.GetGroup())
if !success { if !success {
em := fmt.Sprintf("Received auth confirmation failed its mac " + em := fmt.Sprintf("Received auth confirmation " +
"check") "failed its mac check")
jww.WARN.Print(em) jww.WARN.Print(em)
state.event.Report(10, "Auth", "ConfirmError", em) state.event.Report(10, "Auth", "ConfirmError", em)
return return
......
...@@ -149,6 +149,10 @@ func (rrs *receivedRequestService) Process(message format.Message, ...@@ -149,6 +149,10 @@ func (rrs *receivedRequestService) Process(message format.Message,
// new request // new request
reset := false reset := false
if rrs.reset { if rrs.reset {
jww.INFO.Printf("AuthRequest ResetSession from %s,"+
" msgDigest: %s, FP: %s", partnerID,
format.DigestContents(message.GetContents()),
base64.StdEncoding.EncodeToString(fp))
// delete only deletes if the partner is present, so we can just call delete // delete only deletes if the partner is present, so we can just call delete
// instead of checking if it exists and then calling delete, and check the // instead of checking if it exists and then calling delete, and check the
// error to see if it did or didnt exist // error to see if it did or didnt exist
......
...@@ -86,6 +86,10 @@ func (s *state) request(partner contact.Contact, myfacts fact.FactList, ...@@ -86,6 +86,10 @@ func (s *state) request(partner contact.Contact, myfacts fact.FactList,
} else { } else {
jww.INFO.Printf("Resending request to %s from %s as "+ jww.INFO.Printf("Resending request to %s from %s as "+
"one was already sent", partner.ID, me) "one was already sent", partner.ID, me)
dhPriv = sr.GetMyPrivKey()
dhPub = sr.GetMyPubKey()
//sidhPriv = sr.GetMySIDHPrivKey()
sidhPub = sr.GetMySIDHPubKey()
} }
} }
...@@ -114,9 +118,13 @@ func (s *state) request(partner contact.Contact, myfacts fact.FactList, ...@@ -114,9 +118,13 @@ func (s *state) request(partner contact.Contact, myfacts fact.FactList,
p := cmix.GetDefaultCMIXParams() p := cmix.GetDefaultCMIXParams()
p.DebugTag = "auth.Request" p.DebugTag = "auth.Request"
tag := s.params.RequestTag
if reset {
tag = s.params.ResetRequestTag
}
svc := message.Service{ svc := message.Service{
Identifier: partner.ID.Marshal(), Identifier: partner.ID.Marshal(),
Tag: s.params.RequestTag, Tag: tag,
Metadata: nil, Metadata: nil,
} }
round, _, err := s.net.Send(partner.ID, requestfp, svc, contents, mac, p) round, _, err := s.net.Send(partner.ID, requestfp, svc, contents, mac, p)
......
...@@ -77,11 +77,11 @@ type e2eHandler interface { ...@@ -77,11 +77,11 @@ type e2eHandler interface {
} }
type Callbacks interface { type Callbacks interface {
Request(requestor contact.Contact, receptionID receptionID.EphemeralIdentity, Request(partner contact.Contact, receptionID receptionID.EphemeralIdentity,
round rounds.Round) round rounds.Round)
Confirm(requestor contact.Contact, receptionID receptionID.EphemeralIdentity, Confirm(partner contact.Contact, receptionID receptionID.EphemeralIdentity,
round rounds.Round) round rounds.Round)
Reset(requestor contact.Contact, receptionID receptionID.EphemeralIdentity, Reset(partner contact.Contact, receptionID receptionID.EphemeralIdentity,
round rounds.Round) round rounds.Round)
} }
......
...@@ -181,16 +181,18 @@ func (s *Store) AddSent(partner *id.ID, partnerHistoricalPubKey, myPrivKey, ...@@ -181,16 +181,18 @@ func (s *Store) AddSent(partner *id.ID, partnerHistoricalPubKey, myPrivKey,
s.mux.Lock() s.mux.Lock()
defer s.mux.Unlock() defer s.mux.Unlock()
if !reset {
if sentRq, ok := s.sentByID[*partner]; ok { if sentRq, ok := s.sentByID[*partner]; ok {
return sentRq, errors.Errorf("Cannot make new sentRequest "+ return sentRq, errors.Errorf("sent request "+
"for partner %s, a sent request already exists", "already exists for partner %s",
partner) partner)
} }
if _, ok := s.receivedByID[*partner]; ok { if _, ok := s.receivedByID[*partner]; ok {
return nil, errors.Errorf("Cannot make new sentRequest for "+ return nil, errors.Errorf("received request "+
" partner %s, a received reqyest already exists", "already exists for partner %s",
partner) partner)
} }
}
sr, err := newSentRequest(s.kv, partner, partnerHistoricalPubKey, sr, err := newSentRequest(s.kv, partner, partnerHistoricalPubKey,
myPrivKey, myPubKey, sidHPrivA, sidHPubA, fp, reset) myPrivKey, myPubKey, sidHPrivA, sidHPubA, fp, reset)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment