From: Junio C Hamano Date: Thu, 7 Mar 2024 23:59:42 +0000 (-0800) Subject: Merge branch 'jk/upload-pack-v2-capability-cleanup' X-Git-Tag: v2.45.0-rc0~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a82fa7bce88e9795f18d01ed11df927e4de70ccf;p=thirdparty%2Fgit.git Merge branch 'jk/upload-pack-v2-capability-cleanup' The upload-pack program, when talking over v2, accepted the packfile-uris protocol extension from the client, even if it did not advertise the capability, which has been corrected. * jk/upload-pack-v2-capability-cleanup: upload-pack: only accept packfile-uris if we advertised it upload-pack: use existing config mechanism for advertisement upload-pack: centralize setup of sideband-all config upload-pack: use repository struct to get config --- a82fa7bce88e9795f18d01ed11df927e4de70ccf diff --cc upload-pack.c index 281bdf85c9,66f4de9d87..902144b9d3 --- a/upload-pack.c +++ b/upload-pack.c @@@ -113,7 -113,7 +113,8 @@@ struct upload_pack_data unsigned done : 1; /* v2 only */ unsigned allow_ref_in_want : 1; /* v2 only */ unsigned allow_sideband_all : 1; /* v2 only */ + unsigned seen_haves : 1; /* v2 only */ + unsigned allow_packfile_uris : 1; /* v2 only */ unsigned advertise_sid : 1; unsigned sent_capabilities : 1; }; @@@ -1648,10 -1651,8 +1654,11 @@@ static void process_args(struct packet_ continue; } - if (skip_prefix(arg, "packfile-uris ", &p)) { + if (data->allow_packfile_uris && + skip_prefix(arg, "packfile-uris ", &p)) { + if (data->uri_protocols.nr) + send_err_and_die(data, + "multiple packfile-uris lines forbidden"); string_list_split(&data->uri_protocols, p, ',', -1); continue; }