diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 78b2a2e3..464396d3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -193,6 +193,13 @@ jobs: uses: hugo19941994/delete-draft-releases@v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Delete existing tag if exist + uses: ClementTsang/delete-tag-and-release@v0.3.1 + continue-on-error: true + with: + tag_name: v${{ env.VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Release uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/endpoint/register/pypush_gsa_icloud.py b/endpoint/register/pypush_gsa_icloud.py index 694a3026..f029f805 100644 --- a/endpoint/register/pypush_gsa_icloud.py +++ b/endpoint/register/pypush_gsa_icloud.py @@ -43,6 +43,8 @@ def icloud_login_mobileme(username='', password=''): password = getpass('Password: ') g = gsa_authenticate(username, password) + if not g: + raise Exception("Authentication failed. Please verify your Apple ID and password.") pet = g["t"]["com.apple.gs.idms.pet"]["token"] adsid = g["adsid"] @@ -82,9 +84,17 @@ def gsa_authenticate(username, password): r = gsa_authenticated_request( {"A2k": a, "ps": ["s2k", "s2k_fo"], "u": username, "o": "init"}) + if "Status" in r and r["Status"].get("ec", 0) != 0: + logger.error(f"Authentication initialization failed: {r['Status'].get('em', 'Unknown error')} (ec: {r['Status'].get('ec')})") + return None + + if "sp" not in r: + logger.error("Authentication initialization failed: Server response did not contain SRP parameters.") + return None + if r["sp"] not in ["s2k", "s2k_fo"]: logger.warning(f"This implementation only supports s2k and sk2_fo. Server returned {r['sp']}") - return + return None # Change the password out from under the SRP library, as we couldn't calculate it without the salt. usr.p = encrypt_password(password, r["s"], r["i"], r["sp"]) @@ -144,7 +154,7 @@ def gsa_authenticated_request(parameters): "Content-Type": "text/x-xml-plist", "Accept": "*/*", "User-Agent": "akd/1.0 CFNetwork/978.0.7 Darwin/18.7.0", - "X-MMe-Client-Info": ' ' + "X-MMe-Client-Info": ' ' } with requests.post( diff --git a/version b/version index 37c2961c..0cdd6881 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.7.2 +2.7.3-DEV