diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/auth/mech-anonymous.c | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/auth/mech-anonymous.c')
-rw-r--r-- | src/auth/mech-anonymous.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/auth/mech-anonymous.c b/src/auth/mech-anonymous.c new file mode 100644 index 0000000..fbbfccd --- /dev/null +++ b/src/auth/mech-anonymous.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */ + +#include "auth-common.h" +#include "mech.h" + +static void +mech_anonymous_auth_continue(struct auth_request *request, + const unsigned char *data, size_t data_size) +{ + i_assert(*request->set->anonymous_username != '\0'); + + if (request->set->verbose) { + /* temporarily set the user to the one that was given, + so that the log message goes right */ + auth_request_set_username_forced(request, + t_strndup(data, data_size)); + e_info(request->mech_event, "login"); + } + + auth_request_set_username_forced(request, + request->set->anonymous_username); + + request->passdb_success = TRUE; + auth_request_success(request, "", 0); +} + +static struct auth_request *mech_anonymous_auth_new(void) +{ + struct auth_request *request; + pool_t pool; + + pool = pool_alloconly_create(MEMPOOL_GROWING"anonymous_auth_request", 2048); + request = p_new(pool, struct auth_request, 1); + request->pool = pool; + return request; +} + +const struct mech_module mech_anonymous = { + "ANONYMOUS", + + .flags = MECH_SEC_ANONYMOUS | MECH_SEC_ALLOW_NULS, + .passdb_need = MECH_PASSDB_NEED_NOTHING, + + mech_anonymous_auth_new, + mech_generic_auth_initial, + mech_anonymous_auth_continue, + mech_generic_auth_free +}; |