2 * Copyright (c) 2018, 2019 Stefan Sperling <stsp@openbsd.org>
3 * Copyright (c) 2019, Ori Bernstein <ori@openbsd.org>
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.
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.
19 * All code runs under the same UID but sensitive code paths are
20 * run in a separate process with tighter pledge(2) promises.
21 * Data is communicated between processes via imsg_flush(3) and imsg_read(3).
22 * This behaviour is transparent to users of the library.
24 * We generally transmit data in imsg buffers, split across several messages
25 * if necessary. File descriptors are used in cases where this is impractical,
26 * such as when accessing pack files or when transferring large blobs.
28 * We exec(2) after a fork(2). Parts of our library functionality are
29 * accessible via separate executables in a libexec directory.
32 #define GOT_IMSG_FD_CHILD (STDERR_FILENO + 1)
34 #ifndef GOT_LIBEXECDIR
35 #define GOT_LIBEXECDIR /usr/local/bin
38 /* Names of helper programs in libexec directory */
39 #define GOT_PROG_READ_OBJECT got-read-object
40 #define GOT_PROG_READ_TREE got-read-tree
41 #define GOT_PROG_READ_COMMIT got-read-commit
42 #define GOT_PROG_READ_BLOB got-read-blob
43 #define GOT_PROG_READ_TAG got-read-tag
44 #define GOT_PROG_READ_PACK got-read-pack
45 #define GOT_PROG_READ_GITCONFIG got-read-gitconfig
46 #define GOT_PROG_READ_GOTCONFIG got-read-gotconfig
47 #define GOT_PROG_READ_PATCH got-read-patch
48 #define GOT_PROG_FETCH_PACK got-fetch-pack
49 #define GOT_PROG_INDEX_PACK got-index-pack
50 #define GOT_PROG_SEND_PACK got-send-pack
52 #define GOT_STRINGIFY(x) #x
53 #define GOT_STRINGVAL(x) GOT_STRINGIFY(x)
55 /* Paths to helper programs in libexec directory */
56 #define GOT_PATH_PROG_READ_OBJECT \
57 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_OBJECT)
58 #define GOT_PATH_PROG_READ_TREE \
59 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TREE)
60 #define GOT_PATH_PROG_READ_COMMIT \
61 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_COMMIT)
62 #define GOT_PATH_PROG_READ_BLOB \
63 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_BLOB)
64 #define GOT_PATH_PROG_READ_TAG \
65 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TAG)
66 #define GOT_PATH_PROG_READ_PACK \
67 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_PACK)
68 #define GOT_PATH_PROG_READ_GITCONFIG \
69 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_GITCONFIG)
70 #define GOT_PATH_PROG_READ_GOTCONFIG \
71 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_GOTCONFIG)
72 #define GOT_PATH_PROG_READ_PATCH \
73 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_PATCH)
74 #define GOT_PATH_PROG_FETCH_PACK \
75 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_FETCH_PACK)
76 #define GOT_PATH_PROG_SEND_PACK \
77 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_SEND_PACK)
78 #define GOT_PATH_PROG_INDEX_PACK \
79 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_INDEX_PACK)
81 struct got_privsep_child {
88 /* An error occured while processing a request. */
91 /* Stop the child process. */
95 * Messages concerned with read access to objects in a repository.
96 * Object and pack files are opened by the main process, where
97 * data may be read as a byte string but without any interpretation.
98 * Decompression and parsing of object and pack files occurs in a
99 * separate process which runs under pledge("stdio recvfd").
100 * This sandboxes our own repository parsing code, as well as zlib.
102 GOT_IMSG_OBJECT_REQUEST,
104 GOT_IMSG_COMMIT_REQUEST,
106 GOT_IMSG_COMMIT_LOGMSG,
107 GOT_IMSG_TREE_REQUEST,
110 GOT_IMSG_BLOB_REQUEST,
113 GOT_IMSG_TAG_REQUEST,
117 /* Messages related to networking. */
118 GOT_IMSG_FETCH_REQUEST,
119 GOT_IMSG_FETCH_HAVE_REF,
120 GOT_IMSG_FETCH_WANTED_BRANCH,
121 GOT_IMSG_FETCH_WANTED_REF,
122 GOT_IMSG_FETCH_OUTFD,
123 GOT_IMSG_FETCH_SYMREFS,
125 GOT_IMSG_FETCH_SERVER_PROGRESS,
126 GOT_IMSG_FETCH_DOWNLOAD_PROGRESS,
128 GOT_IMSG_IDXPACK_REQUEST,
129 GOT_IMSG_IDXPACK_OUTFD,
130 GOT_IMSG_IDXPACK_PROGRESS,
131 GOT_IMSG_IDXPACK_DONE,
132 GOT_IMSG_SEND_REQUEST,
134 GOT_IMSG_SEND_REMOTE_REF,
135 GOT_IMSG_SEND_REF_STATUS,
136 GOT_IMSG_SEND_PACK_REQUEST,
137 GOT_IMSG_SEND_PACKFD,
138 GOT_IMSG_SEND_UPLOAD_PROGRESS,
141 /* Messages related to pack files. */
144 GOT_IMSG_PACKED_OBJECT_REQUEST,
145 GOT_IMSG_COMMIT_TRAVERSAL_REQUEST,
146 GOT_IMSG_TRAVERSED_COMMITS,
147 GOT_IMSG_COMMIT_TRAVERSAL_DONE,
149 /* Message sending file descriptor to a temporary file. */
152 /* Messages related to gitconfig files. */
153 GOT_IMSG_GITCONFIG_PARSE_REQUEST,
154 GOT_IMSG_GITCONFIG_REPOSITORY_FORMAT_VERSION_REQUEST,
155 GOT_IMSG_GITCONFIG_REPOSITORY_EXTENSIONS_REQUEST,
156 GOT_IMSG_GITCONFIG_AUTHOR_NAME_REQUEST,
157 GOT_IMSG_GITCONFIG_AUTHOR_EMAIL_REQUEST,
158 GOT_IMSG_GITCONFIG_REMOTES_REQUEST,
159 GOT_IMSG_GITCONFIG_INT_VAL,
160 GOT_IMSG_GITCONFIG_STR_VAL,
161 GOT_IMSG_GITCONFIG_REMOTES,
162 GOT_IMSG_GITCONFIG_REMOTE,
163 GOT_IMSG_GITCONFIG_OWNER_REQUEST,
164 GOT_IMSG_GITCONFIG_OWNER,
166 /* Messages related to gotconfig files. */
167 GOT_IMSG_GOTCONFIG_PARSE_REQUEST,
168 GOT_IMSG_GOTCONFIG_AUTHOR_REQUEST,
169 GOT_IMSG_GOTCONFIG_REMOTES_REQUEST,
170 GOT_IMSG_GOTCONFIG_INT_VAL,
171 GOT_IMSG_GOTCONFIG_STR_VAL,
172 GOT_IMSG_GOTCONFIG_REMOTES,
173 GOT_IMSG_GOTCONFIG_REMOTE,
175 /* Raw object access. Uncompress object data but do not parse it. */
176 GOT_IMSG_RAW_OBJECT_REQUEST,
177 GOT_IMSG_RAW_OBJECT_OUTFD,
178 GOT_IMSG_PACKED_RAW_OBJECT_REQUEST,
181 /* Read raw delta data from pack files. */
182 GOT_IMSG_RAW_DELTA_OUTFD,
183 GOT_IMSG_RAW_DELTA_REQUEST,
186 /* Re-use deltas found in a pack file. */
187 GOT_IMSG_DELTA_REUSE_REQUEST,
188 GOT_IMSG_REUSED_DELTAS,
189 GOT_IMSG_DELTA_REUSE_DONE,
191 /* Transfer a list of object IDs. */
192 GOT_IMSG_OBJ_ID_LIST,
193 GOT_IMSG_OBJ_ID_LIST_DONE,
195 /* Messages related to patch files. */
204 /* Structure for GOT_IMSG_ERROR. */
205 struct got_imsg_error {
206 int code; /* an error code from got_error.h */
207 int errno_code; /* in case code equals GOT_ERR_ERRNO */
208 } __attribute__((__packed__));
211 * Structure for GOT_IMSG_TREE_REQUEST and GOT_IMSG_OBJECT data.
213 struct got_imsg_object {
214 uint8_t id[SHA1_DIGEST_LENGTH];
216 /* These fields are the same as in struct got_object. */
223 } __attribute__((__packed__));
225 /* Structure for GOT_IMSG_COMMIT data. */
226 struct got_imsg_commit_object {
227 uint8_t tree_id[SHA1_DIGEST_LENGTH];
230 time_t author_gmtoff;
231 size_t committer_len;
232 time_t committer_time;
233 time_t committer_gmtoff;
238 * Followed by author_len + committer_len data bytes
241 /* Followed by 'nparents' SHA1_DIGEST_LENGTH length strings */
244 * Followed by 'logmsg_len' bytes of commit log message data in
245 * one or more GOT_IMSG_COMMIT_LOGMSG messages.
247 } __attribute__((__packed__));
250 /* Structure for GOT_IMSG_TREE_ENTRY. */
251 struct got_imsg_tree_entry {
252 char id[SHA1_DIGEST_LENGTH];
254 /* Followed by entry's name in remaining data of imsg buffer. */
255 } __attribute__((__packed__));
257 /* Structure for GOT_IMSG_TREE_OBJECT_REPLY data. */
258 struct got_imsg_tree_object {
259 int nentries; /* This many TREE_ENTRY messages follow. */
262 /* Structure for GOT_IMSG_BLOB. */
263 struct got_imsg_blob {
268 * If size <= GOT_PRIVSEP_INLINE_BLOB_DATA_MAX, blob data follows
269 * in the imsg buffer. Otherwise, blob data has been written to a
270 * file descriptor passed via the GOT_IMSG_BLOB_OUTFD imsg.
272 #define GOT_PRIVSEP_INLINE_BLOB_DATA_MAX \
273 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_blob))
276 /* Structure for GOT_IMSG_RAW_OBJECT. */
277 struct got_imsg_raw_obj {
282 * If size <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX, object data follows
283 * in the imsg buffer. Otherwise, object data has been written to a
284 * file descriptor passed via the GOT_IMSG_RAW_OBJECT_OUTFD imsg.
286 #define GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX \
287 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_raw_obj))
290 /* Structure for GOT_IMSG_RAW_DELTA. */
291 struct got_imsg_raw_delta {
292 uint8_t base_id[SHA1_DIGEST_LENGTH];
294 uint64_t result_size;
296 off_t delta_compressed_size;
298 off_t delta_out_offset;
301 * Delta data has been written at delta_out_offset to the file
302 * descriptor passed via the GOT_IMSG_RAW_DELTA_OUTFD imsg.
306 /* Structures for GOT_IMSG_REUSED_DELTAS. */
307 struct got_imsg_reused_delta {
308 struct got_object_id id;
309 struct got_object_id base_id;
311 uint64_t result_size;
313 off_t delta_compressed_size;
315 off_t delta_out_offset;
318 * Delta data has been written at delta_out_offset to the file
319 * descriptor passed via the GOT_IMSG_RAW_DELTA_OUTFD imsg.
322 struct got_imsg_reused_deltas {
326 * Followed by ndeltas * struct got_imsg_reused_delta.
329 #define GOT_IMSG_REUSED_DELTAS_MAX_NDELTAS \
330 ((MAX_IMSGSIZE - IMSG_HEADER_SIZE - \
331 sizeof(struct got_imsg_reused_deltas)) \
332 / sizeof(struct got_imsg_reused_delta))
335 /* Structure for GOT_IMSG_TAG data. */
336 struct got_imsg_tag_object {
337 uint8_t id[SHA1_DIGEST_LENGTH];
342 time_t tagger_gmtoff;
346 * Followed by tag_len + tagger_len data bytes
350 * Followed by 'tagmsg_len' bytes of tag message data in
351 * one or more GOT_IMSG_TAG_TAGMSG messages.
353 } __attribute__((__packed__));
355 /* Structure for GOT_IMSG_FETCH_HAVE_REF data. */
356 struct got_imsg_fetch_have_ref {
357 uint8_t id[SHA1_DIGEST_LENGTH];
359 /* Followed by name_len data bytes. */
360 } __attribute__((__packed__));
362 /* Structure for GOT_IMSG_FETCH_WANTED_BRANCH data. */
363 struct got_imsg_fetch_wanted_branch {
365 /* Followed by name_len data bytes. */
366 } __attribute__((__packed__));
368 /* Structure for GOT_IMSG_FETCH_WANTED_REF data. */
369 struct got_imsg_fetch_wanted_ref {
371 /* Followed by name_len data bytes. */
372 } __attribute__((__packed__));
374 /* Structure for GOT_IMSG_FETCH_REQUEST data. */
375 struct got_imsg_fetch_request {
376 int fetch_all_branches;
380 size_t n_wanted_branches;
381 size_t n_wanted_refs;
382 /* Followed by n_have_refs GOT_IMSG_FETCH_HAVE_REF messages. */
383 /* Followed by n_wanted_branches times GOT_IMSG_FETCH_WANTED_BRANCH. */
384 /* Followed by n_wanted_refs times GOT_IMSG_FETCH_WANTED_REF. */
385 } __attribute__((__packed__));
387 /* Structures for GOT_IMSG_FETCH_SYMREFS data. */
388 struct got_imsg_fetch_symref {
393 * Followed by name_len + target_len data bytes.
395 } __attribute__((__packed__));
397 struct got_imsg_fetch_symrefs {
400 /* Followed by nsymrefs times of got_imsg_fetch_symref data. */
401 } __attribute__((__packed__));
403 /* Structure for GOT_IMSG_FETCH_REF data. */
404 struct got_imsg_fetch_ref {
405 /* Describes a reference which will be fetched. */
406 uint8_t refid[SHA1_DIGEST_LENGTH];
407 /* Followed by reference name in remaining data of imsg buffer. */
410 /* Structure for GOT_IMSG_FETCH_DOWNLOAD_PROGRESS data. */
411 struct got_imsg_fetch_download_progress {
412 /* Number of packfile data bytes downloaded so far. */
413 off_t packfile_bytes;
416 /* Structure for GOT_IMSG_SEND_REQUEST data. */
417 struct got_imsg_send_request {
420 /* Followed by nrefs GOT_IMSG_SEND_REF messages. */
421 } __attribute__((__packed__));
423 /* Structure for GOT_IMSG_SEND_UPLOAD_PROGRESS data. */
424 struct got_imsg_send_upload_progress {
425 /* Number of packfile data bytes uploaded so far. */
426 off_t packfile_bytes;
429 /* Structure for GOT_IMSG_SEND_REF data. */
430 struct got_imsg_send_ref {
431 uint8_t id[SHA1_DIGEST_LENGTH];
434 /* Followed by name_len data bytes. */
435 } __attribute__((__packed__));
437 /* Structure for GOT_IMSG_SEND_REMOTE_REF data. */
438 struct got_imsg_send_remote_ref {
439 uint8_t id[SHA1_DIGEST_LENGTH];
441 /* Followed by name_len data bytes. */
442 } __attribute__((__packed__));
444 /* Structure for GOT_IMSG_SEND_REF_STATUS data. */
445 struct got_imsg_send_ref_status {
448 /* Followed by name_len data bytes. */
449 } __attribute__((__packed__));
451 /* Structure for GOT_IMSG_IDXPACK_REQUEST data. */
452 struct got_imsg_index_pack_request {
453 uint8_t pack_hash[SHA1_DIGEST_LENGTH];
454 } __attribute__((__packed__));
456 /* Structure for GOT_IMSG_IDXPACK_PROGRESS data. */
457 struct got_imsg_index_pack_progress {
458 /* Total number of objects in pack file. */
461 /* Number of objects indexed so far. */
464 /* Number of non-deltified objects in pack file. */
467 /* Number of deltified objects resolved so far. */
471 /* Structure for GOT_IMSG_PACKIDX. */
472 struct got_imsg_packidx {
475 /* Additionally, a file desciptor is passed via imsg. */
478 /* Structure for GOT_IMSG_PACK. */
479 struct got_imsg_pack {
480 char path_packfile[PATH_MAX];
482 /* Additionally, a file desciptor is passed via imsg. */
483 } __attribute__((__packed__));
486 * Structure for GOT_IMSG_OBJECT_REQUEST, GOT_IMSG_BLOB_REQUEST,
487 * GOT_IMSG_TREE_REQUEST, GOT_IMSG_COMMIT_REQUEST, and
488 * GOT_IMSG_TAG_REQUEST data.
490 struct got_object_id;
493 * Structure for GOT_IMSG_PACKED_OBJECT_REQUEST and
494 * GOT_IMSG_PACKED_RAW_OBJECT_REQUEST data.
496 struct got_imsg_packed_object {
497 uint8_t id[SHA1_DIGEST_LENGTH];
499 } __attribute__((__packed__));
502 * Structure for GOT_IMSG_DELTA data.
504 struct got_imsg_delta {
505 /* These fields are the same as in struct got_delta. */
514 * Structure for GOT_IMSG_RAW_DELTA_REQUEST data.
516 struct got_imsg_raw_delta_request {
517 uint8_t id[SHA1_DIGEST_LENGTH];
522 * Structure for GOT_IMSG_OBJ_ID_LIST data.
523 * Multiple such messages may be sent back-to-back, where each message
524 * contains a chunk of IDs. The entire list must be terminated with a
525 * GOT_IMSG_OBJ_ID_LIST_DONE message.
527 struct got_imsg_object_idlist {
531 * Followed by nids * struct got_object_id.
534 #define GOT_IMSG_OBJ_ID_LIST_MAX_NIDS \
535 ((MAX_IMSGSIZE - IMSG_HEADER_SIZE - \
536 sizeof(struct got_imsg_object_idlist)) / sizeof(struct got_object_id))
539 /* Structure for GOT_IMSG_COMMIT_TRAVERSAL_REQUEST */
540 struct got_imsg_commit_traversal_request {
541 uint8_t id[SHA1_DIGEST_LENGTH];
544 /* Followed by path_len bytes of path data */
545 } __attribute__((__packed__));
547 /* Structure for GOT_IMSG_TRAVERSED_COMMITS */
548 struct got_imsg_traversed_commits {
550 /* Followed by ncommit IDs of SHA1_DIGEST_LENGTH each */
551 } __attribute__((__packed__));
554 * Structure for GOT_IMSG_GOTCONFIG_REMOTE and
555 * GOT_IMSG_GOTCONFIG_REMOTE data.
557 struct got_imsg_remote {
559 size_t fetch_url_len;
561 int mirror_references;
562 int fetch_all_branches;
567 /* Followed by name_len data bytes. */
568 /* Followed by fetch_url_len + send_url_len data bytes. */
569 /* Followed by nfetch_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
570 /* Followed by nsend_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
571 /* Followed by nfetch_refs GOT_IMSG_GITCONFIG_STR_VAL messages. */
572 } __attribute__((__packed__));
575 * Structure for GOT_IMSG_GITCONFIG_REMOTES data.
577 struct got_imsg_remotes {
578 int nremotes; /* This many GOT_IMSG_GITCONFIG_REMOTE messages follow. */
582 * Structure for GOT_IMSG_PATCH data.
584 struct got_imsg_patch {
591 * Structure for GOT_IMSG_PATCH_HUNK data.
593 struct got_imsg_patch_hunk {
600 struct got_remote_repo;
603 struct got_pathlist_head;
605 const struct got_error *got_send_ack(pid_t);
606 const struct got_error *got_privsep_wait_for_child(pid_t);
607 const struct got_error *got_privsep_flush_imsg(struct imsgbuf *);
608 const struct got_error *got_privsep_send_stop(int);
609 const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
611 void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
612 const struct got_error *got_privsep_send_ack(struct imsgbuf *);
613 const struct got_error *got_privsep_wait_ack(struct imsgbuf *);
614 const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int,
615 struct got_object_id *);
616 const struct got_error *got_privsep_send_raw_obj_req(struct imsgbuf *, int,
617 struct got_object_id *);
618 const struct got_error *got_privsep_send_raw_obj_outfd(struct imsgbuf *, int);
619 const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
620 struct got_object_id *, int);
621 const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
622 struct got_object_id *, int);
623 const struct got_error *got_privsep_send_tag_req(struct imsgbuf *, int,
624 struct got_object_id *, int);
625 const struct got_error *got_privsep_send_blob_req(struct imsgbuf *, int,
626 struct got_object_id *, int);
627 const struct got_error *got_privsep_send_blob_outfd(struct imsgbuf *, int);
628 const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
629 const struct got_error *got_privsep_send_obj(struct imsgbuf *,
630 struct got_object *);
631 const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *,
633 const struct got_error *got_privsep_send_index_pack_outfd(struct imsgbuf *,
635 const struct got_error *got_privsep_recv_index_progress(int *, int *, int *,
636 int *, int *, struct imsgbuf *ibuf);
637 const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
638 struct got_pathlist_head *, int, struct got_pathlist_head *,
639 struct got_pathlist_head *, int, int);
640 const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
641 const struct got_error *got_privsep_recv_fetch_progress(int *,
642 struct got_object_id **, char **, struct got_pathlist_head *, char **,
643 off_t *, uint8_t *, struct imsgbuf *);
644 const struct got_error *got_privsep_send_send_req(struct imsgbuf *, int,
645 struct got_pathlist_head *, struct got_pathlist_head *, int);
646 const struct got_error *got_privsep_recv_send_remote_refs(
647 struct got_pathlist_head *, struct imsgbuf *);
648 const struct got_error *got_privsep_send_packfd(struct imsgbuf *, int);
649 const struct got_error *got_privsep_recv_send_progress(int *, off_t *,
650 int *, char **, struct imsgbuf *);
651 const struct got_error *got_privsep_get_imsg_obj(struct got_object **,
652 struct imsg *, struct imsgbuf *);
653 const struct got_error *got_privsep_recv_obj(struct got_object **,
655 const struct got_error *got_privsep_send_raw_obj(struct imsgbuf *, off_t,
657 const struct got_error *got_privsep_recv_raw_obj(uint8_t **, off_t *, size_t *,
659 const struct got_error *got_privsep_send_commit(struct imsgbuf *,
660 struct got_commit_object *);
661 const struct got_error *got_privsep_recv_commit(struct got_commit_object **,
663 const struct got_error *got_privsep_recv_tree(struct got_tree_object **,
665 const struct got_error *got_privsep_send_tree(struct imsgbuf *,
666 struct got_pathlist_head *, int);
667 const struct got_error *got_privsep_send_blob(struct imsgbuf *, size_t, size_t,
669 const struct got_error *got_privsep_recv_blob(uint8_t **, size_t *, size_t *,
671 const struct got_error *got_privsep_send_tag(struct imsgbuf *,
672 struct got_tag_object *);
673 const struct got_error *got_privsep_recv_tag(struct got_tag_object **,
675 const struct got_error *got_privsep_init_pack_child(struct imsgbuf *,
676 struct got_pack *, struct got_packidx *);
677 const struct got_error *got_privsep_send_packed_obj_req(struct imsgbuf *, int,
678 struct got_object_id *);
679 const struct got_error *got_privsep_send_packed_raw_obj_req(struct imsgbuf *,
680 int, struct got_object_id *);
681 const struct got_error *got_privsep_send_pack_child_ready(struct imsgbuf *);
683 const struct got_error *got_privsep_send_gitconfig_parse_req(struct imsgbuf *,
685 const struct got_error *
686 got_privsep_send_gitconfig_repository_format_version_req(struct imsgbuf *);
687 const struct got_error *got_privsep_send_gitconfig_repository_extensions_req(
689 const struct got_error *got_privsep_send_gitconfig_author_name_req(
691 const struct got_error *got_privsep_send_gitconfig_author_email_req(
693 const struct got_error *got_privsep_send_gitconfig_remotes_req(
695 const struct got_error *got_privsep_send_gitconfig_owner_req(struct imsgbuf *);
696 const struct got_error *got_privsep_recv_gitconfig_str(char **,
698 const struct got_error *got_privsep_recv_gitconfig_int(int *, struct imsgbuf *);
699 const struct got_error *got_privsep_recv_gitconfig_remotes(
700 struct got_remote_repo **, int *, struct imsgbuf *);
702 const struct got_error *got_privsep_send_gotconfig_parse_req(struct imsgbuf *,
704 const struct got_error *got_privsep_send_gotconfig_author_req(struct imsgbuf *);
705 const struct got_error *got_privsep_send_gotconfig_remotes_req(
707 const struct got_error *got_privsep_recv_gotconfig_str(char **,
709 const struct got_error *got_privsep_recv_gotconfig_remotes(
710 struct got_remote_repo **, int *, struct imsgbuf *);
712 const struct got_error *got_privsep_send_commit_traversal_request(
713 struct imsgbuf *, struct got_object_id *, int, const char *);
714 const struct got_error *got_privsep_recv_traversed_commits(
715 struct got_commit_object **, struct got_object_id **,
716 struct got_object_id_queue *, struct imsgbuf *);
718 const struct got_error *got_privsep_send_raw_delta_req(struct imsgbuf *, int,
719 struct got_object_id *);
720 const struct got_error *got_privsep_send_raw_delta_outfd(struct imsgbuf *, int);
721 const struct got_error *got_privsep_send_raw_delta(struct imsgbuf *, uint64_t,
722 uint64_t, off_t, off_t, off_t, off_t, struct got_object_id *);
723 const struct got_error *got_privsep_recv_raw_delta(uint64_t *, uint64_t *,
724 off_t *, off_t *, off_t *, off_t *, struct got_object_id **,
727 const struct got_error *got_privsep_send_object_idlist(struct imsgbuf *,
728 struct got_object_id **, size_t);
729 const struct got_error *got_privsep_send_object_idlist_done(struct imsgbuf *);
730 const struct got_error *got_privsep_recv_object_idlist(int *,
731 struct got_object_id **, size_t *, struct imsgbuf *);
733 const struct got_error *got_privsep_send_delta_reuse_req(struct imsgbuf *);
734 const struct got_error *got_privsep_send_reused_deltas(struct imsgbuf *,
735 struct got_imsg_reused_delta *, size_t);
736 const struct got_error *got_privsep_send_reused_deltas_done(struct imsgbuf *);
737 const struct got_error *got_privsep_recv_reused_deltas(int *,
738 struct got_imsg_reused_delta *, size_t *, struct imsgbuf *);
740 void got_privsep_exec_child(int[2], const char *, const char *);