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_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 {
82 int imsg_fd;
83 pid_t pid;
84 struct imsgbuf *ibuf;
85 };
87 enum got_imsg_type {
88 /* An error occured while processing a request. */
89 GOT_IMSG_ERROR,
91 /* Stop the child process. */
92 GOT_IMSG_STOP,
94 /*
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.
101 */
102 GOT_IMSG_OBJECT_REQUEST,
103 GOT_IMSG_OBJECT,
104 GOT_IMSG_COMMIT_REQUEST,
105 GOT_IMSG_COMMIT,
106 GOT_IMSG_COMMIT_LOGMSG,
107 GOT_IMSG_TREE_REQUEST,
108 GOT_IMSG_TREE,
109 GOT_IMSG_TREE_ENTRY,
110 GOT_IMSG_BLOB_REQUEST,
111 GOT_IMSG_BLOB_OUTFD,
112 GOT_IMSG_BLOB,
113 GOT_IMSG_TAG_REQUEST,
114 GOT_IMSG_TAG,
115 GOT_IMSG_TAG_TAGMSG,
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,
124 GOT_IMSG_FETCH_REF,
125 GOT_IMSG_FETCH_SERVER_PROGRESS,
126 GOT_IMSG_FETCH_DOWNLOAD_PROGRESS,
127 GOT_IMSG_FETCH_DONE,
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,
133 GOT_IMSG_SEND_REF,
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,
139 GOT_IMSG_SEND_DONE,
141 /* Messages related to pack files. */
142 GOT_IMSG_PACKIDX,
143 GOT_IMSG_PACK,
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. */
150 GOT_IMSG_TMPFD,
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,
179 GOT_IMSG_RAW_OBJECT,
181 /* Read raw delta data from pack files. */
182 GOT_IMSG_RAW_DELTA_OUTFD,
183 GOT_IMSG_RAW_DELTA_REQUEST,
184 GOT_IMSG_RAW_DELTA,
186 /* Messages related to patch files. */
187 GOT_IMSG_PATCH_FILE,
188 GOT_IMSG_PATCH_HUNK,
189 GOT_IMSG_PATCH_DONE,
190 GOT_IMSG_PATCH_LINE,
191 GOT_IMSG_PATCH,
192 GOT_IMSG_PATCH_EOF,
193 };
195 /* Structure for GOT_IMSG_ERROR. */
196 struct got_imsg_error {
197 int code; /* an error code from got_error.h */
198 int errno_code; /* in case code equals GOT_ERR_ERRNO */
199 } __attribute__((__packed__));
201 /*
202 * Structure for GOT_IMSG_TREE_REQUEST and GOT_IMSG_OBJECT data.
203 */
204 struct got_imsg_object {
205 uint8_t id[SHA1_DIGEST_LENGTH];
207 /* These fields are the same as in struct got_object. */
208 int type;
209 int flags;
210 size_t hdrlen;
211 size_t size;
212 off_t pack_offset;
213 int pack_idx;
214 } __attribute__((__packed__));
216 /* Structure for GOT_IMSG_COMMIT data. */
217 struct got_imsg_commit_object {
218 uint8_t tree_id[SHA1_DIGEST_LENGTH];
219 size_t author_len;
220 time_t author_time;
221 time_t author_gmtoff;
222 size_t committer_len;
223 time_t committer_time;
224 time_t committer_gmtoff;
225 size_t logmsg_len;
226 int nparents;
228 /*
229 * Followed by author_len + committer_len data bytes
230 */
232 /* Followed by 'nparents' SHA1_DIGEST_LENGTH length strings */
234 /*
235 * Followed by 'logmsg_len' bytes of commit log message data in
236 * one or more GOT_IMSG_COMMIT_LOGMSG messages.
237 */
238 } __attribute__((__packed__));
241 /* Structure for GOT_IMSG_TREE_ENTRY. */
242 struct got_imsg_tree_entry {
243 char id[SHA1_DIGEST_LENGTH];
244 mode_t mode;
245 /* Followed by entry's name in remaining data of imsg buffer. */
246 } __attribute__((__packed__));
248 /* Structure for GOT_IMSG_TREE_OBJECT_REPLY data. */
249 struct got_imsg_tree_object {
250 int nentries; /* This many TREE_ENTRY messages follow. */
251 };
253 /* Structure for GOT_IMSG_BLOB. */
254 struct got_imsg_blob {
255 size_t size;
256 size_t hdrlen;
258 /*
259 * If size <= GOT_PRIVSEP_INLINE_BLOB_DATA_MAX, blob data follows
260 * in the imsg buffer. Otherwise, blob data has been written to a
261 * file descriptor passed via the GOT_IMSG_BLOB_OUTFD imsg.
262 */
263 #define GOT_PRIVSEP_INLINE_BLOB_DATA_MAX \
264 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_blob))
265 };
267 /* Structure for GOT_IMSG_RAW_OBJECT. */
268 struct got_imsg_raw_obj {
269 off_t size;
270 size_t hdrlen;
272 /*
273 * If size <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX, object data follows
274 * in the imsg buffer. Otherwise, object data has been written to a
275 * file descriptor passed via the GOT_IMSG_RAW_OBJECT_OUTFD imsg.
276 */
277 #define GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX \
278 (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_raw_obj))
279 };
281 /* Structure for GOT_IMSG_RAW_DELTA. */
282 struct got_imsg_raw_delta {
283 uint8_t base_id[SHA1_DIGEST_LENGTH];
284 uint64_t base_size;
285 uint64_t result_size;
286 off_t delta_size;
287 off_t delta_compressed_size;
288 off_t delta_offset;
289 off_t delta_out_offset;
291 /*
292 * Delta data has been written at delta_out_offset to the file
293 * descriptor passed via the GOT_IMSG_RAW_DELTA_OUTFD imsg.
294 */
295 };
297 /* Structure for GOT_IMSG_TAG data. */
298 struct got_imsg_tag_object {
299 uint8_t id[SHA1_DIGEST_LENGTH];
300 int obj_type;
301 size_t tag_len;
302 size_t tagger_len;
303 time_t tagger_time;
304 time_t tagger_gmtoff;
305 size_t tagmsg_len;
307 /*
308 * Followed by tag_len + tagger_len data bytes
309 */
311 /*
312 * Followed by 'tagmsg_len' bytes of tag message data in
313 * one or more GOT_IMSG_TAG_TAGMSG messages.
314 */
315 } __attribute__((__packed__));
317 /* Structure for GOT_IMSG_FETCH_HAVE_REF data. */
318 struct got_imsg_fetch_have_ref {
319 uint8_t id[SHA1_DIGEST_LENGTH];
320 size_t name_len;
321 /* Followed by name_len data bytes. */
322 } __attribute__((__packed__));
324 /* Structure for GOT_IMSG_FETCH_WANTED_BRANCH data. */
325 struct got_imsg_fetch_wanted_branch {
326 size_t name_len;
327 /* Followed by name_len data bytes. */
328 } __attribute__((__packed__));
330 /* Structure for GOT_IMSG_FETCH_WANTED_REF data. */
331 struct got_imsg_fetch_wanted_ref {
332 size_t name_len;
333 /* Followed by name_len data bytes. */
334 } __attribute__((__packed__));
336 /* Structure for GOT_IMSG_FETCH_REQUEST data. */
337 struct got_imsg_fetch_request {
338 int fetch_all_branches;
339 int list_refs_only;
340 int verbosity;
341 size_t n_have_refs;
342 size_t n_wanted_branches;
343 size_t n_wanted_refs;
344 /* Followed by n_have_refs GOT_IMSG_FETCH_HAVE_REF messages. */
345 /* Followed by n_wanted_branches times GOT_IMSG_FETCH_WANTED_BRANCH. */
346 /* Followed by n_wanted_refs times GOT_IMSG_FETCH_WANTED_REF. */
347 } __attribute__((__packed__));
349 /* Structures for GOT_IMSG_FETCH_SYMREFS data. */
350 struct got_imsg_fetch_symref {
351 size_t name_len;
352 size_t target_len;
354 /*
355 * Followed by name_len + target_len data bytes.
356 */
357 } __attribute__((__packed__));
359 struct got_imsg_fetch_symrefs {
360 size_t nsymrefs;
362 /* Followed by nsymrefs times of got_imsg_fetch_symref data. */
363 } __attribute__((__packed__));
365 /* Structure for GOT_IMSG_FETCH_REF data. */
366 struct got_imsg_fetch_ref {
367 /* Describes a reference which will be fetched. */
368 uint8_t refid[SHA1_DIGEST_LENGTH];
369 /* Followed by reference name in remaining data of imsg buffer. */
370 };
372 /* Structure for GOT_IMSG_FETCH_DOWNLOAD_PROGRESS data. */
373 struct got_imsg_fetch_download_progress {
374 /* Number of packfile data bytes downloaded so far. */
375 off_t packfile_bytes;
376 };
378 /* Structure for GOT_IMSG_SEND_REQUEST data. */
379 struct got_imsg_send_request {
380 int verbosity;
381 size_t nrefs;
382 /* Followed by nrefs GOT_IMSG_SEND_REF messages. */
383 } __attribute__((__packed__));
385 /* Structure for GOT_IMSG_SEND_UPLOAD_PROGRESS data. */
386 struct got_imsg_send_upload_progress {
387 /* Number of packfile data bytes uploaded so far. */
388 off_t packfile_bytes;
389 };
391 /* Structure for GOT_IMSG_SEND_REF data. */
392 struct got_imsg_send_ref {
393 uint8_t id[SHA1_DIGEST_LENGTH];
394 int delete;
395 size_t name_len;
396 /* Followed by name_len data bytes. */
397 } __attribute__((__packed__));
399 /* Structure for GOT_IMSG_SEND_REMOTE_REF data. */
400 struct got_imsg_send_remote_ref {
401 uint8_t id[SHA1_DIGEST_LENGTH];
402 size_t name_len;
403 /* Followed by name_len data bytes. */
404 } __attribute__((__packed__));
406 /* Structure for GOT_IMSG_SEND_REF_STATUS data. */
407 struct got_imsg_send_ref_status {
408 int success;
409 size_t name_len;
410 /* Followed by name_len data bytes. */
411 } __attribute__((__packed__));
413 /* Structure for GOT_IMSG_IDXPACK_REQUEST data. */
414 struct got_imsg_index_pack_request {
415 uint8_t pack_hash[SHA1_DIGEST_LENGTH];
416 } __attribute__((__packed__));
418 /* Structure for GOT_IMSG_IDXPACK_PROGRESS data. */
419 struct got_imsg_index_pack_progress {
420 /* Total number of objects in pack file. */
421 int nobj_total;
423 /* Number of objects indexed so far. */
424 int nobj_indexed;
426 /* Number of non-deltified objects in pack file. */
427 int nobj_loose;
429 /* Number of deltified objects resolved so far. */
430 int nobj_resolved;
431 };
433 /* Structure for GOT_IMSG_PACKIDX. */
434 struct got_imsg_packidx {
435 size_t len;
436 off_t packfile_size;
437 /* Additionally, a file desciptor is passed via imsg. */
438 };
440 /* Structure for GOT_IMSG_PACK. */
441 struct got_imsg_pack {
442 char path_packfile[PATH_MAX];
443 size_t filesize;
444 /* Additionally, a file desciptor is passed via imsg. */
445 } __attribute__((__packed__));
447 /*
448 * Structure for GOT_IMSG_OBJECT_REQUEST, GOT_IMSG_BLOB_REQUEST,
449 * GOT_IMSG_TREE_REQUEST, GOT_IMSG_COMMIT_REQUEST, and
450 * GOT_IMSG_TAG_REQUEST data.
451 */
452 struct got_object_id;
454 /*
455 * Structure for GOT_IMSG_PACKED_OBJECT_REQUEST and
456 * GOT_IMSG_PACKED_RAW_OBJECT_REQUEST data.
457 */
458 struct got_imsg_packed_object {
459 uint8_t id[SHA1_DIGEST_LENGTH];
460 int idx;
461 } __attribute__((__packed__));
463 /*
464 * Structure for GOT_IMSG_DELTA data.
465 */
466 struct got_imsg_delta {
467 /* These fields are the same as in struct got_delta. */
468 off_t offset;
469 size_t tslen;
470 int type;
471 size_t size;
472 off_t data_offset;
473 };
475 /*
476 * Structure for GOT_IMSG_RAW_DELTA_REQUEST data.
477 */
478 struct got_imsg_raw_delta_request {
479 uint8_t id[SHA1_DIGEST_LENGTH];
480 int idx;
481 };
483 /* Structure for GOT_IMSG_COMMIT_TRAVERSAL_REQUEST */
484 struct got_imsg_commit_traversal_request {
485 uint8_t id[SHA1_DIGEST_LENGTH];
486 int idx;
487 size_t path_len;
488 /* Followed by path_len bytes of path data */
489 } __attribute__((__packed__));
491 /* Structure for GOT_IMSG_TRAVERSED_COMMITS */
492 struct got_imsg_traversed_commits {
493 size_t ncommits;
494 /* Followed by ncommit IDs of SHA1_DIGEST_LENGTH each */
495 } __attribute__((__packed__));
497 /*
498 * Structure for GOT_IMSG_GOTCONFIG_REMOTE and
499 * GOT_IMSG_GOTCONFIG_REMOTE data.
500 */
501 struct got_imsg_remote {
502 size_t name_len;
503 size_t fetch_url_len;
504 size_t send_url_len;
505 int mirror_references;
506 int fetch_all_branches;
507 int nfetch_branches;
508 int nsend_branches;
509 int nfetch_refs;
511 /* Followed by name_len data bytes. */
512 /* Followed by fetch_url_len + send_url_len data bytes. */
513 /* Followed by nfetch_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
514 /* Followed by nsend_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
515 /* Followed by nfetch_refs GOT_IMSG_GITCONFIG_STR_VAL messages. */
516 } __attribute__((__packed__));
518 /*
519 * Structure for GOT_IMSG_GITCONFIG_REMOTES data.
520 */
521 struct got_imsg_remotes {
522 int nremotes; /* This many GOT_IMSG_GITCONFIG_REMOTE messages follow. */
523 };
525 /*
526 * Structure for GOT_IMSG_PATCH data.
527 */
528 struct got_imsg_patch {
529 int git;
530 char old[PATH_MAX];
531 char new[PATH_MAX];
532 };
534 /*
535 * Structure for GOT_IMSG_PATCH_HUNK data.
536 */
537 struct got_imsg_patch_hunk {
538 long oldfrom;
539 long oldlines;
540 long newfrom;
541 long newlines;
542 };
544 struct got_remote_repo;
545 struct got_pack;
546 struct got_packidx;
547 struct got_pathlist_head;
549 const struct got_error *got_send_ack(pid_t);
550 const struct got_error *got_privsep_wait_for_child(pid_t);
551 const struct got_error *got_privsep_flush_imsg(struct imsgbuf *);
552 const struct got_error *got_privsep_send_stop(int);
553 const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
554 size_t);
555 void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
556 const struct got_error *got_privsep_send_ack(struct imsgbuf *);
557 const struct got_error *got_privsep_wait_ack(struct imsgbuf *);
558 const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int,
559 struct got_object_id *);
560 const struct got_error *got_privsep_send_raw_obj_req(struct imsgbuf *, int,
561 struct got_object_id *);
562 const struct got_error *got_privsep_send_raw_obj_outfd(struct imsgbuf *, int);
563 const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
564 struct got_object_id *, int);
565 const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
566 struct got_object_id *, int);
567 const struct got_error *got_privsep_send_tag_req(struct imsgbuf *, int,
568 struct got_object_id *, int);
569 const struct got_error *got_privsep_send_blob_req(struct imsgbuf *, int,
570 struct got_object_id *, int);
571 const struct got_error *got_privsep_send_blob_outfd(struct imsgbuf *, int);
572 const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
573 const struct got_error *got_privsep_send_obj(struct imsgbuf *,
574 struct got_object *);
575 const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *,
576 uint8_t *, int);
577 const struct got_error *got_privsep_send_index_pack_outfd(struct imsgbuf *,
578 int);
579 const struct got_error *got_privsep_recv_index_progress(int *, int *, int *,
580 int *, int *, struct imsgbuf *ibuf);
581 const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
582 struct got_pathlist_head *, int, struct got_pathlist_head *,
583 struct got_pathlist_head *, int, int);
584 const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
585 const struct got_error *got_privsep_recv_fetch_progress(int *,
586 struct got_object_id **, char **, struct got_pathlist_head *, char **,
587 off_t *, uint8_t *, struct imsgbuf *);
588 const struct got_error *got_privsep_send_send_req(struct imsgbuf *, int,
589 struct got_pathlist_head *, struct got_pathlist_head *, int);
590 const struct got_error *got_privsep_recv_send_remote_refs(
591 struct got_pathlist_head *, struct imsgbuf *);
592 const struct got_error *got_privsep_send_packfd(struct imsgbuf *, int);
593 const struct got_error *got_privsep_recv_send_progress(int *, off_t *,
594 int *, char **, struct imsgbuf *);
595 const struct got_error *got_privsep_get_imsg_obj(struct got_object **,
596 struct imsg *, struct imsgbuf *);
597 const struct got_error *got_privsep_recv_obj(struct got_object **,
598 struct imsgbuf *);
599 const struct got_error *got_privsep_send_raw_obj(struct imsgbuf *, off_t,
600 size_t, uint8_t *);
601 const struct got_error *got_privsep_recv_raw_obj(uint8_t **, off_t *, size_t *,
602 struct imsgbuf *);
603 const struct got_error *got_privsep_send_commit(struct imsgbuf *,
604 struct got_commit_object *);
605 const struct got_error *got_privsep_recv_commit(struct got_commit_object **,
606 struct imsgbuf *);
607 const struct got_error *got_privsep_recv_tree(struct got_tree_object **,
608 struct imsgbuf *);
609 const struct got_error *got_privsep_send_tree(struct imsgbuf *,
610 struct got_pathlist_head *, int);
611 const struct got_error *got_privsep_send_blob(struct imsgbuf *, size_t, size_t,
612 const uint8_t *);
613 const struct got_error *got_privsep_recv_blob(uint8_t **, size_t *, size_t *,
614 struct imsgbuf *);
615 const struct got_error *got_privsep_send_tag(struct imsgbuf *,
616 struct got_tag_object *);
617 const struct got_error *got_privsep_recv_tag(struct got_tag_object **,
618 struct imsgbuf *);
619 const struct got_error *got_privsep_init_pack_child(struct imsgbuf *,
620 struct got_pack *, struct got_packidx *);
621 const struct got_error *got_privsep_send_packed_obj_req(struct imsgbuf *, int,
622 struct got_object_id *);
623 const struct got_error *got_privsep_send_packed_raw_obj_req(struct imsgbuf *,
624 int, struct got_object_id *);
625 const struct got_error *got_privsep_send_pack_child_ready(struct imsgbuf *);
627 const struct got_error *got_privsep_send_gitconfig_parse_req(struct imsgbuf *,
628 int);
629 const struct got_error *
630 got_privsep_send_gitconfig_repository_format_version_req(struct imsgbuf *);
631 const struct got_error *got_privsep_send_gitconfig_repository_extensions_req(
632 struct imsgbuf *);
633 const struct got_error *got_privsep_send_gitconfig_author_name_req(
634 struct imsgbuf *);
635 const struct got_error *got_privsep_send_gitconfig_author_email_req(
636 struct imsgbuf *);
637 const struct got_error *got_privsep_send_gitconfig_remotes_req(
638 struct imsgbuf *);
639 const struct got_error *got_privsep_send_gitconfig_owner_req(struct imsgbuf *);
640 const struct got_error *got_privsep_recv_gitconfig_str(char **,
641 struct imsgbuf *);
642 const struct got_error *got_privsep_recv_gitconfig_int(int *, struct imsgbuf *);
643 const struct got_error *got_privsep_recv_gitconfig_remotes(
644 struct got_remote_repo **, int *, struct imsgbuf *);
646 const struct got_error *got_privsep_send_gotconfig_parse_req(struct imsgbuf *,
647 int);
648 const struct got_error *got_privsep_send_gotconfig_author_req(struct imsgbuf *);
649 const struct got_error *got_privsep_send_gotconfig_remotes_req(
650 struct imsgbuf *);
651 const struct got_error *got_privsep_recv_gotconfig_str(char **,
652 struct imsgbuf *);
653 const struct got_error *got_privsep_recv_gotconfig_remotes(
654 struct got_remote_repo **, int *, struct imsgbuf *);
656 const struct got_error *got_privsep_send_commit_traversal_request(
657 struct imsgbuf *, struct got_object_id *, int, const char *);
658 const struct got_error *got_privsep_recv_traversed_commits(
659 struct got_commit_object **, struct got_object_id **,
660 struct got_object_id_queue *, struct imsgbuf *);
662 const struct got_error *got_privsep_send_raw_delta_req(struct imsgbuf *, int,
663 struct got_object_id *);
664 const struct got_error *got_privsep_send_raw_delta_outfd(struct imsgbuf *, int);
665 const struct got_error *got_privsep_send_raw_delta(struct imsgbuf *, uint64_t,
666 uint64_t, off_t, off_t, off_t, off_t, struct got_object_id *);
667 const struct got_error *got_privsep_recv_raw_delta(uint64_t *, uint64_t *,
668 off_t *, off_t *, off_t *, off_t *, struct got_object_id **,
669 struct imsgbuf *);
671 void got_privsep_exec_child(int[2], const char *, const char *);