From 4db066a8571703c89a4c148c6a2ab1cd8f3423ac Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Thu, 1 Apr 2021 18:55:25 +0000
Subject: [PATCH] Modify integration to create E2E connection in rekey like the
 E2E test, then update golds to match.

---
 basice2e/clients.goldoutput/client100.txt |  3 ++-
 basice2e/clients.goldoutput/client101.txt |  1 +
 basice2e/clients.goldoutput/client31.txt  |  2 +-
 basice2e/clients.goldoutput/client42.txt  |  2 +-
 basice2e/run.sh                           | 18 +++++++++++++++++-
 5 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/basice2e/clients.goldoutput/client100.txt b/basice2e/clients.goldoutput/client100.txt
index 04f0f26..54c6714 100644
--- a/basice2e/clients.goldoutput/client100.txt
+++ b/basice2e/clients.goldoutput/client100.txt
@@ -1,6 +1,7 @@
 Sent: Hello from Jake100 to myself, without E2E Encryption
 Message received: Hello from Jake100 to myself, without E2E Encryption
 Received 1
+Received 0
 
 Sent: Hello from Jake100, with E2E Encryption
 Sent: Hello from Jake100, with E2E Encryption
@@ -22,7 +23,7 @@ Sent: Hello from Jake100, with E2E Encryption
 Sent: Hello from Jake100, with E2E Encryption
 Sent: Hello from Jake100, with E2E Encryption
 Sent: Hello from Jake100, with E2E Encryption
-Message received: Hello from Jake100 to myself, without E2E Encryption
+Message received: Hello from Niamh101, with E2E Encryption
 Message received: Hello from Niamh101, with E2E Encryption
 Message received: Hello from Niamh101, with E2E Encryption
 Message received: Hello from Niamh101, with E2E Encryption
diff --git a/basice2e/clients.goldoutput/client101.txt b/basice2e/clients.goldoutput/client101.txt
index 5d4fef8..1d41f2f 100644
--- a/basice2e/clients.goldoutput/client101.txt
+++ b/basice2e/clients.goldoutput/client101.txt
@@ -1,6 +1,7 @@
 WARNING: unsafe channel creation enabled
 Adding 
 Received 0
+Received 0
 Sent: Hello from Niamh101, with E2E Encryption
 Sent: Hello from Niamh101, with E2E Encryption
 Sent: Hello from Niamh101, with E2E Encryption
diff --git a/basice2e/clients.goldoutput/client31.txt b/basice2e/clients.goldoutput/client31.txt
index 3e36473..6fd6367 100644
--- a/basice2e/clients.goldoutput/client31.txt
+++ b/basice2e/clients.goldoutput/client31.txt
@@ -1,5 +1,5 @@
-
 Received 0
+
 Sent: Hello from Josh31, with E2E Encryption
 Sent: Hello from Josh31, with E2E Encryption
 Sent: Hello from Josh31, with E2E Encryption
diff --git a/basice2e/clients.goldoutput/client42.txt b/basice2e/clients.goldoutput/client42.txt
index f3aacc0..841d03c 100644
--- a/basice2e/clients.goldoutput/client42.txt
+++ b/basice2e/clients.goldoutput/client42.txt
@@ -1,8 +1,8 @@
 Sent: Hello from Rick42 to myself, without E2E Encryption
 Message received: Hello from Rick42 to myself, without E2E Encryption
 Received 1
-
 Received 0
+
 Sent: Hello from Rick42, with E2E Encryption
 Sent: Hello from Rick42, with E2E Encryption
 Sent: Hello from Rick42, with E2E Encryption
diff --git a/basice2e/run.sh b/basice2e/run.sh
index d4c99bf..d66e89a 100755
--- a/basice2e/run.sh
+++ b/basice2e/run.sh
@@ -328,7 +328,7 @@ eval $CLIENTCMD >> $CLIENTOUT/client100.txt || true &
 PIDVAL=$!
 echo "$CLIENTCMD -- $PIDVAL"
 wait $PIDVAL
-CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS $REKEYOPTS -l $CLIENTOUT/client101.log -s blob101 --writeContact $CLIENTOUT/Niamh101-contact.bin --destfile $CLIENTOUT/Jake100-contact.bin --sendCount 0 --receiveCount 0 -m \"Hello from Niamh101, with E2E Encryption\""
+CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS $REKEYOPTS -l $CLIENTOUT/client101.log -s blob101 --writeContact $CLIENTOUT/Niamh101-contact.bin --destfile $CLIENTOUT/Jake100-contact.bin --sendCount 0 --receiveCount 0"
 eval $CLIENTCMD >> $CLIENTOUT/client101.txt || true &
 PIDVAL2=$!
 echo "$CLIENTCMD -- $PIDVAL"
@@ -340,6 +340,22 @@ TMPID=$(cat $CLIENTOUT/client101.log | grep "User\:" | awk -F' ' '{print $5}')
 NIAMHID=${TMPID}
 echo "NIAMH ID: $NIAMHID"
 
+# Client 100 will now wait for client 101's E2E Auth channel request and not do
+# anything else.
+CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client100.log -s blob100 --destid b64:$NIAMHID --sendCount 0 --receiveCount 0 --unsafe"
+eval $CLIENTCMD >> $CLIENTOUT/client100.txt || true &
+PIDVAL=$!
+echo "$CLIENTCMD -- $PIDVAL"
+wait $PIDVAL
+
+# Client 101 will now wait for the confirmation.
+CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client101.log -s blob101 --destid b64:$JAKEID --sendCount 0 --receiveCount 0 --unsafe"
+eval $CLIENTCMD >> $CLIENTOUT/client101.txt || true &
+PIDVAL=$!
+echo "$CLIENTCMD -- $PIDVAL"
+wait $PIDVAL
+
+
 echo "RUNNING REKEY TEST..."
 # Test destid syntax too, note wait for 11 messages to catch the message from above ^^^
 CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS $REKEYOPTS -l $CLIENTOUT/client100.log -s blob100 --destid b64:$NIAMHID --sendCount 20 --receiveCount 20 -m \"Hello from Jake100, with E2E Encryption\""
-- 
GitLab