From: Aki Tuomi Date: Wed, 1 Feb 2023 11:53:42 +0000 (+0200) Subject: login-common: Add event_ prefixed values from auth as event fields X-Git-Tag: 2.4.0~2997 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66abcd68a6f2527b7ddec41afd9665511e12301b;p=thirdparty%2Fdovecot%2Fcore.git login-common: Add event_ prefixed values from auth as event fields --- diff --git a/src/lib-auth-client/auth-client-request.c b/src/lib-auth-client/auth-client-request.c index a67c26f8d2..788a1f4c2b 100644 --- a/src/lib-auth-client/auth-client-request.c +++ b/src/lib-auth-client/auth-client-request.c @@ -6,6 +6,7 @@ #include "strescape.h" #include "ostream.h" #include "auth-client-private.h" +#include "strfuncs.h" static void auth_server_send_new_request(struct auth_client_connection *conn, struct auth_client_request *request, @@ -328,8 +329,16 @@ void auth_client_request_server_input(struct auth_client_request *request, } for (tmp = args; *tmp != NULL; tmp++) { - (void)str_begins(*tmp, "resp=", &base64_data); - args_parse_user(request, *tmp); + const char *key; + const char *value; + t_split_key_value_eq(*tmp, &key, &value); + if (str_begins(key, "event_", &key)) { + event_add_str(request->event, key, value); + } else if (strcmp(key, "resp") == 0) { + base64_data = value; + } else { + args_parse_user(request, *tmp); + } } switch (status) { diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index ec7850d938..96226f4804 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -206,6 +206,9 @@ static bool client_auth_parse_args(const struct client *client, bool success, } } else if (str_begins_with(key, "forward_")) { /* these are passed to upstream */ + } else if (str_begins(key, "event_", &key)) { + /* add key to event */ + event_add_str(client->event_auth, key, value); } else e_debug(client->event_auth, "Ignoring unknown passdb extra field: %s", key); diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c index faa0b9e466..d9c66efc40 100644 --- a/src/login-common/sasl-server.c +++ b/src/login-common/sasl-server.c @@ -367,6 +367,8 @@ authenticate_callback(struct auth_client_request *request, nologin = TRUE; } else if (strcmp(key, "anonymous") == 0) { client->auth_anonymous = TRUE; + } else if (str_begins(args[i], "event_", &key)) { + event_add_str(client->event_auth, key, value); } else if (login_binary->sasl_support_final_reply && strcmp(key, "resp") == 0) { client->sasl_final_resp =