From: Stephan Bosch Date: Mon, 2 Oct 2017 09:38:59 +0000 (+0200) Subject: lib-auth-client: auth-master - Move auth_lookup_reply_callback() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c91cbcacecf50c5697b3bd75718f803d65e11a6;p=thirdparty%2Fdovecot%2Fcore.git lib-auth-client: auth-master - Move auth_lookup_reply_callback() --- diff --git a/src/lib-auth-client/auth-master.c b/src/lib-auth-client/auth-master.c index 08ca455a94..4886c1124a 100644 --- a/src/lib-auth-client/auth-master.c +++ b/src/lib-auth-client/auth-master.c @@ -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,