Commit Briefs

Thomas Adam

portable: add back sys/queue.h

Now that the handling of including sys/queue.h is better, there's no need to remove those lines from the source. Copy the location of those original sys/queue.h lines from upstream at the same line number, so as to avoid any conflicts in the future.


Omar Polo

use capsicum on FreeBSD

Thanks to the design of Got, the libexec helpers don't need any resource (in fact they run under pledge "stdio recvfd" on OpenBSD) and so using cap_enter(2) on FreeBSD is dead-easy. While the main process can't be sandboxed on FreeBSD (needs to exec the helpers), all the tough work is done by these small libexec helpers which is also the biggest attack surface. tested by naddy, ok thomas




Thomas Adam

portable: add support for landlock

landlock is a new set of linux APIs that is conceptually similar to unveil(2): the idea is to restrict what a process can do on a specified part of the filesystem. There are some differences in the behaviour: the major one being that the landlock ruleset is inherited across execve(2). This just restricts the libexec helpers by completely revoking ANY filesystem access; after all they are the biggest attack surface. got send/fetch/clone *may* end up spawning ssh(1), so at the moment is not possible to landlock the main process. From Omar Polo.


Thomas Adam

plug memory leaks in got-fetch-pack and got-send-pack

ok naddy


Thomas Adam

let 'got fetch' send all references to the server to avoid redundant downloads

Problem reported by naddy. ok naddy



Thomas Adam

portable: add FreeBSD support

This adds the capability to compile got-portable on FreeBSD.


Thomas Adam

portable: initial Linux compilation

This commit modifies the GoT main branch to be able to compile it under linux.


Stefan Sperling

de-duplicate a constant used by both 'got fetch' and 'got send'

Both GOT_FETCH_PKTMAX and GOT_SEND_PKTMAX had the same value. Declare this value as GOT_PKT_MAX in got_lib_pkt.h instead.


Stefan Sperling

move more code used by got-send-pack and got-fetch-pack to a common file

Move functions and data structures which implement Git protocol features required for fetching and sending pack files to new files lib/gitproto.c and lib/got_lib_gitproto.h. This code was duplicated in got-fetch-pack and got-send-pack. No functional change.


Stefan Sperling

move pkt code used by got-fetch-pack and got-send-pack to a common file

The Git protocol uses a simple packet framing format. The got-fetch-pack and got-send-pack programs contained identical copies of functions to support this format. Move related functions to new file lib/pkt.c and link both programs against this common implementation. No functional change.


Stefan Sperling

add a missing bounds-check in got-fetch-pack when parsing server response

The tokenize_refline() function could end up reading past the end of the buffer if the refline is not terminated with whitespace or \0.


Stefan Sperling

prevent NULL deref in got-fetch-pack if server does not announce capabilities

The my_capabilities pointer may remain NULL. Check for NULL before use.


Stefan Sperling

fix the error message shown when the server sends a bad ref line

Exposed by trying to run got clone -l against shithub.us over git:// found by abieber@



Stefan Sperling

work around spurious ACK responses from git servers in got-fetch-pack

The Git server can apparently send duplicate ACK responses even though we do not enable the multi_ack capability. According to the Git protocol docs the server should only send ACKs after receiving 'done' from the client if multi_ack has been enabled. However, a duplicate ACK response can be triggered by running 'got fetch -a' in our fetch_update_tag test. This resulted in the following error: got-fetch-pack: unknown side-band received from server got: bad packet received


Stefan Sperling

use size_t for loop indices to avoid signedness warnings; by emaste@freebsd

Same change as 16aeacf7088d, for subdirectories other than lib/


Christian Weisgerber

indentation fixes


Christian Weisgerber

Stop including <sys/syslimits.h> directly.

POSIX says the limits defined there are available from <limits.h>, which almost all affected source files already included anyway. ok millert stsp


Stefan Sperling

zap trailing tabs


Christian Weisgerber

do not rely on <zlib.h> to pull in <unistd.h>

ok stsp


Christian Weisgerber

Fix missing block grouping.

ok tracey stsp