| 101 | } |
| 102 | |
| 103 | static int read_request(FILE *fh, struct credential *c, |
| 104 | struct strbuf *action, int *timeout) |
| 105 | { |
| 106 | static struct strbuf item = STRBUF_INIT; |
| 107 | const char *p; |
| 108 | |
| 109 | strbuf_getline_lf(&item, fh); |
| 110 | if (!skip_prefix(item.buf, "action=", &p)) |
| 111 | return error("client sent bogus action line: %s", item.buf); |
| 112 | strbuf_addstr(action, p); |
| 113 | |
| 114 | strbuf_getline_lf(&item, fh); |
| 115 | if (!skip_prefix(item.buf, "timeout=", &p)) |
| 116 | return error("client sent bogus timeout line: %s", item.buf); |
| 117 | *timeout = atoi(p); |
| 118 | |
| 119 | credential_set_all_capabilities(c, CREDENTIAL_OP_INITIAL); |
| 120 | |
| 121 | if (credential_read(c, fh, CREDENTIAL_OP_HELPER) < 0) |
| 122 | return -1; |
| 123 | return 0; |
| 124 | } |
| 125 | |
| 126 | static void serve_one_client(FILE *in, FILE *out) |
| 127 | { |
no test coverage detected