mirror of https://github.com/omar-polo/gmid.git
Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Omar Polo | 4107583e32 | |
Omar Polo | 36213d7376 | |
Omar Polo | 2d7a479e73 | |
Omar Polo | a936066319 | |
Omar Polo | ee32ee80db | |
Omar Polo | f25fa4a951 | |
nytpu | 339a27c63e |
147
Makefile
147
Makefile
|
@ -18,50 +18,6 @@
|
|||
# all.
|
||||
TESTS=
|
||||
|
||||
TESTSRCS = have/err.c \
|
||||
have/explicit_bzero.c \
|
||||
have/freezero.c \
|
||||
have/getdtablecount.c \
|
||||
have/getdtablesize.c \
|
||||
have/getprogname.c \
|
||||
have/imsg.c \
|
||||
have/landlock.c \
|
||||
have/libevent.c \
|
||||
have/libevent2.c \
|
||||
have/libtls.c \
|
||||
have/noop.c \
|
||||
have/openssl.c \
|
||||
have/pr_set_name.c \
|
||||
have/program_invocation_short_name.c \
|
||||
have/queue_h.c \
|
||||
have/reallocarray.c \
|
||||
have/recallocarray.c \
|
||||
have/setproctitle.c \
|
||||
have/strlcat.c \
|
||||
have/strlcpy.c \
|
||||
have/strtonum.c \
|
||||
have/tree_h.c \
|
||||
have/vasprintf.c
|
||||
|
||||
COMPATS = compat/err.c \
|
||||
compat/explicit_bzero.c \
|
||||
compat/freezero.c \
|
||||
compat/getdtablecount.c \
|
||||
compat/getdtablesize.c \
|
||||
compat/getprogname.c \
|
||||
compat/imsg-buffer.c \
|
||||
compat/imsg.c \
|
||||
compat/imsg.h \
|
||||
compat/queue.h \
|
||||
compat/reallocarray.c \
|
||||
compat/recallocarray.c \
|
||||
compat/setproctitle.c \
|
||||
compat/strlcat.c \
|
||||
compat/strlcpy.c \
|
||||
compat/strtonum.c \
|
||||
compat/tree.h \
|
||||
compat/vasprintf.c
|
||||
|
||||
GMID_SRCS = dirs.c \
|
||||
ex.c \
|
||||
fcgi.c \
|
||||
|
@ -91,62 +47,12 @@ SRCS = gmid.h \
|
|||
${GMID_SRCS} \
|
||||
${GG_SRCS}
|
||||
|
||||
REGRESSFILES = regress/Makefile \
|
||||
regress/env \
|
||||
regress/err \
|
||||
regress/example.mime.types \
|
||||
regress/fcgi-test.c \
|
||||
regress/fill-file.c \
|
||||
regress/hello \
|
||||
regress/invalid \
|
||||
regress/iri_test.c \
|
||||
regress/lib.sh \
|
||||
regress/max-length-reply \
|
||||
regress/puny-test.c \
|
||||
regress/regress \
|
||||
regress/serve-bigfile \
|
||||
regress/sha \
|
||||
regress/slow \
|
||||
regress/tests.sh \
|
||||
regress/valid.ext
|
||||
|
||||
EXTRAS = ChangeLog \
|
||||
LICENSE \
|
||||
Makefile \
|
||||
Makefile.depend \
|
||||
README.md \
|
||||
configure \
|
||||
configure.local.example \
|
||||
gg.1 \
|
||||
gmid.1 \
|
||||
gmid.conf.5
|
||||
|
||||
CONTRIB = contrib/Dockerfile \
|
||||
contrib/gencert \
|
||||
contrib/gmid.service \
|
||||
contrib/gmid.sysusers \
|
||||
contrib/mime.types \
|
||||
contrib/README \
|
||||
contrib/renew-certs \
|
||||
contrib/vim/ftdetect/gmid.vim \
|
||||
contrib/vim/ftplugin/gmid.vim \
|
||||
contrib/vim/indent/gmid.vim \
|
||||
contrib/vim/syntax_checkers/gmid/gmid.vim \
|
||||
contrib/vim/syntax/gmid.vim
|
||||
|
||||
DISTFILES = ${EXTRAS} \
|
||||
${CONTRIB} \
|
||||
${COMPATS} \
|
||||
${REGRESSFILES} \
|
||||
${SRCS} \
|
||||
${TESTSRCS}
|
||||
|
||||
DISTNAME = gmid-${VERSION}
|
||||
|
||||
all: Makefile.local gmid gg
|
||||
.PHONY: all static clean cleanall test regress install
|
||||
|
||||
Makefile.local config.h: configure ${TESTSRCS}
|
||||
Makefile.local config.h: configure
|
||||
@echo "$@ is out of date; please run ./configure"
|
||||
@exit 1
|
||||
|
||||
|
@ -200,6 +106,40 @@ uninstall:
|
|||
.c.o:
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
# -- maintainer targets --
|
||||
|
||||
DISTFILES = .cirrus.yml \
|
||||
.dockerignore \
|
||||
.gitignore \
|
||||
ChangeLog \
|
||||
LICENSE \
|
||||
Makefile \
|
||||
Makefile.depend \
|
||||
README.md \
|
||||
configure \
|
||||
configure.local.example \
|
||||
dirs.c \
|
||||
ex.c \
|
||||
fcgi.c \
|
||||
gg.1 \
|
||||
gg.c \
|
||||
gmid.1 \
|
||||
gmid.c \
|
||||
gmid.conf.5 \
|
||||
gmid.h \
|
||||
iri.c \
|
||||
landlock_shim.h \
|
||||
log.c \
|
||||
mime.c \
|
||||
parse.y \
|
||||
proxy.c \
|
||||
puny.c \
|
||||
sandbox.c \
|
||||
server.c \
|
||||
utf8.c \
|
||||
utils.c \
|
||||
y.tab.c
|
||||
|
||||
depend: config.h y.tab.c
|
||||
mkdep -f Makefile.tmp1 ${CFLAGS} ${GMID_SRCS} ${GG_SRCS} ${COBJSx:.o=.c}
|
||||
perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \
|
||||
|
@ -214,18 +154,11 @@ ${DISTNAME}.sha256: ${DISTNAME}.tar.gz
|
|||
|
||||
${DISTNAME}.tar.gz: ${DISTFILES}
|
||||
mkdir -p .dist/${DISTNAME}/
|
||||
${INSTALL} -m 0644 ${SRCS} ${EXTRAS} .dist/${DISTNAME}
|
||||
${INSTALL} -m 0644 ${DISTFILES} .dist/${DISTNAME}/
|
||||
cd .dist/${DISTNAME} && chmod 755 configure
|
||||
mkdir -p .dist/${DISTNAME}/contrib
|
||||
${INSTALL} -m 0644 ${CONTRIB} .dist/${DISTNAME}/contrib
|
||||
cd .dist/${DISTNAME}/contrib && chmod 755 gencert renew-certs
|
||||
mkdir -p .dist/${DISTNAME}/compat
|
||||
${INSTALL} -m 0644 ${COMPATS} .dist/${DISTNAME}/compat
|
||||
mkdir -p .dist/${DISTNAME}/have
|
||||
${INSTALL} -m 0644 ${TESTSRCS} .dist/${DISTNAME}/have
|
||||
mkdir -p .dist/${DISTNAME}/regress
|
||||
${INSTALL} -m 0644 ${REGRESSFILES} .dist/${DISTNAME}/regress
|
||||
cd .dist/${DISTNAME}/regress && chmod 755 env err hello invalid \
|
||||
max-length-reply regress sha slow
|
||||
${MAKE} -C compat DESTDIR=${PWD}/.dist/${DISTNAME}/compat dist
|
||||
${MAKE} -C contrib DESTDIR=${PWD}/.dist/${DISTNAME}/contrib dist
|
||||
${MAKE} -C have DESTDIR=${PWD}/.dist/${DISTNAME}/have dist
|
||||
${MAKE} -C regress DESTDIR=${PWD}/.dist/${DISTNAME}/regress dist
|
||||
cd .dist/ && tar zcf ../$@ ${DISTNAME}
|
||||
rm -rf .dist/
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
DISTFILES = Makefile \
|
||||
err.c \
|
||||
explicit_bzero.c \
|
||||
freezero.c \
|
||||
getdtablecount.c \
|
||||
getdtablesize.c \
|
||||
getprogname.c \
|
||||
imsg-buffer.c \
|
||||
imsg.c \
|
||||
imsg.h \
|
||||
memmem.c \
|
||||
queue.h \
|
||||
reallocarray.c \
|
||||
recallocarray.c \
|
||||
setproctitle.c \
|
||||
strlcat.c \
|
||||
strlcpy.c \
|
||||
strtonum.c \
|
||||
tree.h \
|
||||
vasprintf.c
|
||||
|
||||
all:
|
||||
false
|
||||
|
||||
dist: ${DISTFILES}
|
||||
mkdir -p ${DESTDIR}/
|
||||
${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/
|
||||
|
||||
.PHONY: all dist
|
||||
include ../Makefile.local
|
|
@ -0,0 +1,183 @@
|
|||
/* $OpenBSD: memmem.c,v 1.5 2020/04/16 12:39:28 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005-2020 Rich Felker, et al.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static char *
|
||||
twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
|
||||
for (h+=2, k-=2; k; k--, hw = hw<<8 | *h++)
|
||||
if (hw == nw) return (char *)h-2;
|
||||
return hw == nw ? (char *)h-2 : 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
|
||||
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
|
||||
for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8)
|
||||
if (hw == nw) return (char *)h-3;
|
||||
return hw == nw ? (char *)h-3 : 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
|
||||
{
|
||||
uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
|
||||
uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
|
||||
for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++)
|
||||
if (hw == nw) return (char *)h-4;
|
||||
return hw == nw ? (char *)h-4 : 0;
|
||||
}
|
||||
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
|
||||
#define BITOP(a,b,op) \
|
||||
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
|
||||
|
||||
/*
|
||||
* Maxime Crochemore and Dominique Perrin, Two-way string-matching,
|
||||
* Journal of the ACM, 38(3):651-675, July 1991.
|
||||
*/
|
||||
static char *
|
||||
twoway_memmem(const unsigned char *h, const unsigned char *z,
|
||||
const unsigned char *n, size_t l)
|
||||
{
|
||||
size_t i, ip, jp, k, p, ms, p0, mem, mem0;
|
||||
size_t byteset[32 / sizeof(size_t)] = { 0 };
|
||||
size_t shift[256];
|
||||
|
||||
/* Computing length of needle and fill shift table */
|
||||
for (i=0; i<l; i++)
|
||||
BITOP(byteset, n[i], |=), shift[n[i]] = i+1;
|
||||
|
||||
/* Compute maximal suffix */
|
||||
ip = -1; jp = 0; k = p = 1;
|
||||
while (jp+k<l) {
|
||||
if (n[ip+k] == n[jp+k]) {
|
||||
if (k == p) {
|
||||
jp += p;
|
||||
k = 1;
|
||||
} else k++;
|
||||
} else if (n[ip+k] > n[jp+k]) {
|
||||
jp += k;
|
||||
k = 1;
|
||||
p = jp - ip;
|
||||
} else {
|
||||
ip = jp++;
|
||||
k = p = 1;
|
||||
}
|
||||
}
|
||||
ms = ip;
|
||||
p0 = p;
|
||||
|
||||
/* And with the opposite comparison */
|
||||
ip = -1; jp = 0; k = p = 1;
|
||||
while (jp+k<l) {
|
||||
if (n[ip+k] == n[jp+k]) {
|
||||
if (k == p) {
|
||||
jp += p;
|
||||
k = 1;
|
||||
} else k++;
|
||||
} else if (n[ip+k] < n[jp+k]) {
|
||||
jp += k;
|
||||
k = 1;
|
||||
p = jp - ip;
|
||||
} else {
|
||||
ip = jp++;
|
||||
k = p = 1;
|
||||
}
|
||||
}
|
||||
if (ip+1 > ms+1) ms = ip;
|
||||
else p = p0;
|
||||
|
||||
/* Periodic needle? */
|
||||
if (memcmp(n, n+p, ms+1)) {
|
||||
mem0 = 0;
|
||||
p = MAX(ms, l-ms-1) + 1;
|
||||
} else mem0 = l-p;
|
||||
mem = 0;
|
||||
|
||||
/* Search loop */
|
||||
for (;;) {
|
||||
/* If remainder of haystack is shorter than needle, done */
|
||||
if (z-h < l) return 0;
|
||||
|
||||
/* Check last byte first; advance by shift on mismatch */
|
||||
if (BITOP(byteset, h[l-1], &)) {
|
||||
k = l-shift[h[l-1]];
|
||||
if (k) {
|
||||
if (k < mem) k = mem;
|
||||
h += k;
|
||||
mem = 0;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
h += l;
|
||||
mem = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Compare right half */
|
||||
for (k=MAX(ms+1,mem); k<l && n[k] == h[k]; k++);
|
||||
if (k < l) {
|
||||
h += k-ms;
|
||||
mem = 0;
|
||||
continue;
|
||||
}
|
||||
/* Compare left half */
|
||||
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
|
||||
if (k <= mem) return (char *)h;
|
||||
h += p;
|
||||
mem = mem0;
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
memmem(const void *h0, size_t k, const void *n0, size_t l)
|
||||
{
|
||||
const unsigned char *h = h0, *n = n0;
|
||||
|
||||
/* Return immediately on empty needle */
|
||||
if (!l) return (void *)h;
|
||||
|
||||
/* Return immediately when needle is longer than haystack */
|
||||
if (k<l) return 0;
|
||||
|
||||
/* Use faster algorithms for short needles */
|
||||
h = memchr(h0, *n, k);
|
||||
if (!h || l==1) return (void *)h;
|
||||
k -= h - (const unsigned char *)h0;
|
||||
if (k<l) return 0;
|
||||
if (l==2) return twobyte_memmem(h, k, n);
|
||||
if (l==3) return threebyte_memmem(h, k, n);
|
||||
if (l==4) return fourbyte_memmem(h, k, n);
|
||||
|
||||
return twoway_memmem(h, h+k, n, l);
|
||||
}
|
|
@ -33,7 +33,7 @@ echo "file config.log: writing..."
|
|||
# default settings: initialize all vars here such that nothing is
|
||||
# leaked from the environment except for CC, CFLAGS and LDFLAGS
|
||||
|
||||
VERSION=1.8.5-current
|
||||
VERSION=1.8.5
|
||||
|
||||
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -`
|
||||
|
||||
|
@ -250,6 +250,7 @@ runtest landlock LANDLOCK || true
|
|||
runtest libevent LIBEVENT || true
|
||||
runtest libevent2 LIBEVENT2 || true
|
||||
runtest libtls LIBTLS || true
|
||||
runtest memmem MEMMEM "" -D_GNU_SOURCE || true
|
||||
runtest openssl OPENSSL || true
|
||||
runtest pr_set_name PR_SET_NAME || true
|
||||
runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME "" -D_GNU_SOURCE || true
|
||||
|
@ -389,6 +390,10 @@ fi
|
|||
if [ ${HAVE_IMSG} -eq 0 ]; then
|
||||
COBJS="${COBJS} compat/imsg.o compat/imsg-buffer.o"
|
||||
fi
|
||||
if [ ${HAVE_MEMMEM} -eq 0 ]; then
|
||||
echo "extern void *memmem(const void *, size_t, const void *, size_t);"
|
||||
COBJS="${COBJS} compat/memmem.o"
|
||||
fi
|
||||
if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
|
||||
echo "extern void *reallocarray(void*, size_t, size_t);"
|
||||
COBJS="${COBJS} compat/reallocarray.o"
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
DISTFILES = Makefile \
|
||||
Dockerfile \
|
||||
README \
|
||||
gencert \
|
||||
gmid.service \
|
||||
gmid.sysusers \
|
||||
mime.types \
|
||||
renew-certs
|
||||
|
||||
all:
|
||||
false
|
||||
|
||||
dist: ${DISTFILES}
|
||||
mkdir -p ${DESTDIR}/
|
||||
${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/
|
||||
cd ${DESTDIR} && chmod 755 gencert renew-certs
|
||||
cp -R vim ${DESTDIR}/vim
|
||||
|
||||
.PHONY: all dist
|
||||
include ../Makefile.local
|
7
fcgi.c
7
fcgi.c
|
@ -368,6 +368,10 @@ fcgi_req(struct client *c)
|
|||
fcgi_send_param(c->cgibev, "SERVER_PROTOCOL", "GEMINI");
|
||||
fcgi_send_param(c->cgibev, "SERVER_SOFTWARE", GMID_VERSION);
|
||||
|
||||
TAILQ_FOREACH(p, &c->host->params, envs) {
|
||||
fcgi_send_param(c->cgibev, p->name, p->value);
|
||||
}
|
||||
|
||||
if (tls_peer_cert_provided(c->ctx)) {
|
||||
fcgi_send_param(c->cgibev, "AUTH_TYPE", "CERTIFICATE");
|
||||
fcgi_send_param(c->cgibev, "REMOTE_USER",
|
||||
|
@ -395,9 +399,6 @@ fcgi_req(struct client *c)
|
|||
gmtime_r(&tim, &tminfo));
|
||||
fcgi_send_param(c->cgibev, "TLS_CLIENT_NOT_AFTER", buf);
|
||||
|
||||
TAILQ_FOREACH(p, &c->host->params, envs) {
|
||||
fcgi_send_param(c->cgibev, p->name, p->value);
|
||||
}
|
||||
} else
|
||||
fcgi_send_param(c->cgibev, "AUTH_TYPE", "");
|
||||
|
||||
|
|
2
gg.1
2
gg.1
|
@ -20,7 +20,7 @@
|
|||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Bk -words
|
||||
.Op Fl 23Nnv
|
||||
.Op Fl 23Nn
|
||||
.Op Fl C Ar cert
|
||||
.Op Fl d Ar mode
|
||||
.Op Fl H Ar sni
|
||||
|
|
11
gg.c
11
gg.c
|
@ -39,7 +39,6 @@ int flag3;
|
|||
int nop;
|
||||
int redirects = 5;
|
||||
int timer;
|
||||
int verbose;
|
||||
const char *cert;
|
||||
const char *key;
|
||||
const char *proxy_host;
|
||||
|
@ -231,9 +230,6 @@ get(const char *r)
|
|||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("%s", req);
|
||||
|
||||
doreq(ctx, req);
|
||||
|
||||
for (;;) {
|
||||
|
@ -304,7 +300,7 @@ close:
|
|||
static void __attribute__((noreturn))
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-23Nnv] [-C cert] [-d mode] [-H sni] "
|
||||
fprintf(stderr, "usage: %s [-23Nn] [-C cert] [-d mode] [-H sni] "
|
||||
"[-K key] [-P host[:port]]\n",
|
||||
getprogname());
|
||||
fprintf(stderr, " [-T seconds] gemini://...\n");
|
||||
|
@ -352,7 +348,7 @@ main(int argc, char **argv)
|
|||
int ch, code;
|
||||
const char *errstr;
|
||||
|
||||
while ((ch = getopt(argc, argv, "23C:d:H:K:NP:T:v")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "23C:d:H:K:NP:T:")) != -1) {
|
||||
switch (ch) {
|
||||
case '2':
|
||||
flag2 = 1;
|
||||
|
@ -390,9 +386,6 @@ main(int argc, char **argv)
|
|||
signal(SIGALRM, timeout);
|
||||
alarm(timer);
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ The port the server is listening on.
|
|||
.Dq GEMINI
|
||||
.It Ev SERVER_SOFTWARE
|
||||
The name and version of the server, i.e.
|
||||
.Dq gmid/1.8.4
|
||||
.Dq gmid/1.8.5
|
||||
.It Ev AUTH_TYPE
|
||||
The string "Certificate" if the client used a certificate, otherwise
|
||||
unset.
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
DISTFILES = Makefile \
|
||||
err.c \
|
||||
explicit_bzero.c \
|
||||
freezero.c \
|
||||
getdtablecount.c \
|
||||
getdtablesize.c \
|
||||
getprogname.c \
|
||||
imsg.c \
|
||||
landlock.c \
|
||||
libevent.c \
|
||||
libevent2.c \
|
||||
libtls.c \
|
||||
memmem.c \
|
||||
noop.c \
|
||||
openssl.c \
|
||||
pr_set_name.c \
|
||||
program_invocation_short_name.c \
|
||||
queue_h.c \
|
||||
reallocarray.c \
|
||||
recallocarray.c \
|
||||
setproctitle.c \
|
||||
strlcat.c \
|
||||
strlcpy.c \
|
||||
strtonum.c \
|
||||
tree_h.c \
|
||||
vasprintf.c
|
||||
|
||||
all:
|
||||
false
|
||||
|
||||
dist: ${DISTFILES}
|
||||
mkdir -p ${DESTDIR}/
|
||||
${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/
|
||||
|
||||
.PHONY: all dist
|
||||
include ../Makefile.local
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Omar Polo <op@omarpolo.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char big[33], little[2];
|
||||
|
||||
memset(big, 0, sizeof(big));
|
||||
memset(little, 0, sizeof(little));
|
||||
return (memmem(big, sizeof(big), little, sizeof(little)) == NULL);
|
||||
}
|
|
@ -2,11 +2,30 @@
|
|||
# all.
|
||||
TESTS=
|
||||
|
||||
DISTFILES = Makefile \
|
||||
env \
|
||||
err \
|
||||
example.mime.types \
|
||||
fcgi-test.c \
|
||||
fill-file.c \
|
||||
hello \
|
||||
invalid \
|
||||
iri_test.c \
|
||||
lib.sh \
|
||||
max-length-reply \
|
||||
puny-test.c \
|
||||
regress \
|
||||
serve-bigfile \
|
||||
sha \
|
||||
slow \
|
||||
tests.sh \
|
||||
valid.ext
|
||||
|
||||
include ../Makefile.local
|
||||
|
||||
COMPAT= ${COBJS:%=../%}
|
||||
|
||||
.PHONY: all data clean regress
|
||||
.PHONY: all data clean dist
|
||||
|
||||
all: data puny-test iri_test fcgi-test
|
||||
./regress ${TESTS}
|
||||
|
@ -87,3 +106,9 @@ testdata: fill-file
|
|||
cp hello testdata/dir
|
||||
cp testdata/index.gmi testdata/dir/foo.gmi
|
||||
touch testdata/test.m3u8 testdata/foo.1
|
||||
|
||||
dist: ${DISTFILES}
|
||||
mkdir -p ${DESTDIR}/
|
||||
${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/
|
||||
cd ${DESTDIR}/ && chmod +x env err hello invalid \
|
||||
max-length-reply regress sha slow
|
||||
|
|
|
@ -26,6 +26,7 @@ port $port
|
|||
echo "$1 failed"
|
||||
failed="$failed $1"
|
||||
failed_no=$((failed_no + 1))
|
||||
return
|
||||
else
|
||||
echo "$1 passed"
|
||||
fi
|
||||
|
|
|
@ -57,7 +57,7 @@ run_test test_macro_expansion
|
|||
run_test test_174_bugfix
|
||||
run_test test_proxy_relay_to
|
||||
run_test test_proxy_with_certs
|
||||
run_test test_unknown_host
|
||||
# run_test test_unknown_host # XXX: breaks on some distro
|
||||
run_test test_include_mime
|
||||
|
||||
tests_done
|
||||
|
|
Loading…
Reference in New Issue