]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: Add event_ prefixed values from auth as event fields
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 1 Feb 2023 11:53:42 +0000 (13:53 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 8 Feb 2023 17:31:26 +0000 (19:31 +0200)
src/lib-auth/auth-client-request.c
src/login-common/client-common-auth.c
src/login-common/sasl-server.c

index 629b77bcfaac936c139bc0bcec3b852badf3cdaf..e9fb07bfa2e455a1e9f0f90b4e41d16f93802292 100644 (file)
@@ -318,6 +318,13 @@ void auth_client_request_server_input(struct auth_client_request *request,
        for (tmp = args; *tmp != NULL; tmp++) {
                if (str_begins(*tmp, "resp=")) {
                        base64_data = *tmp + 5;
+               } else if (str_begins(*tmp, "event_")) {
+                       const char *key = *tmp + 6;
+                       const char *value = strchr(key, '=');
+                       if (value != NULL) {
+                               event_add_str(request->event,
+                                             t_strdup_until(key, value), value+1);
+                       }
                }
                args_parse_user(request, *tmp);
        }
index 9a9a7100ce507a0575ce8e6c7452809e6509786a..8aff181ae1e0df89792ebec2a6dde2d25de761ba 100644 (file)
@@ -238,6 +238,9 @@ static void client_auth_parse_args(struct client *client, bool success,
                        }
                } else if (str_begins(key, "forward_")) {
                        /* these are passed to upstream */
+               } else if (str_begins(key, "event_")) {
+                       /* add name to event */
+                       event_add_str(client->event, key + 6, value);
                } else
                        e_debug(event_auth, "Ignoring unknown passdb extra field: %s", key);
        }
index 3a03a375596ec336c7eb1b7999a44e33a7c30576..6e4de56e5484509a32e64c1fa8a662074643f2c5 100644 (file)
@@ -360,6 +360,14 @@ authenticate_callback(struct auth_client_request *request,
                                nologin = TRUE;
                        } else if (strcmp(args[i], "anonymous") == 0 ) {
                                client->auth_anonymous = TRUE;
+                       } else if (str_begins(args[i], "event_")) {
+                               const char *key = args[i] + 6;
+                               const char *value = strchr(key, '=');
+                               if (value != NULL) {
+                                       event_add_str(client->event,
+                                                     t_strdup_until(key, value),
+                                                     value+1);
+                               }
                        } else if (str_begins(args[i], "resp=") &&
                                   login_binary->sasl_support_final_reply) {
                                client->sasl_final_resp =