Blob


1 /*
2 * Copyright (c) 2018, 2019 Stefan Sperling <stsp@openbsd.org>
3 * Copyright (c) 2019, Ori Bernstein <ori@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 /*
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.
23 *
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.
27 *
28 * We exec(2) after a fork(2). Parts of our library functionality are
29 * accessible via separate executables in a libexec directory.
30 */
32 #define GOT_IMSG_FD_CHILD (STDERR_FILENO + 1)
34 #ifndef GOT_LIBEXECDIR
35 #define GOT_LIBEXECDIR /usr/libexec
36 #endif
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_FETCH_PACK got-fetch-pack
48 #define GOT_PROG_INDEX_PACK got-index-pack
49 #define GOT_PROG_SEND_PACK got-send-pack
51 #define GOT_STRINGIFY(x) #x
52 #define GOT_STRINGVAL(x) GOT_STRINGIFY(x)
54 /* Paths to helper programs in libexec directory */
55 #define GOT_PATH_PROG_READ_OBJECT \
56 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_OBJECT)
57 #define GOT_PATH_PROG_READ_TREE \
58 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TREE)
59 #define GOT_PATH_PROG_READ_COMMIT \
60 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_COMMIT)
61 #define GOT_PATH_PROG_READ_BLOB \
62 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_BLOB)
63 #define GOT_PATH_PROG_READ_TAG \
64 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TAG)
65 #define GOT_PATH_PROG_READ_PACK \
66 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_PACK)
67 #define GOT_PATH_PROG_READ_GITCONFIG \
68 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_GITCONFIG)
69 #define GOT_PATH_PROG_READ_GOTCONFIG \
70 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_GOTCONFIG)
71 #define GOT_PATH_PROG_FETCH_PACK \
72 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_FETCH_PACK)
73 #define GOT_PATH_PROG_SEND_PACK \
74 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_SEND_PACK)
75 #define GOT_PATH_PROG_INDEX_PACK \
76 GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_INDEX_PACK)
78 struct got_privsep_child {
79 int imsg_fd;
80 pid_t pid;
81 struct imsgbuf *ibuf;
82 };
84 enum got_imsg_type {
85 /* An error occured while processing a request. */
86 GOT_IMSG_ERROR,
88 /* Stop the child process. */
89 GOT_IMSG_STOP,
91 /*
92 * Messages concerned with read access to objects in a repository.
93 * Object and pack files are opened by the main process, where
94 * data may be read as a byte string but without any interpretation.
95 * Decompression and parsing of object and pack files occurs in a
96 * separate process which runs under pledge("stdio recvfd").
97 * This sandboxes our own repository parsing code, as well as zlib.
98 */
99 GOT_IMSG_OBJECT_REQUEST,
100 GOT_IMSG_OBJECT,
101 GOT_IMSG_COMMIT_REQUEST,
102 GOT_IMSG_COMMIT,
103 GOT_IMSG_COMMIT_LOGMSG,
104 GOT_IMSG_TREE_REQUEST,
105 GOT_IMSG_TREE,
106 GOT_IMSG_TREE_ENTRY,
107 GOT_IMSG_BLOB_REQUEST,
108 GOT_IMSG_BLOB_OUTFD,
109 GOT_IMSG_BLOB,
110 GOT_IMSG_TAG_REQUEST,
111 GOT_IMSG_TAG,
112 GOT_IMSG_TAG_TAGMSG,
114 /* Messages related to networking. */
115 GOT_IMSG_FETCH_REQUEST,
116 GOT_IMSG_FETCH_HAVE_REF,
117 GOT_IMSG_FETCH_WANTED_BRANCH,
118 GOT_IMSG_FETCH_WANTED_REF,
119 GOT_IMSG_FETCH_OUTFD,
120 GOT_IMSG_FETCH_SYMREFS,
121 GOT_IMSG_FETCH_REF,
122 GOT_IMSG_FETCH_SERVER_PROGRESS,
123 GOT_IMSG_FETCH_DOWNLOAD_PROGRESS,
124 GOT_IMSG_FETCH_DONE,
125 GOT_IMSG_IDXPACK_REQUEST,
126 GOT_IMSG_IDXPACK_OUTFD,
127 GOT_IMSG_IDXPACK_PROGRESS,
128 GOT_IMSG_IDXPACK_DONE,
129 GOT_IMSG_SEND_REQUEST,
130 GOT_IMSG_SEND_REF,
131 GOT_IMSG_SEND_REMOTE_REF,
132 GOT_IMSG_SEND_REF_STATUS,
133 GOT_IMSG_SEND_PACK_REQUEST,
134 GOT_IMSG_SEND_PACKFD,
135 GOT_IMSG_SEND_UPLOAD_PROGRESS,
136 GOT_IMSG_SEND_DONE,
138 /* Messages related to pack files. */
139 GOT_IMSG_PACKIDX,
140 GOT_IMSG_PACK,
141 GOT_IMSG_PACKED_OBJECT_REQUEST,
142 GOT_IMSG_COMMIT_TRAVERSAL_REQUEST,
143 GOT_IMSG_TRAVERSED_COMMITS,
144 GOT_IMSG_COMMIT_TRAVERSAL_DONE,
146 /* Message sending file descriptor to a temporary file. */
147 GOT_IMSG_TMPFD,
149 /* Messages related to gitconfig files. */
150 GOT_IMSG_GITCONFIG_PARSE_REQUEST,
151 GOT_IMSG_GITCONFIG_REPOSITORY_FORMAT_VERSION_REQUEST,
152 GOT_IMSG_GITCONFIG_REPOSITORY_EXTENSIONS_REQUEST,
153 GOT_IMSG_GITCONFIG_AUTHOR_NAME_REQUEST,
154 GOT_IMSG_GITCONFIG_AUTHOR_EMAIL_REQUEST,
155 GOT_IMSG_GITCONFIG_REMOTES_REQUEST,
156 GOT_IMSG_GITCONFIG_INT_VAL,
157 GOT_IMSG_GITCONFIG_STR_VAL,
158 GOT_IMSG_GITCONFIG_REMOTES,
159 GOT_IMSG_GITCONFIG_REMOTE,
160 GOT_IMSG_GITCONFIG_OWNER_REQUEST,
161 GOT_IMSG_GITCONFIG_OWNER,
163 /* Messages related to gotconfig files. */
164 GOT_IMSG_GOTCONFIG_PARSE_REQUEST,
165 GOT_IMSG_GOTCONFIG_AUTHOR_REQUEST,
166 GOT_IMSG_GOTCONFIG_REMOTES_REQUEST,
167 GOT_IMSG_GOTCONFIG_INT_VAL,
168 GOT_IMSG_GOTCONFIG_STR_VAL,
169 GOT_IMSG_GOTCONFIG_REMOTES,
170 GOT_IMSG_GOTCONFIG_REMOTE,
172 /* Raw object access. Uncompress object data but do not parse it. */
173 GOT_IMSG_RAW_OBJECT_REQUEST,
174 GOT_IMSG_RAW_OBJECT_OUTFD,
175 GOT_IMSG_PACKED_RAW_OBJECT_REQUEST,
176 GOT_IMSG_RAW_OBJECT,
178 /* Read raw delta data from pack files. */
179 GOT_IMSG_RAW_DELTA_OUTFD,
180 GOT_IMSG_RAW_DELTA_REQUEST,
181 GOT_IMSG_RAW_DELTA,
182 };
184 /* Structure for GOT_IMSG_ERROR. */
185 struct got_imsg_error {
186 int code; /* an error code from got_error.h */
187 int errno_code; /* in case code equals GOT_ERR_ERRNO */
188 } __attribute__((__packed__));
190 /*
191 * Structure for GOT_IMSG_TREE_REQUEST and GOT_IMSG_OBJECT data.
192 */
193 struct got_imsg_object {
194 uint8_t id[SHA1_DIGEST_LENGTH];
196 /* These fields are the same as in struct got_object. */
197 int type;
198 int flags;
199 size_t hdrlen;
200 size_t size;
201 off_t pack_offset;
202 int pack_idx;
203 } __attribute__((__packed__));
205 /* Structure for GOT_IMSG_COMMIT data. */
206 struct got_imsg_commit_object {
207 uint8_t tree_id[SHA1_DIGEST_LENGTH];
208 size_t author_len;
209 time_t author_time;
210 time_t author_gmtoff;
211 size_t committer_len;
212 time_t committer_time;
213 time_t committer_gmtoff;
214 size_t logmsg_len;
215 int nparents;
217 /*
218 * Followed by author_len + committer_len data bytes
219 */
221 /* Followed by 'nparents' SHA1_DIGEST_LENGTH length strings */
223 /*
224 * Followed by 'logmsg_len' bytes of commit log message data in
225 * one or more GOT_IMSG_COMMIT_LOGMSG messages.
226 */
227 } __attribute__((__packed__));
230 /* Structure for GOT_IMSG_TREE_ENTRY. */
231 struct got_imsg_tree_entry {
232 char id[SHA1_DIGEST_LENGTH];
233 mode_t mode;
234 /* Followed by entry's name in remaining data of imsg buffer. */
235 } __attribute__((__packed__));
237 /* Structure for GOT_IMSG_TREE_OBJECT_REPLY data. */
238 struct got_imsg_tree_object {
239 int nentries; /* This many TREE_ENTRY messages follow. */
240 };
242 /* Structure for GOT_IMSG_BLOB. */
243 struct got_imsg_blob {
244 size_t size;
245 size_t hdrlen;
247 /*
248 * If size <= GOT_PRIVSEP_INLINE_BLOB_DATA_MAX, blob data follows
249 * in the imsg buffer. Otherwise, blob data has been written to a
250 * file descriptor passed via the GOT_IMSG_BLOB_OUTFD imsg.
251 */
252 #define GOT_PRIVSEP_INLINE_BLOB_DATA_MAX \
253 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_blob))
254 };
256 /* Structure for GOT_IMSG_RAW_OBJECT. */
257 struct got_imsg_raw_obj {
258 off_t size;
259 size_t hdrlen;
261 /*
262 * If size <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX, object data follows
263 * in the imsg buffer. Otherwise, object data has been written to a
264 * file descriptor passed via the GOT_IMSG_RAW_OBJECT_OUTFD imsg.
265 */
266 #define GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX \
267 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_raw_obj))
268 };
270 /* Structure for GOT_IMSG_RAW_DELTA. */
271 struct got_imsg_raw_delta {
272 uint8_t base_id[SHA1_DIGEST_LENGTH];
273 uint64_t base_size;
274 uint64_t result_size;
275 off_t delta_size;
276 off_t delta_offset;
277 off_t delta_out_offset;
279 /*
280 * Delta data has been written at delta_out_offset to the file
281 * descriptor passed via the GOT_IMSG_RAW_DELTA_OUTFD imsg.
282 */
283 };
285 /* Structure for GOT_IMSG_TAG data. */
286 struct got_imsg_tag_object {
287 uint8_t id[SHA1_DIGEST_LENGTH];
288 int obj_type;
289 size_t tag_len;
290 size_t tagger_len;
291 time_t tagger_time;
292 time_t tagger_gmtoff;
293 size_t tagmsg_len;
295 /*
296 * Followed by tag_len + tagger_len data bytes
297 */
299 /*
300 * Followed by 'tagmsg_len' bytes of tag message data in
301 * one or more GOT_IMSG_TAG_TAGMSG messages.
302 */
303 } __attribute__((__packed__));
305 /* Structure for GOT_IMSG_FETCH_HAVE_REF data. */
306 struct got_imsg_fetch_have_ref {
307 uint8_t id[SHA1_DIGEST_LENGTH];
308 size_t name_len;
309 /* Followed by name_len data bytes. */
310 } __attribute__((__packed__));
312 /* Structure for GOT_IMSG_FETCH_WANTED_BRANCH data. */
313 struct got_imsg_fetch_wanted_branch {
314 size_t name_len;
315 /* Followed by name_len data bytes. */
316 } __attribute__((__packed__));
318 /* Structure for GOT_IMSG_FETCH_WANTED_REF data. */
319 struct got_imsg_fetch_wanted_ref {
320 size_t name_len;
321 /* Followed by name_len data bytes. */
322 } __attribute__((__packed__));
324 /* Structure for GOT_IMSG_FETCH_REQUEST data. */
325 struct got_imsg_fetch_request {
326 int fetch_all_branches;
327 int list_refs_only;
328 int verbosity;
329 size_t n_have_refs;
330 size_t n_wanted_branches;
331 size_t n_wanted_refs;
332 /* Followed by n_have_refs GOT_IMSG_FETCH_HAVE_REF messages. */
333 /* Followed by n_wanted_branches times GOT_IMSG_FETCH_WANTED_BRANCH. */
334 /* Followed by n_wanted_refs times GOT_IMSG_FETCH_WANTED_REF. */
335 } __attribute__((__packed__));
337 /* Structures for GOT_IMSG_FETCH_SYMREFS data. */
338 struct got_imsg_fetch_symref {
339 size_t name_len;
340 size_t target_len;
342 /*
343 * Followed by name_len + target_len data bytes.
344 */
345 } __attribute__((__packed__));
347 struct got_imsg_fetch_symrefs {
348 size_t nsymrefs;
350 /* Followed by nsymrefs times of got_imsg_fetch_symref data. */
351 } __attribute__((__packed__));
353 /* Structure for GOT_IMSG_FETCH_REF data. */
354 struct got_imsg_fetch_ref {
355 /* Describes a reference which will be fetched. */
356 uint8_t refid[SHA1_DIGEST_LENGTH];
357 /* Followed by reference name in remaining data of imsg buffer. */
358 };
360 /* Structure for GOT_IMSG_FETCH_DOWNLOAD_PROGRESS data. */
361 struct got_imsg_fetch_download_progress {
362 /* Number of packfile data bytes downloaded so far. */
363 off_t packfile_bytes;
364 };
366 /* Structure for GOT_IMSG_SEND_REQUEST data. */
367 struct got_imsg_send_request {
368 int verbosity;
369 size_t nrefs;
370 /* Followed by nrefs GOT_IMSG_SEND_REF messages. */
371 } __attribute__((__packed__));
373 /* Structure for GOT_IMSG_SEND_UPLOAD_PROGRESS data. */
374 struct got_imsg_send_upload_progress {
375 /* Number of packfile data bytes uploaded so far. */
376 off_t packfile_bytes;
377 };
379 /* Structure for GOT_IMSG_SEND_REF data. */
380 struct got_imsg_send_ref {
381 uint8_t id[SHA1_DIGEST_LENGTH];
382 int delete;
383 size_t name_len;
384 /* Followed by name_len data bytes. */
385 } __attribute__((__packed__));
387 /* Structure for GOT_IMSG_SEND_REMOTE_REF data. */
388 struct got_imsg_send_remote_ref {
389 uint8_t id[SHA1_DIGEST_LENGTH];
390 size_t name_len;
391 /* Followed by name_len data bytes. */
392 } __attribute__((__packed__));
394 /* Structure for GOT_IMSG_SEND_REF_STATUS data. */
395 struct got_imsg_send_ref_status {
396 int success;
397 size_t name_len;
398 /* Followed by name_len data bytes. */
399 } __attribute__((__packed__));
401 /* Structure for GOT_IMSG_IDXPACK_REQUEST data. */
402 struct got_imsg_index_pack_request {
403 uint8_t pack_hash[SHA1_DIGEST_LENGTH];
404 } __attribute__((__packed__));
406 /* Structure for GOT_IMSG_IDXPACK_PROGRESS data. */
407 struct got_imsg_index_pack_progress {
408 /* Total number of objects in pack file. */
409 int nobj_total;
411 /* Number of objects indexed so far. */
412 int nobj_indexed;
414 /* Number of non-deltified objects in pack file. */
415 int nobj_loose;
417 /* Number of deltified objects resolved so far. */
418 int nobj_resolved;
419 };
421 /* Structure for GOT_IMSG_PACKIDX. */
422 struct got_imsg_packidx {
423 size_t len;
424 off_t packfile_size;
425 /* Additionally, a file desciptor is passed via imsg. */
426 };
428 /* Structure for GOT_IMSG_PACK. */
429 struct got_imsg_pack {
430 char path_packfile[PATH_MAX];
431 size_t filesize;
432 /* Additionally, a file desciptor is passed via imsg. */
433 } __attribute__((__packed__));
435 /*
436 * Structure for GOT_IMSG_OBJECT_REQUEST, GOT_IMSG_BLOB_REQUEST,
437 * GOT_IMSG_TREE_REQUEST, GOT_IMSG_COMMIT_REQUEST, and
438 * GOT_IMSG_TAG_REQUEST data.
439 */
440 struct got_object_id;
442 /*
443 * Structure for GOT_IMSG_PACKED_OBJECT_REQUEST and
444 * GOT_IMSG_PACKED_RAW_OBJECT_REQUEST data.
445 */
446 struct got_imsg_packed_object {
447 uint8_t id[SHA1_DIGEST_LENGTH];
448 int idx;
449 } __attribute__((__packed__));
451 /*
452 * Structure for GOT_IMSG_DELTA data.
453 */
454 struct got_imsg_delta {
455 /* These fields are the same as in struct got_delta. */
456 off_t offset;
457 size_t tslen;
458 int type;
459 size_t size;
460 off_t data_offset;
461 };
463 /*
464 * Structure for GOT_IMSG_RAW_DELTA_REQUEST data.
465 */
466 struct got_imsg_raw_delta_request {
467 uint8_t id[SHA1_DIGEST_LENGTH];
468 int idx;
469 };
471 /* Structure for GOT_IMSG_COMMIT_TRAVERSAL_REQUEST */
472 struct got_imsg_commit_traversal_request {
473 uint8_t id[SHA1_DIGEST_LENGTH];
474 int idx;
475 size_t path_len;
476 /* Followed by path_len bytes of path data */
477 } __attribute__((__packed__));
479 /* Structure for GOT_IMSG_TRAVERSED_COMMITS */
480 struct got_imsg_traversed_commits {
481 size_t ncommits;
482 /* Followed by ncommit IDs of SHA1_DIGEST_LENGTH each */
483 } __attribute__((__packed__));
485 /*
486 * Structure for GOT_IMSG_GOTCONFIG_REMOTE and
487 * GOT_IMSG_GOTCONFIG_REMOTE data.
488 */
489 struct got_imsg_remote {
490 size_t name_len;
491 size_t fetch_url_len;
492 size_t send_url_len;
493 int mirror_references;
494 int fetch_all_branches;
495 int nfetch_branches;
496 int nsend_branches;
497 int nfetch_refs;
499 /* Followed by name_len data bytes. */
500 /* Followed by fetch_url_len + send_url_len data bytes. */
501 /* Followed by nfetch_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
502 /* Followed by nsend_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
503 /* Followed by nfetch_refs GOT_IMSG_GITCONFIG_STR_VAL messages. */
504 } __attribute__((__packed__));
506 /*
507 * Structure for GOT_IMSG_GITCONFIG_REMOTES data.
508 */
509 struct got_imsg_remotes {
510 int nremotes; /* This many GOT_IMSG_GITCONFIG_REMOTE messages follow. */
511 };
513 struct got_remote_repo;
514 struct got_pack;
515 struct got_packidx;
516 struct got_pathlist_head;
518 const struct got_error *got_send_ack(pid_t);
519 const struct got_error *got_privsep_wait_for_child(pid_t);
520 const struct got_error *got_privsep_flush_imsg(struct imsgbuf *);
521 const struct got_error *got_privsep_send_stop(int);
522 const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
523 size_t);
524 void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
525 const struct got_error *got_privsep_send_ack(struct imsgbuf *);
526 const struct got_error *got_privsep_wait_ack(struct imsgbuf *);
527 const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int,
528 struct got_object_id *);
529 const struct got_error *got_privsep_send_raw_obj_req(struct imsgbuf *, int,
530 struct got_object_id *);
531 const struct got_error *got_privsep_send_raw_obj_outfd(struct imsgbuf *, int);
532 const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
533 struct got_object_id *, int);
534 const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
535 struct got_object_id *, int);
536 const struct got_error *got_privsep_send_tag_req(struct imsgbuf *, int,
537 struct got_object_id *, int);
538 const struct got_error *got_privsep_send_blob_req(struct imsgbuf *, int,
539 struct got_object_id *, int);
540 const struct got_error *got_privsep_send_blob_outfd(struct imsgbuf *, int);
541 const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
542 const struct got_error *got_privsep_send_obj(struct imsgbuf *,
543 struct got_object *);
544 const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *,
545 uint8_t *, int);
546 const struct got_error *got_privsep_send_index_pack_outfd(struct imsgbuf *,
547 int);
548 const struct got_error *got_privsep_recv_index_progress(int *, int *, int *,
549 int *, int *, struct imsgbuf *ibuf);
550 const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
551 struct got_pathlist_head *, int, struct got_pathlist_head *,
552 struct got_pathlist_head *, int, int);
553 const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
554 const struct got_error *got_privsep_recv_fetch_progress(int *,
555 struct got_object_id **, char **, struct got_pathlist_head *, char **,
556 off_t *, uint8_t *, struct imsgbuf *);
557 const struct got_error *got_privsep_send_send_req(struct imsgbuf *, int,
558 struct got_pathlist_head *, struct got_pathlist_head *, int);
559 const struct got_error *got_privsep_recv_send_remote_refs(
560 struct got_pathlist_head *, struct imsgbuf *);
561 const struct got_error *got_privsep_send_packfd(struct imsgbuf *, int);
562 const struct got_error *got_privsep_recv_send_progress(int *, off_t *,
563 int *, char **, struct imsgbuf *);
564 const struct got_error *got_privsep_get_imsg_obj(struct got_object **,
565 struct imsg *, struct imsgbuf *);
566 const struct got_error *got_privsep_recv_obj(struct got_object **,
567 struct imsgbuf *);
568 const struct got_error *got_privsep_send_raw_obj(struct imsgbuf *, off_t,
569 size_t, uint8_t *);
570 const struct got_error *got_privsep_recv_raw_obj(uint8_t **, off_t *, size_t *,
571 struct imsgbuf *);
572 const struct got_error *got_privsep_send_commit(struct imsgbuf *,
573 struct got_commit_object *);
574 const struct got_error *got_privsep_recv_commit(struct got_commit_object **,
575 struct imsgbuf *);
576 const struct got_error *got_privsep_recv_tree(struct got_tree_object **,
577 struct imsgbuf *);
578 const struct got_error *got_privsep_send_tree(struct imsgbuf *,
579 struct got_pathlist_head *, int);
580 const struct got_error *got_privsep_send_blob(struct imsgbuf *, size_t, size_t,
581 const uint8_t *);
582 const struct got_error *got_privsep_recv_blob(uint8_t **, size_t *, size_t *,
583 struct imsgbuf *);
584 const struct got_error *got_privsep_send_tag(struct imsgbuf *,
585 struct got_tag_object *);
586 const struct got_error *got_privsep_recv_tag(struct got_tag_object **,
587 struct imsgbuf *);
588 const struct got_error *got_privsep_init_pack_child(struct imsgbuf *,
589 struct got_pack *, struct got_packidx *);
590 const struct got_error *got_privsep_send_packed_obj_req(struct imsgbuf *, int,
591 struct got_object_id *);
592 const struct got_error *got_privsep_send_packed_raw_obj_req(struct imsgbuf *,
593 int, struct got_object_id *);
594 const struct got_error *got_privsep_send_pack_child_ready(struct imsgbuf *);
596 const struct got_error *got_privsep_send_gitconfig_parse_req(struct imsgbuf *,
597 int);
598 const struct got_error *
599 got_privsep_send_gitconfig_repository_format_version_req(struct imsgbuf *);
600 const struct got_error *got_privsep_send_gitconfig_repository_extensions_req(
601 struct imsgbuf *);
602 const struct got_error *got_privsep_send_gitconfig_author_name_req(
603 struct imsgbuf *);
604 const struct got_error *got_privsep_send_gitconfig_author_email_req(
605 struct imsgbuf *);
606 const struct got_error *got_privsep_send_gitconfig_remotes_req(
607 struct imsgbuf *);
608 const struct got_error *got_privsep_send_gitconfig_owner_req(struct imsgbuf *);
609 const struct got_error *got_privsep_recv_gitconfig_str(char **,
610 struct imsgbuf *);
611 const struct got_error *got_privsep_recv_gitconfig_int(int *, struct imsgbuf *);
612 const struct got_error *got_privsep_recv_gitconfig_remotes(
613 struct got_remote_repo **, int *, struct imsgbuf *);
615 const struct got_error *got_privsep_send_gotconfig_parse_req(struct imsgbuf *,
616 int);
617 const struct got_error *got_privsep_send_gotconfig_author_req(struct imsgbuf *);
618 const struct got_error *got_privsep_send_gotconfig_remotes_req(
619 struct imsgbuf *);
620 const struct got_error *got_privsep_recv_gotconfig_str(char **,
621 struct imsgbuf *);
622 const struct got_error *got_privsep_recv_gotconfig_remotes(
623 struct got_remote_repo **, int *, struct imsgbuf *);
625 const struct got_error *got_privsep_send_commit_traversal_request(
626 struct imsgbuf *, struct got_object_id *, int, const char *);
627 const struct got_error *got_privsep_recv_traversed_commits(
628 struct got_commit_object **, struct got_object_id **,
629 struct got_object_id_queue *, struct imsgbuf *);
631 const struct got_error *got_privsep_send_raw_delta_req(struct imsgbuf *, int,
632 struct got_object_id *);
633 const struct got_error *got_privsep_send_raw_delta_outfd(struct imsgbuf *, int);
634 const struct got_error *got_privsep_send_raw_delta(struct imsgbuf *, uint64_t,
635 uint64_t, off_t, off_t, off_t, struct got_object_id *);
636 const struct got_error *got_privsep_recv_raw_delta(uint64_t *, uint64_t *,
637 off_t *, off_t *, off_t *, struct got_object_id **, struct imsgbuf *);
639 void got_privsep_exec_child(int[2], const char *, const char *);