Bug 1735803 - Convert server hostname to lowercase before connecting. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D158179
This commit is contained in:
Ping Chen 2022-09-27 05:39:23 +00:00
Родитель eb8fa81497
Коммит cc536d6dc2
5 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -41,12 +41,13 @@ class LDAPClient {
} }
connect() { connect() {
let hostname = this._host.toLowerCase();
this._logger.debug( this._logger.debug(
`Connecting to ${this._useSecureTransport ? "ldaps" : "ldap"}://${ `Connecting to ${
this._host this._useSecureTransport ? "ldaps" : "ldap"
}:${this._port}` }://${hostname}:${this._port}`
); );
this._socket = new TCPSocket(this._host, this._port, { this._socket = new TCPSocket(hostname, this._port, {
binaryType: "arraybuffer", binaryType: "arraybuffer",
useSecureTransport: this._useSecureTransport, useSecureTransport: this._useSecureTransport,
}); });

Просмотреть файл

@ -113,10 +113,11 @@ class SmtpClient {
* Initiate a connection to the server * Initiate a connection to the server
*/ */
connect() { connect() {
let hostname = this._server.hostname.toLowerCase();
let port = this._server.port || (this.options.requireTLS ? 465 : 587); let port = this._server.port || (this.options.requireTLS ? 465 : 587);
this.logger.debug(`Connecting to smtp://${this._server.hostname}:${port}`); this.logger.debug(`Connecting to smtp://${hostname}:${port}`);
this._secureTransport = this.options.requireTLS; this._secureTransport = this.options.requireTLS;
this.socket = new TCPSocket(this._server.hostname, port, { this.socket = new TCPSocket(hostname, port, {
binaryType: "arraybuffer", binaryType: "arraybuffer",
useSecureTransport: this._secureTransport, useSecureTransport: this._secureTransport,
}); });

Просмотреть файл

@ -99,12 +99,11 @@ class ImapClient {
// Reuse the connection. // Reuse the connection.
this.onReady(); this.onReady();
} else { } else {
this._logger.debug( let hostname = this._server.hostName.toLowerCase();
`Connecting to ${this._server.hostName}:${this._server.port}` this._logger.debug(`Connecting to ${hostname}:${this._server.port}`);
);
this._capabilities = null; this._capabilities = null;
this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL; this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL;
this._socket = new TCPSocket(this._server.hostName, this._server.port, { this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer", binaryType: "arraybuffer",
useSecureTransport: this._secureTransport, useSecureTransport: this._secureTransport,
}); });

Просмотреть файл

@ -130,15 +130,14 @@ class Pop3Client {
* Initiate a connection to the server * Initiate a connection to the server
*/ */
connect() { connect() {
this._logger.debug( let hostname = this._server.hostName.toLowerCase();
`Connecting to pop://${this._server.hostName}:${this._server.port}` this._logger.debug(`Connecting to pop://${hostname}:${this._server.port}`);
);
this.runningUri this.runningUri
.QueryInterface(Ci.nsIMsgMailNewsUrl) .QueryInterface(Ci.nsIMsgMailNewsUrl)
.SetUrlState(true, Cr.NS_OK); .SetUrlState(true, Cr.NS_OK);
this._server.serverBusy = true; this._server.serverBusy = true;
this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL; this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL;
this._socket = new TCPSocket(this._server.hostName, this._server.port, { this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer", binaryType: "arraybuffer",
useSecureTransport: this._secureTransport, useSecureTransport: this._secureTransport,
}); });

Просмотреть файл

@ -93,13 +93,14 @@ class NntpClient {
this.onOpen(); this.onOpen();
} else { } else {
// Start a new connection. // Start a new connection.
let hostname = this._server.hostName.toLowerCase();
let useSecureTransport = this._server.isSecure; let useSecureTransport = this._server.isSecure;
this._logger.debug( this._logger.debug(
`Connecting to ${useSecureTransport ? "snews" : "news"}://${ `Connecting to ${useSecureTransport ? "snews" : "news"}://${hostname}:${
this._server.hostName this._server.port
}:${this._server.port}` }`
); );
this._socket = new TCPSocket(this._server.hostName, this._server.port, { this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer", binaryType: "arraybuffer",
useSecureTransport, useSecureTransport,
}); });