]> git.ipfire.org Git - pakfire.git/commitdiff
cli: auth: Use the new ready callback
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 09:45:59 +0000 (09:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 09:45:59 +0000 (09:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/auth.c

index f245a43ae3aa7a907e1ec8b6340cfb3cb1bf5f4d..56d80ba47e4812591a00ed47b661bda6381c8e67 100644 (file)
@@ -55,12 +55,11 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int auth_callback(struct pakfire_client* client,
-               pakfire_client_auth_status status, void* data) {
+static int ready_callback(struct pakfire_client* client, void* data) {
        int* r = data;
 
-       // Set the status
-       *r = status;
+       // If we get here, we set the status to zero
+       *r = 0;
 
        return 0;
 }
@@ -69,7 +68,7 @@ int cli_auth(void* data, int argc, char* argv[]) {
        struct cli_global_args* global_args = data;
        struct cli_local_args local_args = {};
        struct pakfire_client* client = NULL;
-       int status = 0;
+       int status = 1;
        int r;
 
        // Parse the command line
@@ -82,10 +81,8 @@ int cli_auth(void* data, int argc, char* argv[]) {
        if (r < 0)
                goto ERROR;
 
-       // Set the authentication callback
-       r = pakfire_client_set_auth_callback(client, auth_callback, &status);
-       if (r < 0)
-               goto ERROR;
+       // Set the ready callback
+       pakfire_client_set_ready_callback(client, ready_callback, &status);
 
        // Authenticate
        r = pakfire_client_auth_user(client, local_args.username, local_args.password);