Skip to content

Commit 1fcc2a1

Browse files
buxomantdmissmann
andauthored
Check for non-empty 'Error' string in 'StartSessionResponse' (danielpaulus#515)
* 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]>
1 parent b8669ed commit 1fcc2a1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ios/startsession.go

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ios
22

33
import (
44
"bytes"
5+
"fmt"
56

67
plist "howett.net/plist"
78
)
@@ -29,6 +30,7 @@ type StartSessionResponse struct {
2930
EnableSessionSSL bool
3031
Request string
3132
SessionID string
33+
Error string
3234
}
3335

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

0 commit comments

Comments
 (0)