commit - 1077ec6a6f30ef069f367889ba8614be168eabfd
commit + ff36aeea6fe48eb9071eccc41d2a31a47d109be3
blob - b61874a2364add0e17f44fe202b2f5f129a3b41f
blob + fc6eb096a39e9f187ac3455284648c233358aaf0
--- Makefile.am
+++ Makefile.am
-SUBDIRS = compat libexec got tog gotadmin
+SUBDIRS = compat libexec got tog gotadmin gotwebd
include $(top_builddir)/Makefile.common
blob - d72bd29e18b0b34952a255c534f20a85ce4811fc
blob + 03501ce38887afd397bcab1b6f5328de34a01db0
--- configure.ac
+++ configure.ac
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
+# Check for ifgroupreq which is only available on BSD.
+AC_CHECK_TYPES([struct ifgroupreq])
+
# Look for library needed for flock.
AC_SEARCH_LIBS(flock, bsd)
else
AC_LIBOBJ(imsg)
AC_LIBOBJ(imsg-buffer)
+fi
+
+# libevent (for gotwebd). Lifted from tmux.
+# Look for libevent. Try libevent_core or libevent with pkg-config first then
+# look for the library.
+PKG_CHECK_MODULES(
+ LIBEVENT_CORE,
+ [libevent_core >= 2],
+ [
+ AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS"
+ CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
+ LIBS="$LIBEVENT_CORE_LIBS $LIBS"
+ found_libevent=yes
+ ],
+ found_libevent=no
+)
+if test x$found_libevent = xno; then
+ PKG_CHECK_MODULES(
+ LIBEVENT,
+ [libevent >= 2],
+ [
+ AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS"
+ CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS"
+ LIBS="$LIBEVENT_LIBS $LIBS"
+ found_libevent=yes
+ ],
+ found_libevent=no
+ )
+fi
+if test x$found_libevent = xno; then
+ AC_SEARCH_LIBS(
+ event_init,
+ [event_core event event-1.4],
+ found_libevent=yes,
+ found_libevent=no
+ )
+fi
+AC_CHECK_HEADER(
+ event2/event.h,
+ AC_DEFINE(HAVE_EVENT2_EVENT_H),
+ [
+ AC_CHECK_HEADER(
+ event.h,
+ AC_DEFINE(HAVE_EVENT_H),
+ found_libevent=no
+ )
+ ]
+)
+if test "x$found_libevent" = xno; then
+ AC_MSG_ERROR("libevent not found")
fi
# libcrypto (via libssl for SHA information)
libexec/got-send-pack/Makefile
got/Makefile
gotadmin/Makefile
+ gotwebd/Makefile
tog/Makefile
Makefile.common:Makefile.common.in])
AC_OUTPUT
blob - 4c0096efb52bb79e4a8f7e5f09c1b1d953009636 (mode 644)
blob + /dev/null
--- gotwebd/Makefile
+++ /dev/null
-.PATH:${.CURDIR}/../lib
-
-SUBDIR = libexec
-
-.include "../got-version.mk"
-.include "Makefile.inc"
-
-PROG = gotwebd
-SRCS = config.c sockets.c log.c gotwebd.c parse.y proc.c \
- fcgi.c gotweb.c got_operations.c
-SRCS += blame.c commit_graph.c delta.c diff.c \
- diffreg.c error.c fileindex.c object.c object_cache.c \
- object_idset.c object_parse.c opentemp.c path.c pack.c \
- privsep.c reference.c repository.c sha1.c worktree.c \
- utf8.c inflate.c buf.c rcsutil.c diff3.c \
- lockfile.c deflate.c object_create.c delta_cache.c \
- gotconfig.c diff_main.c diff_atomize_text.c diff_myers.c \
- diff_output.c diff_output_plain.c diff_output_unidiff.c \
- diff_output_edscript.c diff_patience.c bloom.c murmurhash2.c \
- worktree_open.c patch.c sigs.c date.c
-
-MAN = ${PROG}.conf.5 ${PROG}.8
-
-CPPFLAGS += -I${.CURDIR}/../include -I${.CURDIR}/../lib -I${.CURDIR}
-LDADD += -lz -levent -lutil -lm
-YFLAGS =
-DPADD = ${LIBEVENT} ${LIBUTIL}
-#CFLAGS += -DGOT_NO_OBJ_CACHE
-
-.if ${GOT_RELEASE} != "Yes"
-NOMAN = Yes
-.endif
-
-.if defined(PROFILE)
-CPPFLAGS += -DPROFILE
-DEBUG = -O0 -pg -g -static
-.else
-DEBUG = -O0 -g
-.endif
-
-realinstall:
- if [ ! -d ${DESTDIR}${PUB_REPOS_DIR}/. ]; then \
- ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${PUB_REPOS_DIR}; \
- fi
- ${INSTALL} -c -o root -g daemon -m 0755 ${PROG} ${BINDIR}/${PROG}
- if [ ! -d ${DESTDIR}${HTTPD_DIR}/. ]; then \
- ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${HTTPD_DIR}; \
- fi
- if [ ! -d ${DESTDIR}${PROG_DIR}/. ]; then \
- ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${PROG_DIR}; \
- fi
- ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 \
- ${.CURDIR}/files/htdocs/${PROG}/* ${DESTDIR}${PROG_DIR}
-
-.include <bsd.prog.mk>
blob - /dev/null
blob + c01b6b26c3efb3e67767d7f6011240f5356eab38 (mode 644)
--- /dev/null
+++ gotwebd/Makefile.am
+bin_PROGRAMS = gotwebd
+
+include $(top_builddir)/Makefile.common
+
+gotwebd_SOURCES = config.c \
+ fcgi.c \
+ got_operations.c \
+ gotweb.c \
+ gotwebd.c \
+ log.c \
+ proc.c \
+ sockets.c \
+ parse.y \
+ $(top_srcdir)/lib/blame.c \
+ $(top_srcdir)/lib/bloom.c \
+ $(top_srcdir)/lib/buf.c \
+ $(top_srcdir)/lib/commit_graph.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/diff.c \
+ $(top_srcdir)/lib/diff3.c \
+ $(top_srcdir)/lib/diff_atomize_text.c \
+ $(top_srcdir)/lib/diff_main.c \
+ $(top_srcdir)/lib/diff_myers.c \
+ $(top_srcdir)/lib/diff_output.c \
+ $(top_srcdir)/lib/diff_output_edscript.c \
+ $(top_srcdir)/lib/diff_output_plain.c \
+ $(top_srcdir)/lib/diff_output_unidiff.c \
+ $(top_srcdir)/lib/diff_patience.c \
+ $(top_srcdir)/lib/diffreg.c \
+ $(top_srcdir)/lib/error.c \
+ $(top_srcdir)/lib/fileindex.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_parse.c \
+ $(top_srcdir)/lib/opentemp.c \
+ $(top_srcdir)/lib/pack.c \
+ $(top_srcdir)/lib/patch.c \
+ $(top_srcdir)/lib/path.c \
+ $(top_srcdir)/lib/privsep.c \
+ $(top_srcdir)/lib/rcsutil.c \
+ $(top_srcdir)/lib/reference.c \
+ $(top_srcdir)/lib/repository.c \
+ $(top_srcdir)/lib/sha1.c \
+ $(top_srcdir)/lib/sigs.c \
+ $(top_srcdir)/lib/utf8.c \
+ $(top_srcdir)/lib/worktree.c \
+ $(top_srcdir)/lib/worktree_open.c
+
+gotwebd_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a
+EXTRA_DIST = gotwebd.8 gotwebd.conf.5
+
+man5_MANS = gotwebd.conf.5
+man8_MANS = gotwebd.8
+
+LDADD = -L$(top_builddir)/compat -lopenbsd-compat -lm
+if HOST_FREEBSD
+LDADD += -lmd
+endif
+
+#realinstall:
+# if [ ! -d ${DESTDIR}${PUB_REPOS_DIR}/. ]; then \
+# ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${PUB_REPOS_DIR}; \
+# fi
+# ${INSTALL} -c -o root -g daemon -m 0755 ${PROG} ${BINDIR}/${PROG}
+# if [ ! -d ${DESTDIR}${HTTPD_DIR}/. ]; then \
+# ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${HTTPD_DIR}; \
+# fi
+# if [ ! -d ${DESTDIR}${PROG_DIR}/. ]; then \
+# ${INSTALL} -d -o root -g daemon -m 755 ${DESTDIR}${PROG_DIR}; \
+# fi
+# ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 \
+# ${.CURDIR}/files/htdocs/${PROG}/* ${DESTDIR}${PROG_DIR}
+#
+#.include <bsd.prog.mk>
blob - 4a8874a87e47d8824f253f466514c16f8ce8c881
blob + 5a76b94aca16e49a18882ea8ab6ac4d9dfcd7f48
--- gotwebd/config.c
+++ gotwebd/config.c
*/
#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <string.h>
#include <event.h>
#include <fcntl.h>
-#include <util.h>
#include <errno.h>
-#include <imsg.h>
#include "got_opentemp.h"
+#include "got_compat.h"
+
#include "proc.h"
#include "gotwebd.h"
blob - 1581cf938674fc59b27476119bfcc54b5b4417b5
blob + 9e68f4027f2f8406d2668b558f5c35423ddd20de
--- gotwebd/fcgi.c
+++ gotwebd/fcgi.c
*/
#include <arpa/inet.h>
-#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <errno.h>
#include <event.h>
-#include <imsg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "got_error.h"
+
+#include "got_compat.h"
#include "proc.h"
#include "gotwebd.h"
blob - e8a77c36de8a9bb990ee17fc8764af9390f1915c
blob + 544fd9c7168f4e8dd30337249821101db7696763
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
#include <sys/stat.h>
#include <event.h>
-#include <imsg.h>
-#include <sha1.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "got_commit_graph.h"
#include "got_blame.h"
#include "got_privsep.h"
+
+#include "got_compat.h"
#include "proc.h"
#include "gotwebd.h"
blob - 1f77113aefd24cce886b89debd8d60dc71eca3fd
blob + 49094f4539435c3d8f70a8497697d56329c8e348
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
#include <dirent.h>
#include <errno.h>
#include <event.h>
-#include <imsg.h>
-#include <sha1.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "proc.h"
#include "gotwebd.h"
+
+#include "got_compat.h"
enum gotweb_ref_tm {
TM_DIFF,
blob - c6930e3119c2231e948970c004f3f21d33c34c16
blob + 56cc78f8ef8d5f658fc9176ef43485f72507a60b
--- gotwebd/gotwebd.c
+++ gotwebd/gotwebd.c
*/
#include <sys/param.h>
-#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/cdefs.h>
#include <errno.h>
#include <event.h>
#include <fcntl.h>
-#include <imsg.h>
#include <pwd.h>
#include <signal.h>
#include <syslog.h>
#include <unistd.h>
#include <ctype.h>
-#include <util.h>
#include "got_opentemp.h"
#include "proc.h"
#include "gotwebd.h"
+#include "got_compat.h"
+
__dead void usage(void);
int main(int, char **);
blob - 79d3d334581eddd8ffcc0f02f067e5c64d0be72e
blob + 1504f3baa6e43159943e72833c450f5ebbbebf05
--- gotwebd/log.c
+++ gotwebd/log.c
#include <errno.h>
#include <time.h>
+#include "got_compat.h"
+
static int debug;
static int verbose;
const char *log_procname;
blob - c7b300955ba979db3cd4d8308802a8179f9d7ac4
blob + 60f3a7e3479292bfe3d5319dbb88e596a222da7b
--- gotwebd/parse.y
+++ gotwebd/parse.y
%{
#include <sys/ioctl.h>
#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <errno.h>
#include <event.h>
#include <ifaddrs.h>
-#include <imsg.h>
#include <limits.h>
#include <netdb.h>
#include <stdarg.h>
#include "proc.h"
#include "gotwebd.h"
+#include "got_compat.h"
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
static struct file {
if ((h = calloc(1, sizeof(*h))) == NULL)
fatal(__func__);
sain = (struct sockaddr_in *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sain->sin_len = sizeof(struct sockaddr_in);
+#endif
sain->sin_family = AF_INET;
sain->sin_addr.s_addr = ina.s_addr;
if (sain->sin_addr.s_addr == INADDR_ANY)
if ((h = calloc(1, sizeof(*h))) == NULL)
fatal(__func__);
sa_in6 = (struct sockaddr_in6 *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sa_in6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
sa_in6->sin6_family = AF_INET6;
memcpy(&sa_in6->sin6_addr,
&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
if (res->ai_family == AF_INET) {
sain = (struct sockaddr_in *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sain->sin_len = sizeof(struct sockaddr_in);
+#endif
sain->sin_addr.s_addr = ((struct sockaddr_in *)
res->ai_addr)->sin_addr.s_addr;
} else {
sin6 = (struct sockaddr_in6 *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *)
res->ai_addr)->sin6_addr, sizeof(struct in6_addr));
}
if (af == AF_INET) {
sain = (struct sockaddr_in *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sain->sin_len = sizeof(struct sockaddr_in);
+#endif
sain->sin_addr.s_addr = ((struct sockaddr_in *)
p->ifa_addr)->sin_addr.s_addr;
} else {
sin6 = (struct sockaddr_in6 *)&h->ss;
+/* TA: Iffy... */
+#ifndef __linux__
sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *)
p->ifa_addr)->sin6_addr, sizeof(struct in6_addr));
sin6->sin6_scope_id = ((struct sockaddr_in6 *)
int
is_if_in_group(const char *ifname, const char *groupname)
{
+/* TA: Check this... */
+#ifdef HAVE_STRUCT_IFGROUPREQ
unsigned int len;
struct ifgroupreq ifgr;
struct ifg_req *ifg;
end:
close(s);
return (ret);
+#else
+ return (0);
+#endif
}
int
blob - 037993ed0667b68af3bc09186201595197a814c9
blob + 9a66f6ba7ddb7546a29900c4fc95a185fe56f657
--- gotwebd/proc.c
+++ gotwebd/proc.c
*/
#include <sys/types.h>
-#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
+/* TA: FIXME */
+#include <grp.h>
+
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <pwd.h>
#include <event.h>
-#include <imsg.h>
#include "proc.h"
+#include "got_compat.h"
+
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int,
int, char **);
void proc_setup(struct privsep *, struct privsep_proc *, unsigned int);
blob - 524112fcf4b0c72a25c6f5a4cb85c16bd33ef3a9
blob + 217c9e4be9fba252cfbaf0026bb6f2c271888bfc
--- gotwebd/proc.h
+++ gotwebd/proc.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "got_compat.h"
+
enum {
IMSG_NONE,
IMSG_CTL_OK,
blob - f07a3be3b97818f5ddfc016d4f5b93952636de34
blob + d6c6ae4610fffa999ac7595ada5fb92eac62307c
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/uio.h>
#include <sys/resource.h>
#include <event.h>
#include <fcntl.h>
#include <ifaddrs.h>
-#include <imsg.h>
#include <limits.h>
#include <netdb.h>
#include <poll.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <util.h>
#include "got_error.h"
#include "got_opentemp.h"
#include "proc.h"
#include "gotwebd.h"
+
+#include "got_compat.h"
#define SOCKS_BACKLOG 5
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
switch (ss->ss_family) {
case AF_INET:
((struct sockaddr_in *)ss)->sin_port = port;
+/* TA: Iffy... */
+#ifndef __linux__
((struct sockaddr_in *)ss)->sin_len =
sizeof(struct sockaddr_in);
+#endif
break;
case AF_INET6:
((struct sockaddr_in6 *)ss)->sin6_port = port;
+/* TA: Iffy... */
+#ifndef __linux__
((struct sockaddr_in6 *)ss)->sin6_len =
sizeof(struct sockaddr_in6);
+#endif
break;
default:
return -1;
flags |= O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
- if (bind(fd, (struct sockaddr *)&a->ss, a->ss.ss_len) == -1) {
+ /* TA: 'sizeof a' vs a->ss.len */
+ if (bind(fd, (struct sockaddr *)&a->ss, sizeof a) == -1) {
close(fd);
log_info("%s: can't bind to port %d", __func__,
ntohs(port));
rl.rlim_cur = MAXIMUM(rl.rlim_max, (rlim_t)maxfd);
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
fatal("%s: failed to set resource limit", __func__);
-}
\ No newline at end of file
+}