Commit Briefs

ae25a666dd Omar Polo

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@


53bf0b5419 Omar Polo

rename lib/sha1.c to lib/hash.c

It will soon grow functions to deal with sha256 too. stsp@ agrees.


5822e79e39 Omar Polo

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>


161b566ff8 Omar Polo

lib/object_create.c: calloc object ids

future fields added to the got_object_id will be implicitly zeroed instead of gibberish. ok stsp@


b90054ed55 Stefan Sperling

use mkstemps(3) instead of mkstemp(3) for opening named temporary files

Allows 'got commit' to use a ".diff" suffix for temporary diff files. ok op@


4083147108 Josh Rickmar

don't create signed tag objects with trailing NUL

Although Git itself did not care, the superfluous NUL at the end of the tag object was breaking GitHub's SSH signature detection. ok stsp@


438d0cc30b Omar Polo

fix snprintf error handling

follow the "proper secure idiom" described in the CAVEATS section of printf(3). reminded by tb@ and millert@


c9e76cc42e Florian Obser

Prevent memory leak when asprintf fails.

Found by llvm's scan-build. OK stsp


1bd8e3b16c Josh Rickmar

fix pipe usage for linux

This uses the correct read and write ends of the fds returned by pipe(2) on linux. It also moves away from creating FILE* streams with fdopen and reading the stream with buf_load (which performs a fstat, and breaks due to a zero length file size on linux) by instead reading from the fd itself. Reported by abieber@, with assistance from stsp@ ok stsp@


91d845ad5d Josh Rickmar

fix tag signing when the key file does not exist

This should fail without creating any tag. Before, ssh-keygen(1) would print an error to stderr, but got would create an unsigned tag. ok op@


4d5ee9564a Josh Rickmar

create and verify tags signed by SSH keys

This adds a new -s flag to 'got tag' that specifies the signer identity (for example, a key file) of the tagger. The tag object will include a signature that validates each of the tag object headers and the tag message. Verifying these signed tags requires maintaining an allowed signers file which maps signer identities (i.e. the email address of the tagger) to SSH public keys. See ssh-keygen(1) for more details of the allowed signers file. After creating this file and providing the path to it in got.conf(5) using the allowed_signers option, tags may be verified using with 'got tag -V tag_name'. The return code will be non-zero if a signature fails to verify. ok stsp@


336075a42a Omar Polo

build with -Wmissing-prototypes

ok stsp@


d7b5a0e827 Stefan Sperling

inline struct got_object_id in struct got_object_qid

Saves us from doing a malloc/free call for every item on the list. ok op@



8bd0cdad05 Stefan Sperling

add O_CLOEXEC (close-on-exec) flag to open(2) calls

suggested by millert ok thomas_adam


ed7cc4a821 Stefan Sperling

remove outdated comment


5c02d2a555 Stefan Sperling

for portability, handle errno variations upon open(2) failure with O_NOFOLLOW

Problem pointed out by naddy for FreeBSD -portable. Discussed with millert, thomas adam, and naddy.


f259c4c182 Stefan Sperling

add a 'got merge' command for creating merge commits

Additional testing by Thomas Adam. ok tracey



dbdddfee14 Christian Weisgerber

switch from SIMPLEQ to equivalent STAILQ macros

The singly-linked tail queue macros were added to OpenBSD 6.9 and are more widely available on other systems. ok stsp


91b40e30e0 Stefan Sperling

add checksum support to got_deflate_to_file()

This will eventually be used by 'gotadmin pack'. Checksum init and finalization will need to be done by the caller since many objects will be written out in compressed form while we are computing checksums across the entire pack file. ok millert, naddy


08578a35f6 Stefan Sperling

make close(2) failure checks consistent; check 'close() == -1' everywhere

ok millert, naddy


56b63ca4ab Stefan Sperling

make fclose(3) failure checks consistent; check 'fclose() == EOF' everywhere

ok millert, naddy


3818e3c42c Christian Weisgerber

convert all remaining instances of chmod(2) to fchmod(2)

ok stsp


1367695b58 Christian Weisgerber

fix potential type mismatches between format specifiers and arguments

Cast printf arguments of type time_t and off_t to long long to match the %lld format specifier on platforms where this might not be the case. In parse.y, switch the number variable to long long because all its interactions are with that type anyway. ok millert stsp