about summary refs log tree commit diff
path: root/src/libnm-client-impl/tests/test-copy-cert-as-user.c
blob: b2ef9de67def7bc5a1266197da4351ca869e5594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* SPDX-License-Identifier: LGPL-2.1-or-later */

/* 
 * This is a program to manually test the
 * nm_utils_copy_cert_as_user() libnm function.
 */

#include "libnm-client-impl/nm-default-libnm.h"

#include "nm-utils.h"

int
main(int argc, char **argv)
{
    gs_free_error GError *error    = NULL;
    gs_free char         *filename = NULL;

    if (argc != 3) {
        g_printerr("Usage: %s <FILE> <USER>\n", argv[0]);
        return 1;
    }

    filename = nm_utils_copy_cert_as_user(argv[1], argv[2], &error);
    if (!filename) {
        g_printerr("Error: %s\n", error->message);
        return 1;
    }

    g_print("%s\n", filename);

    return 0;
}