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

Replacing port 25 to 587 for SMTP protocol #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,8 @@ static struct mobile_packet *command_change_clock(struct mobile_adapter *adapter
// Replying with a different command in the header tricks the official GBA
// library into never changing its serial mode. Using the REINIT command
// forces it to set its serial mode to 8-bit.
mobile_debug_print(adapter, PSTR("<NO32BIT> Forcing adapter to keep using 8-bit mode!"));
mobile_debug_endl(adapter);
packet->command = MOBILE_COMMAND_REINIT;
s->mode_32bit = false;
#endif
Expand Down Expand Up @@ -904,6 +906,11 @@ static struct mobile_packet *command_tcp_connect_begin(struct mobile_adapter *ad
}
s->connections[conn] = true;

if ((packet->data[4] << 8 | packet->data[5]) == 25) {
mobile_debug_print(adapter, PSTR("<SMTP> Replacing port 25 to 587!"));
mobile_debug_endl(adapter);
}

b->processing_data[PROCDATA_TCP_CONNECT_CONN] = conn;
b->processing = PROCESS_TCP_CONNECT_CONNECTING;
return NULL;
Expand All @@ -920,6 +927,8 @@ static struct mobile_packet *command_tcp_connect_connecting(struct mobile_adapte
.type = MOBILE_ADDRTYPE_IPV4,
.port = packet->data[4] << 8 | packet->data[5],
};
if (addr.port == 25) addr.port = 587;

memcpy(addr.host, packet->data, 4);

int rc = mobile_cb_sock_connect(adapter, conn,
Expand Down