MCPcopy Index your code
hub / github.com/git/git / select_service

Function select_service

http-backend.c:268–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268static struct rpc_service *select_service(struct strbuf *hdr, const char *name)
269{
270 const char *svc_name;
271 struct rpc_service *svc = NULL;
272 int i;
273
274 if (!skip_prefix(name, "git-", &svc_name))
275 forbidden(hdr, "Unsupported service: '%s'", name);
276
277 for (i = 0; i < ARRAY_SIZE(rpc_service); i++) {
278 struct rpc_service *s = &rpc_service[i];
279 if (!strcmp(s->name, svc_name)) {
280 svc = s;
281 break;
282 }
283 }
284
285 if (!svc)
286 forbidden(hdr, "Unsupported service: '%s'", name);
287
288 if (svc->enabled < 0) {
289 const char *user = getenv("REMOTE_USER");
290 svc->enabled = (user && *user) ? 1 : 0;
291 }
292 if (!svc->enabled)
293 forbidden(hdr, "Service not enabled: '%s'", svc->name);
294 return svc;
295}
296
297static void write_to_child(int out, const unsigned char *buf, ssize_t len, const char *prog_name)
298{

Callers 2

get_info_refsFunction · 0.85
service_rpcFunction · 0.85

Calls 1

forbiddenFunction · 0.85

Tested by

no test coverage detected