From 1f4ee1b5e08e114ff57487fc4a63eb75dd4a36d0 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 13 Mar 2018 22:13:27 +0000
Subject: [PATCH] More detailed log output in inbound_auth_cb() to help debug
 why inbound Mystic sessions are failing (e.g. with Al@TRMB's BinkIt mailer).

---
 exec/binkit.js | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/exec/binkit.js b/exec/binkit.js
index 284fcb593e..bec5adaf23 100644
--- a/exec/binkit.js
+++ b/exec/binkit.js
@@ -13,7 +13,7 @@
  *    zone.  That is, if the default zone is zone 1, and the outbound
  *    is "/path/to/outbound", it will not correctly handle the case
  *    where there is a "/path/to/outbound.001" directory.
- * 
+ *
  * See FTS-5005 for details.
  */
 
@@ -115,7 +115,7 @@ function outbound_root(addr, scfg)
 /*
  * Given a list of addresses to rescan, calls
  * bp.addFile() for any pending file transfers.
- * 
+ *
  * TODO: Call this after sending a M_EOB to rescan per FSP-1024?  We
  * 		 hold the lock files, so nothing should be changing the flow
  * 		 files (per FTS-5005) though.  This is mostly for REQ handling,
@@ -397,7 +397,7 @@ function callout_want_callback(fobj, fsize, fdate, offset, bp)
 	 * Likely we'll want magical handling for control files (*.TIC,
 	 * *.REQ, and *.PKT, Bundle Files, and the default handling for the
 	 * rest.
-	 * 
+	 *
 	 * We should lower-case incoming filenames here too...
 	 *
 	 * Also, for partial files, we can cancel the remote and do an M_GET resume.
@@ -828,21 +828,27 @@ function inbound_auth_cb(pwd, bp)
 				cpw = '-';
 			if (pwd[0].substr(0, 9) === 'CRAM-MD5-') {
 				if (bp.getCRAM('MD5', cpw) === pwd[0]) {
+					log(LOG_INFO, "CRAM-MD5 password match for " + addr);
 					addrs.push(addr);
 					check_nocrypt(bp.cb_data.binkitcfg.node[addr]);
 					ret = cpw;
 				} else {
-					log(LOG_WARNING, "CRAM-MD5 of password does not match");
+					log(LOG_WARNING, "CRAM-MD5 password mismatch for " + addr);
 					ret = false;	// How do we break out of this forEach loop?!?
 				}
 			}
 			else {
 				// TODO: Deal with arrays of passwords?
-				if (bp.cb_data.binkitcfg.node[addr].nomd5 === false && bp.cb_data.binkitcfg.node[addr].pass === pwd[0]) {
+				if (bp.cb_data.binkitcfg.node[addr].nomd5)
+					log(LOG_WARNING, "CRAM-MD5 required (and not provided) by " + addr);
+				else if (bp.cb_data.binkitcfg.node[addr].pass === pwd[0]) {
+					log(LOG_INFO, "Plain-text password match for " + addr);
 					addrs.push(addr);
 					check_nocrypt(bp.cb_data.binkitcfg.node[addr]);
 					ret = cpw;
 				}
+				else
+					log(LOG_WARNING, "Plain-text password mismatch for " + addr);
 			}
 		}
 		else
-- 
GitLab