2 4d5ee956 2022-07-02 jrick * Copyright (c) 2022 Josh Rickmar <jrick@zettaport.com>
4 4d5ee956 2022-07-02 jrick * Permission to use, copy, modify, and distribute this software for any
5 4d5ee956 2022-07-02 jrick * purpose with or without fee is hereby granted, provided that the above
6 4d5ee956 2022-07-02 jrick * copyright notice and this permission notice appear in all copies.
8 4d5ee956 2022-07-02 jrick * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 4d5ee956 2022-07-02 jrick * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 4d5ee956 2022-07-02 jrick * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 4d5ee956 2022-07-02 jrick * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 4d5ee956 2022-07-02 jrick * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 4d5ee956 2022-07-02 jrick * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 4d5ee956 2022-07-02 jrick * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1b2dedff 2022-07-04 stsp #include <sys/time.h>
18 4d5ee956 2022-07-02 jrick #include <sys/types.h>
19 4d5ee956 2022-07-02 jrick #include <sys/stat.h>
20 4d5ee956 2022-07-02 jrick #include <sys/socket.h>
21 4d5ee956 2022-07-02 jrick #include <sys/queue.h>
22 4d5ee956 2022-07-02 jrick #include <sys/wait.h>
24 4d5ee956 2022-07-02 jrick #include <stdlib.h>
25 4d5ee956 2022-07-02 jrick #include <stdio.h>
26 4d5ee956 2022-07-02 jrick #include <fcntl.h>
27 4d5ee956 2022-07-02 jrick #include <unistd.h>
28 4d5ee956 2022-07-02 jrick #include <string.h>
29 4d5ee956 2022-07-02 jrick #include <err.h>
30 4d5ee956 2022-07-02 jrick #include <assert.h>
31 4d5ee956 2022-07-02 jrick #include <sha1.h>
32 5822e79e 2023-02-23 op #include <sha2.h>
34 4d5ee956 2022-07-02 jrick #include "got_error.h"
35 4d5ee956 2022-07-02 jrick #include "got_date.h"
36 4d5ee956 2022-07-02 jrick #include "got_object.h"
37 4d5ee956 2022-07-02 jrick #include "got_opentemp.h"
39 4d5ee956 2022-07-02 jrick #include "got_sigs.h"
41 4d5ee956 2022-07-02 jrick #include "buf.h"
43 4d5ee956 2022-07-02 jrick #ifndef MIN
44 4d5ee956 2022-07-02 jrick #define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
47 4d5ee956 2022-07-02 jrick #ifndef nitems
48 4d5ee956 2022-07-02 jrick #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
51 4d5ee956 2022-07-02 jrick #ifndef GOT_TAG_PATH_SSH_KEYGEN
52 4d5ee956 2022-07-02 jrick #define GOT_TAG_PATH_SSH_KEYGEN "/usr/bin/ssh-keygen"
55 4d5ee956 2022-07-02 jrick #ifndef GOT_TAG_PATH_SIGNIFY
56 4d5ee956 2022-07-02 jrick #define GOT_TAG_PATH_SIGNIFY "/usr/bin/signify"
59 4d5ee956 2022-07-02 jrick const struct got_error *
60 d30ab56f 2022-08-11 naddy got_sigs_apply_unveil(void)
62 4d5ee956 2022-07-02 jrick if (unveil(GOT_TAG_PATH_SSH_KEYGEN, "x") != 0) {
63 4d5ee956 2022-07-02 jrick return got_error_from_errno2("unveil",
64 4d5ee956 2022-07-02 jrick GOT_TAG_PATH_SSH_KEYGEN);
66 4d5ee956 2022-07-02 jrick if (unveil(GOT_TAG_PATH_SIGNIFY, "x") != 0) {
67 4d5ee956 2022-07-02 jrick return got_error_from_errno2("unveil",
68 4d5ee956 2022-07-02 jrick GOT_TAG_PATH_SIGNIFY);
71 4d5ee956 2022-07-02 jrick return NULL;
74 4d5ee956 2022-07-02 jrick const struct got_error *
75 4d5ee956 2022-07-02 jrick got_sigs_sign_tag_ssh(pid_t *newpid, int *in_fd, int *out_fd,
76 4d5ee956 2022-07-02 jrick const char* key_file, int verbosity)
78 4d5ee956 2022-07-02 jrick const struct got_error *error = NULL;
79 4d5ee956 2022-07-02 jrick int pid, in_pfd[2], out_pfd[2];
80 4d5ee956 2022-07-02 jrick const char* argv[11];
81 4d5ee956 2022-07-02 jrick int i = 0, j;
83 4d5ee956 2022-07-02 jrick *newpid = -1;
84 4d5ee956 2022-07-02 jrick *in_fd = -1;
85 4d5ee956 2022-07-02 jrick *out_fd = -1;
87 4d5ee956 2022-07-02 jrick argv[i++] = GOT_TAG_PATH_SSH_KEYGEN;
88 4d5ee956 2022-07-02 jrick argv[i++] = "-Y";
89 4d5ee956 2022-07-02 jrick argv[i++] = "sign";
90 4d5ee956 2022-07-02 jrick argv[i++] = "-f";
91 4d5ee956 2022-07-02 jrick argv[i++] = key_file;
92 4d5ee956 2022-07-02 jrick argv[i++] = "-n";
93 4d5ee956 2022-07-02 jrick argv[i++] = "git";
94 4d5ee956 2022-07-02 jrick if (verbosity <= 0) {
95 4d5ee956 2022-07-02 jrick argv[i++] = "-q";
97 4d5ee956 2022-07-02 jrick /* ssh(1) allows up to 3 "-v" options. */
98 4d5ee956 2022-07-02 jrick for (j = 0; j < MIN(3, verbosity); j++)
99 4d5ee956 2022-07-02 jrick argv[i++] = "-v";
101 4d5ee956 2022-07-02 jrick argv[i++] = NULL;
102 4d5ee956 2022-07-02 jrick assert(i <= nitems(argv));
104 c632297d 2022-07-03 jrick if (pipe(in_pfd) == -1)
105 c632297d 2022-07-03 jrick return got_error_from_errno("pipe");
106 c632297d 2022-07-03 jrick if (pipe(out_pfd) == -1)
107 c632297d 2022-07-03 jrick return got_error_from_errno("pipe");
109 4d5ee956 2022-07-02 jrick pid = fork();
110 4d5ee956 2022-07-02 jrick if (pid == -1) {
111 4d5ee956 2022-07-02 jrick error = got_error_from_errno("fork");
112 4d5ee956 2022-07-02 jrick close(in_pfd[0]);
113 4d5ee956 2022-07-02 jrick close(in_pfd[1]);
114 4d5ee956 2022-07-02 jrick close(out_pfd[0]);
115 4d5ee956 2022-07-02 jrick close(out_pfd[1]);
116 4d5ee956 2022-07-02 jrick return error;
117 4d5ee956 2022-07-02 jrick } else if (pid == 0) {
118 4d5ee956 2022-07-02 jrick if (close(in_pfd[1]) == -1)
119 4d5ee956 2022-07-02 jrick err(1, "close");
120 1bd8e3b1 2022-07-12 jrick if (close(out_pfd[0]) == -1)
121 4d5ee956 2022-07-02 jrick err(1, "close");
122 4d5ee956 2022-07-02 jrick if (dup2(in_pfd[0], 0) == -1)
123 4d5ee956 2022-07-02 jrick err(1, "dup2");
124 1bd8e3b1 2022-07-12 jrick if (dup2(out_pfd[1], 1) == -1)
125 4d5ee956 2022-07-02 jrick err(1, "dup2");
126 4d5ee956 2022-07-02 jrick if (execv(GOT_TAG_PATH_SSH_KEYGEN, (char **const)argv) == -1)
127 7a86002d 2024-02-16 op err(1, "execv %s", GOT_TAG_PATH_SSH_KEYGEN);
128 4d5ee956 2022-07-02 jrick abort(); /* not reached */
130 4d5ee956 2022-07-02 jrick if (close(in_pfd[0]) == -1)
131 4d5ee956 2022-07-02 jrick return got_error_from_errno("close");
132 1bd8e3b1 2022-07-12 jrick if (close(out_pfd[1]) == -1)
133 4d5ee956 2022-07-02 jrick return got_error_from_errno("close");
134 4d5ee956 2022-07-02 jrick *newpid = pid;
135 4d5ee956 2022-07-02 jrick *in_fd = in_pfd[1];
136 1bd8e3b1 2022-07-12 jrick *out_fd = out_pfd[0];
137 4d5ee956 2022-07-02 jrick return NULL;
140 4d5ee956 2022-07-02 jrick static char *
141 4d5ee956 2022-07-02 jrick signer_identity(const char *tagger)
143 4d5ee956 2022-07-02 jrick char *lt, *gt;
145 4d5ee956 2022-07-02 jrick lt = strstr(tagger, " <");
146 4d5ee956 2022-07-02 jrick gt = strrchr(tagger, '>');
147 4d5ee956 2022-07-02 jrick if (lt && gt && lt+1 < gt)
148 4d5ee956 2022-07-02 jrick return strndup(lt+2, gt-lt-2);
149 4d5ee956 2022-07-02 jrick return NULL;
152 4d5ee956 2022-07-02 jrick static const char* BEGIN_SSH_SIG = "-----BEGIN SSH SIGNATURE-----\n";
153 4d5ee956 2022-07-02 jrick static const char* END_SSH_SIG = "-----END SSH SIGNATURE-----\n";
155 4d5ee956 2022-07-02 jrick const char *
156 4d5ee956 2022-07-02 jrick got_sigs_get_tagmsg_ssh_signature(const char *tagmsg)
158 4d5ee956 2022-07-02 jrick const char *s = tagmsg, *begin = NULL, *end = NULL;
160 4d5ee956 2022-07-02 jrick while ((s = strstr(s, BEGIN_SSH_SIG)) != NULL) {
161 4d5ee956 2022-07-02 jrick begin = s;
162 4d5ee956 2022-07-02 jrick s += strlen(BEGIN_SSH_SIG);
164 4d5ee956 2022-07-02 jrick if (begin)
165 4d5ee956 2022-07-02 jrick end = strstr(begin+strlen(BEGIN_SSH_SIG), END_SSH_SIG);
166 4d5ee956 2022-07-02 jrick if (end == NULL)
167 4d5ee956 2022-07-02 jrick return NULL;
168 4d5ee956 2022-07-02 jrick return (end[strlen(END_SSH_SIG)] == '\0') ? begin : NULL;
171 4d5ee956 2022-07-02 jrick static const struct got_error *
172 4d5ee956 2022-07-02 jrick got_tag_write_signed_data(BUF *buf, struct got_tag_object *tag,
173 4d5ee956 2022-07-02 jrick const char *start_sig)
175 4d5ee956 2022-07-02 jrick const struct got_error *err = NULL;
176 4d5ee956 2022-07-02 jrick struct got_object_id *id;
177 4d5ee956 2022-07-02 jrick char *id_str = NULL;
178 4d5ee956 2022-07-02 jrick char *tagger = NULL;
179 4d5ee956 2022-07-02 jrick const char *tagmsg;
180 4d5ee956 2022-07-02 jrick char gmtoff[6];
181 4d5ee956 2022-07-02 jrick size_t len;
183 4d5ee956 2022-07-02 jrick id = got_object_tag_get_object_id(tag);
184 4d5ee956 2022-07-02 jrick err = got_object_id_str(&id_str, id);
186 4d5ee956 2022-07-02 jrick goto done;
188 4d5ee956 2022-07-02 jrick const char *type_label = NULL;
189 4d5ee956 2022-07-02 jrick switch (got_object_tag_get_object_type(tag)) {
190 4d5ee956 2022-07-02 jrick case GOT_OBJ_TYPE_BLOB:
191 4d5ee956 2022-07-02 jrick type_label = GOT_OBJ_LABEL_BLOB;
193 4d5ee956 2022-07-02 jrick case GOT_OBJ_TYPE_TREE:
194 4d5ee956 2022-07-02 jrick type_label = GOT_OBJ_LABEL_TREE;
196 4d5ee956 2022-07-02 jrick case GOT_OBJ_TYPE_COMMIT:
197 4d5ee956 2022-07-02 jrick type_label = GOT_OBJ_LABEL_COMMIT;
199 4d5ee956 2022-07-02 jrick case GOT_OBJ_TYPE_TAG:
200 4d5ee956 2022-07-02 jrick type_label = GOT_OBJ_LABEL_TAG;
205 4d5ee956 2022-07-02 jrick got_date_format_gmtoff(gmtoff, sizeof(gmtoff),
206 4d5ee956 2022-07-02 jrick got_object_tag_get_tagger_gmtoff(tag));
207 4d5ee956 2022-07-02 jrick if (asprintf(&tagger, "%s %lld %s", got_object_tag_get_tagger(tag),
208 b9a36ae5 2022-07-04 naddy (long long)got_object_tag_get_tagger_time(tag), gmtoff) == -1) {
209 4d5ee956 2022-07-02 jrick err = got_error_from_errno("asprintf");
210 4d5ee956 2022-07-02 jrick goto done;
213 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, GOT_TAG_LABEL_OBJECT);
215 4d5ee956 2022-07-02 jrick goto done;
216 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, id_str);
218 4d5ee956 2022-07-02 jrick goto done;
219 4d5ee956 2022-07-02 jrick err = buf_putc(buf, '\n');
221 4d5ee956 2022-07-02 jrick goto done;
222 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, GOT_TAG_LABEL_TYPE);
224 4d5ee956 2022-07-02 jrick goto done;
225 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, type_label);
227 4d5ee956 2022-07-02 jrick goto done;
228 4d5ee956 2022-07-02 jrick err = buf_putc(buf, '\n');
230 4d5ee956 2022-07-02 jrick goto done;
231 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, GOT_TAG_LABEL_TAG);
233 4d5ee956 2022-07-02 jrick goto done;
234 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, got_object_tag_get_name(tag));
236 4d5ee956 2022-07-02 jrick goto done;
237 4d5ee956 2022-07-02 jrick err = buf_putc(buf, '\n');
239 4d5ee956 2022-07-02 jrick goto done;
240 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, GOT_TAG_LABEL_TAGGER);
242 4d5ee956 2022-07-02 jrick goto done;
243 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, tagger);
245 4d5ee956 2022-07-02 jrick goto done;
246 4d5ee956 2022-07-02 jrick err = buf_puts(&len, buf, "\n");
248 4d5ee956 2022-07-02 jrick goto done;
249 4d5ee956 2022-07-02 jrick tagmsg = got_object_tag_get_message(tag);
250 4d5ee956 2022-07-02 jrick err = buf_append(&len, buf, tagmsg, start_sig-tagmsg);
252 4d5ee956 2022-07-02 jrick goto done;
255 4d5ee956 2022-07-02 jrick free(id_str);
256 4d5ee956 2022-07-02 jrick free(tagger);
257 4d5ee956 2022-07-02 jrick return err;
260 4d5ee956 2022-07-02 jrick const struct got_error *
261 4d5ee956 2022-07-02 jrick got_sigs_verify_tag_ssh(char **msg, struct got_tag_object *tag,
262 4d5ee956 2022-07-02 jrick const char *start_sig, const char* allowed_signers, const char* revoked,
263 4d5ee956 2022-07-02 jrick int verbosity)
265 4d5ee956 2022-07-02 jrick const struct got_error *error = NULL;
266 4d5ee956 2022-07-02 jrick const char* argv[17];
267 4d5ee956 2022-07-02 jrick int pid, status, in_pfd[2], out_pfd[2];
268 4d5ee956 2022-07-02 jrick char* parsed_identity = NULL;
269 4d5ee956 2022-07-02 jrick const char *identity;
270 84bc347c 2022-07-14 stsp char *tmppath = NULL;
271 1bd8e3b1 2022-07-12 jrick FILE *tmpsig = NULL;
273 4d5ee956 2022-07-02 jrick int i = 0, j;
275 4d5ee956 2022-07-02 jrick *msg = NULL;
277 4d5ee956 2022-07-02 jrick error = got_opentemp_named(&tmppath, &tmpsig,
278 b90054ed 2022-11-01 stsp GOT_TMPDIR_STR "/got-tagsig", "");
279 4d5ee956 2022-07-02 jrick if (error)
280 4d5ee956 2022-07-02 jrick goto done;
282 4d5ee956 2022-07-02 jrick identity = got_object_tag_get_tagger(tag);
283 4d5ee956 2022-07-02 jrick parsed_identity = signer_identity(identity);
284 4d5ee956 2022-07-02 jrick if (parsed_identity != NULL)
285 4d5ee956 2022-07-02 jrick identity = parsed_identity;
287 4d5ee956 2022-07-02 jrick if (fputs(start_sig, tmpsig) == EOF) {
288 4d5ee956 2022-07-02 jrick error = got_error_from_errno("fputs");
289 4d5ee956 2022-07-02 jrick goto done;
291 4d5ee956 2022-07-02 jrick if (fflush(tmpsig) == EOF) {
292 4d5ee956 2022-07-02 jrick error = got_error_from_errno("fflush");
293 4d5ee956 2022-07-02 jrick goto done;
296 4d5ee956 2022-07-02 jrick error = buf_alloc(&buf, 0);
297 4d5ee956 2022-07-02 jrick if (error)
298 4d5ee956 2022-07-02 jrick goto done;
299 4d5ee956 2022-07-02 jrick error = got_tag_write_signed_data(buf, tag, start_sig);
300 4d5ee956 2022-07-02 jrick if (error)
301 4d5ee956 2022-07-02 jrick goto done;
303 4d5ee956 2022-07-02 jrick argv[i++] = GOT_TAG_PATH_SSH_KEYGEN;
304 4d5ee956 2022-07-02 jrick argv[i++] = "-Y";
305 4d5ee956 2022-07-02 jrick argv[i++] = "verify";
306 4d5ee956 2022-07-02 jrick argv[i++] = "-f";
307 4d5ee956 2022-07-02 jrick argv[i++] = allowed_signers;
308 4d5ee956 2022-07-02 jrick argv[i++] = "-I";
309 4d5ee956 2022-07-02 jrick argv[i++] = identity;
310 4d5ee956 2022-07-02 jrick argv[i++] = "-n";
311 4d5ee956 2022-07-02 jrick argv[i++] = "git";
312 4d5ee956 2022-07-02 jrick argv[i++] = "-s";
313 4d5ee956 2022-07-02 jrick argv[i++] = tmppath;
314 4d5ee956 2022-07-02 jrick if (revoked) {
315 4d5ee956 2022-07-02 jrick argv[i++] = "-r";
316 4d5ee956 2022-07-02 jrick argv[i++] = revoked;
318 4d5ee956 2022-07-02 jrick if (verbosity > 0) {
319 4d5ee956 2022-07-02 jrick /* ssh(1) allows up to 3 "-v" options. */
320 4d5ee956 2022-07-02 jrick for (j = 0; j < MIN(3, verbosity); j++)
321 4d5ee956 2022-07-02 jrick argv[i++] = "-v";
323 4d5ee956 2022-07-02 jrick argv[i++] = NULL;
324 4d5ee956 2022-07-02 jrick assert(i <= nitems(argv));
326 c632297d 2022-07-03 jrick if (pipe(in_pfd) == -1) {
327 c632297d 2022-07-03 jrick error = got_error_from_errno("pipe");
328 4d5ee956 2022-07-02 jrick goto done;
330 c632297d 2022-07-03 jrick if (pipe(out_pfd) == -1) {
331 c632297d 2022-07-03 jrick error = got_error_from_errno("pipe");
332 4d5ee956 2022-07-02 jrick goto done;
335 4d5ee956 2022-07-02 jrick pid = fork();
336 4d5ee956 2022-07-02 jrick if (pid == -1) {
337 4d5ee956 2022-07-02 jrick error = got_error_from_errno("fork");
338 4d5ee956 2022-07-02 jrick close(in_pfd[0]);
339 4d5ee956 2022-07-02 jrick close(in_pfd[1]);
340 4d5ee956 2022-07-02 jrick close(out_pfd[0]);
341 4d5ee956 2022-07-02 jrick close(out_pfd[1]);
342 4d5ee956 2022-07-02 jrick return error;
343 4d5ee956 2022-07-02 jrick } else if (pid == 0) {
344 4d5ee956 2022-07-02 jrick if (close(in_pfd[1]) == -1)
345 4d5ee956 2022-07-02 jrick err(1, "close");
346 1bd8e3b1 2022-07-12 jrick if (close(out_pfd[0]) == -1)
347 4d5ee956 2022-07-02 jrick err(1, "close");
348 4d5ee956 2022-07-02 jrick if (dup2(in_pfd[0], 0) == -1)
349 4d5ee956 2022-07-02 jrick err(1, "dup2");
350 1bd8e3b1 2022-07-12 jrick if (dup2(out_pfd[1], 1) == -1)
351 4d5ee956 2022-07-02 jrick err(1, "dup2");
352 4d5ee956 2022-07-02 jrick if (execv(GOT_TAG_PATH_SSH_KEYGEN, (char **const)argv) == -1)
353 7a86002d 2024-02-16 op err(1, "execv %s", GOT_TAG_PATH_SSH_KEYGEN);
354 4d5ee956 2022-07-02 jrick abort(); /* not reached */
356 4d5ee956 2022-07-02 jrick if (close(in_pfd[0]) == -1) {
357 4d5ee956 2022-07-02 jrick error = got_error_from_errno("close");
358 4d5ee956 2022-07-02 jrick goto done;
360 1bd8e3b1 2022-07-12 jrick if (close(out_pfd[1]) == -1) {
361 4d5ee956 2022-07-02 jrick error = got_error_from_errno("close");
362 4d5ee956 2022-07-02 jrick goto done;
364 4d5ee956 2022-07-02 jrick if (buf_write_fd(buf, in_pfd[1]) == -1) {
365 4d5ee956 2022-07-02 jrick error = got_error_from_errno("write");
366 4d5ee956 2022-07-02 jrick goto done;
368 4d5ee956 2022-07-02 jrick if (close(in_pfd[1]) == -1) {
369 4d5ee956 2022-07-02 jrick error = got_error_from_errno("close");
370 4d5ee956 2022-07-02 jrick goto done;
372 4d5ee956 2022-07-02 jrick if (waitpid(pid, &status, 0) == -1) {
373 4d5ee956 2022-07-02 jrick error = got_error_from_errno("waitpid");
374 4d5ee956 2022-07-02 jrick goto done;
376 4d5ee956 2022-07-02 jrick if (!WIFEXITED(status)) {
377 4d5ee956 2022-07-02 jrick error = got_error(GOT_ERR_BAD_TAG_SIGNATURE);
378 4d5ee956 2022-07-02 jrick goto done;
381 1bd8e3b1 2022-07-12 jrick error = buf_load_fd(&buf, out_pfd[0]);
382 4d5ee956 2022-07-02 jrick if (error)
383 4d5ee956 2022-07-02 jrick goto done;
384 4d5ee956 2022-07-02 jrick error = buf_putc(buf, '\0');
385 4d5ee956 2022-07-02 jrick if (error)
386 4d5ee956 2022-07-02 jrick goto done;
387 1bd8e3b1 2022-07-12 jrick if (close(out_pfd[0]) == -1) {
388 4d5ee956 2022-07-02 jrick error = got_error_from_errno("close");
389 4d5ee956 2022-07-02 jrick goto done;
391 4d5ee956 2022-07-02 jrick *msg = buf_get(buf);
392 4d5ee956 2022-07-02 jrick if (WEXITSTATUS(status) != 0)
393 4d5ee956 2022-07-02 jrick error = got_error(GOT_ERR_BAD_TAG_SIGNATURE);
396 4d5ee956 2022-07-02 jrick free(parsed_identity);
397 84bc347c 2022-07-14 stsp if (tmppath && unlink(tmppath) == -1 && error == NULL)
398 84bc347c 2022-07-14 stsp error = got_error_from_errno("unlink");
399 4d5ee956 2022-07-02 jrick free(tmppath);
400 1bd8e3b1 2022-07-12 jrick close(out_pfd[0]);
401 4d5ee956 2022-07-02 jrick if (tmpsig && fclose(tmpsig) == EOF && error == NULL)
402 4d5ee956 2022-07-02 jrick error = got_error_from_errno("fclose");
403 4d5ee956 2022-07-02 jrick return error;