Blob


1 /*
2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <sys/queue.h>
20 #include <sys/uio.h>
21 #include <sys/socket.h>
22 #include <sys/wait.h>
24 #include <errno.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdint.h>
29 #include <sha1.h>
30 #include <zlib.h>
31 #include <ctype.h>
32 #include <limits.h>
33 #include <imsg.h>
34 #include <time.h>
35 #include <unistd.h>
37 #include "got_error.h"
38 #include "got_object.h"
39 #include "got_repository.h"
40 #include "got_opentemp.h"
42 #include "got_lib_sha1.h"
43 #include "got_lib_delta.h"
44 #include "got_lib_privsep.h"
45 #include "got_lib_pack.h"
46 #include "got_lib_inflate.h"
47 #include "got_lib_object.h"
48 #include "got_lib_repository.h"
50 #ifndef nitems
51 #define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
52 #endif
54 #define GOT_OBJ_TAG_COMMIT "commit"
55 #define GOT_OBJ_TAG_TREE "tree"
56 #define GOT_OBJ_TAG_BLOB "blob"
58 #define GOT_COMMIT_TAG_TREE "tree "
59 #define GOT_COMMIT_TAG_PARENT "parent "
60 #define GOT_COMMIT_TAG_AUTHOR "author "
61 #define GOT_COMMIT_TAG_COMMITTER "committer "
63 void
64 got_object_close(struct got_object *obj)
65 {
66 if (obj->refcnt > 0) {
67 obj->refcnt--;
68 if (obj->refcnt > 0)
69 return;
70 }
72 if (obj->flags & GOT_OBJ_FLAG_DELTIFIED) {
73 struct got_delta *delta;
74 while (!SIMPLEQ_EMPTY(&obj->deltas.entries)) {
75 delta = SIMPLEQ_FIRST(&obj->deltas.entries);
76 SIMPLEQ_REMOVE_HEAD(&obj->deltas.entries, entry);
77 got_delta_close(delta);
78 }
79 }
80 if (obj->flags & GOT_OBJ_FLAG_PACKED)
81 free(obj->path_packfile);
82 free(obj);
83 }
85 void
86 got_object_qid_free(struct got_object_qid *qid)
87 {
88 free(qid->id);
89 free(qid);
90 }
92 static const struct got_error *
93 request_object(struct got_object **obj, struct got_repository *repo, int fd)
94 {
95 const struct got_error *err = NULL;
96 struct imsgbuf *ibuf;
98 ibuf = repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].ibuf;
100 err = got_privsep_send_obj_req(ibuf, fd, NULL);
101 if (err)
102 return err;
104 return got_privsep_recv_obj(obj, ibuf);
107 static void
108 exec_privsep_child(int imsg_fds[2], const char *path, const char *repo_path)
110 close(imsg_fds[0]);
112 if (dup2(imsg_fds[1], GOT_IMSG_FD_CHILD) == -1) {
113 fprintf(stderr, "%s: %s\n", getprogname(),
114 strerror(errno));
115 _exit(1);
117 if (closefrom(GOT_IMSG_FD_CHILD + 1) == -1) {
118 fprintf(stderr, "%s: %s\n", getprogname(),
119 strerror(errno));
120 _exit(1);
123 if (execl(path, path, repo_path, (char *)NULL) == -1) {
124 fprintf(stderr, "%s: %s: %s\n", getprogname(), path,
125 strerror(errno));
126 _exit(1);
130 const struct got_error *
131 got_object_read_header_privsep(struct got_object **obj,
132 struct got_repository *repo, int obj_fd)
134 int imsg_fds[2];
135 pid_t pid;
136 struct imsgbuf *ibuf;
138 if (repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].imsg_fd != -1)
139 return request_object(obj, repo, obj_fd);
141 ibuf = calloc(1, sizeof(*ibuf));
142 if (ibuf == NULL)
143 return got_error_from_errno();
145 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, imsg_fds) == -1)
146 return got_error_from_errno();
148 pid = fork();
149 if (pid == -1)
150 return got_error_from_errno();
151 else if (pid == 0) {
152 exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_OBJECT,
153 repo->path);
154 /* not reached */
157 close(imsg_fds[1]);
158 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].imsg_fd =
159 imsg_fds[0];
160 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].pid = pid;
161 imsg_init(ibuf, imsg_fds[0]);
162 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_OBJECT].ibuf = ibuf;
164 return request_object(obj, repo, obj_fd);
167 struct got_commit_object *
168 got_object_commit_alloc_partial(void)
170 struct got_commit_object *commit;
172 commit = calloc(1, sizeof(*commit));
173 if (commit == NULL)
174 return NULL;
175 commit->tree_id = calloc(1, sizeof(*commit->tree_id));
176 if (commit->tree_id == NULL) {
177 free(commit);
178 return NULL;
181 SIMPLEQ_INIT(&commit->parent_ids);
183 return commit;
186 const struct got_error *
187 got_object_commit_add_parent(struct got_commit_object *commit,
188 const char *id_str)
190 const struct got_error *err = NULL;
191 struct got_object_qid *qid;
193 qid = malloc(sizeof(*qid));
194 if (qid == NULL)
195 return got_error_from_errno();
197 qid->id = malloc(sizeof(*qid->id));
198 if (qid->id == NULL) {
199 err = got_error_from_errno();
200 got_object_qid_free(qid);
201 return err;
204 if (!got_parse_sha1_digest(qid->id->sha1, id_str)) {
205 err = got_error(GOT_ERR_BAD_OBJ_DATA);
206 free(qid->id);
207 free(qid);
208 return err;
211 SIMPLEQ_INSERT_TAIL(&commit->parent_ids, qid, entry);
212 commit->nparents++;
214 return NULL;
217 static const struct got_error *
218 parse_gmtoff(time_t *gmtoff, const char *tzstr)
220 int sign = 1;
221 const char *p = tzstr;
222 time_t h, m;
224 *gmtoff = 0;
226 if (*p == '-')
227 sign = -1;
228 else if (*p != '+')
229 return got_error(GOT_ERR_BAD_OBJ_DATA);
230 p++;
231 if (!isdigit(*p) && !isdigit(*(p + 1)))
232 return got_error(GOT_ERR_BAD_OBJ_DATA);
233 h = (((*p - '0') * 10) + (*(p + 1) - '0'));
235 p += 2;
236 if (!isdigit(*p) && !isdigit(*(p + 1)))
237 return got_error(GOT_ERR_BAD_OBJ_DATA);
238 m = ((*p - '0') * 10) + (*(p + 1) - '0');
240 *gmtoff = (h * 60 * 60 + m * 60) * sign;
241 return NULL;
244 static const struct got_error *
245 parse_commit_time(struct tm *tm, char *committer)
247 const struct got_error *err = NULL;
248 const char *errstr;
249 char *space, *tzstr;
250 time_t gmtoff;
251 time_t time;
253 /* Parse and strip off trailing timezone indicator string. */
254 space = strrchr(committer, ' ');
255 if (space == NULL)
256 return got_error(GOT_ERR_BAD_OBJ_DATA);
257 tzstr = strdup(space + 1);
258 if (tzstr == NULL)
259 return got_error_from_errno();
260 err = parse_gmtoff(&gmtoff, tzstr);
261 free(tzstr);
262 if (err)
263 return err;
264 *space = '\0';
266 /* Timestamp is separated from committer name + email by space. */
267 space = strrchr(committer, ' ');
268 if (space == NULL)
269 return got_error(GOT_ERR_BAD_OBJ_DATA);
271 /* Timestamp parsed here is expressed in comitter's local time. */
272 time = strtonum(space + 1, 0, INT64_MAX, &errstr);
273 if (errstr)
274 return got_error(GOT_ERR_BAD_OBJ_DATA);
276 /* Express the time stamp in UTC. */
277 memset(tm, 0, sizeof(*tm));
278 time -= gmtoff;
279 if (localtime_r(&time, tm) == NULL)
280 return got_error_from_errno();
281 tm->tm_gmtoff = gmtoff;
283 /* Strip off parsed time information, leaving just author and email. */
284 *space = '\0';
286 return NULL;
289 void
290 got_object_commit_close(struct got_commit_object *commit)
292 struct got_object_qid *qid;
294 if (commit->refcnt > 0) {
295 commit->refcnt--;
296 if (commit->refcnt > 0)
297 return;
300 while (!SIMPLEQ_EMPTY(&commit->parent_ids)) {
301 qid = SIMPLEQ_FIRST(&commit->parent_ids);
302 SIMPLEQ_REMOVE_HEAD(&commit->parent_ids, entry);
303 got_object_qid_free(qid);
306 free(commit->tree_id);
307 free(commit->author);
308 free(commit->committer);
309 free(commit->logmsg);
310 free(commit);
313 const struct got_error *
314 got_object_parse_commit(struct got_commit_object **commit, char *buf, size_t len)
316 const struct got_error *err = NULL;
317 char *s = buf;
318 size_t tlen;
319 ssize_t remain = (ssize_t)len;
321 *commit = got_object_commit_alloc_partial();
322 if (*commit == NULL)
323 return got_error_from_errno();
325 tlen = strlen(GOT_COMMIT_TAG_TREE);
326 if (strncmp(s, GOT_COMMIT_TAG_TREE, tlen) == 0) {
327 remain -= tlen;
328 if (remain < SHA1_DIGEST_STRING_LENGTH) {
329 err = got_error(GOT_ERR_BAD_OBJ_DATA);
330 goto done;
332 s += tlen;
333 if (!got_parse_sha1_digest((*commit)->tree_id->sha1, s)) {
334 err = got_error(GOT_ERR_BAD_OBJ_DATA);
335 goto done;
337 remain -= SHA1_DIGEST_STRING_LENGTH;
338 s += SHA1_DIGEST_STRING_LENGTH;
339 } else {
340 err = got_error(GOT_ERR_BAD_OBJ_DATA);
341 goto done;
344 tlen = strlen(GOT_COMMIT_TAG_PARENT);
345 while (strncmp(s, GOT_COMMIT_TAG_PARENT, tlen) == 0) {
346 remain -= tlen;
347 if (remain < SHA1_DIGEST_STRING_LENGTH) {
348 err = got_error(GOT_ERR_BAD_OBJ_DATA);
349 goto done;
351 s += tlen;
352 err = got_object_commit_add_parent(*commit, s);
353 if (err)
354 goto done;
356 remain -= SHA1_DIGEST_STRING_LENGTH;
357 s += SHA1_DIGEST_STRING_LENGTH;
360 tlen = strlen(GOT_COMMIT_TAG_AUTHOR);
361 if (strncmp(s, GOT_COMMIT_TAG_AUTHOR, tlen) == 0) {
362 char *p;
363 size_t slen;
365 remain -= tlen;
366 if (remain <= 0) {
367 err = got_error(GOT_ERR_BAD_OBJ_DATA);
368 goto done;
370 s += tlen;
371 p = strchr(s, '\n');
372 if (p == NULL) {
373 err = got_error(GOT_ERR_BAD_OBJ_DATA);
374 goto done;
376 *p = '\0';
377 slen = strlen(s);
378 err = parse_commit_time(&(*commit)->tm_author, s);
379 if (err)
380 goto done;
381 (*commit)->author = strdup(s);
382 if ((*commit)->author == NULL) {
383 err = got_error_from_errno();
384 goto done;
386 s += slen + 1;
387 remain -= slen + 1;
390 tlen = strlen(GOT_COMMIT_TAG_COMMITTER);
391 if (strncmp(s, GOT_COMMIT_TAG_COMMITTER, tlen) == 0) {
392 char *p;
393 size_t slen;
395 remain -= tlen;
396 if (remain <= 0) {
397 err = got_error(GOT_ERR_BAD_OBJ_DATA);
398 goto done;
400 s += tlen;
401 p = strchr(s, '\n');
402 if (p == NULL) {
403 err = got_error(GOT_ERR_BAD_OBJ_DATA);
404 goto done;
406 *p = '\0';
407 slen = strlen(s);
408 err = parse_commit_time(&(*commit)->tm_committer, s);
409 if (err)
410 goto done;
411 (*commit)->committer = strdup(s);
412 if ((*commit)->committer == NULL) {
413 err = got_error_from_errno();
414 goto done;
416 s += slen + 1;
417 remain -= slen + 1;
420 (*commit)->logmsg = strndup(s, remain);
421 if ((*commit)->logmsg == NULL) {
422 err = got_error_from_errno();
423 goto done;
425 done:
426 if (err) {
427 got_object_commit_close(*commit);
428 *commit = NULL;
430 return err;
433 void
434 got_object_tree_entry_close(struct got_tree_entry *te)
436 free(te->id);
437 free(te->name);
438 free(te);
441 void
442 got_object_tree_close(struct got_tree_object *tree)
444 struct got_tree_entry *te;
446 if (tree->refcnt > 0) {
447 tree->refcnt--;
448 if (tree->refcnt > 0)
449 return;
452 while (!SIMPLEQ_EMPTY(&tree->entries.head)) {
453 te = SIMPLEQ_FIRST(&tree->entries.head);
454 SIMPLEQ_REMOVE_HEAD(&tree->entries.head, entry);
455 got_object_tree_entry_close(te);
458 free(tree);
461 struct got_tree_entry *
462 got_alloc_tree_entry_partial(void)
464 struct got_tree_entry *te;
466 te = calloc(1, sizeof(*te));
467 if (te == NULL)
468 return NULL;
470 te->id = calloc(1, sizeof(*te->id));
471 if (te->id == NULL) {
472 free(te);
473 te = NULL;
475 return te;
478 static const struct got_error *
479 parse_tree_entry(struct got_tree_entry **te, size_t *elen, char *buf,
480 size_t maxlen)
482 char *p = buf, *space;
483 const struct got_error *err = NULL;
485 *te = got_alloc_tree_entry_partial();
486 if (*te == NULL)
487 return got_error_from_errno();
489 *elen = strlen(buf) + 1;
490 if (*elen > maxlen) {
491 free(*te);
492 *te = NULL;
493 return got_error(GOT_ERR_BAD_OBJ_DATA);
496 space = strchr(buf, ' ');
497 if (space == NULL) {
498 err = got_error(GOT_ERR_BAD_OBJ_DATA);
499 free(*te);
500 *te = NULL;
501 return err;
503 while (*p != ' ') {
504 if (*p < '0' && *p > '7') {
505 err = got_error(GOT_ERR_BAD_OBJ_DATA);
506 goto done;
508 (*te)->mode <<= 3;
509 (*te)->mode |= *p - '0';
510 p++;
513 (*te)->name = strdup(space + 1);
514 if (*elen > maxlen || maxlen - *elen < SHA1_DIGEST_LENGTH) {
515 err = got_error(GOT_ERR_BAD_OBJ_DATA);
516 goto done;
518 buf += strlen(buf) + 1;
519 memcpy((*te)->id->sha1, buf, SHA1_DIGEST_LENGTH);
520 *elen += SHA1_DIGEST_LENGTH;
521 done:
522 if (err) {
523 got_object_tree_entry_close(*te);
524 *te = NULL;
526 return err;
529 const struct got_error *
530 got_object_parse_tree(struct got_tree_object **tree, uint8_t *buf, size_t len)
532 const struct got_error *err;
533 size_t remain = len;
535 *tree = calloc(1, sizeof(**tree));
536 if (*tree == NULL)
537 return got_error_from_errno();
539 SIMPLEQ_INIT(&(*tree)->entries.head);
541 while (remain > 0) {
542 struct got_tree_entry *te;
543 size_t elen;
545 err = parse_tree_entry(&te, &elen, buf, remain);
546 if (err)
547 return err;
548 (*tree)->entries.nentries++;
549 SIMPLEQ_INSERT_TAIL(&(*tree)->entries.head, te, entry);
550 buf += elen;
551 remain -= elen;
554 if (remain != 0) {
555 got_object_tree_close(*tree);
556 return got_error(GOT_ERR_BAD_OBJ_DATA);
559 return NULL;
562 const struct got_error *
563 got_read_file_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
565 const struct got_error *err = NULL;
566 static const size_t blocksize = 512;
567 size_t n, total, remain;
568 uint8_t *buf;
570 *outbuf = NULL;
571 *outlen = 0;
573 buf = malloc(blocksize);
574 if (buf == NULL)
575 return got_error_from_errno();
577 remain = blocksize;
578 total = 0;
579 while (1) {
580 if (remain == 0) {
581 uint8_t *newbuf;
582 newbuf = reallocarray(buf, 1, total + blocksize);
583 if (newbuf == NULL) {
584 err = got_error_from_errno();
585 goto done;
587 buf = newbuf;
588 remain += blocksize;
590 n = fread(buf + total, 1, remain, f);
591 if (n == 0) {
592 if (ferror(f)) {
593 err = got_ferror(f, GOT_ERR_IO);
594 goto done;
596 break; /* EOF */
598 remain -= n;
599 total += n;
600 };
602 done:
603 if (err == NULL) {
604 *outbuf = buf;
605 *outlen = total;
606 } else
607 free(buf);
608 return err;
611 static const struct got_error *
612 request_commit(struct got_commit_object **commit, struct got_repository *repo,
613 struct got_object *obj, int fd)
615 const struct got_error *err = NULL;
616 struct imsgbuf *ibuf;
618 ibuf = repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_COMMIT].ibuf;
620 err = got_privsep_send_obj_req(ibuf, fd,obj);
621 if (err)
622 return err;
624 return got_privsep_recv_commit(commit, ibuf);
627 const struct got_error *
628 got_object_read_commit_privsep(struct got_commit_object **commit,
629 struct got_object *obj, int obj_fd, struct got_repository *repo)
631 int imsg_fds[2];
632 pid_t pid;
633 struct imsgbuf *ibuf;
635 if (repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_COMMIT].imsg_fd != -1)
636 return request_commit(commit, repo, obj, obj_fd);
638 ibuf = calloc(1, sizeof(*ibuf));
639 if (ibuf == NULL)
640 return got_error_from_errno();
642 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, imsg_fds) == -1)
643 return got_error_from_errno();
645 pid = fork();
646 if (pid == -1)
647 return got_error_from_errno();
648 else if (pid == 0) {
649 exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_COMMIT,
650 repo->path);
651 /* not reached */
654 close(imsg_fds[1]);
655 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_COMMIT].imsg_fd =
656 imsg_fds[0];
657 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_COMMIT].pid = pid;
658 imsg_init(ibuf, imsg_fds[0]);
659 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_COMMIT].ibuf = ibuf;
661 return request_commit(commit, repo, obj, obj_fd);
664 static const struct got_error *
665 request_tree(struct got_tree_object **tree, struct got_repository *repo,
666 struct got_object *obj, int fd)
668 const struct got_error *err = NULL;
669 struct imsgbuf *ibuf;
671 ibuf = repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_TREE].ibuf;
673 err = got_privsep_send_obj_req(ibuf, fd,obj);
674 if (err)
675 return err;
677 return got_privsep_recv_tree(tree, ibuf);
680 const struct got_error *
681 got_object_read_tree_privsep(struct got_tree_object **tree,
682 struct got_object *obj, int obj_fd, struct got_repository *repo)
684 int imsg_fds[2];
685 pid_t pid;
686 struct imsgbuf *ibuf;
688 if (repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_TREE].imsg_fd != -1)
689 return request_tree(tree, repo, obj, obj_fd);
691 ibuf = calloc(1, sizeof(*ibuf));
692 if (ibuf == NULL)
693 return got_error_from_errno();
695 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, imsg_fds) == -1)
696 return got_error_from_errno();
698 pid = fork();
699 if (pid == -1)
700 return got_error_from_errno();
701 else if (pid == 0) {
702 exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_TREE,
703 repo->path);
704 /* not reached */
707 close(imsg_fds[1]);
709 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_TREE].imsg_fd =
710 imsg_fds[0];
711 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_TREE].pid = pid;
712 imsg_init(ibuf, imsg_fds[0]);
713 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_TREE].ibuf = ibuf;
716 return request_tree(tree, repo, obj, obj_fd);
719 static const struct got_error *
720 request_blob(size_t *size, int outfd, int infd, struct got_repository *repo)
722 const struct got_error *err = NULL;
723 int outfd_child;
724 struct imsgbuf *ibuf;
726 outfd_child = dup(outfd);
727 if (outfd_child == -1)
728 return got_error_from_errno();
730 ibuf = repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_BLOB].ibuf;
732 err = got_privsep_send_blob_req(ibuf, outfd_child, infd);
733 if (err)
734 return err;
736 err = got_privsep_recv_blob(size, ibuf);
737 if (err)
738 return err;
740 if (lseek(outfd, SEEK_SET, 0) == -1)
741 return got_error_from_errno();
743 return err;
746 const struct got_error *
747 got_object_read_blob_privsep(size_t *size, int outfd, int infd,
748 struct got_repository *repo)
750 int imsg_fds[2];
751 pid_t pid;
752 struct imsgbuf *ibuf;
754 if (repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_BLOB].imsg_fd != -1)
755 return request_blob(size, outfd, infd, repo);
757 ibuf = calloc(1, sizeof(*ibuf));
758 if (ibuf == NULL)
759 return got_error_from_errno();
761 if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, imsg_fds) == -1)
762 return got_error_from_errno();
764 pid = fork();
765 if (pid == -1)
766 return got_error_from_errno();
767 else if (pid == 0) {
768 exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_BLOB,
769 repo->path);
770 /* not reached */
773 close(imsg_fds[1]);
774 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_BLOB].imsg_fd =
775 imsg_fds[0];
776 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_BLOB].pid = pid;
777 imsg_init(ibuf, imsg_fds[0]);
778 repo->privsep_children[GOT_REPO_PRIVSEP_CHILD_BLOB].ibuf = ibuf;
780 return request_blob(size, outfd, infd, repo);