mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 12:58:04 +00:00
chatmail.ini: switch username length defaults back to 9
This commit is contained in:
@@ -21,10 +21,10 @@ max_mailbox_size = 100M
|
|||||||
delete_mails_after = 40d
|
delete_mails_after = 40d
|
||||||
|
|
||||||
# minimum length a username must have
|
# minimum length a username must have
|
||||||
username_min_length = 6
|
username_min_length = 9
|
||||||
|
|
||||||
# maximum length a username can have
|
# maximum length a username can have
|
||||||
username_max_length = 20
|
username_max_length = 9
|
||||||
|
|
||||||
# minimum length a password must have
|
# minimum length a password must have
|
||||||
password_min_length = 9
|
password_min_length = 9
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ def test_read_config_testrun(make_config):
|
|||||||
assert config.max_user_send_per_minute == 60
|
assert config.max_user_send_per_minute == 60
|
||||||
assert config.max_mailbox_size == "100M"
|
assert config.max_mailbox_size == "100M"
|
||||||
assert config.delete_mails_after == "40d"
|
assert config.delete_mails_after == "40d"
|
||||||
assert config.username_min_length == 6
|
assert config.username_min_length == 9
|
||||||
assert config.username_max_length == 20
|
assert config.username_max_length == 9
|
||||||
assert config.password_min_length == 9
|
assert config.password_min_length == 9
|
||||||
assert config.passthrough_recipients == ["privacy@testrun.org"]
|
assert config.passthrough_recipients == ["privacy@testrun.org"]
|
||||||
assert config.passthrough_senders == []
|
assert config.passthrough_senders == []
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ from chatmaild.database import DBError
|
|||||||
|
|
||||||
|
|
||||||
def test_basic(db, example_config):
|
def test_basic(db, example_config):
|
||||||
lookup_passdb(
|
lookup_passdb(db, example_config, "asdf12345@chat.example.org", "q9mr3faue")
|
||||||
db, example_config, "link2xt@chat.example.org", "Pieg9aeToe3eghuthe5u"
|
data = get_user_data(db, "asdf12345@chat.example.org")
|
||||||
)
|
|
||||||
data = get_user_data(db, "link2xt@chat.example.org")
|
|
||||||
assert data
|
assert data
|
||||||
data2 = lookup_passdb(
|
data2 = lookup_passdb(
|
||||||
db, example_config, "link2xt@chat.example.org", "Pieg9aeToe3eghuthe5u"
|
db, example_config, "asdf12345@chat.example.org", "q9mr3jewvadsfaue"
|
||||||
)
|
)
|
||||||
assert data == data2
|
assert data == data2
|
||||||
|
|
||||||
@@ -24,10 +22,10 @@ def test_basic(db, example_config):
|
|||||||
def test_dont_overwrite_password_on_wrong_login(db, example_config):
|
def test_dont_overwrite_password_on_wrong_login(db, example_config):
|
||||||
"""Test that logging in with a different password doesn't create a new user"""
|
"""Test that logging in with a different password doesn't create a new user"""
|
||||||
res = lookup_passdb(
|
res = lookup_passdb(
|
||||||
db, example_config, "newuser1@chat.example.org", "kajdlkajsldk12l3kj1983"
|
db, example_config, "newuser12@chat.example.org", "kajdlkajsldk12l3kj1983"
|
||||||
)
|
)
|
||||||
assert res["password"]
|
assert res["password"]
|
||||||
res2 = lookup_passdb(db, example_config, "newuser1@chat.example.org", "kajdlqweqwe")
|
res2 = lookup_passdb(db, example_config, "newuser12@chat.example.org", "kajdslqwe")
|
||||||
# this function always returns a password hash, which is actually compared by dovecot.
|
# this function always returns a password hash, which is actually compared by dovecot.
|
||||||
assert res["password"] == res2["password"]
|
assert res["password"] == res2["password"]
|
||||||
|
|
||||||
@@ -37,9 +35,9 @@ def test_nocreate_file(db, monkeypatch, tmpdir, example_config):
|
|||||||
p.write("")
|
p.write("")
|
||||||
monkeypatch.setattr(chatmaild.doveauth, "NOCREATE_FILE", str(p))
|
monkeypatch.setattr(chatmaild.doveauth, "NOCREATE_FILE", str(p))
|
||||||
lookup_passdb(
|
lookup_passdb(
|
||||||
db, example_config, "newuser1@chat.example.org", "zequ0Aimuchoodaechik"
|
db, example_config, "newuser12@chat.example.org", "zequ0Aimuchoodaechik"
|
||||||
)
|
)
|
||||||
assert not get_user_data(db, "newuser1@chat.example.org")
|
assert not get_user_data(db, "newuser12@chat.example.org")
|
||||||
|
|
||||||
|
|
||||||
def test_db_version(db):
|
def test_db_version(db):
|
||||||
@@ -56,20 +54,18 @@ def test_too_high_db_version(db):
|
|||||||
def test_handle_dovecot_request(db, example_config):
|
def test_handle_dovecot_request(db, example_config):
|
||||||
msg = (
|
msg = (
|
||||||
"Lshared/passdb/laksjdlaksjdlaksjdlk12j3l1k2j3123/"
|
"Lshared/passdb/laksjdlaksjdlaksjdlk12j3l1k2j3123/"
|
||||||
"some42@chat.example.org\tsome42@chat.example.org"
|
"some42123@chat.example.org\tsome42123@chat.example.org"
|
||||||
)
|
)
|
||||||
res = handle_dovecot_request(msg, db, example_config)
|
res = handle_dovecot_request(msg, db, example_config)
|
||||||
assert res
|
assert res
|
||||||
assert res[0] == "O" and res.endswith("\n")
|
assert res[0] == "O" and res.endswith("\n")
|
||||||
userdata = json.loads(res[1:].strip())
|
userdata = json.loads(res[1:].strip())
|
||||||
assert userdata["home"] == "/home/vmail/some42@chat.example.org"
|
assert userdata["home"] == "/home/vmail/some42123@chat.example.org"
|
||||||
assert userdata["uid"] == userdata["gid"] == "vmail"
|
assert userdata["uid"] == userdata["gid"] == "vmail"
|
||||||
assert userdata["password"].startswith("{SHA512-CRYPT}")
|
assert userdata["password"].startswith("{SHA512-CRYPT}")
|
||||||
|
|
||||||
|
|
||||||
def test_50_concurrent_lookups_different_accounts(
|
def test_50_concurrent_lookups_different_accounts(db, gencreds, example_config):
|
||||||
db, gencreds, example_config, maildomain
|
|
||||||
):
|
|
||||||
num_threads = 50
|
num_threads = 50
|
||||||
req_per_thread = 5
|
req_per_thread = 5
|
||||||
results = queue.Queue()
|
results = queue.Queue()
|
||||||
|
|||||||
Reference in New Issue
Block a user