mirror of
				https://github.com/dawidd6/action-send-mail.git
				synced 2025-11-04 08:46:41 +07:00 
			
		
		
		
	node_modules: upgrade
This commit is contained in:
		
							
								
								
									
										14
									
								
								node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -44,7 +44,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
 | 
			
		||||
    // Error harness for initial connection. Once connection is established, the responsibility
 | 
			
		||||
    // to handle errors is passed to whoever uses this socket
 | 
			
		||||
    let finished = false;
 | 
			
		||||
    let tempSocketErr = function (err) {
 | 
			
		||||
    let tempSocketErr = err => {
 | 
			
		||||
        if (finished) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -57,6 +57,12 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
 | 
			
		||||
        callback(err);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let timeoutErr = () => {
 | 
			
		||||
        let err = new Error('Proxy socket timed out');
 | 
			
		||||
        err.code = 'ETIMEDOUT';
 | 
			
		||||
        tempSocketErr(err);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    socket = connect(options, () => {
 | 
			
		||||
        if (finished) {
 | 
			
		||||
            return;
 | 
			
		||||
@ -119,12 +125,18 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, callback) {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                socket.removeListener('error', tempSocketErr);
 | 
			
		||||
                socket.removeListener('timeout', timeoutErr);
 | 
			
		||||
                socket.setTimeout(0);
 | 
			
		||||
 | 
			
		||||
                return callback(null, socket);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        socket.on('data', onSocketData);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    socket.setTimeout(httpProxyClient.timeout || 30 * 1000);
 | 
			
		||||
    socket.on('timeout', timeoutErr);
 | 
			
		||||
 | 
			
		||||
    socket.once('error', tempSocketErr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										72
									
								
								node_modules/nodemailer/lib/smtp-connection/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										72
									
								
								node_modules/nodemailer/lib/smtp-connection/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -14,6 +14,7 @@ const shared = require('../shared');
 | 
			
		||||
const CONNECTION_TIMEOUT = 2 * 60 * 1000; // how much to wait for the connection to be established
 | 
			
		||||
const SOCKET_TIMEOUT = 10 * 60 * 1000; // how much to wait for socket inactivity before disconnecting the client
 | 
			
		||||
const GREETING_TIMEOUT = 30 * 1000; // how much to wait after connection is established but SMTP greeting is not receieved
 | 
			
		||||
const DNS_TIMEOUT = 30 * 1000; // how much to wait for resolveHostname 
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Generates a SMTP connection object
 | 
			
		||||
@ -30,6 +31,7 @@ const GREETING_TIMEOUT = 30 * 1000; // how much to wait after connection is esta
 | 
			
		||||
 *  * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 10000)
 | 
			
		||||
 *  * **connectionTimeout** - how many milliseconds to wait for the connection to establish
 | 
			
		||||
 *  * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 1 hour)
 | 
			
		||||
 *  * **dnsTimeout** - Time to wait in ms for the DNS requests to be resolved (defaults to 30 seconds)
 | 
			
		||||
 *  * **lmtp** - if true, uses LMTP instead of SMTP protocol
 | 
			
		||||
 *  * **logger** - bunyan compatible logger interface
 | 
			
		||||
 *  * **debug** - if true pass SMTP traffic to the logger
 | 
			
		||||
@ -56,6 +58,8 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
        this.port = Number(this.options.port) || (this.secureConnection ? 465 : 587);
 | 
			
		||||
        this.host = this.options.host || 'localhost';
 | 
			
		||||
 | 
			
		||||
        this.allowInternalNetworkInterfaces = this.options.allowInternalNetworkInterfaces || false;
 | 
			
		||||
 | 
			
		||||
        if (typeof this.options.secure === 'undefined' && this.port === 465) {
 | 
			
		||||
            // if secure option is not set but port is 465, then default to secure
 | 
			
		||||
            this.secureConnection = true;
 | 
			
		||||
@ -217,7 +221,9 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
 | 
			
		||||
        let opts = {
 | 
			
		||||
            port: this.port,
 | 
			
		||||
            host: this.host
 | 
			
		||||
            host: this.host,
 | 
			
		||||
            allowInternalNetworkInterfaces: this.allowInternalNetworkInterfaces,
 | 
			
		||||
            timeout: this.options.dnsTimeout || DNS_TIMEOUT
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (this.options.localAddress) {
 | 
			
		||||
@ -261,12 +267,12 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
                        tnx: 'dns',
 | 
			
		||||
                        source: opts.host,
 | 
			
		||||
                        resolved: resolved.host,
 | 
			
		||||
                        cached: !!resolved._cached
 | 
			
		||||
                        cached: !!resolved.cached
 | 
			
		||||
                    },
 | 
			
		||||
                    'Resolved %s as %s [cache %s]',
 | 
			
		||||
                    opts.host,
 | 
			
		||||
                    resolved.host,
 | 
			
		||||
                    resolved._cached ? 'hit' : 'miss'
 | 
			
		||||
                    resolved.cached ? 'hit' : 'miss'
 | 
			
		||||
                );
 | 
			
		||||
                Object.keys(resolved).forEach(key => {
 | 
			
		||||
                    if (key.charAt(0) !== '_' && resolved[key]) {
 | 
			
		||||
@ -299,12 +305,12 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
                        tnx: 'dns',
 | 
			
		||||
                        source: opts.host,
 | 
			
		||||
                        resolved: resolved.host,
 | 
			
		||||
                        cached: !!resolved._cached
 | 
			
		||||
                        cached: !!resolved.cached
 | 
			
		||||
                    },
 | 
			
		||||
                    'Resolved %s as %s [cache %s]',
 | 
			
		||||
                    opts.host,
 | 
			
		||||
                    resolved.host,
 | 
			
		||||
                    resolved._cached ? 'hit' : 'miss'
 | 
			
		||||
                    resolved.cached ? 'hit' : 'miss'
 | 
			
		||||
                );
 | 
			
		||||
                Object.keys(resolved).forEach(key => {
 | 
			
		||||
                    if (key.charAt(0) !== '_' && resolved[key]) {
 | 
			
		||||
@ -332,12 +338,12 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
                        tnx: 'dns',
 | 
			
		||||
                        source: opts.host,
 | 
			
		||||
                        resolved: resolved.host,
 | 
			
		||||
                        cached: !!resolved._cached
 | 
			
		||||
                        cached: !!resolved.cached
 | 
			
		||||
                    },
 | 
			
		||||
                    'Resolved %s as %s [cache %s]',
 | 
			
		||||
                    opts.host,
 | 
			
		||||
                    resolved.host,
 | 
			
		||||
                    resolved._cached ? 'hit' : 'miss'
 | 
			
		||||
                    resolved.cached ? 'hit' : 'miss'
 | 
			
		||||
                );
 | 
			
		||||
                Object.keys(resolved).forEach(key => {
 | 
			
		||||
                    if (key.charAt(0) !== '_' && resolved[key]) {
 | 
			
		||||
@ -548,6 +554,16 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
                                '\u0000' +
 | 
			
		||||
                                this._auth.credentials.pass,
 | 
			
		||||
                            'utf-8'
 | 
			
		||||
                        ).toString('base64'),
 | 
			
		||||
                    // log entry without passwords
 | 
			
		||||
                    'AUTH PLAIN ' +
 | 
			
		||||
                        Buffer.from(
 | 
			
		||||
                            //this._auth.user+'\u0000'+
 | 
			
		||||
                            '\u0000' + // skip authorization identity as it causes problems with some servers
 | 
			
		||||
                                this._auth.credentials.user +
 | 
			
		||||
                                '\u0000' +
 | 
			
		||||
                                '/* secret */',
 | 
			
		||||
                            'utf-8'
 | 
			
		||||
                        ).toString('base64')
 | 
			
		||||
                );
 | 
			
		||||
                return;
 | 
			
		||||
@ -945,8 +961,9 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
     * Send a command to the server, append \r\n
 | 
			
		||||
     *
 | 
			
		||||
     * @param {String} str String to be sent to the server
 | 
			
		||||
     * @param {String} logStr Optional string to be used for logging instead of the actual string
 | 
			
		||||
     */
 | 
			
		||||
    _sendCommand(str) {
 | 
			
		||||
    _sendCommand(str, logStr) {
 | 
			
		||||
        if (this._destroyed) {
 | 
			
		||||
            // Connection already closed, can't send any more data
 | 
			
		||||
            return;
 | 
			
		||||
@ -961,7 +978,7 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
                {
 | 
			
		||||
                    tnx: 'client'
 | 
			
		||||
                },
 | 
			
		||||
                (str || '').toString().replace(/\r?\n$/, '')
 | 
			
		||||
                (logStr || str || '').toString().replace(/\r?\n$/, '')
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1097,7 +1114,7 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
            notify = notify.join(',');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let orcpt = (params.orcpt || params.recipient || '').toString() || null;
 | 
			
		||||
        let orcpt = (params.recipient || params.orcpt || '').toString() || null;
 | 
			
		||||
        if (orcpt && orcpt.indexOf(';') < 0) {
 | 
			
		||||
            orcpt = 'rfc822;' + orcpt;
 | 
			
		||||
        }
 | 
			
		||||
@ -1420,18 +1437,21 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
 | 
			
		||||
        // Decode from base64
 | 
			
		||||
        let base64decoded = Buffer.from(challengeString, 'base64').toString('ascii'),
 | 
			
		||||
            hmac_md5 = crypto.createHmac('md5', this._auth.credentials.pass);
 | 
			
		||||
            hmacMD5 = crypto.createHmac('md5', this._auth.credentials.pass);
 | 
			
		||||
 | 
			
		||||
        hmac_md5.update(base64decoded);
 | 
			
		||||
        hmacMD5.update(base64decoded);
 | 
			
		||||
 | 
			
		||||
        let hex_hmac = hmac_md5.digest('hex');
 | 
			
		||||
        let prepended = this._auth.credentials.user + ' ' + hex_hmac;
 | 
			
		||||
        let prepended = this._auth.credentials.user + ' ' + hmacMD5.digest('hex');
 | 
			
		||||
 | 
			
		||||
        this._responseActions.push(str => {
 | 
			
		||||
            this._actionAUTH_CRAM_MD5_PASS(str, callback);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this._sendCommand(Buffer.from(prepended).toString('base64'));
 | 
			
		||||
        this._sendCommand(
 | 
			
		||||
            Buffer.from(prepended).toString('base64'),
 | 
			
		||||
            // hidden hash for logs
 | 
			
		||||
            Buffer.from(this._auth.credentials.user + ' /* secret */').toString('base64')
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -1476,7 +1496,11 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
            this._actionAUTHComplete(str, callback);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        this._sendCommand(Buffer.from(this._auth.credentials.pass + '', 'utf-8').toString('base64'));
 | 
			
		||||
        this._sendCommand(
 | 
			
		||||
            Buffer.from((this._auth.credentials.pass || '').toString(), 'utf-8').toString('base64'),
 | 
			
		||||
            // Hidden pass for logs
 | 
			
		||||
            Buffer.from('/* secret */', 'utf-8').toString('base64')
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -1706,7 +1730,11 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
            this._responseActions.push(str => {
 | 
			
		||||
                this._actionAUTHComplete(str, isRetry, callback);
 | 
			
		||||
            });
 | 
			
		||||
            this._sendCommand('AUTH XOAUTH2 ' + this._auth.oauth2.buildXOAuth2Token(accessToken));
 | 
			
		||||
            this._sendCommand(
 | 
			
		||||
                'AUTH XOAUTH2 ' + this._auth.oauth2.buildXOAuth2Token(accessToken),
 | 
			
		||||
                //  Hidden for logs
 | 
			
		||||
                'AUTH XOAUTH2 ' + this._auth.oauth2.buildXOAuth2Token('/* secret */')
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1733,10 +1761,16 @@ class SMTPConnection extends EventEmitter {
 | 
			
		||||
 | 
			
		||||
    _getHostname() {
 | 
			
		||||
        // defaul hostname is machine hostname or [IP]
 | 
			
		||||
        let defaultHostname = os.hostname() || '';
 | 
			
		||||
        let defaultHostname;
 | 
			
		||||
        try {
 | 
			
		||||
            defaultHostname = os.hostname() || '';
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            // fails on windows 7
 | 
			
		||||
            defaultHostname = 'localhost';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // ignore if not FQDN
 | 
			
		||||
        if (defaultHostname.indexOf('.') < 0) {
 | 
			
		||||
        if (!defaultHostname || defaultHostname.indexOf('.') < 0) {
 | 
			
		||||
            defaultHostname = '[127.0.0.1]';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user