]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: auth-request - Move get_log_identifier()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sun, 22 Oct 2023 20:55:34 +0000 (22:55 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 29 Nov 2023 08:29:04 +0000 (08:29 +0000)
src/auth/auth-request.c

index d1d52948f41600ee20150cb6396e095f757652ba..0c385354e63b7df0b4170f34c788c015a0d63266 100644 (file)
@@ -69,6 +69,28 @@ static void auth_request_lookup_credentials_policy_continue(
        struct auth_request *request, lookup_credentials_callback_t *callback);
 static void auth_request_policy_check_callback(int result, void *context);
 
+#define MAX_LOG_USERNAME_LEN 64
+static void get_log_identifier(string_t *str, struct auth_request *auth_request)
+{
+       const char *ip;
+
+       if (auth_request->fields.user == NULL)
+               str_append(str, "?");
+       else
+               str_sanitize_append(str, auth_request->fields.user,
+                                   MAX_LOG_USERNAME_LEN);
+
+       ip = net_ip2addr(&auth_request->fields.remote_ip);
+       if (ip[0] != '\0') {
+               str_append_c(str, ',');
+               str_append(str, ip);
+       }
+       if (auth_request->fields.requested_login_user != NULL)
+               str_append(str, ",master");
+       if (auth_request->fields.session_id != NULL)
+               str_printfa(str, ",<%s>", auth_request->fields.session_id);
+}
+
 static const char *get_log_prefix_mech(struct auth_request *auth_request)
 {
        string_t *str = t_str_new(64);
@@ -2524,28 +2546,6 @@ void auth_request_get_log_prefix(string_t *str,
        str_append(str, "): ");
 }
 
-#define MAX_LOG_USERNAME_LEN 64
-static void get_log_identifier(string_t *str, struct auth_request *auth_request)
-{
-       const char *ip;
-
-       if (auth_request->fields.user == NULL)
-               str_append(str, "?");
-       else
-               str_sanitize_append(str, auth_request->fields.user,
-                                   MAX_LOG_USERNAME_LEN);
-
-       ip = net_ip2addr(&auth_request->fields.remote_ip);
-       if (ip[0] != '\0') {
-               str_append_c(str, ',');
-               str_append(str, ip);
-       }
-       if (auth_request->fields.requested_login_user != NULL)
-               str_append(str, ",master");
-       if (auth_request->fields.session_id != NULL)
-               str_printfa(str, ",<%s>", auth_request->fields.session_id);
-}
-
 void auth_request_log_debug(struct auth_request *auth_request,
                            const char *subsystem,
                            const char *format, ...)