Skip to content

Commit

Permalink
Merge pull request #3 from sticnarf/test-for-long-username
Browse files Browse the repository at this point in the history
Add test for very long username and password
  • Loading branch information
sticnarf authored Apr 30, 2019
2 parents cf5c63d + 27ea09f commit 3c93a49
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dir="$(dirname "$(which "$0")")"
#echo $! > /tmp/socat-test.pid

if test -z "$@"; then
list="no_auth username_auth"
list="no_auth username_auth long_username_password_auth"
else
list="$@"
fi
Expand Down
6 changes: 6 additions & 0 deletions tests/long_username_password_auth.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
daemon
users longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongusername:CL:longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongpassword
pidfile /tmp/3proxy-test.pid
auth strong
allow longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongusername
socks -p41080
23 changes: 23 additions & 0 deletions tests/long_username_password_auth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mod common;

use common::{test_bind, test_connect, ECHO_SERVER_ADDR, PROXY_ADDR};
use tokio_socks::{
tcp::{Socks5Listener, Socks5Stream},
Error,
};

type Result<T> = std::result::Result<T, Error>;

#[test]
fn connect() -> Result<()> {
let conn =
Socks5Stream::connect_with_password(PROXY_ADDR, ECHO_SERVER_ADDR, "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongusername", "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongpassword")?;
test_connect(conn)
}

#[test]
fn bind() -> Result<()> {
let bind =
Socks5Listener::bind_with_password(PROXY_ADDR, ECHO_SERVER_ADDR, "mylonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongusername", "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongpassword")?;
test_bind(bind)
}

0 comments on commit 3c93a49

Please sign in to comment.