Blob


1 /*
2 * Copyright (c) 2019 Ori Bernstein <ori@openbsd.org>
3 * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
18 #include <sys/types.h>
19 #include <sys/queue.h>
20 #include <sys/uio.h>
21 #include <sys/time.h>
22 #include <sys/stat.h>
24 #include <stdint.h>
25 #include <errno.h>
26 #include <limits.h>
27 #include <signal.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <ctype.h>
32 #include <fcntl.h>
33 #include <unistd.h>
34 #include <zlib.h>
35 #include <err.h>
37 #include "got_error.h"
38 #include "got_object.h"
39 #include "got_path.h"
40 #include "got_version.h"
41 #include "got_fetch.h"
42 #include "got_reference.h"
44 #include "got_lib_sha1.h"
45 #include "got_lib_delta.h"
46 #include "got_lib_object.h"
47 #include "got_lib_object_parse.h"
48 #include "got_lib_privsep.h"
49 #include "got_lib_pack.h"
50 #include "got_lib_pkt.h"
51 #include "got_lib_gitproto.h"
52 #include "got_lib_ratelimit.h"
54 #ifndef nitems
55 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
56 #endif
58 struct got_object *indexed;
59 static int chattygot;
61 static const struct got_capability got_capabilities[] = {
62 { GOT_CAPA_AGENT, "got/" GOT_VERSION_STR },
63 { GOT_CAPA_OFS_DELTA, NULL },
64 #if 0
65 { GOT_CAPA_SIDE_BAND_64K, NULL },
66 #endif
67 { GOT_CAPA_REPORT_STATUS, NULL },
68 { GOT_CAPA_DELETE_REFS, NULL },
69 };
71 static const struct got_error *
72 send_upload_progress(struct imsgbuf *ibuf, off_t bytes,
73 struct got_ratelimit *rl)
74 {
75 const struct got_error *err = NULL;
76 int elapsed = 0;
78 if (rl) {
79 err = got_ratelimit_check(&elapsed, rl);
80 if (err || !elapsed)
81 return err;
82 }
84 if (imsg_compose(ibuf, GOT_IMSG_SEND_UPLOAD_PROGRESS, 0, 0, -1,
85 &bytes, sizeof(bytes)) == -1)
86 return got_error_from_errno(
87 "imsg_compose SEND_UPLOAD_PROGRESS");
89 return got_privsep_flush_imsg(ibuf);
90 }
92 static const struct got_error *
93 send_pack_request(struct imsgbuf *ibuf)
94 {
95 if (imsg_compose(ibuf, GOT_IMSG_SEND_PACK_REQUEST, 0, 0, -1,
96 NULL, 0) == -1)
97 return got_error_from_errno("imsg_compose SEND_PACK_REQUEST");
98 return got_privsep_flush_imsg(ibuf);
99 }
101 static const struct got_error *
102 send_done(struct imsgbuf *ibuf)
104 if (imsg_compose(ibuf, GOT_IMSG_SEND_DONE, 0, 0, -1, NULL, 0) == -1)
105 return got_error_from_errno("imsg_compose SEND_DONE");
106 return got_privsep_flush_imsg(ibuf);
109 static const struct got_error *
110 recv_packfd(int *packfd, struct imsgbuf *ibuf)
112 const struct got_error *err;
113 struct imsg imsg;
115 *packfd = -1;
117 err = got_privsep_recv_imsg(&imsg, ibuf, 0);
118 if (err)
119 return err;
121 if (imsg.hdr.type == GOT_IMSG_STOP) {
122 err = got_error(GOT_ERR_CANCELLED);
123 goto done;
126 if (imsg.hdr.type != GOT_IMSG_SEND_PACKFD) {
127 err = got_error(GOT_ERR_PRIVSEP_MSG);
128 goto done;
131 if (imsg.hdr.len - IMSG_HEADER_SIZE != 0) {
132 err = got_error(GOT_ERR_PRIVSEP_LEN);
133 goto done;
136 *packfd = imsg.fd;
137 done:
138 imsg_free(&imsg);
139 return err;
142 static const struct got_error *
143 send_pack_file(int sendfd, int packfd, struct imsgbuf *ibuf)
145 const struct got_error *err;
146 unsigned char buf[8192];
147 ssize_t r, w;
148 off_t wtotal = 0;
149 struct got_ratelimit rl;
151 if (lseek(packfd, 0L, SEEK_SET) == -1)
152 return got_error_from_errno("lseek");
154 got_ratelimit_init(&rl, 0, 500);
156 for (;;) {
157 r = read(packfd, buf, sizeof(buf));
158 if (r == -1)
159 return got_error_from_errno("read");
160 if (r == 0)
161 break;
162 w = write(sendfd, buf, r);
163 if (w == -1)
164 return got_error_from_errno("write");
165 if (w != r)
166 return got_error(GOT_ERR_IO);
167 wtotal += w;
168 err = send_upload_progress(ibuf, wtotal, &rl);
169 if (err)
170 return err;
173 return send_upload_progress(ibuf, wtotal, NULL);
176 static const struct got_error *
177 send_error(const char *buf, size_t len)
179 static char msg[1024];
180 size_t i;
182 for (i = 0; i < len && i < sizeof(msg) - 1; i++) {
183 if (!isprint(buf[i]))
184 return got_error_msg(GOT_ERR_BAD_PACKET,
185 "non-printable error message received from server");
186 msg[i] = buf[i];
188 msg[i] = '\0';
189 return got_error_msg(GOT_ERR_SEND_FAILED, msg);
192 static const struct got_error *
193 send_their_ref(struct imsgbuf *ibuf, struct got_object_id *refid,
194 const char *refname)
196 struct ibuf *wbuf;
197 size_t len, reflen = strlen(refname);
199 len = sizeof(struct got_imsg_send_remote_ref) + reflen;
200 if (len >= MAX_IMSGSIZE - IMSG_HEADER_SIZE)
201 return got_error(GOT_ERR_NO_SPACE);
203 wbuf = imsg_create(ibuf, GOT_IMSG_SEND_REMOTE_REF, 0, 0, len);
204 if (wbuf == NULL)
205 return got_error_from_errno("imsg_create SEND_REMOTE_REF");
207 /* Keep in sync with struct got_imsg_send_remote_ref definition! */
208 if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
209 return got_error_from_errno("imsg_add SEND_REMOTE_REF");
210 if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
211 return got_error_from_errno("imsg_add SEND_REMOTE_REF");
212 if (imsg_add(wbuf, refname, reflen) == -1)
213 return got_error_from_errno("imsg_add SEND_REMOTE_REF");
215 wbuf->fd = -1;
216 imsg_close(ibuf, wbuf);
217 return got_privsep_flush_imsg(ibuf);
220 static const struct got_error *
221 send_ref_status(struct imsgbuf *ibuf, const char *refname, int success,
222 struct got_pathlist_head *refs, struct got_pathlist_head *delete_refs)
224 struct ibuf *wbuf;
225 size_t len, reflen = strlen(refname);
226 struct got_pathlist_entry *pe;
227 int ref_valid = 0;
228 char *eol;
230 eol = strchr(refname, '\n');
231 if (eol == NULL) {
232 return got_error_msg(GOT_ERR_BAD_PACKET,
233 "unexpected message from server");
235 *eol = '\0';
237 TAILQ_FOREACH(pe, refs, entry) {
238 if (strcmp(refname, pe->path) == 0) {
239 ref_valid = 1;
240 break;
243 if (!ref_valid) {
244 TAILQ_FOREACH(pe, delete_refs, entry) {
245 if (strcmp(refname, pe->path) == 0) {
246 ref_valid = 1;
247 break;
251 if (!ref_valid) {
252 return got_error_msg(GOT_ERR_BAD_PACKET,
253 "unexpected message from server");
256 len = sizeof(struct got_imsg_send_ref_status) + reflen;
257 if (len >= MAX_IMSGSIZE - IMSG_HEADER_SIZE)
258 return got_error(GOT_ERR_NO_SPACE);
260 wbuf = imsg_create(ibuf, GOT_IMSG_SEND_REF_STATUS,
261 0, 0, len);
262 if (wbuf == NULL)
263 return got_error_from_errno("imsg_create SEND_REF_STATUS");
265 /* Keep in sync with struct got_imsg_send_ref_status definition! */
266 if (imsg_add(wbuf, &success, sizeof(success)) == -1)
267 return got_error_from_errno("imsg_add SEND_REF_STATUS");
268 if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1)
269 return got_error_from_errno("imsg_add SEND_REF_STATUS");
270 if (imsg_add(wbuf, refname, reflen) == -1)
271 return got_error_from_errno("imsg_add SEND_REF_STATUS");
273 wbuf->fd = -1;
274 imsg_close(ibuf, wbuf);
275 return got_privsep_flush_imsg(ibuf);
278 static const struct got_error *
279 describe_refchange(int *n, int *sent_my_capabilites,
280 const char *my_capabilities, char *buf, size_t bufsize,
281 const char *refname, const char *old_hashstr, const char *new_hashstr)
283 *n = snprintf(buf, bufsize, "%s %s %s",
284 old_hashstr, new_hashstr, refname);
285 if (*n >= bufsize)
286 return got_error(GOT_ERR_NO_SPACE);
288 /*
289 * We must announce our capabilities along with the first
290 * reference. Unfortunately, the protocol requires an embedded
291 * NUL as a separator between reference name and capabilities,
292 * which we have to deal with here.
293 * It also requires a linefeed for terminating packet data.
294 */
295 if (!*sent_my_capabilites && my_capabilities != NULL) {
296 int m;
297 if (*n >= bufsize - 1)
298 return got_error(GOT_ERR_NO_SPACE);
299 m = snprintf(buf + *n + 1, /* offset after '\0' */
300 bufsize - (*n + 1), "%s\n", my_capabilities);
301 if (*n + m >= bufsize)
302 return got_error(GOT_ERR_NO_SPACE);
303 *n += m;
304 *sent_my_capabilites = 1;
305 } else {
306 *n = strlcat(buf, "\n", bufsize);
307 if (*n >= bufsize)
308 return got_error(GOT_ERR_NO_SPACE);
311 return NULL;
314 static const struct got_error *
315 send_pack(int fd, struct got_pathlist_head *refs,
316 struct got_pathlist_head *delete_refs, struct imsgbuf *ibuf)
318 const struct got_error *err = NULL;
319 char buf[GOT_PKT_MAX];
320 const unsigned char zero_id[SHA1_DIGEST_LENGTH] = { 0 };
321 char old_hashstr[SHA1_DIGEST_STRING_LENGTH];
322 char new_hashstr[SHA1_DIGEST_STRING_LENGTH];
323 struct got_pathlist_head their_refs;
324 int is_firstpkt = 1;
325 int n, nsent = 0;
326 int packfd = -1;
327 char *id_str = NULL, *refname = NULL;
328 struct got_object_id *id = NULL;
329 char *server_capabilities = NULL, *my_capabilities = NULL;
330 struct got_pathlist_entry *pe;
331 int sent_my_capabilites = 0;
333 TAILQ_INIT(&their_refs);
335 if (TAILQ_EMPTY(refs) && TAILQ_EMPTY(delete_refs))
336 return got_error(GOT_ERR_SEND_EMPTY);
338 while (1) {
339 err = got_pkt_readpkt(&n, fd, buf, sizeof(buf), chattygot);
340 if (err)
341 goto done;
342 if (n == 0)
343 break;
344 if (n >= 4 && strncmp(buf, "ERR ", 4) == 0) {
345 err = send_error(&buf[4], n - 4);
346 goto done;
348 free(id_str);
349 free(refname);
350 err = got_gitproto_parse_refline(&id_str, &refname,
351 &server_capabilities, buf, n);
352 if (err)
353 goto done;
354 if (is_firstpkt) {
355 if (chattygot && server_capabilities[0] != '\0')
356 fprintf(stderr, "%s: server capabilities: %s\n",
357 getprogname(), server_capabilities);
358 err = got_gitproto_match_capabilities(&my_capabilities,
359 NULL, server_capabilities, got_capabilities,
360 nitems(got_capabilities));
361 if (err)
362 goto done;
363 if (chattygot)
364 fprintf(stderr, "%s: my capabilities:%s\n",
365 getprogname(), my_capabilities);
366 is_firstpkt = 0;
368 if (strstr(refname, "^{}")) {
369 if (chattygot) {
370 fprintf(stderr, "%s: ignoring %s\n",
371 getprogname(), refname);
373 continue;
376 id = malloc(sizeof(*id));
377 if (id == NULL) {
378 err = got_error_from_errno("malloc");
379 goto done;
381 if (!got_parse_sha1_digest(id->sha1, id_str)) {
382 err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
383 goto done;
385 err = send_their_ref(ibuf, id, refname);
386 if (err)
387 goto done;
389 err = got_pathlist_append(&their_refs, refname, id);
390 if (chattygot)
391 fprintf(stderr, "%s: remote has %s %s\n",
392 getprogname(), refname, id_str);
393 free(id_str);
394 id_str = NULL;
395 refname = NULL; /* do not free; owned by their_refs */
396 id = NULL; /* do not free; owned by their_refs */
399 if (!TAILQ_EMPTY(delete_refs)) {
400 if (my_capabilities == NULL ||
401 strstr(my_capabilities, GOT_CAPA_DELETE_REFS) == NULL) {
402 err = got_error(GOT_ERR_CAPA_DELETE_REFS);
403 goto done;
407 TAILQ_FOREACH(pe, delete_refs, entry) {
408 const char *refname = pe->path;
409 struct got_pathlist_entry *their_pe;
410 struct got_object_id *their_id = NULL;
412 TAILQ_FOREACH(their_pe, &their_refs, entry) {
413 const char *their_refname = their_pe->path;
414 if (got_path_cmp(refname, their_refname,
415 strlen(refname), strlen(their_refname)) == 0) {
416 their_id = their_pe->data;
417 break;
420 if (their_id == NULL) {
421 err = got_error_fmt(GOT_ERR_NOT_REF,
422 "%s does not exist in remote repository",
423 refname);
424 goto done;
427 got_sha1_digest_to_str(their_id->sha1, old_hashstr,
428 sizeof(old_hashstr));
429 got_sha1_digest_to_str(zero_id, new_hashstr,
430 sizeof(new_hashstr));
431 err = describe_refchange(&n, &sent_my_capabilites,
432 my_capabilities, buf, sizeof(buf), refname,
433 old_hashstr, new_hashstr);
434 if (err)
435 goto done;
436 err = got_pkt_writepkt(fd, buf, n, chattygot);
437 if (err)
438 goto done;
439 if (chattygot) {
440 fprintf(stderr, "%s: deleting %s %s\n",
441 getprogname(), refname, old_hashstr);
443 nsent++;
446 TAILQ_FOREACH(pe, refs, entry) {
447 const char *refname = pe->path;
448 struct got_object_id *id = pe->data;
449 struct got_object_id *their_id = NULL;
450 struct got_pathlist_entry *their_pe;
452 TAILQ_FOREACH(their_pe, &their_refs, entry) {
453 const char *their_refname = their_pe->path;
454 if (got_path_cmp(refname, their_refname,
455 strlen(refname), strlen(their_refname)) == 0) {
456 their_id = their_pe->data;
457 break;
460 if (their_id) {
461 if (got_object_id_cmp(id, their_id) == 0) {
462 if (chattygot) {
463 fprintf(stderr,
464 "%s: no change for %s\n",
465 getprogname(), refname);
467 continue;
469 got_sha1_digest_to_str(their_id->sha1, old_hashstr,
470 sizeof(old_hashstr));
471 } else {
472 got_sha1_digest_to_str(zero_id, old_hashstr,
473 sizeof(old_hashstr));
475 got_sha1_digest_to_str(id->sha1, new_hashstr,
476 sizeof(new_hashstr));
477 err = describe_refchange(&n, &sent_my_capabilites,
478 my_capabilities, buf, sizeof(buf), refname,
479 old_hashstr, new_hashstr);
480 if (err)
481 goto done;
482 err = got_pkt_writepkt(fd, buf, n, chattygot);
483 if (err)
484 goto done;
485 if (chattygot) {
486 if (their_id) {
487 fprintf(stderr, "%s: updating %s %s -> %s\n",
488 getprogname(), refname, old_hashstr,
489 new_hashstr);
490 } else {
491 fprintf(stderr, "%s: creating %s %s\n",
492 getprogname(), refname, new_hashstr);
495 nsent++;
497 err = got_pkt_flushpkt(fd, chattygot);
498 if (err)
499 goto done;
501 err = send_pack_request(ibuf);
502 if (err)
503 goto done;
505 err = recv_packfd(&packfd, ibuf);
506 if (err)
507 goto done;
509 if (packfd != -1) {
510 err = send_pack_file(fd, packfd, ibuf);
511 if (err)
512 goto done;
515 err = got_pkt_readpkt(&n, fd, buf, sizeof(buf), chattygot);
516 if (err)
517 goto done;
518 if (n >= 4 && strncmp(buf, "ERR ", 4) == 0) {
519 err = send_error(&buf[4], n - 4);
520 goto done;
521 } else if (n < 10 || strncmp(buf, "unpack ok\n", 10) != 0) {
522 err = got_error_msg(GOT_ERR_BAD_PACKET,
523 "unexpected message from server");
524 goto done;
527 while (nsent > 0) {
528 err = got_pkt_readpkt(&n, fd, buf, sizeof(buf), chattygot);
529 if (err)
530 goto done;
531 if (n < 3) {
532 err = got_error_msg(GOT_ERR_BAD_PACKET,
533 "unexpected message from server");
534 goto done;
535 } else if (strncmp(buf, "ok ", 3) == 0) {
536 err = send_ref_status(ibuf, buf + 3, 1,
537 refs, delete_refs);
538 if (err)
539 goto done;
540 } else if (strncmp(buf, "ng ", 3) == 0) {
541 err = send_ref_status(ibuf, buf + 3, 0,
542 refs, delete_refs);
543 if (err)
544 goto done;
545 } else {
546 err = got_error_msg(GOT_ERR_BAD_PACKET,
547 "unexpected message from server");
548 goto done;
550 nsent--;
553 err = send_done(ibuf);
554 done:
555 TAILQ_FOREACH(pe, &their_refs, entry) {
556 free((void *)pe->path);
557 free(pe->data);
559 got_pathlist_free(&their_refs);
560 free(id_str);
561 free(id);
562 free(refname);
563 free(server_capabilities);
564 return err;
567 int
568 main(int argc, char **argv)
570 const struct got_error *err = NULL;
571 int sendfd;
572 struct imsgbuf ibuf;
573 struct imsg imsg;
574 struct got_pathlist_head refs;
575 struct got_pathlist_head delete_refs;
576 struct got_pathlist_entry *pe;
577 struct got_imsg_send_request send_req;
578 struct got_imsg_send_ref href;
579 size_t datalen, i;
580 #if 0
581 static int attached;
582 while (!attached)
583 sleep (1);
584 #endif
586 TAILQ_INIT(&refs);
587 TAILQ_INIT(&delete_refs);
589 imsg_init(&ibuf, GOT_IMSG_FD_CHILD);
590 #ifndef PROFILE
591 /* revoke access to most system calls */
592 if (pledge("stdio recvfd", NULL) == -1) {
593 err = got_error_from_errno("pledge");
594 got_privsep_send_error(&ibuf, err);
595 return 1;
598 /* revoke fs access */
599 if (landlock_no_fs() == -1) {
600 err = got_error_from_errno("landlock_no_fs");
601 got_privsep_send_error(&ibuf, err);
602 return 1;
604 if (cap_enter() == -1) {
605 err = got_error_from_errno("cap_enter");
606 got_privsep_send_error(&ibuf, err);
607 return 1;
609 #endif
610 if ((err = got_privsep_recv_imsg(&imsg, &ibuf, 0)) != 0) {
611 if (err->code == GOT_ERR_PRIVSEP_PIPE)
612 err = NULL;
613 goto done;
615 if (imsg.hdr.type == GOT_IMSG_STOP)
616 goto done;
617 if (imsg.hdr.type != GOT_IMSG_SEND_REQUEST) {
618 err = got_error(GOT_ERR_PRIVSEP_MSG);
619 goto done;
621 datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
622 if (datalen < sizeof(send_req)) {
623 err = got_error(GOT_ERR_PRIVSEP_LEN);
624 goto done;
626 memcpy(&send_req, imsg.data, sizeof(send_req));
627 sendfd = imsg.fd;
628 imsg_free(&imsg);
630 if (send_req.verbosity > 0)
631 chattygot += send_req.verbosity;
633 for (i = 0; i < send_req.nrefs; i++) {
634 struct got_object_id *id;
635 char *refname;
637 if ((err = got_privsep_recv_imsg(&imsg, &ibuf, 0)) != 0) {
638 if (err->code == GOT_ERR_PRIVSEP_PIPE)
639 err = NULL;
640 goto done;
642 if (imsg.hdr.type == GOT_IMSG_STOP)
643 goto done;
644 if (imsg.hdr.type != GOT_IMSG_SEND_REF) {
645 err = got_error(GOT_ERR_PRIVSEP_MSG);
646 goto done;
648 datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
649 if (datalen < sizeof(href)) {
650 err = got_error(GOT_ERR_PRIVSEP_LEN);
651 goto done;
653 memcpy(&href, imsg.data, sizeof(href));
654 if (datalen - sizeof(href) < href.name_len) {
655 err = got_error(GOT_ERR_PRIVSEP_LEN);
656 goto done;
658 refname = malloc(href.name_len + 1);
659 if (refname == NULL) {
660 err = got_error_from_errno("malloc");
661 goto done;
663 memcpy(refname, imsg.data + sizeof(href), href.name_len);
664 refname[href.name_len] = '\0';
666 /*
667 * Prevent sending of references that won't make any
668 * sense outside the local repository's context.
669 */
670 if (strncmp(refname, "refs/got/", 9) == 0 ||
671 strncmp(refname, "refs/remotes/", 13) == 0) {
672 err = got_error_fmt(GOT_ERR_SEND_BAD_REF,
673 "%s", refname);
674 goto done;
677 id = malloc(sizeof(*id));
678 if (id == NULL) {
679 free(refname);
680 err = got_error_from_errno("malloc");
681 goto done;
683 memcpy(id->sha1, href.id, SHA1_DIGEST_LENGTH);
684 if (href.delete)
685 err = got_pathlist_append(&delete_refs, refname, id);
686 else
687 err = got_pathlist_append(&refs, refname, id);
688 if (err) {
689 free(refname);
690 free(id);
691 goto done;
694 imsg_free(&imsg);
697 err = send_pack(sendfd, &refs, &delete_refs, &ibuf);
698 done:
699 TAILQ_FOREACH(pe, &refs, entry) {
700 free((char *)pe->path);
701 free(pe->data);
703 got_pathlist_free(&refs);
704 TAILQ_FOREACH(pe, &delete_refs, entry) {
705 free((char *)pe->path);
706 free(pe->data);
708 got_pathlist_free(&delete_refs);
709 if (sendfd != -1 && close(sendfd) == -1 && err == NULL)
710 err = got_error_from_errno("close");
711 if (err != NULL && err->code != GOT_ERR_CANCELLED) {
712 fprintf(stderr, "%s: %s\n", getprogname(), err->msg);
713 got_privsep_send_error(&ibuf, err);
716 exit(0);