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_offset;
288 off_t delta_out_offset;
290 /*
291 * Delta data has been written at delta_out_offset to the file
292 * descriptor passed via the GOT_IMSG_RAW_DELTA_OUTFD imsg.
293 */
294 };
296 /* Structure for GOT_IMSG_TAG data. */
297 struct got_imsg_tag_object {
298 uint8_t id[SHA1_DIGEST_LENGTH];
299 int obj_type;
300 size_t tag_len;
301 size_t tagger_len;
302 time_t tagger_time;
303 time_t tagger_gmtoff;
304 size_t tagmsg_len;
306 /*
307 * Followed by tag_len + tagger_len data bytes
308 */
310 /*
311 * Followed by 'tagmsg_len' bytes of tag message data in
312 * one or more GOT_IMSG_TAG_TAGMSG messages.
313 */
314 } __attribute__((__packed__));
316 /* Structure for GOT_IMSG_FETCH_HAVE_REF data. */
317 struct got_imsg_fetch_have_ref {
318 uint8_t id[SHA1_DIGEST_LENGTH];
319 size_t name_len;
320 /* Followed by name_len data bytes. */
321 } __attribute__((__packed__));
323 /* Structure for GOT_IMSG_FETCH_WANTED_BRANCH data. */
324 struct got_imsg_fetch_wanted_branch {
325 size_t name_len;
326 /* Followed by name_len data bytes. */
327 } __attribute__((__packed__));
329 /* Structure for GOT_IMSG_FETCH_WANTED_REF data. */
330 struct got_imsg_fetch_wanted_ref {
331 size_t name_len;
332 /* Followed by name_len data bytes. */
333 } __attribute__((__packed__));
335 /* Structure for GOT_IMSG_FETCH_REQUEST data. */
336 struct got_imsg_fetch_request {
337 int fetch_all_branches;
338 int list_refs_only;
339 int verbosity;
340 size_t n_have_refs;
341 size_t n_wanted_branches;
342 size_t n_wanted_refs;
343 /* Followed by n_have_refs GOT_IMSG_FETCH_HAVE_REF messages. */
344 /* Followed by n_wanted_branches times GOT_IMSG_FETCH_WANTED_BRANCH. */
345 /* Followed by n_wanted_refs times GOT_IMSG_FETCH_WANTED_REF. */
346 } __attribute__((__packed__));
348 /* Structures for GOT_IMSG_FETCH_SYMREFS data. */
349 struct got_imsg_fetch_symref {
350 size_t name_len;
351 size_t target_len;
353 /*
354 * Followed by name_len + target_len data bytes.
355 */
356 } __attribute__((__packed__));
358 struct got_imsg_fetch_symrefs {
359 size_t nsymrefs;
361 /* Followed by nsymrefs times of got_imsg_fetch_symref data. */
362 } __attribute__((__packed__));
364 /* Structure for GOT_IMSG_FETCH_REF data. */
365 struct got_imsg_fetch_ref {
366 /* Describes a reference which will be fetched. */
367 uint8_t refid[SHA1_DIGEST_LENGTH];
368 /* Followed by reference name in remaining data of imsg buffer. */
369 };
371 /* Structure for GOT_IMSG_FETCH_DOWNLOAD_PROGRESS data. */
372 struct got_imsg_fetch_download_progress {
373 /* Number of packfile data bytes downloaded so far. */
374 off_t packfile_bytes;
375 };
377 /* Structure for GOT_IMSG_SEND_REQUEST data. */
378 struct got_imsg_send_request {
379 int verbosity;
380 size_t nrefs;
381 /* Followed by nrefs GOT_IMSG_SEND_REF messages. */
382 } __attribute__((__packed__));
384 /* Structure for GOT_IMSG_SEND_UPLOAD_PROGRESS data. */
385 struct got_imsg_send_upload_progress {
386 /* Number of packfile data bytes uploaded so far. */
387 off_t packfile_bytes;
388 };
390 /* Structure for GOT_IMSG_SEND_REF data. */
391 struct got_imsg_send_ref {
392 uint8_t id[SHA1_DIGEST_LENGTH];
393 int delete;
394 size_t name_len;
395 /* Followed by name_len data bytes. */
396 } __attribute__((__packed__));
398 /* Structure for GOT_IMSG_SEND_REMOTE_REF data. */
399 struct got_imsg_send_remote_ref {
400 uint8_t id[SHA1_DIGEST_LENGTH];
401 size_t name_len;
402 /* Followed by name_len data bytes. */
403 } __attribute__((__packed__));
405 /* Structure for GOT_IMSG_SEND_REF_STATUS data. */
406 struct got_imsg_send_ref_status {
407 int success;
408 size_t name_len;
409 /* Followed by name_len data bytes. */
410 } __attribute__((__packed__));
412 /* Structure for GOT_IMSG_IDXPACK_REQUEST data. */
413 struct got_imsg_index_pack_request {
414 uint8_t pack_hash[SHA1_DIGEST_LENGTH];
415 } __attribute__((__packed__));
417 /* Structure for GOT_IMSG_IDXPACK_PROGRESS data. */
418 struct got_imsg_index_pack_progress {
419 /* Total number of objects in pack file. */
420 int nobj_total;
422 /* Number of objects indexed so far. */
423 int nobj_indexed;
425 /* Number of non-deltified objects in pack file. */
426 int nobj_loose;
428 /* Number of deltified objects resolved so far. */
429 int nobj_resolved;
430 };
432 /* Structure for GOT_IMSG_PACKIDX. */
433 struct got_imsg_packidx {
434 size_t len;
435 off_t packfile_size;
436 /* Additionally, a file desciptor is passed via imsg. */
437 };
439 /* Structure for GOT_IMSG_PACK. */
440 struct got_imsg_pack {
441 char path_packfile[PATH_MAX];
442 size_t filesize;
443 /* Additionally, a file desciptor is passed via imsg. */
444 } __attribute__((__packed__));
446 /*
447 * Structure for GOT_IMSG_OBJECT_REQUEST, GOT_IMSG_BLOB_REQUEST,
448 * GOT_IMSG_TREE_REQUEST, GOT_IMSG_COMMIT_REQUEST, and
449 * GOT_IMSG_TAG_REQUEST data.
450 */
451 struct got_object_id;
453 /*
454 * Structure for GOT_IMSG_PACKED_OBJECT_REQUEST and
455 * GOT_IMSG_PACKED_RAW_OBJECT_REQUEST data.
456 */
457 struct got_imsg_packed_object {
458 uint8_t id[SHA1_DIGEST_LENGTH];
459 int idx;
460 } __attribute__((__packed__));
462 /*
463 * Structure for GOT_IMSG_DELTA data.
464 */
465 struct got_imsg_delta {
466 /* These fields are the same as in struct got_delta. */
467 off_t offset;
468 size_t tslen;
469 int type;
470 size_t size;
471 off_t data_offset;
472 };
474 /*
475 * Structure for GOT_IMSG_RAW_DELTA_REQUEST data.
476 */
477 struct got_imsg_raw_delta_request {
478 uint8_t id[SHA1_DIGEST_LENGTH];
479 int idx;
480 };
482 /* Structure for GOT_IMSG_COMMIT_TRAVERSAL_REQUEST */
483 struct got_imsg_commit_traversal_request {
484 uint8_t id[SHA1_DIGEST_LENGTH];
485 int idx;
486 size_t path_len;
487 /* Followed by path_len bytes of path data */
488 } __attribute__((__packed__));
490 /* Structure for GOT_IMSG_TRAVERSED_COMMITS */
491 struct got_imsg_traversed_commits {
492 size_t ncommits;
493 /* Followed by ncommit IDs of SHA1_DIGEST_LENGTH each */
494 } __attribute__((__packed__));
496 /*
497 * Structure for GOT_IMSG_GOTCONFIG_REMOTE and
498 * GOT_IMSG_GOTCONFIG_REMOTE data.
499 */
500 struct got_imsg_remote {
501 size_t name_len;
502 size_t fetch_url_len;
503 size_t send_url_len;
504 int mirror_references;
505 int fetch_all_branches;
506 int nfetch_branches;
507 int nsend_branches;
508 int nfetch_refs;
510 /* Followed by name_len data bytes. */
511 /* Followed by fetch_url_len + send_url_len data bytes. */
512 /* Followed by nfetch_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
513 /* Followed by nsend_branches GOT_IMSG_GITCONFIG_STR_VAL messages. */
514 /* Followed by nfetch_refs GOT_IMSG_GITCONFIG_STR_VAL messages. */
515 } __attribute__((__packed__));
517 /*
518 * Structure for GOT_IMSG_GITCONFIG_REMOTES data.
519 */
520 struct got_imsg_remotes {
521 int nremotes; /* This many GOT_IMSG_GITCONFIG_REMOTE messages follow. */
522 };
524 /*
525 * Structure for GOT_IMSG_PATCH data.
526 */
527 struct got_imsg_patch {
528 int git;
529 char old[PATH_MAX];
530 char new[PATH_MAX];
531 };
533 /*
534 * Structure for GOT_IMSG_PATCH_HUNK data.
535 */
536 struct got_imsg_patch_hunk {
537 long oldfrom;
538 long oldlines;
539 long newfrom;
540 long newlines;
541 };
543 struct got_remote_repo;
544 struct got_pack;
545 struct got_packidx;
546 struct got_pathlist_head;
548 const struct got_error *got_send_ack(pid_t);
549 const struct got_error *got_privsep_wait_for_child(pid_t);
550 const struct got_error *got_privsep_flush_imsg(struct imsgbuf *);
551 const struct got_error *got_privsep_send_stop(int);
552 const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
553 size_t);
554 void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
555 const struct got_error *got_privsep_send_ack(struct imsgbuf *);
556 const struct got_error *got_privsep_wait_ack(struct imsgbuf *);
557 const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int,
558 struct got_object_id *);
559 const struct got_error *got_privsep_send_raw_obj_req(struct imsgbuf *, int,
560 struct got_object_id *);
561 const struct got_error *got_privsep_send_raw_obj_outfd(struct imsgbuf *, int);
562 const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
563 struct got_object_id *, int);
564 const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
565 struct got_object_id *, int);
566 const struct got_error *got_privsep_send_tag_req(struct imsgbuf *, int,
567 struct got_object_id *, int);
568 const struct got_error *got_privsep_send_blob_req(struct imsgbuf *, int,
569 struct got_object_id *, int);
570 const struct got_error *got_privsep_send_blob_outfd(struct imsgbuf *, int);
571 const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
572 const struct got_error *got_privsep_send_obj(struct imsgbuf *,
573 struct got_object *);
574 const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *,
575 uint8_t *, int);
576 const struct got_error *got_privsep_send_index_pack_outfd(struct imsgbuf *,
577 int);
578 const struct got_error *got_privsep_recv_index_progress(int *, int *, int *,
579 int *, int *, struct imsgbuf *ibuf);
580 const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
581 struct got_pathlist_head *, int, struct got_pathlist_head *,
582 struct got_pathlist_head *, int, int);
583 const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
584 const struct got_error *got_privsep_recv_fetch_progress(int *,
585 struct got_object_id **, char **, struct got_pathlist_head *, char **,
586 off_t *, uint8_t *, struct imsgbuf *);
587 const struct got_error *got_privsep_send_send_req(struct imsgbuf *, int,
588 struct got_pathlist_head *, struct got_pathlist_head *, int);
589 const struct got_error *got_privsep_recv_send_remote_refs(
590 struct got_pathlist_head *, struct imsgbuf *);
591 const struct got_error *got_privsep_send_packfd(struct imsgbuf *, int);
592 const struct got_error *got_privsep_recv_send_progress(int *, off_t *,
593 int *, char **, struct imsgbuf *);
594 const struct got_error *got_privsep_get_imsg_obj(struct got_object **,
595 struct imsg *, struct imsgbuf *);
596 const struct got_error *got_privsep_recv_obj(struct got_object **,
597 struct imsgbuf *);
598 const struct got_error *got_privsep_send_raw_obj(struct imsgbuf *, off_t,
599 size_t, uint8_t *);
600 const struct got_error *got_privsep_recv_raw_obj(uint8_t **, off_t *, size_t *,
601 struct imsgbuf *);
602 const struct got_error *got_privsep_send_commit(struct imsgbuf *,
603 struct got_commit_object *);
604 const struct got_error *got_privsep_recv_commit(struct got_commit_object **,
605 struct imsgbuf *);
606 const struct got_error *got_privsep_recv_tree(struct got_tree_object **,
607 struct imsgbuf *);
608 const struct got_error *got_privsep_send_tree(struct imsgbuf *,
609 struct got_pathlist_head *, int);
610 const struct got_error *got_privsep_send_blob(struct imsgbuf *, size_t, size_t,
611 const uint8_t *);
612 const struct got_error *got_privsep_recv_blob(uint8_t **, size_t *, size_t *,
613 struct imsgbuf *);
614 const struct got_error *got_privsep_send_tag(struct imsgbuf *,
615 struct got_tag_object *);
616 const struct got_error *got_privsep_recv_tag(struct got_tag_object **,
617 struct imsgbuf *);
618 const struct got_error *got_privsep_init_pack_child(struct imsgbuf *,
619 struct got_pack *, struct got_packidx *);
620 const struct got_error *got_privsep_send_packed_obj_req(struct imsgbuf *, int,
621 struct got_object_id *);
622 const struct got_error *got_privsep_send_packed_raw_obj_req(struct imsgbuf *,
623 int, struct got_object_id *);
624 const struct got_error *got_privsep_send_pack_child_ready(struct imsgbuf *);
626 const struct got_error *got_privsep_send_gitconfig_parse_req(struct imsgbuf *,
627 int);
628 const struct got_error *
629 got_privsep_send_gitconfig_repository_format_version_req(struct imsgbuf *);
630 const struct got_error *got_privsep_send_gitconfig_repository_extensions_req(
631 struct imsgbuf *);
632 const struct got_error *got_privsep_send_gitconfig_author_name_req(
633 struct imsgbuf *);
634 const struct got_error *got_privsep_send_gitconfig_author_email_req(
635 struct imsgbuf *);
636 const struct got_error *got_privsep_send_gitconfig_remotes_req(
637 struct imsgbuf *);
638 const struct got_error *got_privsep_send_gitconfig_owner_req(struct imsgbuf *);
639 const struct got_error *got_privsep_recv_gitconfig_str(char **,
640 struct imsgbuf *);
641 const struct got_error *got_privsep_recv_gitconfig_int(int *, struct imsgbuf *);
642 const struct got_error *got_privsep_recv_gitconfig_remotes(
643 struct got_remote_repo **, int *, struct imsgbuf *);
645 const struct got_error *got_privsep_send_gotconfig_parse_req(struct imsgbuf *,
646 int);
647 const struct got_error *got_privsep_send_gotconfig_author_req(struct imsgbuf *);
648 const struct got_error *got_privsep_send_gotconfig_remotes_req(
649 struct imsgbuf *);
650 const struct got_error *got_privsep_recv_gotconfig_str(char **,
651 struct imsgbuf *);
652 const struct got_error *got_privsep_recv_gotconfig_remotes(
653 struct got_remote_repo **, int *, struct imsgbuf *);
655 const struct got_error *got_privsep_send_commit_traversal_request(
656 struct imsgbuf *, struct got_object_id *, int, const char *);
657 const struct got_error *got_privsep_recv_traversed_commits(
658 struct got_commit_object **, struct got_object_id **,
659 struct got_object_id_queue *, struct imsgbuf *);
661 const struct got_error *got_privsep_send_raw_delta_req(struct imsgbuf *, int,
662 struct got_object_id *);
663 const struct got_error *got_privsep_send_raw_delta_outfd(struct imsgbuf *, int);
664 const struct got_error *got_privsep_send_raw_delta(struct imsgbuf *, uint64_t,
665 uint64_t, off_t, off_t, off_t, struct got_object_id *);
666 const struct got_error *got_privsep_recv_raw_delta(uint64_t *, uint64_t *,
667 off_t *, off_t *, off_t *, struct got_object_id **, struct imsgbuf *);
669 void got_privsep_exec_child(int[2], const char *, const char *);