]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client: auth-master - Move auth_lookup_reply_callback()
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 2 Oct 2017 09:38:59 +0000 (11:38 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 27 Aug 2025 11:34:57 +0000 (13:34 +0200)
src/lib-auth-client/auth-master.c

index 08ca455a944649a9b1448babd615d5cc116f03c7..4886c1124af3020b918df3d35466c63d524e8be0 100644 (file)
@@ -244,39 +244,6 @@ static const char *const *args_hide_passwords(const char *const *args)
        return array_front(&new_args);
 }
 
-static bool auth_lookup_reply_callback(const char *cmd, const char *const *args,
-                                      void *context)
-{
-       struct auth_master_lookup_ctx *ctx = context;
-       const char *value;
-       unsigned int i, len;
-
-       io_loop_stop(ctx->conn->ioloop);
-
-       ctx->return_value = parse_reply(ctx, cmd, args);
-
-       len = str_array_length(args);
-       i_assert(*args != NULL || len == 0); /* for static analyzer */
-       if (ctx->return_value >= 0) {
-               ctx->fields = p_new(ctx->pool, const char *, len + 1);
-               for (i = 0; i < len; i++)
-                       ctx->fields[i] = p_strdup(ctx->pool, args[i]);
-       } else {
-               /* put the reason string into first field */
-               ctx->fields = p_new(ctx->pool, const char *, 2);
-               for (i = 0; i < len; i++) {
-                       if (str_begins(args[i], "reason=", &value)) {
-                               ctx->fields[0] = p_strdup(ctx->pool, value);
-                               break;
-                       }
-               }
-       }
-       args = args_hide_passwords(args);
-       e_debug(ctx->conn->event, "auth %s input: %s",
-               ctx->expected_reply, t_strarray_join(args, " "));
-       return TRUE;
-}
-
 static int
 auth_master_handshake_line(struct connection *_conn, const char *line)
 {
@@ -654,6 +621,39 @@ auth_master_event_finish(struct auth_master_connection *conn)
        conn->event = conn->event_parent;
 }
 
+static bool auth_lookup_reply_callback(const char *cmd, const char *const *args,
+                                      void *context)
+{
+       struct auth_master_lookup_ctx *ctx = context;
+       const char *value;
+       unsigned int i, len;
+
+       io_loop_stop(ctx->conn->ioloop);
+
+       ctx->return_value = parse_reply(ctx, cmd, args);
+
+       len = str_array_length(args);
+       i_assert(*args != NULL || len == 0); /* for static analyzer */
+       if (ctx->return_value >= 0) {
+               ctx->fields = p_new(ctx->pool, const char *, len + 1);
+               for (i = 0; i < len; i++)
+                       ctx->fields[i] = p_strdup(ctx->pool, args[i]);
+       } else {
+               /* put the reason string into first field */
+               ctx->fields = p_new(ctx->pool, const char *, 2);
+               for (i = 0; i < len; i++) {
+                       if (str_begins(args[i], "reason=", &value)) {
+                               ctx->fields[0] = p_strdup(ctx->pool, value);
+                               break;
+                       }
+               }
+       }
+       args = args_hide_passwords(args);
+       e_debug(ctx->conn->event, "auth %s input: %s",
+               ctx->expected_reply, t_strarray_join(args, " "));
+       return TRUE;
+}
+
 int auth_master_user_lookup(struct auth_master_connection *conn,
                            const char *user, const struct auth_user_info *info,
                            pool_t pool, const char **username_r,