Skip to content
Browse files

Added use strict to all code

  • Loading branch information...
1 parent e02ead2 commit 84ac8fbf689b588735a4b586eb1e0446a98e2e10 @baudehlo baudehlo committed
Showing with 24 additions and 39 deletions.
  1. +1 −0 address.js
  2. +1 −0 config.js
  3. +3 −0 configfile.js
  4. +1 −0 connection.js
  5. +1 −0 constants.js
  6. +1 −0 dsn.js
  7. +2 −0 haraka.js
  8. +1 −0 line_socket.js
  9. +1 −0 logger.js
  10. +1 −0 mailbody.js
  11. +1 −0 mailheader.js
  12. +2 −1 outbound.js
  13. +3 −38 plugins.js
  14. +1 −0 rfc1869.js
  15. +1 −0 server.js
  16. +1 −0 tls_socket.js
  17. +1 −0 transaction.js
  18. +1 −0 utils.js
View
1 address.js
@@ -1,3 +1,4 @@
+"use strict";
// a class encapsulating an email address as per RFC-2821
var logger = require('./logger');
View
1 config.js
@@ -1,3 +1,4 @@
+"use strict";
var configloader = require('./configfile');
var path = require('path');
var logger = require('./logger');
View
3 configfile.js
@@ -1,3 +1,4 @@
+"use strict";
// Config file loader
var fs = require('fs');
@@ -53,6 +54,8 @@ cfreader.empty_config = function(type) {
cfreader.load_config = function(name, type) {
+ var result;
+
if (type === 'ini' || /\.ini$/.test(name)) {
result = cfreader.load_ini_config(name);
}
View
1 connection.js
@@ -1,3 +1,4 @@
+"use strict";
// a single connection
var path = require('path');
var config = require('./config');
View
1 constants.js
@@ -1,3 +1,4 @@
+"use strict";
// Constants
exports.cont = 900;
View
1 dsn.js
@@ -1,3 +1,4 @@
+"use strict";
// RFC 3463 Enhanced Status Codes
var enum_status_codes = [
[ // X.0.XXX Other or Undefined Status (unspecified)
View
2 haraka.js
@@ -1,5 +1,7 @@
#!/usr/bin/env node
+"use strict";
+
var path = require('path');
// this must be set before "server.js" is loaded
View
1 line_socket.js
@@ -1,3 +1,4 @@
+"use strict";
// A subclass of Socket which reads data by line
var net = require('net');
View
1 logger.js
@@ -1,3 +1,4 @@
+"use strict";
// Log class
var config = require('./config');
View
1 mailbody.js
@@ -1,3 +1,4 @@
+"use strict";
// Mail Body Parser
var logger = require('./logger');
var Header = require('./mailheader').Header;
View
1 mailheader.js
@@ -1,3 +1,4 @@
+"use strict";
// An RFC 2822 email header parser
var logger = require('./logger');
View
3 outbound.js
@@ -1,3 +1,4 @@
+"use strict";
var fs = require('fs');
var path = require('path');
var dns = require('dns');
@@ -47,7 +48,7 @@ exports.load_queue = function () {
if (!path.existsSync(queue_dir)) {
this.logdebug("Creating queue directory " + queue_dir);
try {
- fs.mkdirSync(queue_dir, 0755 );
+ fs.mkdirSync(queue_dir, 493); // 493 == 0755
}
catch (err) {
if (err.code != 'EEXIST') {
View
41 plugins.js
@@ -1,3 +1,4 @@
+"use strict";
// load all defined plugins
var logger = require('./logger');
@@ -12,42 +13,6 @@ var util = require('util');
var plugin_paths = [path.join(__dirname, './plugins')];
if (process.env.HARAKA) { plugin_paths.unshift(path.join(process.env.HARAKA, 'plugins')); }
-// These are the hooks that qpsmtpd implements - I should get around
-// to supporting them all some day... :-/
-var regular_hooks = {
- 'connect':1,
- 'pre-connection': 1,
- 'connect': 1,
- 'ehlo_parse': 1,
- 'ehlo': 1,
- 'helo_parse': 1,
- 'helo': 1,
- 'auth_parse': 1,
- 'auth': 1,
- 'auth-plain': 1,
- 'auth-login': 1,
- 'auth-cram-md5': 1,
- 'rcpt_parse': 1,
- 'rcpt_pre': 1,
- 'rcpt': 1,
- 'mail_parse': 1,
- 'mail': 1,
- 'mail_pre': 1,
- 'data': 1,
- 'data_headers_end': 1,
- 'data_post': 1,
- 'queue_pre': 1,
- 'queue': 1,
- 'queue_post': 1,
- 'vrfy': 1,
- 'noop': 1,
- 'quit': 1,
- 'reset_transaction': 1,
- 'disconnect': 1,
- 'unrecognized_command': 1,
- 'help': 1
-};
-
function Plugin(name) {
this.name = name;
this.timeout = config.get(name + '.timeout');
@@ -149,7 +114,7 @@ plugins._load_and_compile_plugin = function(name) {
}
throw "Loading plugin " + name + " failed: " + last_err;
}
- var code = rf;
+ var code = '"use strict";' + rf;
var sandbox = {
require: require,
__filename: fp[i],
@@ -197,7 +162,7 @@ plugins.run_hooks = function (hook, object, params) {
if (hook != 'log')
object.logdebug("running " + hook + " hooks");
- if (regular_hooks[hook] && object.hooks_to_run.length) {
+ if (hook != 'deny' && hook != 'log' && object.hooks_to_run.length) {
throw new Error("We are already running hooks! Fatal error!");
}
View
1 rfc1869.js
@@ -1,3 +1,4 @@
+"use strict";
// RFC 1869 command parser
// 6. MAIL FROM and RCPT TO Parameters
View
1 server.js
@@ -1,3 +1,4 @@
+"use strict";
// smtp network server
var net = require('./tls_socket');
View
1 tls_socket.js
@@ -1,3 +1,4 @@
+"use strict";
/*----------------------------------------------------------------------------------------------*/
/* Obtained and modified from http://js.5sh.net/starttls.js on 8/18/2011. */
/*----------------------------------------------------------------------------------------------*/
View
1 transaction.js
@@ -1,3 +1,4 @@
+"use strict";
// An SMTP Transaction
var config = require('./config');
View
1 utils.js
@@ -1,3 +1,4 @@
+"use strict";
// Various utility functions
// copied from http://www.broofa.com/Tools/Math.uuid.js

0 comments on commit 84ac8fb

Please sign in to comment.
Something went wrong with that request. Please try again.