mirror of
https://github.com/curl/curl.git
synced 2024-12-15 06:40:09 +08:00
runtests: support dynamicly base64 encoded sections in tests
This allows us to make test cases to use base64 at run-time and still use and verify information determined at run-time, such as the IMAP test server's port number in test 842. This change makes 12 tests run again that basically never ran since we moved to dynamic port numbers. ftpserver.pl is adjusted to load test instructions and test number from the preprocessed test file. FILEFORMAT.md now documents the new base64 encoding syntax. Reported-by: Marcel Raad Fixes #5761 Closes #5775
This commit is contained in:
parent
ca222824f3
commit
424092e70f
@ -21,6 +21,25 @@ variables are substituted by the their respective contents and the output
|
|||||||
version of the test file is stored as `log/testNUM`. That version is what will
|
version of the test file is stored as `log/testNUM`. That version is what will
|
||||||
be read and used by the test servers.
|
be read and used by the test servers.
|
||||||
|
|
||||||
|
## Base64 Encoding
|
||||||
|
|
||||||
|
In the preprocess stage, a special instruction can be used to have runtests.pl
|
||||||
|
base64 encode a certain section and insert in the generated output file. This
|
||||||
|
is in particular good for test cases where the test tool is expected to pass
|
||||||
|
in base64 encoded content that might use dynamic information that is unique
|
||||||
|
for this particular test invocation, like the server port number.
|
||||||
|
|
||||||
|
To insert a base64 encoded string into the output, use this syntax:
|
||||||
|
|
||||||
|
%b64[ data to encode ]b64%
|
||||||
|
|
||||||
|
The data to encode can then use any of the existing variables mentioned below,
|
||||||
|
or even percent-encoded individual bytes. As an example, insert the HTTP
|
||||||
|
server's port number (in ASCII) followed by a space and the hexadecimal byte
|
||||||
|
9a:
|
||||||
|
|
||||||
|
%b64[%HTTPPORT %9a]b64%
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
|
||||||
When the test is preprocessed, a range of "variables" in the test file will be
|
When the test is preprocessed, a range of "variables" in the test file will be
|
||||||
|
@ -15,7 +15,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTHENTICATE +
|
REPLY AUTHENTICATE +
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== A002 OK AUTHENTICATE completed
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% A002 OK AUTHENTICATE completed
|
||||||
</servercmd>
|
</servercmd>
|
||||||
<data>
|
<data>
|
||||||
From: me@somewhere
|
From: me@somewhere
|
||||||
@ -42,9 +42,6 @@ IMAP OAuth 2.0 (OAUTHBEARER) authentication
|
|||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
# The protocol section doesn't support ways of specifying the raw data in the
|
||||||
# base64 encoded message so we must assert this
|
# base64 encoded message so we must assert this
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%IMAPPORT' ne '9003' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -53,7 +50,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
A001 CAPABILITY
|
A001 CAPABILITY
|
||||||
A002 AUTHENTICATE OAUTHBEARER
|
A002 AUTHENTICATE OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
A003 SELECT 842
|
A003 SELECT 842
|
||||||
A004 FETCH 1 BODY[]
|
A004 FETCH 1 BODY[]
|
||||||
A005 LOGOUT
|
A005 LOGOUT
|
||||||
|
@ -41,11 +41,6 @@ IMAP OAuth 2.0 (OAUTHBEARER) authentication with initial response
|
|||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/843/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
'imap://%HOSTIP:%IMAPPORT/843/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%IMAPPORT' ne '9003' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -53,7 +48,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
A001 CAPABILITY
|
A001 CAPABILITY
|
||||||
A002 AUTHENTICATE OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
A002 AUTHENTICATE OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
A003 SELECT 843
|
A003 SELECT 843
|
||||||
A004 FETCH 1 BODY[]
|
A004 FETCH 1 BODY[]
|
||||||
A005 LOGOUT
|
A005 LOGOUT
|
||||||
|
@ -15,9 +15,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTHENTICATE +
|
REPLY AUTHENTICATE +
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% A002 NO Authentication failed
|
||||||
eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxlX3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9uIn0=
|
|
||||||
REPLY AQ== A002 NO Authentication failed
|
|
||||||
</servercmd>
|
</servercmd>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
@ -33,11 +31,6 @@ IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation
|
|||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/844/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
'imap://%HOSTIP:%IMAPPORT/844/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%IMAPPORT' ne '9003' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -53,8 +46,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
A001 CAPABILITY
|
A001 CAPABILITY
|
||||||
A002 AUTHENTICATE OAUTHBEARER
|
A002 AUTHENTICATE OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -33,11 +33,6 @@ IMAP OAuth 2.0 (OAUTHBEARER) failure as continuation with initial response
|
|||||||
<command>
|
<command>
|
||||||
'imap://%HOSTIP:%IMAPPORT/845/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
'imap://%HOSTIP:%IMAPPORT/845/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%IMAPPORT' ne '9003' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -52,8 +47,8 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
# transfer and such a connection will not get a "LOGOUT"
|
# transfer and such a connection will not get a "LOGOUT"
|
||||||
<protocol>
|
<protocol>
|
||||||
A001 CAPABILITY
|
A001 CAPABILITY
|
||||||
A002 AUTHENTICATE OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
A002 AUTHENTICATE OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%IMAPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
%b64[%01]b64%
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -17,7 +17,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTH +
|
REPLY AUTH +
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +OK Login successful
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% +OK Login successful
|
||||||
</servercmd>
|
</servercmd>
|
||||||
<data>
|
<data>
|
||||||
From: me@somewhere
|
From: me@somewhere
|
||||||
@ -42,11 +42,6 @@ POP3 OAuth 2.0 (OAUTHBEARER) authentication
|
|||||||
<command>
|
<command>
|
||||||
pop3://%HOSTIP:%POP3PORT/887 -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
pop3://%HOSTIP:%POP3PORT/887 -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%POP3PORT' ne '9001' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -55,7 +50,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
CAPA
|
CAPA
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
RETR 887
|
RETR 887
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -42,11 +42,6 @@ POP3 OAuth 2.0 (OAUTHBEARER) authentication with initial response
|
|||||||
<command>
|
<command>
|
||||||
pop3://%HOSTIP:%POP3PORT/888 -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir
|
pop3://%HOSTIP:%POP3PORT/888 -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%POP3PORT' ne '9001' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -54,7 +49,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
CAPA
|
CAPA
|
||||||
AUTH OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
AUTH OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
RETR 888
|
RETR 888
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -17,7 +17,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTH +
|
REPLY AUTH +
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== + eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxlX3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9uIn0
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% + eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxlX3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9uIn0
|
||||||
REPLY AQ== -ERR Authentication failed
|
REPLY AQ== -ERR Authentication failed
|
||||||
</servercmd>
|
</servercmd>
|
||||||
</reply>
|
</reply>
|
||||||
@ -34,11 +34,6 @@ POP3 OAuth 2.0 (OAUTHBEARER) failure as continuation
|
|||||||
<command>
|
<command>
|
||||||
pop3://%HOSTIP:%POP3PORT/889 -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
pop3://%HOSTIP:%POP3PORT/889 -u user --oauth2-bearer mF_9.B5f-4.1JqM
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%POP3PORT' ne '9001' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -54,7 +49,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
CAPA
|
CAPA
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
AQ==
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
|
@ -34,11 +34,6 @@ POP3 OAuth 2.0 (OAUTHBEARER) failure as continuation with initial response
|
|||||||
<command>
|
<command>
|
||||||
pop3://%HOSTIP:%POP3PORT/890 -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir
|
pop3://%HOSTIP:%POP3PORT/890 -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%POP3PORT' ne '9001' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -53,7 +48,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
# transfer and such a connection will not get a "QUIT"
|
# transfer and such a connection will not get a "QUIT"
|
||||||
<protocol>
|
<protocol>
|
||||||
CAPA
|
CAPA
|
||||||
AUTH OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
AUTH OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%POP3PORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
AQ==
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
|
@ -16,7 +16,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTH 334 OAUTHBEARER supported
|
REPLY AUTH 334 OAUTHBEARER supported
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== 235 Authenticated
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% 235 Authenticated
|
||||||
</servercmd>
|
</servercmd>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
@ -35,11 +35,6 @@ mail body
|
|||||||
<command>
|
<command>
|
||||||
smtp://%HOSTIP:%SMTPPORT/946 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM -T -
|
smtp://%HOSTIP:%SMTPPORT/946 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM -T -
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%SMTPPORT' ne '9005' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -48,7 +43,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
EHLO 946
|
EHLO 946
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
MAIL FROM:<sender@example.com>
|
MAIL FROM:<sender@example.com>
|
||||||
RCPT TO:<recipient@example.com>
|
RCPT TO:<recipient@example.com>
|
||||||
DATA
|
DATA
|
||||||
|
@ -35,11 +35,6 @@ mail body
|
|||||||
<command>
|
<command>
|
||||||
smtp://%HOSTIP:%SMTPPORT/947 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir -T -
|
smtp://%HOSTIP:%SMTPPORT/947 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir -T -
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%SMTPPORT' ne '9005' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -47,7 +42,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
EHLO 947
|
EHLO 947
|
||||||
AUTH OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
AUTH OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
MAIL FROM:<sender@example.com>
|
MAIL FROM:<sender@example.com>
|
||||||
RCPT TO:<recipient@example.com>
|
RCPT TO:<recipient@example.com>
|
||||||
DATA
|
DATA
|
||||||
|
@ -16,7 +16,7 @@ RFC7628
|
|||||||
<servercmd>
|
<servercmd>
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
REPLY AUTH 334 OAUTHBEARER supported
|
REPLY AUTH 334 OAUTHBEARER supported
|
||||||
REPLY bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== 334 eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxlX3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9uIn0
|
REPLY %b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64% 334 eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxlX3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9uIn0
|
||||||
REPLY AQ== 535 Username and Password not accepted. Learn more at\r\n535 http://support.example.com/mail/oauth
|
REPLY AQ== 535 Username and Password not accepted. Learn more at\r\n535 http://support.example.com/mail/oauth
|
||||||
</servercmd>
|
</servercmd>
|
||||||
</reply>
|
</reply>
|
||||||
@ -36,11 +36,6 @@ mail body
|
|||||||
<command>
|
<command>
|
||||||
smtp://%HOSTIP:%SMTPPORT/948 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM -T -
|
smtp://%HOSTIP:%SMTPPORT/948 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM -T -
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%SMTPPORT' ne '9005' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -56,7 +51,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
<protocol>
|
<protocol>
|
||||||
EHLO 948
|
EHLO 948
|
||||||
AUTH OAUTHBEARER
|
AUTH OAUTHBEARER
|
||||||
bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
%b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
AQ==
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
|
@ -36,11 +36,6 @@ mail body
|
|||||||
<command>
|
<command>
|
||||||
smtp://%HOSTIP:%SMTPPORT/949 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir -T -
|
smtp://%HOSTIP:%SMTPPORT/949 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir -T -
|
||||||
</command>
|
</command>
|
||||||
# The protocol section doesn't support ways of specifying the raw data in the
|
|
||||||
# base64 encoded message so we must assert this
|
|
||||||
<precheck>
|
|
||||||
perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP' ne '127.0.0.1' || '%SMTPPORT' ne '9005' );"
|
|
||||||
</precheck>
|
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -55,7 +50,7 @@ perl -e "print 'Test requires default test server host and port' if ( '%HOSTIP'
|
|||||||
# transfer and such a connection will not get a "QUIT"
|
# transfer and such a connection will not get a "QUIT"
|
||||||
<protocol>
|
<protocol>
|
||||||
EHLO 949
|
EHLO 949
|
||||||
AUTH OAUTHBEARER bixhPXVzZXIsAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ==
|
AUTH OAUTHBEARER %b64[n,a=user,%01host=127.0.0.1%01port=%SMTPPORT%01auth=Bearer mF_9.B5f-4.1JqM%01%01]b64%
|
||||||
AQ==
|
AQ==
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
|
@ -83,6 +83,7 @@ my $proto = 'ftp'; # default server protocol
|
|||||||
my $srcdir; # directory where ftpserver.pl is located
|
my $srcdir; # directory where ftpserver.pl is located
|
||||||
my $srvrname; # server name for presentation purposes
|
my $srvrname; # server name for presentation purposes
|
||||||
my $cwd_testno; # test case numbers extracted from CWD command
|
my $cwd_testno; # test case numbers extracted from CWD command
|
||||||
|
my $testno = 0; # test case number (read from ftpserver.cmd)
|
||||||
my $path = '.';
|
my $path = '.';
|
||||||
my $logdir = $path .'/log';
|
my $logdir = $path .'/log';
|
||||||
|
|
||||||
@ -449,17 +450,14 @@ sub startsf {
|
|||||||
# Returns the given test's reply data
|
# Returns the given test's reply data
|
||||||
#
|
#
|
||||||
sub getreplydata {
|
sub getreplydata {
|
||||||
my ($testno) = @_;
|
my ($num) = @_;
|
||||||
my $testpart = "";
|
my $testpart = "";
|
||||||
|
|
||||||
$testno =~ s/^([^0-9]*)//;
|
$num =~ s/^([^0-9]*)//;
|
||||||
if($testno > 10000) {
|
if($num > 10000) {
|
||||||
$testpart = $testno % 10000;
|
$testpart = $num % 10000;
|
||||||
$testno = int($testno / 10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadtest("$srcdir/data/test$testno");
|
|
||||||
|
|
||||||
my @data = getpart("reply", "data$testpart");
|
my @data = getpart("reply", "data$testpart");
|
||||||
if((!@data) && ($testpart ne "")) {
|
if((!@data) && ($testpart ne "")) {
|
||||||
@data = getpart("reply", "data");
|
@data = getpart("reply", "data");
|
||||||
@ -2093,7 +2091,8 @@ my @ftpdir=("total 20\r\n",
|
|||||||
logmsg "pass LIST data on data connection\n";
|
logmsg "pass LIST data on data connection\n";
|
||||||
|
|
||||||
if($cwd_testno) {
|
if($cwd_testno) {
|
||||||
loadtest("$srcdir/data/test$cwd_testno");
|
loadtest("$logdir/test$cwd_testno") ||
|
||||||
|
loadtest("$srcdir/data/test$cwd_testno");
|
||||||
|
|
||||||
my @data = getpart("reply", "data");
|
my @data = getpart("reply", "data");
|
||||||
for(@data) {
|
for(@data) {
|
||||||
@ -2156,7 +2155,8 @@ sub MDTM_ftp {
|
|||||||
$testno = int($testno / 10000);
|
$testno = int($testno / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadtest("$srcdir/data/test$testno");
|
loadtest("$logdir/test$testno") ||
|
||||||
|
loadtest("$srcdir/data/test$testno");
|
||||||
|
|
||||||
my @data = getpart("reply", "mdtm");
|
my @data = getpart("reply", "mdtm");
|
||||||
|
|
||||||
@ -2209,7 +2209,8 @@ sub SIZE_ftp {
|
|||||||
$testno = int($testno / 10000);
|
$testno = int($testno / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadtest("$srcdir/data/test$testno");
|
loadtest("$logdir/test$testno") ||
|
||||||
|
loadtest("$srcdir/data/test$testno");
|
||||||
|
|
||||||
my @data = getpart("reply", "size");
|
my @data = getpart("reply", "size");
|
||||||
|
|
||||||
@ -2298,7 +2299,8 @@ sub RETR_ftp {
|
|||||||
$testno = int($testno / 10000);
|
$testno = int($testno / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadtest("$srcdir/data/test$testno");
|
loadtest("$logdir/test$testno") ||
|
||||||
|
loadtest("$srcdir/data/test$testno");
|
||||||
|
|
||||||
my @data = getpart("reply", "data$testpart");
|
my @data = getpart("reply", "data$testpart");
|
||||||
|
|
||||||
@ -2881,6 +2883,10 @@ sub customize {
|
|||||||
$nosave = 1;
|
$nosave = 1;
|
||||||
logmsg "FTPD: NOSAVE prevents saving of uploaded data\n";
|
logmsg "FTPD: NOSAVE prevents saving of uploaded data\n";
|
||||||
}
|
}
|
||||||
|
elsif($_ =~ /^Testnum (\d+)/){
|
||||||
|
$testno = $1;
|
||||||
|
logmsg "FTPD: run test case number: $testno\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(CUSTOM);
|
close(CUSTOM);
|
||||||
}
|
}
|
||||||
@ -3069,6 +3075,8 @@ while(1) {
|
|||||||
$| = 1;
|
$| = 1;
|
||||||
|
|
||||||
&customize(); # read test control instructions
|
&customize(); # read test control instructions
|
||||||
|
loadtest("$logdir/test$testno") ||
|
||||||
|
loadtest("$srcdir/data/test$testno");
|
||||||
|
|
||||||
my $welcome = $commandreply{"welcome"};
|
my $welcome = $commandreply{"welcome"};
|
||||||
if(!$welcome) {
|
if(!$welcome) {
|
||||||
|
@ -76,6 +76,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use Cwd;
|
use Cwd;
|
||||||
use Digest::MD5 qw(md5);
|
use Digest::MD5 qw(md5);
|
||||||
|
use MIME::Base64;
|
||||||
|
|
||||||
# Subs imported from serverhelp module
|
# Subs imported from serverhelp module
|
||||||
use serverhelp qw(
|
use serverhelp qw(
|
||||||
@ -3338,6 +3339,20 @@ sub subVariables {
|
|||||||
$$thing =~ s/${prefix}H2CVER/$h2cver/g;
|
$$thing =~ s/${prefix}H2CVER/$h2cver/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub subBase64 {
|
||||||
|
my ($thing) = @_;
|
||||||
|
|
||||||
|
# cut out the base64 piece
|
||||||
|
if($$thing =~ s/%b64\[(.*)\]b64%/%%B64%%/i) {
|
||||||
|
my $d = $1;
|
||||||
|
# encode %NN characters
|
||||||
|
$d =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
|
||||||
|
my $enc = encode_base64($d, "");
|
||||||
|
# put the result into there
|
||||||
|
$$thing =~ s/%%B64%%/$enc/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub fixarray {
|
sub fixarray {
|
||||||
my @in = @_;
|
my @in = @_;
|
||||||
|
|
||||||
@ -3560,16 +3575,21 @@ sub singletest {
|
|||||||
for my $s (@entiretest) {
|
for my $s (@entiretest) {
|
||||||
my $f = $s;
|
my $f = $s;
|
||||||
subVariables(\$s, "%");
|
subVariables(\$s, "%");
|
||||||
|
subBase64(\$s);
|
||||||
if($f ne $s) {
|
if($f ne $s) {
|
||||||
$diff++;
|
$diff++;
|
||||||
}
|
}
|
||||||
print D $s;
|
print D $s;
|
||||||
}
|
}
|
||||||
close(D);
|
close(D);
|
||||||
|
|
||||||
# remove the separate test file again if nothing was updated to keep
|
# remove the separate test file again if nothing was updated to keep
|
||||||
# things simpler
|
# things simpler
|
||||||
unlink($otest) if(!$diff);
|
unlink($otest) if(!$diff);
|
||||||
|
|
||||||
|
# in case the process changed the file, reload it
|
||||||
|
loadtest("log/test${testnum}") if($diff);
|
||||||
|
|
||||||
# timestamp required servers verification end
|
# timestamp required servers verification end
|
||||||
$timesrvrend{$testnum} = Time::HiRes::time();
|
$timesrvrend{$testnum} = Time::HiRes::time();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user