Blame


1 7be7cc45 2018-04-02 stsp /*
2 5d56da81 2019-01-13 stsp * Copyright (c) 2018, 2019 Stefan Sperling <stsp@openbsd.org>
3 93658fb9 2020-03-18 stsp * Copyright (c) 2019, Ori Bernstein <ori@openbsd.org>
4 7be7cc45 2018-04-02 stsp *
5 7be7cc45 2018-04-02 stsp * Permission to use, copy, modify, and distribute this software for any
6 7be7cc45 2018-04-02 stsp * purpose with or without fee is hereby granted, provided that the above
7 7be7cc45 2018-04-02 stsp * copyright notice and this permission notice appear in all copies.
8 7be7cc45 2018-04-02 stsp *
9 7be7cc45 2018-04-02 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 7be7cc45 2018-04-02 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 7be7cc45 2018-04-02 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 7be7cc45 2018-04-02 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 7be7cc45 2018-04-02 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 7be7cc45 2018-04-02 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 7be7cc45 2018-04-02 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 7be7cc45 2018-04-02 stsp */
17 7be7cc45 2018-04-02 stsp
18 7be7cc45 2018-04-02 stsp /*
19 7be7cc45 2018-04-02 stsp * All code runs under the same UID but sensitive code paths are
20 7be7cc45 2018-04-02 stsp * run in a separate process with tighter pledge(2) promises.
21 2ca3a24b 2018-04-02 stsp * Data is communicated between processes via imsg_flush(3) and imsg_read(3).
22 7be7cc45 2018-04-02 stsp * This behaviour is transparent to users of the library.
23 7be7cc45 2018-04-02 stsp *
24 1e4880cb 2018-04-02 stsp * We generally transmit data in imsg buffers, split across several messages
25 ff6b18f8 2018-04-24 stsp * if necessary. File descriptors are used in cases where this is impractical,
26 ff6b18f8 2018-04-24 stsp * such as when accessing pack files or when transferring large blobs.
27 7be7cc45 2018-04-02 stsp *
28 ad242220 2018-09-08 stsp * We exec(2) after a fork(2). Parts of our library functionality are
29 ad242220 2018-09-08 stsp * accessible via separate executables in a libexec directory.
30 7be7cc45 2018-04-02 stsp */
31 7be7cc45 2018-04-02 stsp
32 ad242220 2018-09-08 stsp #define GOT_IMSG_FD_CHILD (STDERR_FILENO + 1)
33 ad242220 2018-09-08 stsp
34 ad242220 2018-09-08 stsp #ifndef GOT_LIBEXECDIR
35 ad242220 2018-09-08 stsp #define GOT_LIBEXECDIR /usr/libexec
36 ad242220 2018-09-08 stsp #endif
37 ad242220 2018-09-08 stsp
38 ad242220 2018-09-08 stsp /* Names of helper programs in libexec directory */
39 ad242220 2018-09-08 stsp #define GOT_PROG_READ_OBJECT got-read-object
40 ad242220 2018-09-08 stsp #define GOT_PROG_READ_TREE got-read-tree
41 ad242220 2018-09-08 stsp #define GOT_PROG_READ_COMMIT got-read-commit
42 ad242220 2018-09-08 stsp #define GOT_PROG_READ_BLOB got-read-blob
43 f4a881ce 2018-11-17 stsp #define GOT_PROG_READ_TAG got-read-tag
44 876c234b 2018-09-10 stsp #define GOT_PROG_READ_PACK got-read-pack
45 aba9c984 2019-09-08 stsp #define GOT_PROG_READ_GITCONFIG got-read-gitconfig
46 93658fb9 2020-03-18 stsp #define GOT_PROG_FETCH_PACK got-fetch-pack
47 93658fb9 2020-03-18 stsp #define GOT_PROG_INDEX_PACK got-index-pack
48 93658fb9 2020-03-18 stsp #define GOT_PROG_SEND_PACK got-send-pack
49 ad242220 2018-09-08 stsp
50 ad242220 2018-09-08 stsp #define GOT_STRINGIFY(x) #x
51 ad242220 2018-09-08 stsp #define GOT_STRINGVAL(x) GOT_STRINGIFY(x)
52 ad242220 2018-09-08 stsp
53 ad242220 2018-09-08 stsp /* Paths to helper programs in libexec directory */
54 ad242220 2018-09-08 stsp #define GOT_PATH_PROG_READ_OBJECT \
55 ad242220 2018-09-08 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_OBJECT)
56 ad242220 2018-09-08 stsp #define GOT_PATH_PROG_READ_TREE \
57 ad242220 2018-09-08 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TREE)
58 ad242220 2018-09-08 stsp #define GOT_PATH_PROG_READ_COMMIT \
59 ad242220 2018-09-08 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_COMMIT)
60 ad242220 2018-09-08 stsp #define GOT_PATH_PROG_READ_BLOB \
61 ad242220 2018-09-08 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_BLOB)
62 f4a881ce 2018-11-17 stsp #define GOT_PATH_PROG_READ_TAG \
63 f4a881ce 2018-11-17 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_TAG)
64 876c234b 2018-09-10 stsp #define GOT_PATH_PROG_READ_PACK \
65 876c234b 2018-09-10 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_PACK)
66 aba9c984 2019-09-08 stsp #define GOT_PATH_PROG_READ_GITCONFIG \
67 aba9c984 2019-09-08 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_READ_GITCONFIG)
68 93658fb9 2020-03-18 stsp #define GOT_PATH_PROG_FETCH_PACK \
69 93658fb9 2020-03-18 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_FETCH_PACK)
70 93658fb9 2020-03-18 stsp #define GOT_PATH_PROG_SEND_PACK \
71 93658fb9 2020-03-18 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_SEND_PACK)
72 93658fb9 2020-03-18 stsp #define GOT_PATH_PROG_INDEX_PACK \
73 93658fb9 2020-03-18 stsp GOT_STRINGVAL(GOT_LIBEXECDIR) "/" GOT_STRINGVAL(GOT_PROG_INDEX_PACK)
74 ad242220 2018-09-08 stsp
75 876c234b 2018-09-10 stsp struct got_privsep_child {
76 876c234b 2018-09-10 stsp int imsg_fd;
77 876c234b 2018-09-10 stsp pid_t pid;
78 876c234b 2018-09-10 stsp struct imsgbuf *ibuf;
79 876c234b 2018-09-10 stsp };
80 876c234b 2018-09-10 stsp
81 7be7cc45 2018-04-02 stsp enum got_imsg_type {
82 c025a41e 2018-04-02 stsp /* An error occured while processing a request. */
83 c025a41e 2018-04-02 stsp GOT_IMSG_ERROR,
84 c025a41e 2018-04-02 stsp
85 ad242220 2018-09-08 stsp /* Stop the child process. */
86 ad242220 2018-09-08 stsp GOT_IMSG_STOP,
87 1e4880cb 2018-04-02 stsp
88 7be7cc45 2018-04-02 stsp /*
89 7be7cc45 2018-04-02 stsp * Messages concerned with read access to objects in a repository.
90 7be7cc45 2018-04-02 stsp * Object and pack files are opened by the main process, where
91 7be7cc45 2018-04-02 stsp * data may be read as a byte string but without any interpretation.
92 7be7cc45 2018-04-02 stsp * Decompression and parsing of object and pack files occurs in a
93 f0b0c746 2018-09-09 stsp * separate process which runs under pledge("stdio recvfd").
94 7be7cc45 2018-04-02 stsp * This sandboxes our own repository parsing code, as well as zlib.
95 7be7cc45 2018-04-02 stsp */
96 ad242220 2018-09-08 stsp GOT_IMSG_OBJECT_REQUEST,
97 2178c42e 2018-04-22 stsp GOT_IMSG_OBJECT,
98 ad242220 2018-09-08 stsp GOT_IMSG_COMMIT_REQUEST,
99 bff6ca00 2018-04-23 stsp GOT_IMSG_COMMIT,
100 c75f7264 2018-09-11 stsp GOT_IMSG_COMMIT_LOGMSG,
101 ad242220 2018-09-08 stsp GOT_IMSG_TREE_REQUEST,
102 366d86ca 2018-04-23 stsp GOT_IMSG_TREE,
103 d80ab12b 2018-04-02 stsp GOT_IMSG_TREE_ENTRY,
104 ad242220 2018-09-08 stsp GOT_IMSG_BLOB_REQUEST,
105 ad242220 2018-09-08 stsp GOT_IMSG_BLOB_OUTFD,
106 366d86ca 2018-04-23 stsp GOT_IMSG_BLOB,
107 f4a881ce 2018-11-17 stsp GOT_IMSG_TAG_REQUEST,
108 f4a881ce 2018-11-17 stsp GOT_IMSG_TAG,
109 f4a881ce 2018-11-17 stsp GOT_IMSG_TAG_TAGMSG,
110 876c234b 2018-09-10 stsp
111 93658fb9 2020-03-18 stsp /* Messages related to networking. */
112 93658fb9 2020-03-18 stsp GOT_IMSG_FETCH_REQUEST,
113 abe0f35f 2020-03-18 stsp GOT_IMSG_FETCH_SYMREFS,
114 b9f99abf 2020-03-18 stsp GOT_IMSG_FETCH_PROGRESS,
115 93658fb9 2020-03-18 stsp GOT_IMSG_FETCH_DONE,
116 93658fb9 2020-03-18 stsp GOT_IMSG_IDXPACK_REQUEST,
117 93658fb9 2020-03-18 stsp GOT_IMSG_IDXPACK_DONE,
118 93658fb9 2020-03-18 stsp
119 876c234b 2018-09-10 stsp /* Messages related to pack files. */
120 876c234b 2018-09-10 stsp GOT_IMSG_PACKIDX,
121 876c234b 2018-09-10 stsp GOT_IMSG_PACK,
122 876c234b 2018-09-10 stsp GOT_IMSG_PACKED_OBJECT_REQUEST,
123 ca6e02ac 2020-01-07 stsp GOT_IMSG_COMMIT_TRAVERSAL_REQUEST,
124 ca6e02ac 2020-01-07 stsp GOT_IMSG_TRAVERSED_COMMITS,
125 ca6e02ac 2020-01-07 stsp GOT_IMSG_COMMIT_TRAVERSAL_DONE,
126 3840f4c9 2018-09-12 stsp
127 33ad4cbe 2019-05-12 jcs /* Message sending file descriptor to a temporary file. */
128 3840f4c9 2018-09-12 stsp GOT_IMSG_TMPFD,
129 aba9c984 2019-09-08 stsp
130 aba9c984 2019-09-08 stsp /* Messages related to gitconfig files. */
131 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_PARSE_REQUEST,
132 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_REPOSITORY_FORMAT_VERSION_REQUEST,
133 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_AUTHOR_NAME_REQUEST,
134 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_AUTHOR_EMAIL_REQUEST,
135 cd95becd 2019-11-29 stsp GOT_IMSG_GITCONFIG_REMOTES_REQUEST,
136 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_INT_VAL,
137 aba9c984 2019-09-08 stsp GOT_IMSG_GITCONFIG_STR_VAL,
138 cd95becd 2019-11-29 stsp GOT_IMSG_GITCONFIG_REMOTES,
139 cd95becd 2019-11-29 stsp GOT_IMSG_GITCONFIG_REMOTE,
140 9a1cc63f 2020-02-03 stsp GOT_IMSG_GITCONFIG_OWNER_REQUEST,
141 9a1cc63f 2020-02-03 stsp GOT_IMSG_GITCONFIG_OWNER,
142 7be7cc45 2018-04-02 stsp };
143 7be7cc45 2018-04-02 stsp
144 c025a41e 2018-04-02 stsp /* Structure for GOT_IMSG_ERROR. */
145 c025a41e 2018-04-02 stsp struct got_imsg_error {
146 c025a41e 2018-04-02 stsp int code; /* an error code from got_error.h */
147 2178c42e 2018-04-22 stsp int errno_code; /* in case code equals GOT_ERR_ERRNO */
148 291624d8 2018-11-07 stsp } __attribute__((__packed__));
149 c025a41e 2018-04-02 stsp
150 ad242220 2018-09-08 stsp /*
151 1785f84a 2018-12-23 stsp * Structure for GOT_IMSG_TREE_REQUEST and GOT_IMSG_OBJECT data.
152 ad242220 2018-09-08 stsp */
153 f7171542 2018-04-02 stsp struct got_imsg_object {
154 c59b3346 2018-09-11 stsp uint8_t id[SHA1_DIGEST_LENGTH];
155 c59b3346 2018-09-11 stsp
156 7be7cc45 2018-04-02 stsp /* These fields are the same as in struct got_object. */
157 7be7cc45 2018-04-02 stsp int type;
158 7be7cc45 2018-04-02 stsp int flags;
159 7be7cc45 2018-04-02 stsp size_t hdrlen;
160 7be7cc45 2018-04-02 stsp size_t size;
161 876c234b 2018-09-10 stsp off_t pack_offset;
162 c59b3346 2018-09-11 stsp int pack_idx;
163 291624d8 2018-11-07 stsp } __attribute__((__packed__));
164 7be7cc45 2018-04-02 stsp
165 366d86ca 2018-04-23 stsp /* Structure for GOT_IMSG_COMMIT data. */
166 bff6ca00 2018-04-23 stsp struct got_imsg_commit_object {
167 86acc566 2018-04-23 stsp uint8_t tree_id[SHA1_DIGEST_LENGTH];
168 bff6ca00 2018-04-23 stsp size_t author_len;
169 ccb26ccd 2018-11-05 stsp time_t author_time;
170 ccb26ccd 2018-11-05 stsp time_t author_gmtoff;
171 bff6ca00 2018-04-23 stsp size_t committer_len;
172 ccb26ccd 2018-11-05 stsp time_t committer_time;
173 ccb26ccd 2018-11-05 stsp time_t committer_gmtoff;
174 bff6ca00 2018-04-23 stsp size_t logmsg_len;
175 bff6ca00 2018-04-23 stsp int nparents;
176 bff6ca00 2018-04-23 stsp
177 6c281f94 2018-06-11 stsp /*
178 c75f7264 2018-09-11 stsp * Followed by author_len + committer_len data bytes
179 6c281f94 2018-06-11 stsp */
180 bff6ca00 2018-04-23 stsp
181 86acc566 2018-04-23 stsp /* Followed by 'nparents' SHA1_DIGEST_LENGTH length strings */
182 bff6ca00 2018-04-23 stsp
183 c75f7264 2018-09-11 stsp /*
184 c75f7264 2018-09-11 stsp * Followed by 'logmsg_len' bytes of commit log message data in
185 c75f7264 2018-09-11 stsp * one or more GOT_IMSG_COMMIT_LOGMSG messages.
186 c75f7264 2018-09-11 stsp */
187 bff6ca00 2018-04-23 stsp } __attribute__((__packed__));
188 bff6ca00 2018-04-23 stsp
189 f7171542 2018-04-02 stsp
190 48f392b2 2018-04-02 stsp /* Structure for GOT_IMSG_TREE_ENTRY. */
191 48f392b2 2018-04-02 stsp struct got_imsg_tree_entry {
192 e033d803 2018-04-23 stsp char id[SHA1_DIGEST_LENGTH];
193 48f392b2 2018-04-02 stsp mode_t mode;
194 48f392b2 2018-04-02 stsp /* Followed by entry's name in remaining data of imsg buffer. */
195 8d98bcfb 2018-04-02 stsp } __attribute__((__packed__));
196 48f392b2 2018-04-02 stsp
197 d80ab12b 2018-04-02 stsp /* Structure for GOT_IMSG_TREE_OBJECT_REPLY data. */
198 48f392b2 2018-04-02 stsp struct got_imsg_tree_object {
199 48f392b2 2018-04-02 stsp int nentries; /* This many TREE_ENTRY messages follow. */
200 48f392b2 2018-04-02 stsp };
201 48f392b2 2018-04-02 stsp
202 2967a784 2018-04-24 stsp /* Structure for GOT_IMSG_BLOB. */
203 2967a784 2018-04-24 stsp struct got_imsg_blob {
204 2967a784 2018-04-24 stsp size_t size;
205 ebc55e2d 2018-12-24 stsp size_t hdrlen;
206 ac544f8c 2019-01-13 stsp
207 ac544f8c 2019-01-13 stsp /*
208 ac544f8c 2019-01-13 stsp * If size <= GOT_PRIVSEP_INLINE_BLOB_DATA_MAX, blob data follows
209 ac544f8c 2019-01-13 stsp * in the imsg buffer. Otherwise, blob data has been written to a
210 ac544f8c 2019-01-13 stsp * file descriptor passed via the GOT_IMSG_BLOB_OUTFD imsg.
211 ac544f8c 2019-01-13 stsp */
212 ac544f8c 2019-01-13 stsp #define GOT_PRIVSEP_INLINE_BLOB_DATA_MAX \
213 ac544f8c 2019-01-13 stsp (MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof(struct got_imsg_blob))
214 2967a784 2018-04-24 stsp };
215 2967a784 2018-04-24 stsp
216 ac544f8c 2019-01-13 stsp
217 f4a881ce 2018-11-17 stsp /* Structure for GOT_IMSG_TAG data. */
218 f4a881ce 2018-11-17 stsp struct got_imsg_tag_object {
219 f4a881ce 2018-11-17 stsp uint8_t id[SHA1_DIGEST_LENGTH];
220 f4a881ce 2018-11-17 stsp int obj_type;
221 f4a881ce 2018-11-17 stsp size_t tag_len;
222 f4a881ce 2018-11-17 stsp size_t tagger_len;
223 f4a881ce 2018-11-17 stsp time_t tagger_time;
224 f4a881ce 2018-11-17 stsp time_t tagger_gmtoff;
225 f4a881ce 2018-11-17 stsp size_t tagmsg_len;
226 f4a881ce 2018-11-17 stsp
227 f4a881ce 2018-11-17 stsp /*
228 f4a881ce 2018-11-17 stsp * Followed by tag_len + tagger_len data bytes
229 f4a881ce 2018-11-17 stsp */
230 f4a881ce 2018-11-17 stsp
231 f4a881ce 2018-11-17 stsp /*
232 f4a881ce 2018-11-17 stsp * Followed by 'tagmsg_len' bytes of tag message data in
233 f4a881ce 2018-11-17 stsp * one or more GOT_IMSG_TAG_TAGMSG messages.
234 f4a881ce 2018-11-17 stsp */
235 abe0f35f 2020-03-18 stsp } __attribute__((__packed__));
236 abe0f35f 2020-03-18 stsp
237 abe0f35f 2020-03-18 stsp /* Structures for GOT_IMSG_FETCH_SYMREFS data. */
238 abe0f35f 2020-03-18 stsp struct got_imsg_fetch_symref {
239 abe0f35f 2020-03-18 stsp size_t name_len;
240 abe0f35f 2020-03-18 stsp size_t target_len;
241 abe0f35f 2020-03-18 stsp
242 abe0f35f 2020-03-18 stsp /*
243 d45e6863 2020-03-18 stsp * Followed by name_len + target_len data bytes.
244 abe0f35f 2020-03-18 stsp */
245 abe0f35f 2020-03-18 stsp } __attribute__((__packed__));
246 abe0f35f 2020-03-18 stsp
247 abe0f35f 2020-03-18 stsp struct got_imsg_fetch_symrefs {
248 abe0f35f 2020-03-18 stsp size_t nsymrefs;
249 abe0f35f 2020-03-18 stsp
250 abe0f35f 2020-03-18 stsp /* Followed by nsymrefs times of got_imsg_fetch_symref data. */
251 f4a881ce 2018-11-17 stsp } __attribute__((__packed__));
252 b9f99abf 2020-03-18 stsp
253 b9f99abf 2020-03-18 stsp /* Structure for GOT_IMSG_FETCH_PROGRESS data. */
254 b9f99abf 2020-03-18 stsp struct got_imsg_fetch_progress {
255 abe0f35f 2020-03-18 stsp /* Describes a reference which will be fetched. */
256 b9f99abf 2020-03-18 stsp uint8_t refid[SHA1_DIGEST_LENGTH];
257 b9f99abf 2020-03-18 stsp /* Followed by reference name in remaining data of imsg buffer. */
258 b9f99abf 2020-03-18 stsp };
259 f4a881ce 2018-11-17 stsp
260 876c234b 2018-09-10 stsp /* Structure for GOT_IMSG_PACKIDX. */
261 876c234b 2018-09-10 stsp struct got_imsg_packidx {
262 876c234b 2018-09-10 stsp size_t len;
263 876c234b 2018-09-10 stsp /* Additionally, a file desciptor is passed via imsg. */
264 876c234b 2018-09-10 stsp };
265 876c234b 2018-09-10 stsp
266 876c234b 2018-09-10 stsp /* Structure for GOT_IMSG_PACK. */
267 876c234b 2018-09-10 stsp struct got_imsg_pack {
268 876c234b 2018-09-10 stsp char path_packfile[PATH_MAX];
269 876c234b 2018-09-10 stsp size_t filesize;
270 876c234b 2018-09-10 stsp /* Additionally, a file desciptor is passed via imsg. */
271 291624d8 2018-11-07 stsp } __attribute__((__packed__));
272 876c234b 2018-09-10 stsp
273 876c234b 2018-09-10 stsp /*
274 876c234b 2018-09-10 stsp * Structure for GOT_IMSG_PACKED_OBJECT_REQUEST data.
275 876c234b 2018-09-10 stsp */
276 876c234b 2018-09-10 stsp struct got_imsg_packed_object {
277 106807b4 2018-09-15 stsp uint8_t id[SHA1_DIGEST_LENGTH];
278 876c234b 2018-09-10 stsp int idx;
279 291624d8 2018-11-07 stsp } __attribute__((__packed__));
280 876c234b 2018-09-10 stsp
281 ca6e02ac 2020-01-07 stsp /* Structure for GOT_IMSG_COMMIT_TRAVERSAL_REQUEST */
282 ca6e02ac 2020-01-07 stsp struct got_imsg_commit_traversal_request {
283 ca6e02ac 2020-01-07 stsp uint8_t id[SHA1_DIGEST_LENGTH];
284 ca6e02ac 2020-01-07 stsp int idx;
285 ca6e02ac 2020-01-07 stsp size_t path_len;
286 ca6e02ac 2020-01-07 stsp /* Followed by path_len bytes of path data */
287 ca6e02ac 2020-01-07 stsp } __attribute__((__packed__));
288 ca6e02ac 2020-01-07 stsp
289 ca6e02ac 2020-01-07 stsp /* Structure for GOT_IMSG_TRAVERSED_COMMITS */
290 ca6e02ac 2020-01-07 stsp struct got_imsg_traversed_commits {
291 ca6e02ac 2020-01-07 stsp size_t ncommits;
292 ca6e02ac 2020-01-07 stsp /* Followed by ncommit IDs of SHA1_DIGEST_LENGTH each */
293 ca6e02ac 2020-01-07 stsp } __attribute__((__packed__));
294 ca6e02ac 2020-01-07 stsp
295 cd95becd 2019-11-29 stsp /*
296 cd95becd 2019-11-29 stsp * Structure for GOT_IMSG_GITCONFIG_REMOTE data.
297 cd95becd 2019-11-29 stsp */
298 cd95becd 2019-11-29 stsp struct got_imsg_remote {
299 cd95becd 2019-11-29 stsp size_t name_len;
300 cd95becd 2019-11-29 stsp size_t url_len;
301 cd95becd 2019-11-29 stsp
302 cd95becd 2019-11-29 stsp /* Followed by name_len + url_len data bytes. */
303 cd95becd 2019-11-29 stsp };
304 cd95becd 2019-11-29 stsp
305 cd95becd 2019-11-29 stsp /*
306 cd95becd 2019-11-29 stsp * Structure for GOT_IMSG_GITCONFIG_REMOTES data.
307 cd95becd 2019-11-29 stsp */
308 cd95becd 2019-11-29 stsp struct got_imsg_remotes {
309 cd95becd 2019-11-29 stsp int nremotes; /* This many GOT_IMSG_GITCONFIG_REMOTE messages follow. */
310 cd95becd 2019-11-29 stsp };
311 cd95becd 2019-11-29 stsp
312 cd95becd 2019-11-29 stsp struct got_remote_repo;
313 876c234b 2018-09-10 stsp struct got_pack;
314 876c234b 2018-09-10 stsp struct got_packidx;
315 3022d272 2019-11-14 stsp struct got_pathlist_head;
316 876c234b 2018-09-10 stsp
317 93658fb9 2020-03-18 stsp const struct got_error *got_send_ack(pid_t);
318 876c234b 2018-09-10 stsp const struct got_error *got_privsep_wait_for_child(pid_t);
319 ad242220 2018-09-08 stsp const struct got_error *got_privsep_send_stop(int);
320 ad242220 2018-09-08 stsp const struct got_error *got_privsep_recv_imsg(struct imsg *, struct imsgbuf *,
321 ad242220 2018-09-08 stsp size_t);
322 2178c42e 2018-04-22 stsp void got_privsep_send_error(struct imsgbuf *, const struct got_error *);
323 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_send_ack(struct imsgbuf *);
324 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_wait_ack(struct imsgbuf *);
325 aea5f015 2018-12-24 stsp const struct got_error *got_privsep_send_obj_req(struct imsgbuf *, int);
326 1785f84a 2018-12-23 stsp const struct got_error *got_privsep_send_commit_req(struct imsgbuf *, int,
327 1785f84a 2018-12-23 stsp struct got_object_id *, int);
328 13c729f7 2018-12-24 stsp const struct got_error *got_privsep_send_tree_req(struct imsgbuf *, int,
329 13c729f7 2018-12-24 stsp struct got_object_id *, int);
330 268f7291 2018-12-24 stsp const struct got_error *got_privsep_send_tag_req(struct imsgbuf *, int,
331 268f7291 2018-12-24 stsp struct got_object_id *, int);
332 ebc55e2d 2018-12-24 stsp const struct got_error *got_privsep_send_blob_req(struct imsgbuf *, int,
333 ebc55e2d 2018-12-24 stsp struct got_object_id *, int);
334 55da3778 2018-09-10 stsp const struct got_error *got_privsep_send_blob_outfd(struct imsgbuf *, int);
335 3840f4c9 2018-09-12 stsp const struct got_error *got_privsep_send_tmpfd(struct imsgbuf *, int);
336 2178c42e 2018-04-22 stsp const struct got_error *got_privsep_send_obj(struct imsgbuf *,
337 876c234b 2018-09-10 stsp struct got_object *);
338 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_send_index_pack_req(struct imsgbuf *, int,
339 279090e1 2020-03-18 stsp struct got_object_id *);
340 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_send_index_pack_done(struct imsgbuf *);
341 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_wait_index_pack_done(struct imsgbuf *);
342 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int);
343 abe0f35f 2020-03-18 stsp const struct got_error *got_privsep_send_fetch_symrefs(struct imsgbuf *,
344 abe0f35f 2020-03-18 stsp struct got_pathlist_head *);
345 b9f99abf 2020-03-18 stsp const struct got_error *got_privsep_send_fetch_progress(struct imsgbuf *,
346 b9f99abf 2020-03-18 stsp struct got_object_id *, const char *);
347 8f2d01a6 2020-03-18 stsp const struct got_error *got_privsep_recv_fetch_progress(int *,
348 abe0f35f 2020-03-18 stsp struct got_object_id **, char **, struct got_pathlist_head *,
349 abe0f35f 2020-03-18 stsp struct imsgbuf *);
350 93658fb9 2020-03-18 stsp const struct got_error *got_privsep_send_fetch_done(struct imsgbuf *,
351 93658fb9 2020-03-18 stsp struct got_object_id);
352 cfd633c2 2018-09-10 stsp const struct got_error *got_privsep_get_imsg_obj(struct got_object **,
353 cfd633c2 2018-09-10 stsp struct imsg *, struct imsgbuf *);
354 2178c42e 2018-04-22 stsp const struct got_error *got_privsep_recv_obj(struct got_object **,
355 2178c42e 2018-04-22 stsp struct imsgbuf *);
356 068fd2bf 2018-04-24 stsp const struct got_error *got_privsep_send_commit(struct imsgbuf *,
357 bff6ca00 2018-04-23 stsp struct got_commit_object *);
358 068fd2bf 2018-04-24 stsp const struct got_error *got_privsep_recv_commit(struct got_commit_object **,
359 bff6ca00 2018-04-23 stsp struct imsgbuf *);
360 068fd2bf 2018-04-24 stsp const struct got_error *got_privsep_recv_tree(struct got_tree_object **,
361 e033d803 2018-04-23 stsp struct imsgbuf *);
362 068fd2bf 2018-04-24 stsp const struct got_error *got_privsep_send_tree(struct imsgbuf *,
363 3022d272 2019-11-14 stsp struct got_pathlist_head *, int);
364 ac544f8c 2019-01-13 stsp const struct got_error *got_privsep_send_blob(struct imsgbuf *, size_t, size_t,
365 ac544f8c 2019-01-13 stsp const uint8_t *);
366 ac544f8c 2019-01-13 stsp const struct got_error *got_privsep_recv_blob(uint8_t **, size_t *, size_t *,
367 ebc55e2d 2018-12-24 stsp struct imsgbuf *);
368 f4a881ce 2018-11-17 stsp const struct got_error *got_privsep_send_tag(struct imsgbuf *,
369 f4a881ce 2018-11-17 stsp struct got_tag_object *);
370 f4a881ce 2018-11-17 stsp const struct got_error *got_privsep_recv_tag(struct got_tag_object **,
371 f4a881ce 2018-11-17 stsp struct imsgbuf *);
372 876c234b 2018-09-10 stsp const struct got_error *got_privsep_init_pack_child(struct imsgbuf *,
373 876c234b 2018-09-10 stsp struct got_pack *, struct got_packidx *);
374 106807b4 2018-09-15 stsp const struct got_error *got_privsep_send_packed_obj_req(struct imsgbuf *, int,
375 106807b4 2018-09-15 stsp struct got_object_id *);
376 41fa1437 2018-11-05 stsp const struct got_error *got_privsep_send_pack_child_ready(struct imsgbuf *);
377 aba9c984 2019-09-08 stsp
378 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_send_gitconfig_parse_req(struct imsgbuf *,
379 aba9c984 2019-09-08 stsp int);
380 aba9c984 2019-09-08 stsp const struct got_error *
381 aba9c984 2019-09-08 stsp got_privsep_send_gitconfig_repository_format_version_req(struct imsgbuf *);
382 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_send_gitconfig_author_name_req(
383 aba9c984 2019-09-08 stsp struct imsgbuf *);
384 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_send_gitconfig_author_email_req(
385 aba9c984 2019-09-08 stsp struct imsgbuf *);
386 cd95becd 2019-11-29 stsp const struct got_error *got_privsep_send_gitconfig_remotes_req(
387 cd95becd 2019-11-29 stsp struct imsgbuf *);
388 9a1cc63f 2020-02-03 stsp const struct got_error *got_privsep_send_gitconfig_owner_req(struct imsgbuf *);
389 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_send_gitconfig_str(struct imsgbuf *,
390 aba9c984 2019-09-08 stsp const char *);
391 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_recv_gitconfig_str(char **,
392 aba9c984 2019-09-08 stsp struct imsgbuf *);
393 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_send_gitconfig_int(struct imsgbuf *, int);
394 aba9c984 2019-09-08 stsp const struct got_error *got_privsep_recv_gitconfig_int(int *, struct imsgbuf *);
395 cd95becd 2019-11-29 stsp const struct got_error *got_privsep_send_gitconfig_remotes(struct imsgbuf *,
396 cd95becd 2019-11-29 stsp struct got_remote_repo *, int);
397 cd95becd 2019-11-29 stsp const struct got_error *got_privsep_recv_gitconfig_remotes(
398 cd95becd 2019-11-29 stsp struct got_remote_repo **, int *, struct imsgbuf *);
399 aba9c984 2019-09-08 stsp
400 ca6e02ac 2020-01-07 stsp const struct got_error *got_privsep_send_commit_traversal_request(
401 ca6e02ac 2020-01-07 stsp struct imsgbuf *, struct got_object_id *, int, const char *);
402 ca6e02ac 2020-01-07 stsp const struct got_error *got_privsep_recv_traversed_commits(
403 ca6e02ac 2020-01-07 stsp struct got_commit_object **, struct got_object_id **,
404 ca6e02ac 2020-01-07 stsp struct got_object_id_queue *, struct imsgbuf *);
405 ca6e02ac 2020-01-07 stsp const struct got_error *got_privsep_send_traversed_commits(
406 ca6e02ac 2020-01-07 stsp struct got_object_id *, size_t, struct imsgbuf *);
407 ca6e02ac 2020-01-07 stsp const struct got_error *got_privsep_send_commit_traversal_done(
408 ca6e02ac 2020-01-07 stsp struct imsgbuf *);
409 ca6e02ac 2020-01-07 stsp
410 aba9c984 2019-09-08 stsp void got_privsep_exec_child(int[2], const char *, const char *);