Blame


1 50b0790e 2020-09-11 stsp /*
2 50b0790e 2020-09-11 stsp * Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
3 50b0790e 2020-09-11 stsp *
4 50b0790e 2020-09-11 stsp * Permission to use, copy, modify, and distribute this software for any
5 50b0790e 2020-09-11 stsp * purpose with or without fee is hereby granted, provided that the above
6 50b0790e 2020-09-11 stsp * copyright notice and this permission notice appear in all copies.
7 50b0790e 2020-09-11 stsp *
8 50b0790e 2020-09-11 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 50b0790e 2020-09-11 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 50b0790e 2020-09-11 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 50b0790e 2020-09-11 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 50b0790e 2020-09-11 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 50b0790e 2020-09-11 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 50b0790e 2020-09-11 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 50b0790e 2020-09-11 stsp */
16 50b0790e 2020-09-11 stsp
17 50b0790e 2020-09-11 stsp #include <sys/types.h>
18 50b0790e 2020-09-11 stsp #include <sys/queue.h>
19 50b0790e 2020-09-11 stsp #include <sys/uio.h>
20 50b0790e 2020-09-11 stsp #include <sys/socket.h>
21 50b0790e 2020-09-11 stsp
22 50b0790e 2020-09-11 stsp #include <unistd.h>
23 50b0790e 2020-09-11 stsp #include <fcntl.h>
24 50b0790e 2020-09-11 stsp #include <errno.h>
25 50b0790e 2020-09-11 stsp #include <stdlib.h>
26 50b0790e 2020-09-11 stsp #include <stdio.h>
27 50b0790e 2020-09-11 stsp #include <stdint.h>
28 50b0790e 2020-09-11 stsp #include <imsg.h>
29 50b0790e 2020-09-11 stsp #include <sha1.h>
30 5822e79e 2023-02-23 op #include <sha2.h>
31 50b0790e 2020-09-11 stsp #include <limits.h>
32 50b0790e 2020-09-11 stsp
33 50b0790e 2020-09-11 stsp #include "got_error.h"
34 50b0790e 2020-09-11 stsp #include "got_object.h"
35 50b0790e 2020-09-11 stsp #include "got_repository.h"
36 50b0790e 2020-09-11 stsp
37 50b0790e 2020-09-11 stsp #include "got_lib_gotconfig.h"
38 50b0790e 2020-09-11 stsp
39 336075a4 2022-06-25 op #include "got_gotconfig.h"
40 336075a4 2022-06-25 op
41 50b0790e 2020-09-11 stsp void
42 50b0790e 2020-09-11 stsp got_gotconfig_free(struct got_gotconfig *conf)
43 50b0790e 2020-09-11 stsp {
44 50b0790e 2020-09-11 stsp int i;
45 50b0790e 2020-09-11 stsp
46 a9705505 2020-09-18 stsp if (conf == NULL)
47 a9705505 2020-09-18 stsp return;
48 a9705505 2020-09-18 stsp
49 50b0790e 2020-09-11 stsp free(conf->author);
50 50b0790e 2020-09-11 stsp
51 b8adfa55 2020-09-25 stsp for (i = 0; i < conf->nremotes; i++)
52 b8adfa55 2020-09-25 stsp got_repo_free_remote_repo_data(&conf->remotes[i]);
53 50b0790e 2020-09-11 stsp free(conf->remotes);
54 50b0790e 2020-09-11 stsp free(conf);
55 50b0790e 2020-09-11 stsp }
56 50b0790e 2020-09-11 stsp
57 50b0790e 2020-09-11 stsp const char *
58 50b0790e 2020-09-11 stsp got_gotconfig_get_author(const struct got_gotconfig *conf)
59 50b0790e 2020-09-11 stsp {
60 50b0790e 2020-09-11 stsp return conf->author;
61 50b0790e 2020-09-11 stsp }
62 50b0790e 2020-09-11 stsp
63 50b0790e 2020-09-11 stsp void
64 50b0790e 2020-09-11 stsp got_gotconfig_get_remotes(int *nremotes, const struct got_remote_repo **remotes,
65 50b0790e 2020-09-11 stsp const struct got_gotconfig *conf)
66 50b0790e 2020-09-11 stsp {
67 50b0790e 2020-09-11 stsp *nremotes = conf->nremotes;
68 50b0790e 2020-09-11 stsp *remotes = conf->remotes;
69 50b0790e 2020-09-11 stsp }
70 4d5ee956 2022-07-02 jrick
71 4d5ee956 2022-07-02 jrick const char *
72 4d5ee956 2022-07-02 jrick got_gotconfig_get_allowed_signers_file(const struct got_gotconfig *conf)
73 4d5ee956 2022-07-02 jrick {
74 4d5ee956 2022-07-02 jrick return conf->allowed_signers_file;
75 4d5ee956 2022-07-02 jrick }
76 4d5ee956 2022-07-02 jrick
77 4d5ee956 2022-07-02 jrick const char *
78 4d5ee956 2022-07-02 jrick got_gotconfig_get_revoked_signers_file(const struct got_gotconfig *conf)
79 4d5ee956 2022-07-02 jrick {
80 4d5ee956 2022-07-02 jrick return conf->revoked_signers_file;
81 4d5ee956 2022-07-02 jrick }
82 d68f2c0e 2022-07-05 jrick
83 d68f2c0e 2022-07-05 jrick const char *
84 d68f2c0e 2022-07-05 jrick got_gotconfig_get_signer_id(const struct got_gotconfig *conf)
85 d68f2c0e 2022-07-05 jrick {
86 d68f2c0e 2022-07-05 jrick return conf->signer_id;
87 d68f2c0e 2022-07-05 jrick }