Intial Commit

This commit is contained in:
valki
2020-10-17 18:42:50 +02:00
commit 664c6d8ca3
5892 changed files with 759183 additions and 0 deletions

153
nodered/rootfs/data/node_modules/poplib/tests/apop.js generated vendored Normal file
View File

@@ -0,0 +1,153 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --login [on/off] --download [on/off]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
var login = argv.login === "on" ? true : false;
var download = argv.download === "on" ? true : false;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
var client = new POP3Client(port, host, { debug: (argv.debug === "on" ? true: false) });
client.on("error", function(err) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
if (login) client.apop(username, password);
else client.quit();
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state, failed. You tried calling " + cmd);
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet, failed. You tried calling " + cmd);
});
client.on("apop", function(status, rawdata) {
if (status) {
console.log("APOP success");
if (download) client.list();
else client.quit();
} else {
console.log("APOP failed because " + rawdata);
client.quit();
}
});
client.on("list", function(status, msgcount, msgnumber, data, rawdata) {
if (status === false) {
console.log("LIST failed because " + rawdata);
client.quit();
} else if (msgcount > 0) {
totalmsgcount = msgcount;
currentmsg = 1;
console.log("LIST success with " + msgcount + " message(s)");
client.retr(1);
} else {
console.log("LIST success with 0 message(s)");
client.quit();
}
});
client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success " + msgnumber + " with data " + data);
client.dele(msgnumber);
} else {
console.log("RETR failed for msgnumber " + msgnumber + " because " + rawdata);
client.quit();
}
});
client.on("dele", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("DELE success for msgnumber " + msgnumber);
if (currentmsg < totalmsgcount) {
currentmsg += 1;
client.retr(currentmsg);
} else client.quit();
} else {
console.log("DELE failed for msgnumber " + msgnumber);
client.quit();
}
});
client.on("quit", function(status, rawdata) {
if (status === true) console.log("QUIT success");
else console.log("QUIT failed because " + rawdata);
});

45
nodered/rootfs/data/node_modules/poplib/tests/apop.sh generated vendored Normal file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "apop.js"
RANDOMID=$RANDOM
print_test "Sending test message (str: $RANDOMID)"
OUTPUT=`./sendmail.sh 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Correct auth"
OUTPUT=`node apop.js --username $USER --password $PASS --host $HOST --port $PORT --login on`;
print_result 0 $OUTPUT
print_test "Invalid auth"
OUTPUT=`node apop.js --username $USER --password ${PASS}a --host $HOST --port $PORT --login on`;
print_result 1 $OUTPUT
print_test "Login and message download"
OUTPUT=`node apop.js --username $USER --password $PASS --host $HOST --port $PORT --login on --download on`
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT

197
nodered/rootfs/data/node_modules/poplib/tests/basic.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --download [on/off] --dele [on/off] --rset [on/off]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
var dele = argv.dele === "on" ? true : false;
var rset = argv.rset === "on" ? true : false;
var download = argv.download === "on" ? true : false;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
var client = new POP3Client(port, host, {
debug: (argv.networkdebug === "on" ? true: false)
});
client.on("error", function(err) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
client.login(username, password);
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state, failed. You tried calling " + cmd);
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet, failed. You tried calling " + cmd);
});
client.on("login", function(status, data, rawdata) {
if (status) {
console.log("LOGIN/PASS success");
if (download || dele) client.list();
else client.capa();
} else {
console.log("LOGIN/PASS failed because " + rawdata);
client.quit();
}
});
client.on("capa", function(status, data, rawdata) {
if (download) client.list();
else client.quit();
});
client.on("rset", function(status,rawdata) {
if (status) {
console.log("RSET success");
rset=false;
currentmsg=1;
client.retr(1);
} else {
console.log("RSET failed because " + rawdata);
client.quit();
}
});
client.on("list", function(status, msgcount, msgnumber, data, rawdata) {
if (status === false) {
console.log("LIST failed");
client.quit();
} else if (msgcount > 0) {
totalmsgcount = msgcount;
currentmsg = 1;
console.log("LIST success with " + msgcount + " message(s)");
if (download) client.retr(1);
else if (dele) client.dele(1);
else client.quit();
} else {
console.log("LIST success with 0 message(s)");
client.quit();
}
});
client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success " + msgnumber + " with data " + data);
if (dele) client.dele(msgnumber);
else {
if (currentmsg < totalmsgcount) {
currentmsg += 1;
client.retr(currentmsg);
} else client.quit();
}
} else {
console.log("RETR failed for msgnumber " + msgnumber + " because " + rawdata);
client.quit();
}
});
client.on("dele", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("DELE success for msgnumber " + msgnumber);
if (currentmsg < totalmsgcount) {
currentmsg += 1;
if (!rset && download) client.retr(currentmsg);
else client.dele(currentmsg);
} else if (rset) client.rset()
else client.quit();
} else {
console.log("DELE failed for msgnumber " + msgnumber);
client.quit();
}
});
client.on("quit", function(status, rawdata) {
if (status === true) console.log("QUIT success");
else console.log("QUIT failed");
});

81
nodered/rootfs/data/node_modules/poplib/tests/basic.sh generated vendored Normal file
View File

@@ -0,0 +1,81 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "basic.js"
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Sleeping 5 seconds"
OUTPUT=`sleep 5`
print_result 0 $OUTPUT
print_test "CAPA test"
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT`;
print_result 0 $OUTPUT
print_test "RETR test"
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --download on`;
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT
print_test "RETR, DELE test"
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --download on --dele on`;
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --download on`;
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 0 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Sleeping 5 seconds"
OUTPUT=`sleep 5`
print_result 0 $OUTPUT
print_test "DELE test"
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --dele on`;
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --download on`;
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 0 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Sleeping 5 seconds"
OUTPUT=`sleep 5`
print_result 0 $OUTPUT
print_test "DELE, RSET, RETR test"
OUTPUT=`node basic.js --username $USER --password $PASS --host $HOST --port $PORT --dele on --rset on --download on`;
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT

84
nodered/rootfs/data/node_modules/poplib/tests/login.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
var filename = argv.filename;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
var client = new POP3Client(port, host, { debug: (argv.debug === "on" ? true: false) });
client.on("error", function(err) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
client.login(username, password);
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state, failed. You tried calling " + cmd);
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet, failed. You tried calling " + cmd);
});
client.on("login", function(status, rawdata) {
if (status) console.log("LOGIN success");
else console.log("LOGIN failed because " + rawdata);
client.quit();
});
client.on("quit", function(status, rawdata) {
if (status === true) console.log("QUIT success");
else console.log("QUIT failed because " + rawdata);
});

47
nodered/rootfs/data/node_modules/poplib/tests/login.sh generated vendored Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "login.js"
print_test "Correct auth"
OUTPUT=`node login.js --username $USER --password $PASS --host $HOST --port $PORT`;
print_result 0 $OUTPUT
print_test "Invalid auth"
OUTPUT=`node login.js --username $USER --password ${PASS}a --host $HOST --port $PORT`
print_result 1 $OUTPUT
print_test "Correct host"
OUTPUT=`node login.js --username $USER --password $PASS --host $HOST --port $PORT`;
print_result 0 $OUTPUT
print_test "Invalid host"
OUTPUT=`node login.js --username $USER --password $PASS --host ${HOST}a --port $PORT`
print_result 1 $OUTPUT
print_test "Correct port"
OUTPUT=`node login.js --username $USER --password $PASS --host $HOST --port $PORT`;
print_result 0 $OUTPUT
print_test "Invalid port"
OUTPUT=`node login.js --username $USER --password $PASS --host $HOST --port ${PORT}1`
print_result 1 $OUTPUT

100
nodered/rootfs/data/node_modules/poplib/tests/runner.sh generated vendored Executable file
View File

@@ -0,0 +1,100 @@
#!/bin/sh
# Test runner
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title() {
echo -e "\033[1;30mTesting ${1}\033[0;30m";
}
print_test() {
printf "%-60s" "$1";
}
print_result() {
echo $* | grep -q "fail"
# $1: 0 is expecting no failure, 1 is expecting failure
if [ $? -eq $1 ]; then
FAILCOUNT=`expr $FAILCOUNT + 1`
echo -e " [\033[1;31mFAIL\033[0;30m]";
else
PASSCOUNT=`expr $PASSCOUNT + 1`
echo -e " [\033[1;32mPASS\033[0;30m]";
fi
}
echo "runner.sh v0.1 - a test runner utility"
echo "Copyright (c) 2011 Ditesh Shashikant Gathani <ditesh@gathani.org>"
if [ $# -lt 6 ]; then
echo "Usage:"
echo " runner.sh username password host standard-port tls-port testemail@example.com [test]"
echo
echo " username: POP3 username"
echo " password: POP3 password"
echo " host: POP3 host"
echo " standard-port: POP3 port (eg 110)"
echo " tls-port: POP3 TLS port (eg 995)"
echo " email: valid email address on POP3 server which can receive emails"
echo " test: which test to run (default all)"
echo
exit 1
fi
USER=$1
PASS=$2
HOST=$3
PORT=$4
TLSPORT=$5
EMAIL=$6
FAILCOUNT=0
PASSCOUNT=0
if [ $# -eq 7 ]; then
echo
source ./$7
else
echo
source ./login.sh
echo
source ./basic.sh
echo
source ./apop.sh
echo
source ./stls.sh
echo
source ./tls.sh
fi
echo
echo -e "\033[1;30mSummary:"
echo -e " \033[1;32mPassed tests: ${PASSCOUNT}\033[0;30m"
echo -e " \033[1;31mFailed tests: ${FAILCOUNT}\033[0;30m"
echo

177
nodered/rootfs/data/node_modules/poplib/tests/sasl.js generated vendored Normal file
View File

@@ -0,0 +1,177 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --auth [plain/cram-md5] --tls [on/off] --download [on/off]")
.demand(['username', 'password', 'auth'])
.describe('auth', 'Valid AUTH types: plain, cram-md5')
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
var tls = argv.tls === "on" ? true : false;
var auth = argv.auth;
var download = argv.download === "on" ? true : false;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
// We carefully ignore self signed cert errors (bad practice!)
var client = new POP3Client(port, host, {
enabletls: tls,
ignoretlserrs: true,
debug: (argv.networkdebug === "on" ? true: false)
});
client.on("tls-error", function(err) {
console.log("TLS error occurred, failed");
console.log(err);
});
client.on("close", function() {
console.log("close event unexpectedly received, failed");
});
client.on("error", function(err) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
client.auth(auth, username, password);
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state. You tried calling " + cmd);
client.quit();
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet. You tried calling " + cmd);
client.quit();
});
client.on("auth", function(status, errmsg, rawdata) {
if (status) {
console.log("AUTH success");
if (download) client.list();
else client.quit();
} else {
console.log("AUTH failed (" + errmsg + ")");
client.quit();
}
});
client.on("list", function(status, msgcount, msgnumber, data, rawdata) {
if (status === false) {
console.log("LIST failed");
client.quit();
} else if (msgcount > 0) {
totalmsgcount = msgcount;
currentmsg = 1;
console.log("LIST success with " + msgcount + " message(s)");
client.retr(1);
} else {
console.log("LIST success with 0 message(s)");
client.quit();
}
});
client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success " + msgnumber + " with data " + data);
client.dele(msgnumber);
} else {
console.log("RETR failed for msgnumber " + msgnumber + " because " + rawdata);
client.quit();
}
});
client.on("dele", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("DELE success for msgnumber " + msgnumber);
if (currentmsg < totalmsgcount) {
currentmsg += 1;
client.retr(currentmsg);
} else client.quit();
} else {
console.log("DELE failed for msgnumber " + msgnumber);
client.quit();
}
});
client.on("quit", function(status, rawdata) {
client.removeAllListeners("close");
if (status === true) console.log("QUIT success");
else console.log("QUIT failed");
});

85
nodered/rootfs/data/node_modules/poplib/tests/sasl.sh generated vendored Normal file
View File

@@ -0,0 +1,85 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "sasl.js"
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Valid PLAIN login without TLS"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $PORT --auth plain`;
print_result 0 $OUTPUT
print_test "Valid CRAM-MD5 login without TLS"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $PORT --auth "cram-md5"`;
print_result 0 $OUTPUT
print_test "Invalid PLAIN login without TLS"
OUTPUT=`node sasl.js --username $USER --password ${PASS}a --host $HOST --port $PORT --auth plain`;
print_result 1 $OUTPUT
print_test "Invalid CRAM-MD5 login without TLS"
OUTPUT=`node sasl.js --username $USER --password ${PASS}a --host $HOST --port $PORT --auth "cram-md5"`;
print_result 1 $OUTPUT
print_test "Valid PLAIN login with TLS"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $TLSPORT --auth plain --tls on`;
print_result 0 $OUTPUT
print_test "Valid CRAM-MD5 login with TLS"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $TLSPORT --auth "cram-md5" --tls on`;
print_result 0 $OUTPUT
print_test "Invalid PLAIN login with TLS"
OUTPUT=`node sasl.js --username $USER --password ${PASS}a --host $HOST --port $TLSPORT --auth plain --tls on`;
print_result 1 $OUTPUT
print_test "Invalid CRAM-MD5 login with TLS"
OUTPUT=`node sasl.js --username $USER --password ${PASS}a --host $HOST --port $TLSPORT --auth "cram-md5" --tls on`;
print_result 1 $OUTPUT
print_test "PLAIN login and message download"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $PORT --auth plain --download on`
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT
print_test "Sending another test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Sleeping 5 seconds"
OUTPUT=`sleep 5`
print_result 0 $OUTPUT
print_test "CRAM-MD5 login and message download"
OUTPUT=`node sasl.js --username $USER --password $PASS --host $HOST --port $PORT --auth "cram-md5" --download on`
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT

60
nodered/rootfs/data/node_modules/poplib/tests/sendmail.sh generated vendored Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
# Email pumper helper script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
QUIET=0
if [ "$1" = "-q" ]; then
QUIET=1
shift
fi
if [ $QUIET -eq 0 ]; then
echo "sendmail.sh v0.1 - a utility to pump email into an SMTP server"
echo "Copyright (c) 2011 Ditesh Shashikant Gathani <ditesh@gathani.org>"
echo
fi
if [ $# -ne 4 ]; then
echo "Usage:"
echo " sendmail.sh [-q] [number of emails] [to] [subject] [body]"
exit 1
fi
if [ $QUIET -eq 0 ]; then
echo "Sending $1 email(s)"
echo " to: $2"
echo " subject: \"$3\""
echo " body: \"$4\""
echo
fi
for i in `seq 1 $1`; do
echo "$4" | mail -s "$3" "$2";
done

177
nodered/rootfs/data/node_modules/poplib/tests/stls.js generated vendored Normal file
View File

@@ -0,0 +1,177 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --login [on/off] --download [on/off]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
var login = argv.login === "on" ? true : false;
var download = argv.download === "on" ? true : false;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
var client = new POP3Client(port, host, {
ignoretlserrs: true,
debug: (argv.networkdebug === "on" ? true: false)
});
client.on("error", function(err, rawdata) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
client.stls();
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state, failed. You tried calling " + cmd);
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet, failed. You tried calling " + cmd);
});
client.on("stls", function(status, rawdata) {
if (status) {
console.log("STLS success");
if (login) client.login(username, password);
else client.quit();
} else {
console.log("STLS failed because " + rawdata);
client.quit();
}
});
client.on("login", function(status, data, rawdata) {
if (status) {
console.log("LOGIN/PASS success");
if (download) client.list();
else client.quit();
} else {
console.log("LOGIN/PASS failed because " + rawdata);
client.quit();
}
});
client.on("list", function(status, msgcount, msgnumber, data, rawdata) {
if (status === false) {
console.log("LIST failed because " + rawdata);
client.quit();
} else if (msgcount > 0) {
totalmsgcount = msgcount;
currentmsg = 1;
console.log("LIST success with " + msgcount + " message(s)");
client.retr(1);
} else {
console.log("LIST success with 0 message(s)");
client.quit();
}
});
client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success " + msgnumber + " with data " + data);
client.dele(msgnumber);
} else {
console.log("RETR failed for msgnumber " + msgnumber + " because " + rawdata);
client.quit();
}
});
client.on("dele", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("DELE success for msgnumber " + msgnumber);
if (currentmsg < totalmsgcount) {
currentmsg += 1;
client.retr(currentmsg);
} else client.quit();
} else {
console.log("DELE failed for msgnumber " + msgnumber);
client.quit();
}
});
client.on("quit", function(status, rawdata) {
if (status === true) console.log("QUIT success");
else console.log("QUIT failed");
});

45
nodered/rootfs/data/node_modules/poplib/tests/stls.sh generated vendored Normal file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "stls.js"
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "No login"
OUTPUT=`node stls.js --username $USER --password $PASS --host $HOST --port $PORT --login off`;
print_result 0 $OUTPUT
print_test "Login only"
OUTPUT=`node stls.js --username $USER --password $PASS --host $HOST --port $PORT --login on`;
print_result 0 $OUTPUT
print_test "Login and message download"
OUTPUT=`node stls.js --username $USER --password $PASS --host $HOST --port $PORT --login on --download on`
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT

173
nodered/rootfs/data/node_modules/poplib/tests/tls.js generated vendored Normal file
View File

@@ -0,0 +1,173 @@
/*
Node.js POP3 client test file
Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var POP3Client = require("../main.js");
var argv = require('optimist')
.usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --login [on/off] --download [on/off]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 995;
var debug = argv.debug === "on" ? true : false;
var login = argv.login === "on" ? true : false;
var download = argv.download === "on" ? true : false;
var username = argv.username;
var password = argv.password;
var totalmsgcount = 0;
var currentmsg = 0;
var client = new POP3Client(port, host, {
enabletls: true,
ignoretlserrs: true,
debug: (argv.networkdebug === "on" ? true: false)
});
client.on("tls-error", function(err) {
console.log("TLS error occurred, failed");
console.log(err);
});
client.on("close", function() {
console.log("close event unexpectedly received, failed");
});
client.on("error", function(err) {
console.log("Server error occurred, failed, " + err);
});
client.on("connect", function(status, rawdata) {
if (status) {
console.log("CONNECT success");
if (login) client.login(username, password);
else client.quit();
} else {
console.log("CONNECT failed because " + rawdata);
return;
}
});
client.on("invalid-state", function(cmd) {
console.log("Invalid state, failed. You tried calling " + cmd);
});
client.on("locked", function(cmd) {
console.log("Current command has not finished yet, failed. You tried calling " + cmd);
});
client.on("login", function(status, data, rawdata) {
if (status) {
console.log("LOGIN/PASS success");
if (download) client.list();
else client.quit();
} else {
console.log("LOGIN/PASS failed");
client.quit();
}
});
client.on("list", function(status, msgcount, msgnumber, data, rawdata) {
if (status === false) {
console.log("LIST failed");
client.quit();
} else if (msgcount > 0) {
totalmsgcount = msgcount;
currentmsg = 1;
console.log("LIST success with " + msgcount + " message(s)");
client.retr(1);
} else {
console.log("LIST success with 0 message(s)");
client.quit();
}
});
client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success " + msgnumber + " with data " + data);
client.dele(msgnumber);
} else {
console.log("RETR failed for msgnumber " + msgnumber + " because " + rawdata);
client.quit();
}
});
client.on("dele", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("DELE success for msgnumber " + msgnumber);
if (currentmsg < totalmsgcount) {
currentmsg += 1;
client.retr(currentmsg);
} else client.quit();
} else {
console.log("DELE failed for msgnumber " + msgnumber);
client.quit();
}
});
client.on("quit", function(status, rawdata) {
client.removeAllListeners("close");
if (status === true) console.log("QUIT success");
else console.log("QUIT failed");
});

49
nodered/rootfs/data/node_modules/poplib/tests/tls.sh generated vendored Normal file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# Test script
#
# Copyright (C) 2011 by Ditesh Shashikant Gathani <ditesh@gathani.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
print_title "tls.js"
RANDOMID=$RANDOM
print_test "Sending test message to $EMAIL (str: $RANDOMID)"
OUTPUT=`./sendmail.sh -q 1 $EMAIL "subject with $RANDOMID" "body with $RANDOMID"`
print_result 0 $OUTPUT
print_test "Wrong port"
OUTPUT=`node tls.js --username $USER --password $PASS --host $HOST --port $PORT --login off`;
print_result 1 $OUTPUT
print_test "No login"
OUTPUT=`node tls.js --username $USER --password $PASS --host $HOST --port $TLSPORT --login off`;
print_result 0 $OUTPUT
print_test "Login only"
OUTPUT=`node tls.js --username $USER --password $PASS --host $HOST --port $TLSPORT --login on`;
print_result 0 $OUTPUT
print_test "Login and message download"
OUTPUT=`node tls.js --username $USER --password $PASS --host $HOST --port $TLSPORT --login on --download on`
OUTPUT=`echo $OUTPUT | grep $RANDOMID`
if [ $? -eq 1 ]; then OUTPUT="fail"; fi
print_result 0 $OUTPUT