commit - 14dab6fc9f9df9c3e79dbea3c282e4585e2aee09
commit + 2f1efc186f6bda57e8357f593f19883a7edb7895
blob - 0d1934c9a5ebcef5a5393c8d83db0384f884c787
blob + c4372610089506fc90094b29f0775201458dc21a
--- .gitignore
+++ .gitignore
etc/*
got/got
gotadmin/gotadmin
+gotd/gotd
+gotd/parse.c
gotwebd/gotwebd
gotwebd/pages.c
gotwebd/parse.c
blob - 04d91efdd5772f5a8034f9cbc1727ccc7767cd11
blob + 07d1985d4531f0737185f7cf2ae4fcaa592b51ac
--- Makefile.am
+++ Makefile.am
SUBDIRS = compat libexec got tog gotadmin template gotwebd cvg
# TODO: gotd gotsh template
+
+if GOTD_ENABLED
+SUBDIRS += gotd
+endif
include $(top_builddir)/Makefile.common
blob - b4694f88ccaecd942d4b26ff0a419a5339868ed0
blob + 3ff825b09b88db266bd8e38e15d6289244fed477
--- configure.ac
+++ configure.ac
AC_CANONICAL_HOST
AC_CONFIG_SUBDIRS([template])
+AC_ARG_ENABLE([gotd],
+ AS_HELP_STRING([--enable gotd], [build gotd and gotsh]))
# When CFLAGS isn't set at this stage and gcc is detected by the macro below,
# autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
AH_BOTTOM([#include "got_compat2.h"])
+AM_CONDITIONAL([GOTD_ENABLED], [test "x$enable_gotd" = xyes])
+
AC_CONFIG_FILES([Makefile
compat/Makefile
cvg/Makefile
gotwebd/Makefile
tog/Makefile
Makefile.common:Makefile.common.in])
+
+if test "x$enable_gotd" = "xyes"; then
+ AC_CONFIG_FILES([gotd/Makefile])
+fi
+
AC_OUTPUT
executables="$(eval echo ${exec_prefix}/bin)"
helpers="$(eval echo ${libexecdir})"
manpages="$(eval echo ${mandir})"
+if test -z "$enable_gotd"; then
+ enable_gotd="no"
+fi
+
echo "
Configured got-portable with:
Executables: ${executables}
Bison: $YACC
CFlags: $CFLAGS
+ Gotd: ${enable_gotd}
Helpers: ${helpers}
Man pages: ${manpages}
"
blob - 877e4d8fa52533fe457b51eefc3aed259e36e6a5 (mode 644)
blob + /dev/null
--- gotd/Makefile
+++ /dev/null
-.PATH:${.CURDIR}/../lib
-
-.include "../got-version.mk"
-
-.if ${GOT_RELEASE} == "Yes"
-BINDIR ?= ${PREFIX}/sbin
-.endif
-
-PROG= gotd
-SRCS= gotd.c auth.c repo_read.c repo_write.c log.c privsep_stub.c \
- listen.c imsg.c parse.y pack_create.c ratelimit.c deltify.c \
- bloom.c buf.c date.c deflate.c delta.c delta_cache.c error.c \
- gitconfig.c gotconfig.c inflate.c lockfile.c murmurhash2.c \
- object.c object_cache.c object_create.c object_idset.c \
- object_open_io.c object_parse.c opentemp.c pack.c path.c \
- read_gitconfig.c read_gotconfig.c reference.c repository.c \
- hash.c sigs.c pack_create_io.c pollfd.c reference_parse.c \
- repo_imsg.c pack_index.c session.c object_qid.c
-
-CLEANFILES = parse.h
-
-MAN = ${PROG}.conf.5 ${PROG}.8
-
-CPPFLAGS = -I${.CURDIR}/../include -I${.CURDIR}/../lib -I${.CURDIR}
-YFLAGS =
-
-.if defined(PROFILE)
-LDADD = -lutil_p -lz_p -lm_p -lc_p -levent_p
-.else
-LDADD = -lutil -lz -lm -levent
-.endif
-DPADD = ${LIBZ} ${LIBUTIL} ${LIBM} ${LIBEVENT}
-
-.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 + 466cacf26d2fffa6cc03782eaf718157bfcae71b (mode 644)
--- /dev/null
+++ gotd/Makefile.am
+sbin_PROGRAMS = gotd
+
+include $(top_builddir)/Makefile.common
+
+gotd_SOURCES = gotd.c \
+ imsg.c \
+ log.c \
+ parse.y \
+ privsep_stub.c \
+ repo_imsg.c \
+ repo_read.c \
+ repo_write.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/deltify.c \
+ $(top_srcdir)/lib/error.c \
+ $(top_srcdir)/lib/gitconfig.c \
+ $(top_srcdir)/lib/gotconfig.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/opentemp.c \
+ $(top_srcdir)/lib/pack.c \
+ $(top_srcdir)/lib/pack_create.c \
+ $(top_srcdir)/lib/pack_create_io.c \
+ $(top_srcdir)/lib/pack_index.c \
+ $(top_srcdir)/lib/path.c \
+ $(top_srcdir)/lib/pollfd.c \
+ $(top_srcdir)/lib/ratelimit.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/sha1.c \
+ $(top_srcdir)/lib/sigs.c
+
+gotd_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
+EXTRA_DIST = gotd.8 gotd.conf.5
+
+man5_MANS = gotd.conf.5
+man8_MANS = gotd.8
+
+LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lm
+if HOST_FREEBSD
+LDADD += -lmd
+endif
blob - 63c88141e4edf1caafd25b0612e1ee3094111a79
blob + af44a052722a32c66a572c1d58b97b65193706e1
--- gotd/gotd.c
+++ gotd/gotd.c
#include <pwd.h>
#include <imsg.h>
#include <signal.h>
-#include <siphash.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
struct sockaddr_un sun;
int fd = -1;
mode_t old_umask, mode;
+ int sock_flags = SOCK_STREAM | SOCK_NONBLOCK;
- fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK| SOCK_CLOEXEC, 0);
+#ifdef SOCK_CLOEXEC
+ sock_flags |= SOCK_CLOEXEC;
+#endif
+
+ fd = socket(AF_UNIX, sock_flags, 0);
if (fd == -1) {
log_warn("socket");
return -1;
blob - acb40dee8cd351b48669c3c3247c42ed5f44501b
blob + 3f19d8e3cb52c8795ccedfb4853ac60cab2de702
--- gotd/gotd.h
+++ gotd/gotd.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "got_compat.h"
#define GOTD_UNIX_SOCKET "/var/run/gotd.sock"
#define GOTD_UNIX_SOCKET_BACKLOG 10
blob - fff6f87ffd0edd1a69a1db346fad051aadc39c21
blob + 12e74e15e2a0ca034a3518c8172f54a3721a844f
--- gotd/log.h
+++ gotd/log.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "got_compat.h"
+
void log_init(int, int);
void log_procinit(const char *);
void log_setverbose(int);
blob - e4ef41c13b9df9379aee01fa626867459e06f94e
blob + 129aebf9ca0fd4335e15f41ac3374ac4670aa9e2
--- gotd/repo_write.c
+++ gotd/repo_write.c
#include <errno.h>
#include <imsg.h>
#include <signal.h>
-#include <siphash.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>