Commits


portable: gotd/gitwrapper: update for libs Bring gotd and gitwrapper closer to how libraries are detected.


portable: gotd: listen Include listen.c; make it portable.


portable: enable compiling gotd This enables gotd -- for now, this is opt-in at compile-time, via: ./configure --enable-gotd


fix typo in gotd debug messages: receving -> receiving


fix spurious empty packfile error from gotd when rewinding a branch ok op@


add support for protecting references against 'got send -f' to gotd ok op@


portable: configure: split out dependencies Rather than assume all dependencies are required for all programs, split them out. This will make packaging easier, as well as splitting the code to use subprojects. Note that due to the use of config.h semantics, in most cases the got_compat.h header file is now at the top of the .c file it is included in, so that it can handle the system header inclusion properly.


gotd: remove more (all?) double process names in log


gotd: Fix more double process names Patch by Josiah Frentsos, thanks!


add some helper functions to compute hashes This adds a set of functions to abstract over SHA1Init, SHA1Update, SHA1Final, their respective SHA256 variants and how to compare digests. Replace all the SHA1*() usage with the new APIs. It's a preparatory step for sha256 handling. ok stsp@


portable: rework SHA detection Simply the SHA detection by not predicating on libcrypto, but instead checking individual header files.


portable: remove sha1.h; found portably Remove sha1.h as this is found portably across systems.


rename lib/sha1.c to lib/hash.c It will soon grow functions to deal with sha256 too. stsp@ agrees.


include sha2.h too where sha1.h is included In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


remove recv_disconnect() from repo_write.c; missed in previous commit


do not expect to see a DISCONNECT message in repo processes The parent no longer sends this message. Perform related cleanup in the shutdown path instead. ok op@


typo and style(9): do not use function calls in initialisers. ok stsp@


gotd: implement the delete-refs capability Allow clients to run "got send -d" against gotd. Clients will send a zero-id as new id for a reference and, in the special but more common case of just deleting and not updating, no pack file will be sent. ok and tweaks by stsp@


gotd: fix "bad packfile with zero objects" error while creating branches Clients will send an empty pack file if they are only creating new references and have no objects to upload. Make gotd handle this and add a regression test which triggers the bug. Problem found by op@. The new regression test caught an unrelated issue where the client connection was left lingering after references had been updated, which made 'got send' followed by 'got clone -l' fail with the connection limit configured for the test suite (just one connection is allowed at a time). Fix this as well. ok op@


replace malloc+memcpy with strndup. no functional change intended ok stsp@


gotd: delete trailing blanks spotted while re-reading


add a gotd session process, split off from the parent process The new session process is able to manipulate files in the repository and keeps track of the read/write client session state. The parent process now restricts its view of the filesystem to the absolute path stored in argv[0], and combines this with unveil "x" on this path. As a result the parent process can only re-exec itself. small tweaks + ok op@


convert gotd repo_read.c and repo_write.c to single-client Because these processes are now started on demand per client connection there is no need to keep track of multiple clients anymore. Also, these processes can now exit when a disconnect event is received. ok op, jamsek


fork gotd repo_read/repo_write children on demand ok op, jamsek


switch gotd from chroot(2) to unveil(2) In the future, gotd will fork+exec new processes for each client connection. Using unveil instead of chroot avoids having to start such processes as root. The -portable version could use chroot(2) where no equivalent to unveil(2) exists. A future component which starts new processes will be isolated as a separate process, which could run as root in the -portable version. ok op@