Skip to content

Commit

Permalink
Check for non-empty 'Error' string in 'StartSessionResponse' (#515)
Browse files Browse the repository at this point in the history
* Check for non-empty 'Error' string in 'StartSessionResponse'

* Add more context to lockdown session start error

Co-authored-by: dmissmann <[email protected]>

* Fix imports

---------

Co-authored-by: dmissmann <[email protected]>
  • Loading branch information
buxomant and dmissmann authored Nov 18, 2024
1 parent b8669ed commit 1fcc2a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ios/startsession.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ios

import (
"bytes"
"fmt"

plist "howett.net/plist"
)
Expand Down Expand Up @@ -29,6 +30,7 @@ type StartSessionResponse struct {
EnableSessionSSL bool
Request string
SessionID string
Error string
}

func startSessionResponsefromBytes(plistBytes []byte) StartSessionResponse {
Expand All @@ -52,6 +54,9 @@ func (lockDownConn *LockDownConnection) StartSession(pairRecord PairRecord) (Sta
return StartSessionResponse{}, err
}
response := startSessionResponsefromBytes(resp)
if response.Error != "" {
return StartSessionResponse{}, fmt.Errorf("failed to start new lockdown session: %s", response.Error)
}
lockDownConn.sessionID = response.SessionID
if response.EnableSessionSSL {
err = lockDownConn.deviceConnection.EnableSessionSsl(pairRecord)
Expand Down

0 comments on commit 1fcc2a1

Please sign in to comment.