]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client: auth-master - Move parse_reply()
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 2 Oct 2017 09:40:22 +0000 (11:40 +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 4886c1124af3020b918df3d35466c63d524e8be0..8ae9ccb9ac55cfb289a074ff07e153383226c2e8 100644 (file)
@@ -186,31 +186,6 @@ static void auth_master_destroy(struct connection *_conn)
        auth_request_lookup_abort(conn);
 }
 
-static int
-parse_reply(struct auth_master_lookup_ctx *ctx, const char *cmd,
-           const char *const *args)
-{
-       struct auth_master_connection *conn = ctx->conn;
-
-       if (strcmp(cmd, ctx->expected_reply) == 0)
-               return 1;
-       if (strcmp(cmd, "NOTFOUND") == 0)
-               return 0;
-       if (strcmp(cmd, "FAIL") == 0) {
-               if (*args == NULL) {
-                       e_error(conn->event, "Auth %s lookup failed",
-                               ctx->expected_reply);
-               } else {
-                       e_debug(conn->event,
-                               "Auth %s lookup returned temporary failure: %s",
-                               ctx->expected_reply, *args);
-               }
-               return -2;
-       }
-       e_error(conn->event, "Unknown reply: %s", cmd);
-       return -1;
-}
-
 static const char *const *args_hide_passwords(const char *const *args)
 {
        ARRAY_TYPE(const_string) new_args;
@@ -621,6 +596,31 @@ auth_master_event_finish(struct auth_master_connection *conn)
        conn->event = conn->event_parent;
 }
 
+static int
+parse_reply(struct auth_master_lookup_ctx *ctx, const char *cmd,
+           const char *const *args)
+{
+       struct auth_master_connection *conn = ctx->conn;
+
+       if (strcmp(cmd, ctx->expected_reply) == 0)
+               return 1;
+       if (strcmp(cmd, "NOTFOUND") == 0)
+               return 0;
+       if (strcmp(cmd, "FAIL") == 0) {
+               if (*args == NULL) {
+                       e_error(conn->event, "Auth %s lookup failed",
+                               ctx->expected_reply);
+               } else {
+                       e_debug(conn->event,
+                               "Auth %s lookup returned temporary failure: %s",
+                               ctx->expected_reply, *args);
+               }
+               return -2;
+       }
+       e_error(conn->event, "Unknown reply: %s", cmd);
+       return -1;
+}
+
 static bool auth_lookup_reply_callback(const char *cmd, const char *const *args,
                                       void *context)
 {