| 2177 | } |
| 2178 | |
| 2179 | static void queue_commands_from_cert(struct command **tail, |
| 2180 | struct strbuf *push_cert) |
| 2181 | { |
| 2182 | const char *boc, *eoc; |
| 2183 | |
| 2184 | if (*tail) |
| 2185 | die("protocol error: got both push certificate and unsigned commands"); |
| 2186 | |
| 2187 | boc = strstr(push_cert->buf, "\n\n"); |
| 2188 | if (!boc) |
| 2189 | die("malformed push certificate %.*s", 100, push_cert->buf); |
| 2190 | else |
| 2191 | boc += 2; |
| 2192 | eoc = push_cert->buf + parse_signed_buffer(push_cert->buf, push_cert->len); |
| 2193 | |
| 2194 | while (boc < eoc) { |
| 2195 | const char *eol = memchr(boc, '\n', eoc - boc); |
| 2196 | tail = queue_command(tail, boc, eol ? eol - boc : eoc - boc); |
| 2197 | boc = eol ? eol + 1 : eoc; |
| 2198 | } |
| 2199 | } |
| 2200 | |
| 2201 | static struct command *read_head_info(struct packet_reader *reader, |
| 2202 | struct oid_array *shallow) |
no test coverage detected