Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging in with wrong password causes an infinite loop on the mega-cmd-server #1024

Open
picaronin opened this issue Jan 22, 2025 · 3 comments
Labels

Comments

@picaronin
Copy link

MEGAcmd version

1.7.0

Operating System/Platform

Linux

Platform version. In the case of Linux, please enter the Linux distribution you are using.

Debian 12

Steps

Logging in with an incorrect password, both in interactive and no-interactive mode.

MEGACMD> login [email protected] "WRONG_PASSWORD"

or

mega-login [email protected] "WRONG_PASSWORD"

Expected behavior

Server response with access denied.

Actual behavior

The mega-cmd-server enters an infinite loop without giving any response to the login command.
The Debian server freezes waiting for a response that never comes.

Attached is the mega-cmd-server --debug-full log with the responses it generates.


[API:debug: 00:58:33] cs Retrying the last request after code: 6
[API:debug: 00:58:33] Req command counts: us:1
[API:debug: 00:58:33] cs POST target URL: https://g.api.mega.co.nz/cs?id=ejvkpyaolc&ak=BdARkQSQ&v=2
[API:debug: 00:58:33] cs Sending 154: [{"a":"us","user":"[email protected]","uh":"prtRKvNkMInmqYJAw_j1uA","sek":"LQ5Cce04sEeZuCK_vHek2g","si":"ebQUSwWnv2Qj2aLyioXYngjiH2EpP4NTbA_nZrqkiYc"}] (at ds: 51088)
[API:debug: 00:58:33] Adding curl socket 74 to 2
[API:debug: 00:58:34] Removing socket 74
[API:debug: 00:58:34] cs CURLMSG_DONE with error 22: HTTP response code said error
[API:debug: 00:58:34] cs CURLMSG_DONE with HTTP status: 402 from g.api.mega.co.nz - 66.203.125.13
[API:debug: 00:58:34] cs Received 0: (at ds: 51089)
[API:warn: 00:58:34] cs REQ_FAILURE. Status: 402 CURLcode: 22 Content-Length: -1 buffer? 0 bufferSize: 0
[API:warn: 00:58:34] Retrying cs request in 40 ds
[API:debug: 00:58:38] cs Retrying the last request after code: 6
[API:debug: 00:58:38] Req command counts: us:1
[API:debug: 00:58:38] cs POST target URL: https://g.api.mega.co.nz/cs?id=ejvkpyaolc&ak=BdARkQSQ&v=2
[API:debug: 00:58:38] cs Sending 154: [{"a":"us","user":"[email protected]","uh":"prtRKvNkMInmqYJAw_j1uA","sek":"LQ5Cce04sEeZuCK_vHek2g","si":"ebQUSwWnv2Qj2aLyioXYngjiH2EpP4NTbA_nZrqkiYc"}] (at ds: 51129)
[API:debug: 00:58:38] Adding curl socket 74 to 2
[API:debug: 00:58:38] Removing socket 74
[API:debug: 00:58:38] cs CURLMSG_DONE with error 22: HTTP response code said error
[API:debug: 00:58:38] cs CURLMSG_DONE with HTTP status: 402 from g.api.mega.co.nz - 66.203.125.13
[API:debug: 00:58:38] cs Received 0: (at ds: 51133)
[API:warn: 00:58:38] cs REQ_FAILURE. Status: 402 CURLcode: 22 Content-Length: -1 buffer? 0 bufferSize: 0
[API:warn: 00:58:38] Retrying cs request in 74 ds
[API:debug: 00:58:45] cs Retrying the last request after code: 6
[API:debug: 00:58:45] Req command counts: us:1
[API:debug: 00:58:45] cs POST target URL: https://g.api.mega.co.nz/cs?id=ejvkpyaolc&ak=BdARkQSQ&v=2
[API:debug: 00:58:45] cs Sending 154: [{"a":"us","user":"[email protected]","uh":"prtRKvNkMInmqYJAw_j1uA","sek":"LQ5Cce04sEeZuCK_vHek2g","si":"ebQUSwWnv2Qj2aLyioXYngjiH2EpP4NTbA_nZrqkiYc"}] (at ds: 51207)
[API:debug: 00:58:45] Adding curl socket 74 to 2
[API:debug: 00:58:45] Removing socket 74
[API:debug: 00:58:45] cs CURLMSG_DONE with error 22: HTTP response code said error
[API:debug: 00:58:45] cs CURLMSG_DONE with HTTP status: 402 from g.api.mega.co.nz - 66.203.125.13
[API:debug: 00:58:45] cs Received 0: (at ds: 51208)
[API:warn: 00:58:45] cs REQ_FAILURE. Status: 402 CURLcode: 22 Content-Length: -1 buffer? 0 bufferSize: 0
[API:warn: 00:58:45] Retrying cs request in 169 ds
.....

@picaronin picaronin added the bug label Jan 22, 2025
@ViperCode7
Copy link

ViperCode7 commented Jan 28, 2025

I can confirm the bug... did a typo on the login email (not the password) but didn't notice so I kept retrying and the server kept freezing... later in debug I noticed the same thing as posted by OP, it keeps looping on 402 http error code.

@polmr
Copy link
Collaborator

polmr commented Jan 29, 2025

There will soon be a release that addresses this. In the meantime, you can cancel the login by opening a new MEGAcmdShell and simply:

logout

@picaronin
Copy link
Author

I am currently saving the situation by limiting the execution time and subsequently handling the script's response.

timeout --signal=HUP 5s mega-login USER "PASSWORD"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants