if (strcmp(id, wanted_id) == 0) {
e_debug(conn->conn.event, "auth input: %s",
t_strarray_join(args, "\t"));
- return (conn->reply_callback(cmd, args, conn->reply_context) ?
- 0 : 1);
+ /* Returns 1 upon full completion, 0 upon successful partial
+ completion (will be called again) and -1 upon error. */
+ return conn->reply_callback(cmd, args, conn->reply_context);
}
if (strcmp(cmd, "CUID") == 0) {
int ret;
ret = auth_master_handle_input(conn, args);
- if (ret < 0)
+ if (ret < 0) {
auth_request_lookup_abort(conn);
- return ret;
+ return -1;
+ }
+ /* The continue/stop return 0/1 semantics for auth_master_handle_input()
+ (and the reply callback) are inverted when compared to the connection
+ API, so we need to return 0 for ret > 0 and 1 for ret == 0. */
+ return (ret > 0 ? 0 : 1);
}
static int auth_master_input_line(struct connection *_conn, const char *line)
return -1;
}
-static bool auth_lookup_reply_callback(const char *cmd, const char *const *args,
- void *context)
+static int
+auth_lookup_reply_callback(const char *cmd, const char *const *args,
+ void *context)
{
struct auth_master_lookup *lookup = context;
const char *value;
args = args_hide_passwords(args);
e_debug(lookup->conn->event, "auth %s input: %s",
lookup->expected_reply, t_strarray_join(args, " "));
- return TRUE;
+ return 1;
}
/*
bool failed;
};
-static bool
+static int
auth_user_list_reply_callback(const char *cmd, const char *const *args,
void *context)
{
ctx->failed = TRUE;
}
ctx->finished = TRUE;
- return FALSE;
+ return 1;
}
if (strcmp(cmd, "LIST") != 0 || args[0] == NULL) {
e_error(conn->event, "User listing returned invalid input");
ctx->failed = TRUE;
- return FALSE;
+ return -1;
}
/* We'll just read all the users into memory. otherwise we'd have to use
failure since the connection could be open to dovecot-auth for a long
time. */
str_append(ctx->username, args[0]);
- return FALSE;
+ return 0;
}
struct auth_master_user_list_ctx *
bool failed;
};
-static bool
+static int
auth_cache_flush_reply_callback(const char *cmd, const char *const *args,
void *context)
{
ctx->failed = TRUE;
io_loop_stop(ctx->conn->ioloop);
- return TRUE;
+ return 1;
}
int auth_master_cache_flush(struct auth_master_connection *conn,