Commit Diff


commit - e984b1e4fe2348d3b9d981efde8af60f75390f3a
commit + fde1a9966508de40278266689ba6b687483e2fe2
blob - 17ea73cf28be7bd7139e31a4f3774bd84830eb25
blob + 7dbd5c4500376c5efd243456b5d1b2bc9990191b
--- Makefile.am
+++ Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS = compat libexec got tog gotadmin template got
 # TODO: gotd gotsh template
 
 if GOTD_ENABLED
-SUBDIRS += gotd gotsh gotctl
+SUBDIRS += gotd gotsh gotctl gitwrapper
 endif
 
 include $(top_builddir)/Makefile.common
blob - 3439c32ecd69b1f62d1db6f70f293597a96be1f4
blob + 0c6b4829871cd12a8f1181ebeb65219b8b1ae7bc
--- configure.ac
+++ configure.ac
@@ -893,6 +893,7 @@ AC_CONFIG_FILES([Makefile
 		 libexec/got-read-patch/Makefile
 		 libexec/got-read-tag/Makefile
 		 libexec/got-send-pack/Makefile
+		 gitwrapper/Makefile
 		 got/Makefile
 		 gotadmin/Makefile
 		 gotwebd/Makefile
blob - f1443d0b0dc69d389f59208ecb4ce2354a246f6d (mode 644)
blob + /dev/null
--- gitwrapper/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-.PATH:${.CURDIR}/../lib
-.PATH:${.CURDIR}/../gotd
-
-.include "../got-version.mk"
-
-.if ${GOT_RELEASE} == "Yes"
-BINDIR ?=	${PREFIX}/bin
-.endif
-
-PROG=		gitwrapper
-
-SRCS=		gitwrapper.c parse.y log.c dial.c path.c error.c \
-		reference_parse.c hash.c object_qid.c
-
-CLEANFILES = parse.h
-
-MAN =		${PROG}.1
-
-CPPFLAGS = -I${.CURDIR}/../include -I${.CURDIR}/../lib -I${.CURDIR}/../gotd
-
-.if ${GOT_RELEASE} != "Yes"
-NOMAN = Yes
-.endif
-
-realinstall:
-	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
-	-m ${BINMODE} ${PROG} ${BINDIR}/${PROG}
-
-.include <bsd.prog.mk>
blob - /dev/null
blob + d199a603cd967964eefb0416b9ae6427b2d79cf3 (mode 644)
--- /dev/null
+++ gitwrapper/Makefile.am
@@ -0,0 +1,67 @@
+bin_PROGRAMS = gitwrapper
+
+include $(top_builddir)/Makefile.common
+
+AM_CPPFLAGS += -I$(top_builddir)/gotd
+
+CLEANFILES = parse.h
+
+gitwrapper_SOURCES = gitwrapper.c \
+		  $(top_srcdir)/gotd/auth.c \
+		  $(top_srcdir)/gotd/imsg.c \
+		  $(top_srcdir)/gotd/listen.c \
+		  $(top_srcdir)/gotd/log.c \
+		  $(top_srcdir)/gotd/parse.y \
+		  $(top_srcdir)/gotd/privsep_stub.c \
+		  $(top_srcdir)/lib/bloom.c \
+		  $(top_srcdir)/lib/buf.c \
+		  $(top_srcdir)/lib/date.c \
+		  $(top_srcdir)/lib/deflate.c \
+		  $(top_srcdir)/lib/delta.c \
+		  $(top_srcdir)/lib/delta_cache.c \
+		  $(top_srcdir)/lib/dial.c \
+		  $(top_srcdir)/lib/error.c \
+		  $(top_srcdir)/lib/gitconfig.c \
+		  $(top_srcdir)/lib/gitproto.c \
+		  $(top_srcdir)/lib/gotconfig.c \
+		  $(top_srcdir)/lib/hash.c \
+		  $(top_srcdir)/lib/inflate.c \
+		  $(top_srcdir)/lib/lockfile.c \
+		  $(top_srcdir)/lib/murmurhash2.c \
+		  $(top_srcdir)/lib/object.c \
+		  $(top_srcdir)/lib/object_cache.c \
+		  $(top_srcdir)/lib/object_create.c \
+		  $(top_srcdir)/lib/object_idset.c \
+		  $(top_srcdir)/lib/object_open_io.c \
+		  $(top_srcdir)/lib/object_parse.c \
+		  $(top_srcdir)/lib/object_qid.c \
+		  $(top_srcdir)/lib/opentemp.c \
+		  $(top_srcdir)/lib/pack.c \
+		  $(top_srcdir)/lib/path.c \
+		  $(top_srcdir)/lib/pkt.c \
+		  $(top_srcdir)/lib/pollfd.c \
+		  $(top_srcdir)/lib/read_gitconfig.c \
+		  $(top_srcdir)/lib/read_gotconfig.c \
+		  $(top_srcdir)/lib/reference.c \
+		  $(top_srcdir)/lib/reference_parse.c \
+		  $(top_srcdir)/lib/repository.c \
+		  $(top_srcdir)/lib/serve.c \
+		  $(top_srcdir)/lib/sigs.c
+
+gitwrapper_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
+EXTRA_DIST = gitwrapper.1
+
+man1_MANS = gitwrapper.1
+
+LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lm
+LDADD += $(libbsd_LIBS) \
+	 $(libevent_LIBS) \
+	 $(zlib_LIBS) \
+	 $(libuuid_LIBS) \
+	 $(libutil_LIBS)
+if HOST_FREEBSD
+LDADD += -lmd
+endif
+
+AM_CPPFLAGS += $(libbsd_CFLAGS) $(libevent_CFLAGS) $(zlib_CFLAGS) \
+	       $(libuuid_CFLAGS)
blob - 28645f07dc93480582fce4b5f7dea5813b028a23
blob + 2b1255118b91d4c7edef0a6016130ed9de07bfcd
--- gitwrapper/gitwrapper.c
+++ gitwrapper/gitwrapper.c
@@ -18,6 +18,8 @@
  * Resolve path namespace conflicts for git-upload-pack and git-receive-pack.
  */
 
+#include "got_compat.h"
+
 #include <sys/queue.h>
 #include <sys/types.h>
 #include <sys/uio.h>
@@ -25,15 +27,11 @@
 #include <err.h>
 #include <errno.h>
 #include <event.h>
-#include <imsg.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sha1.h>
-#include <sha2.h>
 #include <syslog.h>
-#include <util.h>
 #include <unistd.h>
 
 #include "got_error.h"
blob - b4042a287132010f9e5b313925beb92eacc7b6ba
blob + c97e7d0e69b77f321536159f10324e7fb857b421
--- gotctl/Makefile.am
+++ gotctl/Makefile.am
@@ -7,15 +7,10 @@ AM_CPPFLAGS += -I$(top_builddir)/gotd
 gotctl_SOURCES = gotctl.c \
 	$(top_srcdir)/gotd/imsg.c \
 	$(top_srcdir)/lib/error.c \
-	$(top_srcdir)/lib/gitproto.c \
-	$(top_srcdir)/lib/inflate.c \
-	$(top_srcdir)/lib/object_parse.c \
+	$(top_srcdir)/lib/hash.c \
+	$(top_srcdir)/lib/object_qid.c \
 	$(top_srcdir)/lib/path.c \
-	$(top_srcdir)/lib/pkt.c \
-	$(top_srcdir)/lib/pollfd.c \
-	$(top_srcdir)/lib/reference_parse.c \
-	$(top_srcdir)/lib/serve.c \
-	$(top_srcdir)/lib/sha1.c
+	$(top_srcdir)/lib/pollfd.c
        
 gotctl_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
 EXTRA_DIST = gotctl.8
@@ -23,6 +18,16 @@ EXTRA_DIST = gotctl.8
 man8_MANS = gotctl.8
 
 LDADD = -L$(top_builddir)/compat -L$(top_builddir)/gotd -lopenbsd-compat -lm
+LDADD += $(libutil_LIBS) \
+	 $(zlib_LIBS) \
+	 $(libbsd_LIBS) \
+	 $(libevent_LIBS)
+
 if HOST_FREEBSD
 LDADD += -lmd
 endif
+
+AM_CPPFLAGS += $(libutil_CFLAGS) \
+	       $(libbsd_CFLAGS) \
+	       $(zlib_CFLAGS) \
+	       $(libevent_CFLAGS)
blob - 4f337798294f24f408b1ba9738cf112d1f5d5a13
blob + e005dd95c74a3dc4b85d1743ab6f06987fe6dd26
--- gotctl/gotctl.c
+++ gotctl/gotctl.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/queue.h>
 #include <sys/socket.h>
blob - b17dd4a3856b7183ca0b63120ac52e133b4081d3
blob + e8f36dc8c9e4dca41153d952a13e1120bff3f215
--- gotd/Makefile.am
+++ gotd/Makefile.am
@@ -23,6 +23,7 @@ gotd_SOURCES = gotd.c \
 	$(top_srcdir)/lib/error.c \
 	$(top_srcdir)/lib/gitconfig.c \
 	$(top_srcdir)/lib/gotconfig.c \
+	$(top_srcdir)/lib/hash.c \
 	$(top_srcdir)/lib/inflate.c \
 	$(top_srcdir)/lib/lockfile.c \
 	$(top_srcdir)/lib/murmurhash2.c \
@@ -32,6 +33,7 @@ gotd_SOURCES = gotd.c \
 	$(top_srcdir)/lib/object_idset.c \
 	$(top_srcdir)/lib/object_open_io.c \
 	$(top_srcdir)/lib/object_parse.c \
+	$(top_srcdir)/lib/object_qid.c \
 	$(top_srcdir)/lib/opentemp.c \
 	$(top_srcdir)/lib/pack.c \
 	$(top_srcdir)/lib/pack_create.c \
@@ -45,7 +47,6 @@ gotd_SOURCES = gotd.c \
 	$(top_srcdir)/lib/reference.c \
 	$(top_srcdir)/lib/reference_parse.c \
 	$(top_srcdir)/lib/repository.c \
-	$(top_srcdir)/lib/sha1.c \
 	$(top_srcdir)/lib/sigs.c
        
 gotd_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
@@ -55,6 +56,15 @@ man5_MANS = gotd.conf.5
 man8_MANS = gotd.8
 
 LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lm
+LDADD += $(libuuid_LIBS) \
+	 $(zlib_LIBS) \
+	 $(libbsd_LIBS) \
+	 $(libevent_LIBS)
 if HOST_FREEBSD
 LDADD += -lmd
 endif
+
+AM_CPPFLAGS += $(libuuid_CFLAGS) \
+	       $(zlib_CFLAGS) \
+	       $(libbsd_CFLAGS) \
+	       $(libevent_CFLAGS)
blob - bd0826ccbd54e9e2d89f708043511316e97fde6c
blob + 483a3722ebfbc592bd2cab15cfd7c13fb9fa3b20
--- gotd/auth.c
+++ gotd/auth.c
@@ -14,6 +14,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
blob - 9ed19e79b8bd0a7e69cf184b6a0bb5abfaa87fc3
blob + d847e923a6c4676e526a8171f6813cb9686f9698
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <sys/queue.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -1564,7 +1566,12 @@ static void
 start_listener(char *argv0, const char *confpath, int daemonize, int verbosity)
 {
 	struct gotd_child_proc *proc;
+	int sock_flags = SOCK_STREAM|SOCK_NONBLOCK;
 
+#ifdef SOCK_CLOEXEC
+	sock_flags |= SOCK_CLOEXEC;
+#endif
+
 	proc = calloc(1, sizeof(*proc));
 	if (proc == NULL)
 		fatal("calloc");
blob - 56711725ea5a13b6c1664f42527978986ba7680d
blob + 1b5f5241eb90e8ea67907a8760ae3e8bb73ae4c0
--- gotd/imsg.c
+++ gotd/imsg.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <sys/queue.h>
 #include <sys/types.h>
 #include <sys/uio.h>
blob - 45bdfb39b3e27a99426467c5a42b68c88a4111a8
blob + 8bee03f37fbfa1fe37b0d0b4738265b00e7dd7ef
--- gotd/listen.c
+++ gotd/listen.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/queue.h>
blob - 14609f4960c9b8d6580769df8494ba5c3d482139
blob + a6d1b73d3885dd6d04013a9bd11b8b18a750a0c3
--- gotd/log.c
+++ gotd/log.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
blob - cc7231514a823861b662e419be141a4492c833fd
blob + 7e544cbf50afb3992f764d956ab4de19a3d67a3c
--- gotd/parse.y
+++ gotd/parse.y
@@ -22,6 +22,8 @@
  */
 
 %{
+#include "got_compat.h"
+
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -34,8 +36,6 @@
 #include <imsg.h>
 #include <limits.h>
 #include <pwd.h>
-#include <sha1.h>
-#include <sha2.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
blob - 23fc9997d1b17fbbeca50bfea1260e6750607210
blob + de2eb3a42ab209cd4a4e18b35625f81b1d88e57a
--- gotd/privsep_stub.c
+++ gotd/privsep_stub.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/queue.h>
blob - b44d02618319a11e9c8d2bfe2b43a20797a9522d
blob + e1a4ecc9f687a70322792d5accac679ce6a5b1cd
--- gotd/repo_imsg.c
+++ gotd/repo_imsg.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <sys/types.h>
 #include <sys/queue.h>
 #include <sys/uio.h>
blob - d9823803b4633e21ea52e1a1ba120c0ac626628c
blob + d061355ea0a84bb5d92a825b752fa8c2914a9a57
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/queue.h>
 #include <sys/types.h>
blob - 9b290cc8fb986baa3dc9b69f48d52e94740ac1e0
blob + fae40607e756382fd72276604fff6f4a1040c452
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/queue.h>
 #include <sys/stat.h>
blob - 108bfe188d7d51323ad7f6323506dba066f9bba0
blob + 779d275d76ee4ec7de49b0eb3ac7c86b3f60da72
--- gotd/session.c
+++ gotd/session.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/queue.h>
blob - 2979bba88002dea2ef6e921993736a143ef79daa
blob + e17392a92a1cf52d778fabefe524e238e0650c00
--- gotsh/Makefile.am
+++ gotsh/Makefile.am
@@ -6,16 +6,17 @@ AM_CPPFLAGS += -I$(top_builddir)/gotd
 
 gotsh_SOURCES = gotsh.c \
 	$(top_srcdir)/gotd/imsg.c \
+	$(top_srcdir)/lib/dial.c \
 	$(top_srcdir)/lib/error.c \
 	$(top_srcdir)/lib/gitproto.c \
+	$(top_srcdir)/lib/hash.c \
 	$(top_srcdir)/lib/inflate.c \
-	$(top_srcdir)/lib/object_parse.c \
+	$(top_srcdir)/lib/object_qid.c \
 	$(top_srcdir)/lib/path.c \
 	$(top_srcdir)/lib/pkt.c \
 	$(top_srcdir)/lib/pollfd.c \
 	$(top_srcdir)/lib/reference_parse.c \
-	$(top_srcdir)/lib/serve.c \
-	$(top_srcdir)/lib/sha1.c
+	$(top_srcdir)/lib/serve.c
        
 gotsh_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
 EXTRA_DIST = gotsh.1
@@ -23,10 +24,19 @@ EXTRA_DIST = gotsh.1
 man1_MANS = gotsh.1
 
 LDADD = -L$(top_builddir)/compat -L$(top_builddir)/gotd -lopenbsd-compat -lm
+LDADD += $(libutil_LIBS) \
+	 $(zlib_LIBS) \
+	 $(libbsd_LIBS) \
+	 $(libevent_LIBS)
 if HOST_FREEBSD
 LDADD += -lmd
 endif
 
+AM_CPPFLAGS += $(libutil_CFLAGS) \
+	       $(libbsd_CFLAGS) \
+	       $(zlib_CFLAGS) \
+	       $(libevent_CFLAGS)
+
 # Disable for now (per upstream)...
 #
 #install-exec-hook:
blob - 99f374425c6a364701634e5798526561a4013c7d
blob + 63410da3130904a23fe9008f76f36dd436f5e107
--- gotsh/gotsh.c
+++ gotsh/gotsh.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <sys/queue.h>
 #include <sys/socket.h>
 #include <sys/un.h>
blob - 67e4b9b0cb9658c973a7006eb116204532d08b27
blob + 1fb7f5aa239b2f0e1d8ad7b472878d612d9c446a
--- include/got_compat2.h
+++ include/got_compat2.h
@@ -16,6 +16,12 @@
 
 #ifndef _GOT_COMPAT_H_2
 #define _GOT_COMPAT_H_2
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include <inttypes.h>
+#endif
 
 #include <limits.h>
 #include <sys/uio.h>
@@ -165,12 +171,6 @@ void uuid_from_string(const char *, uuid_t *, uint32_t
 void uuid_to_string(uuid_t *, char **, uint32_t *);
 #else
 #include <uuid.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#else
-#include <inttypes.h>
 #endif
 
 #ifdef HAVE_QUEUE_H
blob - 413b0529c0a62fa7d9e0e6fdde7a89ac719515dd
blob + d0a650e94035c89c278c558e1797aee694bb7901
--- lib/object_open_io.c
+++ lib/object_open_io.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/queue.h>
 #include <sys/stat.h>
blob - 5b4a01d480e789483ffcf854bc3726c183bf3de9
blob + 88218853cae4f60f8b8353470eb080e5f26b1a68
--- lib/pack_create_io.c
+++ lib/pack_create_io.c
@@ -14,6 +14,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/queue.h>
blob - 178085a6d3a9da157f1c058c93758a7f8607f13f
blob + 652f3a8089f499bd882469d76a46f4643d670a75
--- lib/read_gitconfig.c
+++ lib/read_gitconfig.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/queue.h>
 
blob - a5046c2bf9464fed10977c382b3808acaa482a80
blob + 0a1f04e9dbbbbf48d25ea5ebb1925136ade80ce1
--- lib/read_gotconfig.c
+++ lib/read_gotconfig.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "got_compat.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 
blob - 0e16a80af5bb8c817fdee0d06b2bf9a3fff1502e
blob + b379b3380c8819f33b831b4b307c4301b0d55d1d
--- lib/serve.c
+++ lib/serve.c
@@ -13,6 +13,8 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#include "got_compat.h"
 
 #include <sys/types.h>
 #include <sys/queue.h>