return 0;
}
+static int auth_callback(struct pakfire_client* client,
+ pakfire_client_auth_status status, void* data) {
+ int* r = data;
+
+ // Set the status
+ *r = status;
+
+ return 0;
+}
+
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 r;
// Parse the command line
if (r < 0)
goto ERROR;
+ // Set the authentication callback
+ r = pakfire_client_set_auth_callback(client, auth_callback, &status);
+ if (r < 0)
+ goto ERROR;
+
// Authenticate
r = pakfire_client_auth_user(client, local_args.username, local_args.password);
if (r < 0)
// Run the client
r = pakfire_client_run(client);
+ if (r < 0)
+ goto ERROR;
+
+ // Set status
+ r = status;
ERROR:
if (client)