Modern Apps git

← xtool.git

Fix ADI permissions (#33)

Commit
fa74cd9b104d438c3ef3242b53b3dc1795ee08ae
Author
Kabir Oberai <[email protected]>
When
2025-05-14 06:41 UTC (1 year ago)
Parents
579c907

Diff

Sources/XKit/GrandSlam/Anisette/XADIProvider.swift
diff --git a/Sources/XKit/GrandSlam/Anisette/XADIProvider.swift b/Sources/XKit/GrandSlam/Anisette/XADIProvider.swiftindex faef03e..107c83f 100644--- a/Sources/XKit/GrandSlam/Anisette/XADIProvider.swift+++ b/Sources/XKit/GrandSlam/Anisette/XADIProvider.swift@@ -129,6 +129,15 @@ public actor XADIProvider: RawADIProvider {                 }             })             let file = adiDirectory.appending(path: "adi.pb")+            // adi saves the file as 0o034 (group wx, public r) by default+            // which is a... strange choice that prevents us from reading+            // or writing by default. Since we're the owner, we can easily+            // change this though.+            try FileManager.default.setAttributes(+                // rw for owner+                [.posixPermissions: 0o600],+                ofItemAtPath: file.path+            )             return try Data(contentsOf: file)         }     }@@ -148,9 +157,6 @@ public actor XADIProvider: RawADIProvider {         let adiDirectory = directory.appending(path: "adi")         try? FileManager.default.createDirectory(at: adiDirectory, withIntermediateDirectories: true)         let adiFile = adiDirectory.appending(path: "adi.pb")-        // this file may be saved as write-protected, but we can still remove it-        // and then overwrite it.-        try? FileManager.default.removeItem(at: adiFile)         try provisioningInfo.write(to: adiFile)          try check(xadi_OTPRequest(