mirror of
https://github.com/bdnugget/kcgi.git
synced 2026-11-07 05:47:27 +00:00
Full switch to oconfigure instead of current system, so remove all of the
test and compat files. These are now in tests.c and compats.c, and driven by the configure script. Also remove the MD5 code, which is part of compats.c. Lastly, move ifdefs to ifs, remove defined (same), and also remove HAVE_CONFIG_H.
This commit is contained in:
1 parent
ec33b975f3
commit
685abdeced
85 files changed
+1738
-1013
No files matched your search
+15
-44
@@ -1,6 +1,8 @@
|
||||
.SUFFIXES: .3 .3.html .8 .8.html .dot .svg .gnuplot .png .xml .html
|
||||
.PHONY: regress
|
||||
|
||||
include Makefile.configure
|
||||
|
||||
# Comment if you don't need statically linked.
|
||||
# This is only for the sample program!
|
||||
STATIC = -static
|
||||
@@ -41,11 +43,6 @@ SBINDIR = $(PREFIX)/sbin
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
INCLUDEDIR = $(PREFIX)/include
|
||||
VERSION = 0.9.8
|
||||
LIBCONFIGOBJS = compat-memmem.o \
|
||||
compat-reallocarray.o \
|
||||
compat-strlcat.o \
|
||||
compat-strlcpy.o \
|
||||
compat-strtonum.o
|
||||
LIBOBJS = auth.o \
|
||||
child.o \
|
||||
datetime.o \
|
||||
@@ -53,7 +50,6 @@ LIBOBJS = auth.o \
|
||||
httpauth.o \
|
||||
kcgi.o \
|
||||
logging.o \
|
||||
md5.o \
|
||||
output.o \
|
||||
parent.o \
|
||||
sandbox.o \
|
||||
@@ -65,20 +61,6 @@ LIBOBJS = auth.o \
|
||||
wrappers.o
|
||||
HTMLS = $(addsuffix .html, $(MANS)) \
|
||||
functions.html
|
||||
TESTOBJS = $(addsuffix .o, $(TESTS))
|
||||
TESTSRCS = $(addsuffix .c, $(TESTS))
|
||||
TESTS = test-arc4random \
|
||||
test-memmem \
|
||||
test-reallocarray \
|
||||
test-sandbox_init \
|
||||
test-capsicum \
|
||||
test-pledge \
|
||||
test-strlcat \
|
||||
test-strlcpy \
|
||||
test-strtonum \
|
||||
test-seccomp-filter \
|
||||
test-systrace \
|
||||
test-zlib
|
||||
MAN3S = man/kcgi.3 \
|
||||
man/kcgihtml.3 \
|
||||
man/kcgijson.3 \
|
||||
@@ -106,18 +88,12 @@ MANS = $(MAN3S) \
|
||||
$(MAN8S)
|
||||
SRCS = auth.c \
|
||||
child.c \
|
||||
compat-memmem.c \
|
||||
compat-reallocarray.c \
|
||||
compat-strlcat.c \
|
||||
compat-strlcpy.c \
|
||||
compat-strtonum.c \
|
||||
compats.c \
|
||||
extern.h \
|
||||
datetime.c \
|
||||
fcgi.c \
|
||||
httpauth.c \
|
||||
logging.c \
|
||||
md5.c \
|
||||
md5.h \
|
||||
kcgi.c \
|
||||
kcgihtml.c \
|
||||
kcgijson.c \
|
||||
@@ -140,9 +116,9 @@ SRCS = auth.c \
|
||||
sandbox-pledge.c \
|
||||
sandbox-seccomp-filter.c \
|
||||
sandbox-systrace.c \
|
||||
tests.c \
|
||||
wrappers.c \
|
||||
$(MANS) \
|
||||
$(TESTSRCS)
|
||||
$(MANS)
|
||||
AFL = afl/afl-multipart \
|
||||
afl/afl-plain \
|
||||
afl/afl-template \
|
||||
@@ -216,8 +192,8 @@ regresslog: $(REGRESS)
|
||||
./$$f >/dev/null || exit 1 ; \
|
||||
done
|
||||
|
||||
libconfig.a: config.h $(LIBCONFIGOBJS)
|
||||
$(AR) rs $@ $(LIBCONFIGOBJS)
|
||||
libconfig.a: config.h compats.o
|
||||
$(AR) rs $@ compats.o
|
||||
|
||||
kfcgi: kfcgi.o libconfig.a
|
||||
$(CC) $(CFLAGS) -o $@ kfcgi.o libconfig.a
|
||||
@@ -235,8 +211,8 @@ afl/%: afl/%.c libkcgi.a
|
||||
|
||||
.PRECIOUS: $(REGRESS_OBJS)
|
||||
|
||||
libkcgi.a: $(LIBOBJS) $(LIBCONFIGOBJS) $(LIBSANDBOXOBJS)
|
||||
$(AR) rs $@ $(LIBOBJS) $(LIBCONFIGOBJS) $(LIBSANDBOXOBJS)
|
||||
libkcgi.a: $(LIBOBJS) compats.o $(LIBSANDBOXOBJS)
|
||||
$(AR) rs $@ $(LIBOBJS) compats.o $(LIBSANDBOXOBJS)
|
||||
|
||||
kcgihtml.o: kcgihtml.h
|
||||
|
||||
@@ -262,13 +238,7 @@ $(LIBOBJS) sample.o sample-fcgi.o kcgihtml.o kcgijson.o kcgixml.o: kcgi.h
|
||||
|
||||
$(LIBOBJS) kcgihtml.o kcgijson.o kcgixml.o kcgiregress.o: config.h extern.h
|
||||
|
||||
auth.o child.o md5.o parent.o: md5.h
|
||||
|
||||
$(LIBCONFIGOBJS): config.h
|
||||
|
||||
config.h: config.h.pre config.h.post configure $(TESTSRCS)
|
||||
rm -f config.log
|
||||
CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure
|
||||
compats.o: config.h
|
||||
|
||||
installcgi: sample sample-fcgi sample-cgi
|
||||
install -m 0755 sample $(PREFIX)/sample.cgi
|
||||
@@ -354,7 +324,7 @@ kcgi.tgz:
|
||||
cp $(AFL_SRCS) .dist/kcgi-$(VERSION)/afl
|
||||
cp GNUmakefile template.xml .dist/kcgi-$(VERSION)
|
||||
cp $(MANS) .dist/kcgi-$(VERSION)/man
|
||||
cp configure config.h.pre config.h.post .dist/kcgi-$(VERSION)
|
||||
cp configure .dist/kcgi-$(VERSION)
|
||||
(cd .dist && tar zcf ../$@ kcgi-$(VERSION))
|
||||
rm -rf .dist
|
||||
|
||||
@@ -371,10 +341,11 @@ clean:
|
||||
rm -f kcgi.tgz kcgi.tgz.sha512 $(SVGS) $(HTMLS) sample sample-fcgi sample.o sample-fcgi.o kfcgi kfcgi.o sample-cgi sample-cgi.o
|
||||
rm -f $(SBLGS) $(TUTORIALHTMLS) extending01.html
|
||||
rm -f libconfig.a
|
||||
rm -f $(LIBOBJS) $(LIBCONFIGOBJS)
|
||||
rm -f $(LIBOBJS) compats.o
|
||||
rm -f $(LIBS) kcgihtml.o kcgijson.o kcgixml.o kcgiregress.o
|
||||
rm -f config.log config.h
|
||||
rm -f $(TESTS) $(TESTOBJS)
|
||||
rm -f test-abort-valid.core core
|
||||
rm -f $(REGRESS) $(AFL) $(REGRESS_OBJS)
|
||||
rm -rf *.dSYM regress/*.dSYM afl/*.dSYM
|
||||
|
||||
distclean: clean
|
||||
rm -f config.h config.log Makefile.configure
|
||||
+1
-2
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
+1
-2
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
+1
-2
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
+5
-4
@@ -2,10 +2,11 @@ html, body { margin: 0;
|
||||
padding: 0; }
|
||||
body { color: #333;
|
||||
font-family: "Alegreya sans", Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
font-weight: 400;
|
||||
font-size: 13pt;
|
||||
line-height: 17pt; }
|
||||
a { text-decoration: none; }
|
||||
strong, b { font-weight: 700; }
|
||||
code, pre { font-size: 11pt; }
|
||||
body > header { box-shadow: 0 1px 4px #888;
|
||||
background-color: #333;
|
||||
@@ -25,7 +26,7 @@ body > header nav .version { border-right: thin solid silver;
|
||||
h1 { font-size: 24pt;
|
||||
margin: 0;
|
||||
margin-bottom: 8pt;
|
||||
font-weight: normal; }
|
||||
font-weight: 400; }
|
||||
.nm, .file { font-style: italic; }
|
||||
h1 .nm { text-shadow: 1px 1px #666;
|
||||
font-style: inherit; }
|
||||
@@ -40,7 +41,7 @@ footer span { border-left: thin solid #ccc;
|
||||
footer { padding: 1ex;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em; }
|
||||
.flag { font-weight: 400; }
|
||||
.flag { font-weight: 500; }
|
||||
#functions, #archive { width: 60%;
|
||||
margin-left: auto;
|
||||
margin-right: auto; }
|
||||
@@ -53,7 +54,7 @@ footer { padding: 1ex;
|
||||
#archive .title { display: flex;
|
||||
border-bottom: thin solid #eee;
|
||||
margin-bottom: 0.25em; }
|
||||
#archive .title > :first-child { font-weight: 400; }
|
||||
#archive .title > :first-child { font-weight: 500; }
|
||||
#archive .title > :last-child { flex: 1;
|
||||
font-size: 11pt;
|
||||
text-align: right; }
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<title>kcgi | minimal CGI and FastCGI library for C</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:300,300italic,400" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,700" />
|
||||
<link rel="stylesheet" href="archive.css" />
|
||||
</head>
|
||||
<body itemscope="itemscope" itemtype="http://schema.org/SoftwareApplication">
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#if HAVE_MD5
|
||||
# include <sys/types.h>
|
||||
# include <md5.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -26,7 +28,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "kcgi.h"
|
||||
#include "md5.h"
|
||||
#include "extern.h"
|
||||
|
||||
static const char b64[] =
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
@@ -24,6 +23,10 @@
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#if HAVE_MD5
|
||||
# include <sys/types.h>
|
||||
# include <md5.h>
|
||||
#endif
|
||||
#include <poll.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -35,7 +38,6 @@
|
||||
|
||||
#include "kcgi.h"
|
||||
#include "extern.h"
|
||||
#include "md5.h"
|
||||
|
||||
/*
|
||||
* For handling HTTP multipart forms.
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef HAVE_MEMMEM
|
||||
/* $OpenBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Find the first occurrence of the byte string s in byte string l.
|
||||
*/
|
||||
void *
|
||||
memmem(const void *l, size_t l_len, const void *s, size_t s_len)
|
||||
{
|
||||
const char *cur, *last;
|
||||
const char *cl = l;
|
||||
const char *cs = s;
|
||||
|
||||
/* a zero length needle should just return the haystack */
|
||||
if (l_len == 0)
|
||||
return (void *)cl;
|
||||
|
||||
/* "s" must be smaller or equal to "l" */
|
||||
if (l_len < s_len)
|
||||
return NULL;
|
||||
|
||||
/* special case where s_len == 1 */
|
||||
if (s_len == 1)
|
||||
return memchr(l, *cs, l_len);
|
||||
|
||||
/* the last position where its possible to find "s" in "l" */
|
||||
last = cl + l_len - s_len;
|
||||
|
||||
for (cur = cl; cur <= last; cur++)
|
||||
if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
|
||||
return (void *)cur;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_REALLOCARRAY
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* this is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
|
||||
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
|
||||
*/
|
||||
#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4))
|
||||
|
||||
void *
|
||||
reallocarray(void *optr, size_t nmemb, size_t size)
|
||||
{
|
||||
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
|
||||
nmemb > 0 && SIZE_MAX / nmemb < size) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
return realloc(optr, size * nmemb);
|
||||
}
|
||||
#endif /*HAVE_REALLOCARRAY */
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t strlcat(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (*d != '\0' && n-- != 0)
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
|
||||
#endif /* !HAVE_STRLCAT */
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t strlcpy(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
||||
|
||||
#endif /* !HAVE_STRLCPY */
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRTONUM
|
||||
/* OPENBSD ORIGINAL: lib/libc/stdlib/strtonum.c */
|
||||
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Ted Unangst and Todd Miller
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define INVALID 1
|
||||
#define TOOSMALL 2
|
||||
#define TOOLARGE 3
|
||||
|
||||
long long
|
||||
strtonum(const char *numstr, long long minval, long long maxval,
|
||||
const char **errstrp)
|
||||
{
|
||||
long long ll = 0;
|
||||
char *ep;
|
||||
int error = 0;
|
||||
struct errval {
|
||||
const char *errstr;
|
||||
int err;
|
||||
} ev[4] = {
|
||||
{ NULL, 0 },
|
||||
{ "invalid", EINVAL },
|
||||
{ "too small", ERANGE },
|
||||
{ "too large", ERANGE },
|
||||
};
|
||||
|
||||
ev[0].err = errno;
|
||||
errno = 0;
|
||||
if (minval > maxval)
|
||||
error = INVALID;
|
||||
else {
|
||||
ll = strtoll(numstr, &ep, 10);
|
||||
if (numstr == ep || *ep != '\0')
|
||||
error = INVALID;
|
||||
else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
|
||||
error = TOOSMALL;
|
||||
else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
|
||||
error = TOOLARGE;
|
||||
}
|
||||
if (errstrp != NULL)
|
||||
*errstrp = ev[error].errstr;
|
||||
errno = ev[error].err;
|
||||
if (error)
|
||||
ll = 0;
|
||||
|
||||
return (ll);
|
||||
}
|
||||
#endif /* HAVE_STRTONUM */
|
||||
@@ -0,0 +1,855 @@
|
||||
#include "config.h"
|
||||
#if !HAVE_ERR
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void vwarni(const char *, va_list);
|
||||
static void vwarnxi(const char *, va_list);
|
||||
|
||||
static void
|
||||
vwarnxi(const char *fmt, va_list ap)
|
||||
{
|
||||
fprintf(stderr, "%s: ", getprogname());
|
||||
if (fmt != NULL)
|
||||
vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
|
||||
static void
|
||||
vwarni(const char *fmt, va_list ap)
|
||||
{
|
||||
int sverrno;
|
||||
|
||||
sverrno = errno;
|
||||
vwarnxi(fmt, ap);
|
||||
if (fmt != NULL)
|
||||
fputs(": ", stderr);
|
||||
fprintf(stderr, "%s\n", strerror(sverrno));
|
||||
}
|
||||
|
||||
void
|
||||
err(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vwarni(fmt, ap);
|
||||
va_end(ap);
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
errx(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vwarnxi(fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
void
|
||||
warn(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vwarni(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
warnx(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vwarnxi(fmt, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
#endif /* !HAVE_ERR */
|
||||
#if !HAVE_EXPLICIT_BZERO
|
||||
/* OPENBSD ORIGINAL: lib/libc/string/explicit_bzero.c */
|
||||
/*
|
||||
* Public domain.
|
||||
* Written by Ted Unangst
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* explicit_bzero - don't let the compiler optimize away bzero
|
||||
*/
|
||||
|
||||
#if HAVE_MEMSET_S
|
||||
|
||||
void
|
||||
explicit_bzero(void *p, size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return;
|
||||
(void)memset_s(p, n, 0, n);
|
||||
}
|
||||
|
||||
#else /* HAVE_MEMSET_S */
|
||||
|
||||
/*
|
||||
* Indirect bzero through a volatile pointer to hopefully avoid
|
||||
* dead-store optimisation eliminating the call.
|
||||
*/
|
||||
static void (* volatile ssh_bzero)(void *, size_t) = bzero;
|
||||
|
||||
void
|
||||
explicit_bzero(void *p, size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return;
|
||||
/*
|
||||
* clang -fsanitize=memory needs to intercept memset-like functions
|
||||
* to correctly detect memory initialisation. Make sure one is called
|
||||
* directly since our indirection trick above sucessfully confuses it.
|
||||
*/
|
||||
#if defined(__has_feature)
|
||||
# if __has_feature(memory_sanitizer)
|
||||
memset(p, 0, n);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
ssh_bzero(p, n);
|
||||
}
|
||||
|
||||
#endif /* HAVE_MEMSET_S */
|
||||
#endif /* !HAVE_EXPLICIT_BZERO */
|
||||
#if !HAVE_GETPROGNAME
|
||||
/*
|
||||
* Copyright (c) 2016 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
* Copyright (c) 2017 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
* 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 MIND, 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 <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_PROGRAM_INVOCATION_SHORT_NAME
|
||||
const char *
|
||||
getprogname(void)
|
||||
{
|
||||
return (program_invocation_short_name);
|
||||
}
|
||||
#elif HAVE___PROGNAME
|
||||
const char *
|
||||
getprogname(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
|
||||
return (__progname);
|
||||
}
|
||||
#else
|
||||
#error No getprogname available.
|
||||
#endif
|
||||
#endif /* !HAVE_GETPROGNAME */
|
||||
#if !HAVE_MD5
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PUT_64BIT_LE(cp, value) do { \
|
||||
(cp)[7] = (value) >> 56; \
|
||||
(cp)[6] = (value) >> 48; \
|
||||
(cp)[5] = (value) >> 40; \
|
||||
(cp)[4] = (value) >> 32; \
|
||||
(cp)[3] = (value) >> 24; \
|
||||
(cp)[2] = (value) >> 16; \
|
||||
(cp)[1] = (value) >> 8; \
|
||||
(cp)[0] = (value); } while (0)
|
||||
|
||||
#define PUT_32BIT_LE(cp, value) do { \
|
||||
(cp)[3] = (value) >> 24; \
|
||||
(cp)[2] = (value) >> 16; \
|
||||
(cp)[1] = (value) >> 8; \
|
||||
(cp)[0] = (value); } while (0)
|
||||
|
||||
static u_int8_t PADDING[MD5_BLOCK_LENGTH] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void
|
||||
MD5Init(MD5_CTX *ctx)
|
||||
{
|
||||
ctx->count = 0;
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xefcdab89;
|
||||
ctx->state[2] = 0x98badcfe;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void
|
||||
MD5Update(MD5_CTX *ctx, const unsigned char *input, size_t len)
|
||||
{
|
||||
size_t have, need;
|
||||
|
||||
/* Check how many bytes we already have and how many more we need. */
|
||||
have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
|
||||
need = MD5_BLOCK_LENGTH - have;
|
||||
|
||||
/* Update bitcount */
|
||||
ctx->count += (u_int64_t)len << 3;
|
||||
|
||||
if (len >= need) {
|
||||
if (have != 0) {
|
||||
memcpy(ctx->buffer + have, input, need);
|
||||
MD5Transform(ctx->state, ctx->buffer);
|
||||
input += need;
|
||||
len -= need;
|
||||
have = 0;
|
||||
}
|
||||
|
||||
/* Process data in MD5_BLOCK_LENGTH-byte chunks. */
|
||||
while (len >= MD5_BLOCK_LENGTH) {
|
||||
MD5Transform(ctx->state, input);
|
||||
input += MD5_BLOCK_LENGTH;
|
||||
len -= MD5_BLOCK_LENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
if (len != 0)
|
||||
memcpy(ctx->buffer + have, input, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pad pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void
|
||||
MD5Pad(MD5_CTX *ctx)
|
||||
{
|
||||
u_int8_t count[8];
|
||||
size_t padlen;
|
||||
|
||||
/* Convert count to 8 bytes in little endian order. */
|
||||
PUT_64BIT_LE(count, ctx->count);
|
||||
|
||||
/* Pad out to 56 mod 64. */
|
||||
padlen = MD5_BLOCK_LENGTH -
|
||||
((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
|
||||
if (padlen < 1 + 8)
|
||||
padlen += MD5_BLOCK_LENGTH;
|
||||
MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
|
||||
MD5Update(ctx, count, 8);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup--call MD5Pad, fill in digest and zero out ctx.
|
||||
*/
|
||||
void
|
||||
MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
MD5Pad(ctx);
|
||||
for (i = 0; i < 4; i++)
|
||||
PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void
|
||||
MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH])
|
||||
{
|
||||
u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
memcpy(in, block, sizeof(in));
|
||||
#else
|
||||
for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {
|
||||
in[a] = (u_int32_t)(
|
||||
(u_int32_t)(block[a * 4 + 0]) |
|
||||
(u_int32_t)(block[a * 4 + 1]) << 8 |
|
||||
(u_int32_t)(block[a * 4 + 2]) << 16 |
|
||||
(u_int32_t)(block[a * 4 + 3]) << 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[ 0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[ 2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[ 3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[ 4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[ 6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[ 7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[ 8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[ 1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[ 6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[ 5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[ 9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[ 3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[ 2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[ 7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[ 5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[ 1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[ 7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[ 3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[ 6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[ 9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2 ] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[ 0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7 ] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5 ] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3 ] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1 ] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8 ] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6 ] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4 ] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2 ] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9 ] + 0xeb86d391, 21);
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
}
|
||||
|
||||
char *
|
||||
MD5End(MD5_CTX *ctx, char *buf)
|
||||
{
|
||||
int i;
|
||||
unsigned char digest[MD5_DIGEST_LENGTH];
|
||||
static const char hex[]="0123456789abcdef";
|
||||
|
||||
if (!buf)
|
||||
buf = malloc(2*MD5_DIGEST_LENGTH + 1);
|
||||
if (!buf)
|
||||
return 0;
|
||||
MD5Final(digest, ctx);
|
||||
for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
|
||||
buf[i+i] = hex[digest[i] >> 4];
|
||||
buf[i+i+1] = hex[digest[i] & 0x0f];
|
||||
}
|
||||
buf[i+i] = '\0';
|
||||
return buf;
|
||||
}
|
||||
#endif /* !HAVE_MD5 */
|
||||
#if !HAVE_MEMMEM
|
||||
/*-
|
||||
* Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Find the first occurrence of the byte string s in byte string l.
|
||||
*/
|
||||
void *
|
||||
memmem(const void *l, size_t l_len, const void *s, size_t s_len)
|
||||
{
|
||||
const char *cur, *last;
|
||||
const char *cl = l;
|
||||
const char *cs = s;
|
||||
|
||||
/* a zero length needle should just return the haystack */
|
||||
if (l_len == 0)
|
||||
return (void *)cl;
|
||||
|
||||
/* "s" must be smaller or equal to "l" */
|
||||
if (l_len < s_len)
|
||||
return NULL;
|
||||
|
||||
/* special case where s_len == 1 */
|
||||
if (s_len == 1)
|
||||
return memchr(l, *cs, l_len);
|
||||
|
||||
/* the last position where its possible to find "s" in "l" */
|
||||
last = cl + l_len - s_len;
|
||||
|
||||
for (cur = cl; cur <= last; cur++)
|
||||
if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
|
||||
return (void *)cur;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !HAVE_MEMMEM */
|
||||
#if !HAVE_MEMRCHR
|
||||
/*
|
||||
* Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.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>
|
||||
|
||||
/*
|
||||
* Reverse memchr()
|
||||
* Find the last occurrence of 'c' in the buffer 's' of size 'n'.
|
||||
*/
|
||||
void *
|
||||
memrchr(const void *s, int c, size_t n)
|
||||
{
|
||||
const unsigned char *cp;
|
||||
|
||||
if (n != 0) {
|
||||
cp = (unsigned char *)s + n;
|
||||
do {
|
||||
if (*(--cp) == (unsigned char)c)
|
||||
return((void *)cp);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
#endif /* !HAVE_MEMRCHR */
|
||||
#if !HAVE_REALLOCARRAY
|
||||
/*
|
||||
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
|
||||
*
|
||||
* 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 <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
|
||||
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
|
||||
*/
|
||||
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
|
||||
|
||||
void *
|
||||
reallocarray(void *optr, size_t nmemb, size_t size)
|
||||
{
|
||||
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
|
||||
nmemb > 0 && SIZE_MAX / nmemb < size) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
return realloc(optr, size * nmemb);
|
||||
}
|
||||
#endif /* !HAVE_REALLOCARRAY */
|
||||
#if !HAVE_RECALLOCARRAY
|
||||
/*
|
||||
* Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* OPENBSD ORIGINAL: lib/libc/stdlib/recallocarray.c */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
|
||||
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
|
||||
*/
|
||||
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
|
||||
|
||||
void *
|
||||
recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
|
||||
{
|
||||
size_t oldsize, newsize;
|
||||
void *newptr;
|
||||
|
||||
if (ptr == NULL)
|
||||
return calloc(newnmemb, size);
|
||||
|
||||
if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
|
||||
newnmemb > 0 && SIZE_MAX / newnmemb < size) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
newsize = newnmemb * size;
|
||||
|
||||
if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
|
||||
oldnmemb > 0 && SIZE_MAX / oldnmemb < size) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
oldsize = oldnmemb * size;
|
||||
|
||||
/*
|
||||
* Don't bother too much if we're shrinking just a bit,
|
||||
* we do not shrink for series of small steps, oh well.
|
||||
*/
|
||||
if (newsize <= oldsize) {
|
||||
size_t d = oldsize - newsize;
|
||||
|
||||
if (d < oldsize / 2 && d < (size_t)getpagesize()) {
|
||||
memset((char *)ptr + newsize, 0, d);
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
newptr = malloc(newsize);
|
||||
if (newptr == NULL)
|
||||
return NULL;
|
||||
|
||||
if (newsize > oldsize) {
|
||||
memcpy(newptr, ptr, oldsize);
|
||||
memset((char *)newptr + oldsize, 0, newsize - oldsize);
|
||||
} else
|
||||
memcpy(newptr, ptr, newsize);
|
||||
|
||||
explicit_bzero(ptr, oldsize);
|
||||
free(ptr);
|
||||
|
||||
return newptr;
|
||||
}
|
||||
#endif /* !HAVE_RECALLOCARRAY */
|
||||
#if !HAVE_STRLCAT
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.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 <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
* If retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
#endif /* !HAVE_STRLCAT */
|
||||
#if !HAVE_STRLCPY
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.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 <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcpy(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0) {
|
||||
while (--n != 0) {
|
||||
if ((*d++ = *s++) == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
||||
#endif /* !HAVE_STRLCPY */
|
||||
#if !HAVE_STRTONUM
|
||||
/*
|
||||
* Copyright (c) 2004 Ted Unangst and Todd Miller
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define INVALID 1
|
||||
#define TOOSMALL 2
|
||||
#define TOOLARGE 3
|
||||
|
||||
long long
|
||||
strtonum(const char *numstr, long long minval, long long maxval,
|
||||
const char **errstrp)
|
||||
{
|
||||
long long ll = 0;
|
||||
int error = 0;
|
||||
char *ep;
|
||||
struct errval {
|
||||
const char *errstr;
|
||||
int err;
|
||||
} ev[4] = {
|
||||
{ NULL, 0 },
|
||||
{ "invalid", EINVAL },
|
||||
{ "too small", ERANGE },
|
||||
{ "too large", ERANGE },
|
||||
};
|
||||
|
||||
ev[0].err = errno;
|
||||
errno = 0;
|
||||
if (minval > maxval) {
|
||||
error = INVALID;
|
||||
} else {
|
||||
ll = strtoll(numstr, &ep, 10);
|
||||
if (numstr == ep || *ep != '\0')
|
||||
error = INVALID;
|
||||
else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
|
||||
error = TOOSMALL;
|
||||
else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
|
||||
error = TOOLARGE;
|
||||
}
|
||||
if (errstrp != NULL)
|
||||
*errstrp = ev[error].errstr;
|
||||
errno = ev[error].err;
|
||||
if (error)
|
||||
ll = 0;
|
||||
|
||||
return (ll);
|
||||
}
|
||||
#endif /* !HAVE_STRTONUM */
|
||||
@@ -1,37 +0,0 @@
|
||||
#if !defined(__BEGIN_DECLS)
|
||||
# ifdef __cplusplus
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# else
|
||||
# define __BEGIN_DECLS
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(__END_DECLS)
|
||||
# ifdef __cplusplus
|
||||
# define __END_DECLS }
|
||||
# else
|
||||
# define __END_DECLS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRTONUM
|
||||
extern long long strtonum
|
||||
(const char *numstr, long long minval,
|
||||
long long maxval, const char **errstrp);
|
||||
#endif
|
||||
#ifndef HAVE_MEMMEM
|
||||
extern void *memmem
|
||||
(const void *l, size_t l_len,
|
||||
const void *s, size_t s_len);
|
||||
#endif
|
||||
#ifndef HAVE_REALLOCARRAY
|
||||
extern void *reallocarray
|
||||
(void *optr, size_t nmemb, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCPY
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCAT
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#if defined(__linux__) || defined(__MINT__)
|
||||
# define _GNU_SOURCE /* vasprintf */
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* #define SANDBOX_SECCOMP_DEBUG */
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/bin/sh
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
|
||||
# Copyright (c) 2017 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -14,44 +17,448 @@
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#
|
||||
# This script outputs two files: config.h and Makefile.configure.
|
||||
# It tries to read from configure.local, which contains predefined
|
||||
# values we won't autoconfigure.
|
||||
#
|
||||
# If you want to use configure with your project, have your GNUmakefile
|
||||
# or BSDmakefile---whichever---try to import/include Makefile.configure
|
||||
# at the beginning of the file.
|
||||
#
|
||||
# Like so (note no quotes, no period, etc.):
|
||||
#
|
||||
# include Makefile.configure
|
||||
#
|
||||
# If it exists, configure was run; otherwise, it wasn't.
|
||||
#
|
||||
# You'll probably want to change parts of this file. I've noted the
|
||||
# parts that you'll probably change in the section documentation.
|
||||
|
||||
set -e
|
||||
exec > config.h 2> config.log
|
||||
|
||||
CFLAGS="${CFLAGS} -Wno-unused -Werror"
|
||||
#----------------------------------------------------------------------
|
||||
# Prepare for running: move aside previous configure runs.
|
||||
# Output file descriptor usage:
|
||||
# 1 (stdout): config.h or Makefile.configure
|
||||
# 2 (stderr): original stderr, usually to the console
|
||||
# 3: config.log
|
||||
# You DO NOT want to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
runtest() {
|
||||
echo ${CC} ${CFLAGS} -o test-${1} test-${1}.c 1>&2
|
||||
${CC} ${CFLAGS} -o "test-${1}" "test-${1}.c" $3 1>&2 || return 0
|
||||
"./test-${1}" && echo "#define HAVE_${2}" \
|
||||
|| echo FAILURE: test-${1} returned $? 1>&2
|
||||
rm "test-${1}"
|
||||
[ -w config.log ] && mv config.log config.log.old
|
||||
[ -w config.h ] && mv config.h config.h.old
|
||||
|
||||
exec 3> config.log
|
||||
echo "config.log: writing..."
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Initialize all variables here such that nothing can leak in from the
|
||||
# environment.
|
||||
# You MIGHT want to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
|
||||
CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | env -i make -sf -`
|
||||
CFLAGS="${CFLAGS} -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes"
|
||||
CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
|
||||
LDADD=
|
||||
CPPFLAGS=
|
||||
LDFLAGS=
|
||||
PREFIX="/usr/local"
|
||||
BINDIR=
|
||||
SBINDIR=
|
||||
INCLUDEDIR=
|
||||
LIBDIR=
|
||||
MANDIR=
|
||||
INSTALL="install"
|
||||
INSTALL_PROGRAM=
|
||||
INSTALL_LIB=
|
||||
INSTALL_MAN=
|
||||
INSTALL_DATA=
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Allow certain variables to be overriden on the command line.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
for keyvals in $@
|
||||
do
|
||||
key=`echo $keyvals | cut -s -d '=' -f 1`
|
||||
if [ -z "$key" ]
|
||||
then
|
||||
echo "$0: invalid key-value: $keyvals" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
val=`echo $keyvals | cut -d '=' -f 2-`
|
||||
case "$key" in
|
||||
LDFLAGS)
|
||||
LDFLAGS="$val" ;;
|
||||
CPPFLAGS)
|
||||
CPPFLAGS="$val" ;;
|
||||
PREFIX)
|
||||
PREFIX="$val" ;;
|
||||
MANDIR)
|
||||
MANDIR="$val" ;;
|
||||
LIBDIR)
|
||||
LIBDIR="$val" ;;
|
||||
BINDIR)
|
||||
BINDIR="$val" ;;
|
||||
SBINDIR)
|
||||
SBINDIR="$val" ;;
|
||||
INCLUDEDIR)
|
||||
INCLUDEDIR="$val" ;;
|
||||
*)
|
||||
echo "$0: invalid key: $key" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# These are the values that will be pushed into config.h after we test
|
||||
# for whether they're supported or not.
|
||||
# Each of these must have a runtest(), below.
|
||||
# Please sort by alpha, for clarity.
|
||||
# You WANT to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
HAVE_ARC4RANDOM=
|
||||
HAVE_CAPSICUM=
|
||||
HAVE_ERR=
|
||||
HAVE_EXPLICIT_BZERO=
|
||||
HAVE_GETPROGNAME=
|
||||
HAVE_INFTIM=
|
||||
HAVE_MD5=
|
||||
HAVE_MEMMEM=
|
||||
HAVE_MEMRCHR=
|
||||
HAVE_MEMSET_S=
|
||||
HAVE_PATH_MAX=
|
||||
HAVE_PLEDGE=
|
||||
HAVE_PROGRAM_INVOCATION_SHORT_NAME=
|
||||
HAVE_REALLOCARRAY=
|
||||
HAVE_RECALLOCARRAY=
|
||||
HAVE_SANDBOX_INIT=
|
||||
HAVE_SECCOMP_FILTER=
|
||||
HAVE_SOCK_NONBLOCK=
|
||||
HAVE_STRLCAT=
|
||||
HAVE_STRLCPY=
|
||||
HAVE_STRTONUM=
|
||||
HAVE_SYSTRACE=
|
||||
HAVE___PROGNAME=
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Allow configure.local to override all variables, default settings,
|
||||
# command-line arguments, and tested features, above.
|
||||
# You PROBABLY DO NOT want to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if [ -r ./configure.local ]; then
|
||||
echo "configure.local: reading..." 1>&2
|
||||
echo "configure.local: reading..." 1>&3
|
||||
cat ./configure.local 1>&3
|
||||
. ./configure.local
|
||||
else
|
||||
echo "configure.local: no (fully automatic configuration)" 1>&2
|
||||
echo "configure.local: no (fully automatic configuration)" 1>&3
|
||||
fi
|
||||
|
||||
echo 1>&3
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Infrastructure for running tests.
|
||||
# These consists of a series of functions that will attempt to run the
|
||||
# given test file and record its exit into a HAVE_xxx variable.
|
||||
# You DO NOT want to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
COMP="${CC} ${CFLAGS} ${CPPFLAGS} -Wno-unused -Werror"
|
||||
|
||||
# Check whether this HAVE_ setting is manually overridden.
|
||||
# If yes, use the override, if no, do not decide anything yet.
|
||||
# Arguments: lower-case test name, manual value
|
||||
|
||||
ismanual() {
|
||||
[ -z "${3}" ] && return 1
|
||||
echo "${1}: manual (HAVE_${2}=${3})" 1>&2
|
||||
echo "${1}: manual (HAVE_${2}=${3})" 1>&3
|
||||
echo 1>&3
|
||||
return 0
|
||||
}
|
||||
|
||||
cat config.h.pre
|
||||
runtest arc4random ARC4RANDOM ""
|
||||
runtest capsicum CAPSICUM ""
|
||||
runtest memmem MEMMEM ""
|
||||
runtest pledge PLEDGE ""
|
||||
runtest reallocarray REALLOCARRAY ""
|
||||
runtest sandbox_init SANDBOX_INIT ""
|
||||
runtest seccomp-filter SECCOMP_FILTER ""
|
||||
runtest strlcat STRLCAT ""
|
||||
runtest strlcpy STRLCPY ""
|
||||
runtest strtonum STRTONUM ""
|
||||
runtest systrace SYSTRACE ""
|
||||
runtest zlib ZLIB "-lz"
|
||||
arch=`uname -m 2>/dev/null || echo unknown`
|
||||
case "$arch" in
|
||||
x86_64)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_X86_64"
|
||||
;;
|
||||
i*86)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_I386"
|
||||
;;
|
||||
arm*)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_ARM"
|
||||
;;
|
||||
esac
|
||||
cat config.h.post
|
||||
# Run a single autoconfiguration test.
|
||||
# In case of success, enable the feature.
|
||||
# In case of failure, do not decide anything yet.
|
||||
# Arguments: lower-case test name, upper-case test name, additional
|
||||
# CFLAGS, additional LIBS.
|
||||
|
||||
singletest() {
|
||||
cat 1>&3 << __HEREDOC__
|
||||
${1}: testing...
|
||||
${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${4}
|
||||
__HEREDOC__
|
||||
|
||||
if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${4} 1>&3 2>&3; then
|
||||
echo "${1}: ${CC} succeeded" 1>&3
|
||||
else
|
||||
echo "${1}: ${CC} failed with $?" 1>&3
|
||||
echo 1>&3
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ./test-${1} 1>&3 2>&3; then
|
||||
echo "${1}: yes" 1>&2
|
||||
echo "${1}: yes" 1>&3
|
||||
echo 1>&3
|
||||
eval HAVE_${2}=1
|
||||
rm "test-${1}"
|
||||
return 0
|
||||
else
|
||||
echo "${1}: execution failed with $?" 1>&3
|
||||
echo 1>&3
|
||||
rm "test-${1}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Run a complete autoconfiguration test, including the check for
|
||||
# a manual override and disabling the feature on failure.
|
||||
# Arguments: lower case name, upper case name, additional CFLAGS
|
||||
|
||||
runtest() {
|
||||
eval _manual=\${HAVE_${2}}
|
||||
ismanual "${1}" "${2}" "${_manual}" && return 0
|
||||
singletest "${1}" "${2}" "${3}" "${4}" "${test}" && return 0
|
||||
echo "${1}: no" 1>&2
|
||||
eval HAVE_${2}=0
|
||||
return 1
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Begin running the tests themselves.
|
||||
# All of your tests must be defined here.
|
||||
# Please sort as the HAVE_xxxx values were defined.
|
||||
# You WANT to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
runtest arc4random ARC4RANDOM || true
|
||||
runtest capsicum CAPSICUM || true
|
||||
runtest err ERR || true
|
||||
runtest explicit_bzero EXPLICIT_BZERO || true
|
||||
runtest getprogname GETPROGNAME || true
|
||||
runtest INFTIM INFTIM || true
|
||||
runtest md5 MD5 || true
|
||||
runtest memmem MEMMEM || true
|
||||
runtest memrchr MEMRCHR || true
|
||||
runtest memset_s MEMSET_S || true
|
||||
runtest PATH_MAX PATH_MAX || true
|
||||
runtest pledge PLEDGE || true
|
||||
runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME || true
|
||||
runtest reallocarray REALLOCARRAY || true
|
||||
runtest recallocarray RECALLOCARRAY || true
|
||||
runtest sandbox_init SANDBOX_INIT "-Wno-deprecated" || true
|
||||
runtest seccomp-filter SECCOMP_FILTER || true
|
||||
runtest SOCK_NONBLOCK SOCK_NONBLOCK || true
|
||||
runtest strlcat STRLCAT || true
|
||||
runtest strlcpy STRLCPY || true
|
||||
runtest strtonum STRTONUM || true
|
||||
runtest systrace SYSTRACE || true
|
||||
runtest zlib ZLIB "" "-lz" || true
|
||||
runtest __progname __PROGNAME || true
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Output writing: generate the config.h file.
|
||||
# This file contains all of the HAVE_xxxx variables necessary for
|
||||
# compiling your source.
|
||||
# You must include "config.h" BEFORE any other variables.
|
||||
# You WANT to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec > config.h
|
||||
|
||||
# Start with prologue.
|
||||
|
||||
cat << __HEREDOC__
|
||||
#ifdef __cplusplus
|
||||
#error "Do not use C++: this is a C application."
|
||||
#endif
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 4)
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
#if defined(__linux__) || defined(__MINT__)
|
||||
#define _GNU_SOURCE /* See test-*.c what needs this. */
|
||||
#endif
|
||||
#if !defined(__BEGIN_DECLS)
|
||||
# define __BEGIN_DECLS
|
||||
#endif
|
||||
#if !defined(__END_DECLS)
|
||||
# define __END_DECLS
|
||||
#endif
|
||||
__HEREDOC__
|
||||
|
||||
# For the function declaration variables...
|
||||
|
||||
[ ${HAVE_MD5} -eq 0 -o \
|
||||
${HAVE_REALLOCARRAY} -eq 0 -o \
|
||||
${HAVE_RECALLOCARRAY} -eq 0 -o \
|
||||
${HAVE_STRLCAT} -eq 0 -o \
|
||||
${HAVE_STRLCPY} -eq 0 ] \
|
||||
&& echo "#include <sys/types.h>"
|
||||
|
||||
# Now we handle our HAVE_xxxx values.
|
||||
# Most will just be defined as 0 or 1.
|
||||
|
||||
[ ${HAVE_PATH_MAX} -eq 0 ] \
|
||||
&& echo "#define PATH_MAX 4096"
|
||||
|
||||
cat << __HEREDOC__
|
||||
#define HAVE_ARC4RANDOM ${HAVE_ARC4RANDOM}
|
||||
#define HAVE_CAPSICUM ${HAVE_CAPSICUM}
|
||||
#define HAVE_ERR ${HAVE_ERR}
|
||||
#define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO}
|
||||
#define HAVE_GETPROGNAME ${HAVE_GETPROGNAME}
|
||||
#define HAVE_INFTIM ${HAVE_INFTIM}
|
||||
#define HAVE_MD5 ${HAVE_MD5}
|
||||
#define HAVE_MEMMEM ${HAVE_MEMMEM}
|
||||
#define HAVE_MEMRCHR ${HAVE_MEMRCHR}
|
||||
#define HAVE_MEMSET_S ${HAVE_MEMSET_S}
|
||||
#define HAVE_PATH_MAX ${HAVE_PATH_MAX}
|
||||
#define HAVE_PLEDGE ${HAVE_PLEDGE}
|
||||
#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME}
|
||||
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
|
||||
#define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
|
||||
#define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
|
||||
#define HAVE_SECCOMP_FILTER ${HAVE_SECCOMP_FILTER}
|
||||
#define HAVE_SOCK_NONBLOCK ${HAVE_SOCK_NONBLOCK}
|
||||
#define HAVE_STRLCAT ${HAVE_STRLCAT}
|
||||
#define HAVE_STRLCPY ${HAVE_STRLCPY}
|
||||
#define HAVE_STRTONUM ${HAVE_STRTONUM}
|
||||
#define HAVE_SYSTRACE ${HAVE_SYSTRACE}
|
||||
#define HAVE___PROGNAME ${HAVE___PROGNAME}
|
||||
__HEREDOC__
|
||||
|
||||
# Now we do our function declarations for missing functions.
|
||||
|
||||
if [ ${HAVE_ERR} -eq 0 ]; then
|
||||
echo "extern void err(int, const char *, ...);"
|
||||
echo "extern void errx(int, const char *, ...);"
|
||||
echo "extern void warn(const char *, ...);"
|
||||
echo "extern void warnx(const char *, ...);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_MD5} -eq 0 ]; then
|
||||
echo "#define MD5_BLOCK_LENGTH 64"
|
||||
echo "#define MD5_DIGEST_LENGTH 16"
|
||||
echo "#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)"
|
||||
cat <<!!
|
||||
typedef struct MD5Context {
|
||||
u_int32_t state[4];
|
||||
u_int64_t count;
|
||||
u_int8_t buffer[MD5_BLOCK_LENGTH];
|
||||
} MD5_CTX;
|
||||
!!
|
||||
echo "extern void MD5Init(MD5_CTX *);"
|
||||
echo "extern void MD5Update(MD5_CTX *, const u_int8_t *, size_t);"
|
||||
echo "extern void MD5Pad(MD5_CTX *);"
|
||||
echo "extern void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH]);"
|
||||
echo "extern char *MD5End(MD5_CTX *, char *);"
|
||||
echo "extern void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *);";
|
||||
fi
|
||||
|
||||
if [ ${HAVE_SECCOMP_FILTER} -eq 0 ]; then
|
||||
arch=`uname -m 2>/dev/null || echo unknown`
|
||||
case "$arch" in
|
||||
x86_64)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_X86_64"
|
||||
;;
|
||||
i*86)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_I386"
|
||||
;;
|
||||
arm*)
|
||||
echo "#define SECCOMP_AUDIT_ARCH AUDIT_ARCH_ARM"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ${HAVE_EXPLICIT_BZERO} -eq 0 ]; then
|
||||
echo "extern void explicit_bzero(void *, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_MEMMEM} -eq 0 ]; then
|
||||
echo "void *memmem(const void *, size_t, const void *, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_MEMRCHR} -eq 0 ]; then
|
||||
echo "void *memrchr(const void *b, int, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_GETPROGNAME} -eq 0 ]; then
|
||||
echo "extern const char *getprogname(void);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
|
||||
echo "extern void *reallocarray(void *, size_t, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
|
||||
echo "extern void *recallocarray(void *, size_t, size_t, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_STRLCAT} -eq 0 ]; then
|
||||
echo "extern size_t strlcat(char *, const char *, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_STRLCPY} -eq 0 ]; then
|
||||
echo "extern size_t strlcpy(char *, const char *, size_t);"
|
||||
fi
|
||||
|
||||
if [ ${HAVE_STRTONUM} -eq 0 ]; then
|
||||
echo "extern long long strtonum(const char *, long long, long long, const char **);"
|
||||
fi
|
||||
|
||||
echo "config.h: written" 1>&2
|
||||
echo "config.h: written" 1>&3
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Now we go to generate our Makefile.configure.
|
||||
# This file is simply a bunch of Makefile variables.
|
||||
# They'll work in both GNUmakefile and BSDmakefile.
|
||||
# You MIGHT want to change this.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec > Makefile.configure
|
||||
|
||||
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
|
||||
[ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
|
||||
[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include"
|
||||
[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib"
|
||||
[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
|
||||
|
||||
[ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
|
||||
[ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
|
||||
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
|
||||
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
|
||||
|
||||
cat << __HEREDOC__
|
||||
CC = ${CC}
|
||||
CFLAGS = ${CFLAGS}
|
||||
CPPFLAGS = ${CPPFLAGS}
|
||||
LDADD = ${LDADD}
|
||||
LDFLAGS = ${LDFLAGS}
|
||||
STATIC = ${STATIC}
|
||||
PREFIX = ${PREFIX}
|
||||
BINDIR = ${BINDIR}
|
||||
SBINDIR = ${SBINDIR}
|
||||
INCLUDEDIR = ${INCLUDEDIR}
|
||||
LIBDIR = ${LIBDIR}
|
||||
MANDIR = ${MANDIR}
|
||||
INSTALL = ${INSTALL}
|
||||
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
|
||||
INSTALL_LIB = ${INSTALL_LIB}
|
||||
INSTALL_MAN = ${INSTALL_MAN}
|
||||
INSTALL_DATA = ${INSTALL_DATA}
|
||||
__HEREDOC__
|
||||
|
||||
echo "Makefile.configure: written" 1>&2
|
||||
echo "Makefile.configure: written" 1>&3
|
||||
|
||||
exit 0
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<title>kcgi | minimal CGI and FastCGI library for C</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:300,300italic,400" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,700" />
|
||||
<link rel="stylesheet" href="archive.css" />
|
||||
</head>
|
||||
<body itemscope="itemscope" itemtype="http://schema.org/SoftwareApplication">
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -2,12 +2,13 @@ html, body { margin: 0;
|
||||
padding: 0; }
|
||||
body { color: #333;
|
||||
font-family: "Alegreya sans", Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
font-weight: 400;
|
||||
font-size: 13pt;
|
||||
line-height: 17pt; }
|
||||
code, pre { font-size: 11pt; }
|
||||
a { text-decoration: none;
|
||||
color: blue; }
|
||||
strong, b { font-weight: 700; }
|
||||
body > header { box-shadow: 0 1px 4px #888;
|
||||
background-color: #333;
|
||||
padding: 5em 20% 1ex 20%;
|
||||
@@ -32,12 +33,12 @@ body > header nav .version { border-right: thin solid silver;
|
||||
#version time,
|
||||
#version span.version { font-style: normal; }
|
||||
#version .content > div + div { margin-top: 0.5em; }
|
||||
#version nav .title { font-weight: 400;
|
||||
#version nav .title { font-weight: 500;
|
||||
margin-bottom: 1em; }
|
||||
h1 { font-size: 28pt;
|
||||
margin: 0;
|
||||
line-height: 34pt;
|
||||
font-weight: normal; }
|
||||
font-weight: 400; }
|
||||
#breadcrumbs { font-size: 14pt; }
|
||||
.nm, .file { font-style: italic; }
|
||||
h1 .nm { text-shadow: 1px 1px #666;
|
||||
@@ -70,10 +71,10 @@ footer a { color: #000; }
|
||||
footer span { border-left: thin solid #ccc;
|
||||
padding-left: 1ex; }
|
||||
body > section h2 { font-size: x-large;
|
||||
font-weight: 400;
|
||||
font-weight: 500;
|
||||
color: #333; }
|
||||
body > section h3 { font-size: large;
|
||||
font-weight: bolder;
|
||||
font-weight: 500;
|
||||
margin-bottom: 0.25ex;
|
||||
color: #333; }
|
||||
body > section { padding: 0.5em 20%;
|
||||
@@ -82,7 +83,7 @@ figure figcaption { margin: 0; }
|
||||
figure { margin: 0;
|
||||
text-align: center;
|
||||
color: #444; }
|
||||
figcaption span { font-weight: 400; }
|
||||
figcaption span { font-weight: 500; }
|
||||
dd { margin: 0 0 1em 0; }
|
||||
body > header nav { overflow: hidden; }
|
||||
body > header nav li + li { margin-top: 1.5em; }
|
||||
@@ -97,7 +98,7 @@ pre.prettyprint ol.linenums > li { list-style-type: decimal; }
|
||||
footer { padding: 1ex;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em; }
|
||||
.flag { font-weight: 400; }
|
||||
.flag { font-weight: 500; }
|
||||
|
||||
@media only screen and (max-width: 768px), only screen and (max-device-width: 768px) {
|
||||
h1 { font-size: 15pt; }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>kcgi | minimal CGI and FastCGI library for C</title>
|
||||
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:300,300italic,400" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,700" />
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
</head>
|
||||
<body itemscope="itemscope" itemtype="http://schema.org/SoftwareApplication">
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -900,7 +898,7 @@ khttp_body_compress(struct kreq *req, int comp)
|
||||
}
|
||||
|
||||
/* Only work with compression if we support it... */
|
||||
#ifdef HAVE_ZLIB
|
||||
#if HAVE_ZLIB
|
||||
/*
|
||||
* Enable compression if the function argument is zero or if
|
||||
* it's >0 and the request headers have been set for it.
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
+1
-2
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
#define PUT_64BIT_LE(cp, value) do { \
|
||||
(cp)[7] = (value) >> 56; \
|
||||
(cp)[6] = (value) >> 48; \
|
||||
(cp)[5] = (value) >> 40; \
|
||||
(cp)[4] = (value) >> 32; \
|
||||
(cp)[3] = (value) >> 24; \
|
||||
(cp)[2] = (value) >> 16; \
|
||||
(cp)[1] = (value) >> 8; \
|
||||
(cp)[0] = (value); } while (0)
|
||||
|
||||
#define PUT_32BIT_LE(cp, value) do { \
|
||||
(cp)[3] = (value) >> 24; \
|
||||
(cp)[2] = (value) >> 16; \
|
||||
(cp)[1] = (value) >> 8; \
|
||||
(cp)[0] = (value); } while (0)
|
||||
|
||||
static u_int8_t PADDING[MD5_BLOCK_LENGTH] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void
|
||||
MD5Init(MD5_CTX *ctx)
|
||||
{
|
||||
ctx->count = 0;
|
||||
ctx->state[0] = 0x67452301;
|
||||
ctx->state[1] = 0xefcdab89;
|
||||
ctx->state[2] = 0x98badcfe;
|
||||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void
|
||||
MD5Update(MD5_CTX *ctx, const void *inputptr, size_t len)
|
||||
{
|
||||
const uint8_t *input = inputptr;
|
||||
size_t have, need;
|
||||
|
||||
/* Check how many bytes we already have and how many more we need. */
|
||||
have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
|
||||
need = MD5_BLOCK_LENGTH - have;
|
||||
|
||||
/* Update bitcount */
|
||||
ctx->count += (u_int64_t)len << 3;
|
||||
|
||||
if (len >= need) {
|
||||
if (have != 0) {
|
||||
memcpy(ctx->buffer + have, input, need);
|
||||
MD5Transform(ctx->state, ctx->buffer);
|
||||
input += need;
|
||||
len -= need;
|
||||
have = 0;
|
||||
}
|
||||
|
||||
/* Process data in MD5_BLOCK_LENGTH-byte chunks. */
|
||||
while (len >= MD5_BLOCK_LENGTH) {
|
||||
MD5Transform(ctx->state, input);
|
||||
input += MD5_BLOCK_LENGTH;
|
||||
len -= MD5_BLOCK_LENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
if (len != 0)
|
||||
memcpy(ctx->buffer + have, input, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void
|
||||
MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5_CTX *ctx)
|
||||
{
|
||||
u_int8_t count[8];
|
||||
size_t padlen;
|
||||
int i;
|
||||
|
||||
/* Convert count to 8 bytes in little endian order. */
|
||||
PUT_64BIT_LE(count, ctx->count);
|
||||
|
||||
/* Pad out to 56 mod 64. */
|
||||
padlen = MD5_BLOCK_LENGTH -
|
||||
((ctx->count >> 3) & (MD5_BLOCK_LENGTH - 1));
|
||||
if (padlen < 1 + 8)
|
||||
padlen += MD5_BLOCK_LENGTH;
|
||||
MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
|
||||
MD5Update(ctx, count, 8);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
|
||||
#ifdef __OpenBSD__
|
||||
explicit_bzero(ctx, sizeof(*ctx)); /* in case it's sensitive */
|
||||
#else
|
||||
memset(ctx, 0, sizeof(*ctx)); /* in case it's sensitive */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void
|
||||
MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH])
|
||||
{
|
||||
u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
memcpy(in, block, sizeof(in));
|
||||
#else
|
||||
for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {
|
||||
in[a] = (u_int32_t)(
|
||||
(u_int32_t)(block[a * 4 + 0]) |
|
||||
(u_int32_t)(block[a * 4 + 1]) << 8 |
|
||||
(u_int32_t)(block[a * 4 + 2]) << 16 |
|
||||
(u_int32_t)(block[a * 4 + 3]) << 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[ 0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[ 2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[ 3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[ 4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[ 6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[ 7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[ 8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[ 9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[ 1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[ 6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[ 5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[ 9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[ 3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[ 8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[ 2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[ 7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[ 5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[ 1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[ 7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[ 0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[ 3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[ 6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[ 9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2 ] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[ 0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7 ] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5 ] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3 ] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1 ] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8 ] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6 ] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4 ] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2 ] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9 ] + 0xeb86d391, 21);
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*/
|
||||
|
||||
#ifndef _MD5_H_
|
||||
#define _MD5_H_
|
||||
|
||||
#define MD5_BLOCK_LENGTH 64
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
|
||||
/* Silence compiler warnings. */
|
||||
#ifndef __OpenBSD__
|
||||
#define __bounded__(a, b, c) /* Nothing */
|
||||
#endif
|
||||
|
||||
typedef struct MD5Context {
|
||||
u_int32_t state[4]; /* state */
|
||||
u_int64_t count; /* number of bits, mod 2^64 */
|
||||
u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
|
||||
} MD5_CTX;
|
||||
|
||||
__BEGIN_DECLS
|
||||
void MD5Init(MD5_CTX *);
|
||||
void MD5Update(MD5_CTX *, const void *, size_t)
|
||||
__attribute__((__bounded__(__string__,2,3)));
|
||||
void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
|
||||
__attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
|
||||
void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH])
|
||||
__attribute__((__bounded__(__minbytes__,1,4)))
|
||||
__attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MD5_H_ */
|
||||
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
@@ -28,8 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#if HAVE_ZLIB
|
||||
# include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "kcgi.h"
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#if HAVE_MD5
|
||||
# include <sys/types.h>
|
||||
# include <md5.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -27,7 +29,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "kcgi.h"
|
||||
#include "md5.h"
|
||||
#include "extern.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
+1
-3
@@ -15,11 +15,9 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAPSICUM
|
||||
#if HAVE_CAPSICUM
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/capability.h>
|
||||
|
||||
+1
-3
@@ -14,11 +14,9 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SANDBOX_INIT
|
||||
#if HAVE_SANDBOX_INIT
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
|
||||
+1
-3
@@ -14,11 +14,9 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PLEDGE
|
||||
#if HAVE_PLEDGE
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SECCOMP_FILTER
|
||||
#if HAVE_SECCOMP_FILTER
|
||||
|
||||
#ifndef SECCOMP_AUDIT_ARCH
|
||||
#error Unknown seccomp arch: please contact us with your uname -m
|
||||
|
||||
+1
-3
@@ -14,11 +14,9 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSTRACE
|
||||
#if HAVE_SYSTRACE
|
||||
|
||||
#warning This feature is deprecated!
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PLEDGE
|
||||
#ifndef HAVE_SYSTRACE
|
||||
@@ -55,18 +53,18 @@ int
|
||||
ksandbox_init_parent(void *arg, enum sandtype type, pid_t child)
|
||||
{
|
||||
|
||||
#if defined(HAVE_CAPSICUM)
|
||||
#if HAVE_CAPSICUM
|
||||
return(1);
|
||||
#elif defined(HAVE_SANDBOX_INIT)
|
||||
#elif HAVE_SANDBOX_INIT
|
||||
return(1);
|
||||
#elif defined(HAVE_PLEDGE)
|
||||
#elif HAVE_PLEDGE
|
||||
return(1);
|
||||
#elif defined(HAVE_SYSTRACE)
|
||||
#elif HAVE_SYSTRACE
|
||||
if ( ! ksandbox_systrace_init_parent(arg, type, child)) {
|
||||
XWARNX("ksandbox_systrace_init_child");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_SECCOMP_FILTER)
|
||||
#elif HAVE_SECCOMP_FILTER
|
||||
return(1);
|
||||
#endif
|
||||
return(1);
|
||||
@@ -83,18 +81,18 @@ ksandbox_alloc(void **pp)
|
||||
|
||||
*pp = NULL;
|
||||
|
||||
#if defined(HAVE_CAPSICUM)
|
||||
#if HAVE_CAPSICUM
|
||||
return(1);
|
||||
#elif defined(HAVE_SANDBOX_INIT)
|
||||
#elif HAVE_SANDBOX_INIT
|
||||
return(1);
|
||||
#elif defined(HAVE_PLEDGE)
|
||||
#elif HAVE_PLEDGE
|
||||
return(1);
|
||||
#elif defined(HAVE_SYSTRACE)
|
||||
#elif HAVE_SYSTRACE
|
||||
if (NULL == (*pp = (ksandbox_systrace_alloc()))) {
|
||||
XWARNX("ksandbox_systrace_alloc");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_SECCOMP_FILTER)
|
||||
#elif HAVE_SECCOMP_FILTER
|
||||
return(1);
|
||||
#endif
|
||||
return(1);
|
||||
@@ -115,15 +113,15 @@ void
|
||||
ksandbox_close(void *arg)
|
||||
{
|
||||
|
||||
#if defined(HAVE_CAPSICUM)
|
||||
#if HAVE_CAPSICUM
|
||||
return;
|
||||
#elif defined(HAVE_SANDBOX_INIT)
|
||||
#elif HAVE_SANDBOX_INIT
|
||||
return;
|
||||
#elif defined(HAVE_PLEDGE)
|
||||
#elif HAVE_PLEDGE
|
||||
return;
|
||||
#elif defined(HAVE_SYSTRACE)
|
||||
#elif HAVE_SYSTRACE
|
||||
ksandbox_systrace_close(arg);
|
||||
#elif defined(HAVE_SECCOMP_FILTER)
|
||||
#elif HAVE_SECCOMP_FILTER
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
@@ -148,28 +146,28 @@ ksandbox_init_child(void *arg,
|
||||
int fdfiled, int fdaccept)
|
||||
{
|
||||
|
||||
#if defined(HAVE_CAPSICUM)
|
||||
#if HAVE_CAPSICUM
|
||||
if ( ! ksandbox_capsicum_init_child(arg, type,
|
||||
fd1, fd2, fdfiled, fdaccept)) {
|
||||
XWARNX("ksandbox_capsicum_init_child");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_SANDBOX_INIT)
|
||||
#elif HAVE_SANDBOX_INIT
|
||||
if ( ! ksandbox_darwin_init_child(arg, type)) {
|
||||
XWARNX("ksandbox_darwin_init_child");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_PLEDGE)
|
||||
#elif HAVE_PLEDGE
|
||||
if ( ! ksandbox_pledge_init_child(arg, type)) {
|
||||
XWARNX("ksandbox_pledge_init_child");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_SYSTRACE)
|
||||
#elif HAVE_SYSTRACE
|
||||
if ( ! ksandbox_systrace_init_child(arg, type)) {
|
||||
XWARNX("ksandbox_systrace_init_child");
|
||||
return(0);
|
||||
}
|
||||
#elif defined(HAVE_SECCOMP_FILTER)
|
||||
#elif HAVE_SECCOMP_FILTER
|
||||
if ( ! ksandbox_seccomp_init_child(arg, type)) {
|
||||
XWARNX("ksandbox_seccomp_init_child");
|
||||
return(0);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
volatile int foo = arc4random() % 2;
|
||||
|
||||
if (foo > 0)
|
||||
return(0);
|
||||
|
||||
return(foo);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#include <sys/capability.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
cap_enter();
|
||||
return(0);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *a = memmem("hello, world", strlen("hello, world"), "world", strlen("world"));
|
||||
return(NULL == a);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
if (-1 == pledge("stdio", NULL)) {
|
||||
perror("pledge");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *a = reallocarray(NULL, 0, 0);
|
||||
return(NULL == a);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <sandbox.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *er;
|
||||
|
||||
sandbox_init("kSBXProfilePureComputation", SANDBOX_NAMED, &er);
|
||||
sandbox_free_error(er);
|
||||
return(0);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
|
||||
return(EFAULT == errno ? 0 : 1);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char a[] = "foo";
|
||||
char b[1024];
|
||||
b[0] = '\0';
|
||||
strlcat(b, a, sizeof(b));
|
||||
return(0);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char a[] = "foo";
|
||||
char b[1024];
|
||||
b[0] = '\0';
|
||||
strlcpy(b, a, sizeof(b));
|
||||
return(0);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const char *ep;
|
||||
int a = strtonum("20", 0, 30, &ep);
|
||||
return(a != 20);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <sys/param.h>
|
||||
#include <dev/systrace.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
return(0);
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <zlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
gzFile gz;
|
||||
|
||||
if (NULL == (gz = gzopen("/dev/null", "w")))
|
||||
return(1);
|
||||
gzputs(gz, "foo");
|
||||
gzclose(gz);
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
#if TEST___PROGNAME
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
extern char *__progname;
|
||||
|
||||
return !__progname;
|
||||
}
|
||||
#endif /* TEST___PROGNAME */
|
||||
#if TEST_ARC4RANDOM
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return (arc4random() + 1) ? 0 : 1;
|
||||
}
|
||||
#endif /* TEST_ARC4RANDOM */
|
||||
#if TEST_CAPSICUM
|
||||
#include <sys/capability.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
cap_enter();
|
||||
return(0);
|
||||
}
|
||||
#endif /* TEST_CAPSICUM */
|
||||
#if TEST_ERR
|
||||
/*
|
||||
* Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
|
||||
*
|
||||
* 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 <err.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
warnx("%d. warnx", 1);
|
||||
warn("%d. warn", 2);
|
||||
err(0, "%d. err", 3);
|
||||
/* NOTREACHED */
|
||||
return 1;
|
||||
}
|
||||
#endif /* TEST_ERR */
|
||||
#if TEST_EXPLICIT_BZERO
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char foo[10];
|
||||
|
||||
explicit_bzero(foo, sizeof(foo));
|
||||
return(0);
|
||||
}
|
||||
#endif /* TEST_EXPLICIT_BZERO */
|
||||
#if TEST_GETPROGNAME
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const char * progname;
|
||||
|
||||
progname = getprogname();
|
||||
return progname == NULL;
|
||||
}
|
||||
#endif /* TEST_GETPROGNAME */
|
||||
#if TEST_INFTIM
|
||||
/*
|
||||
* Linux doesn't (always?) have this.
|
||||
*/
|
||||
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("INFTIM is defined to be %ld\n", (long)INFTIM);
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_INFTIM */
|
||||
#if TEST_MD5
|
||||
#include <sys/types.h>
|
||||
#include <md5.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, "abcd", 4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_MD5 */
|
||||
#if TEST_MEMMEM
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *a = memmem("hello, world", strlen("hello, world"), "world", strlen("world"));
|
||||
return(NULL == a);
|
||||
}
|
||||
#endif /* TEST_MEMMEM */
|
||||
#if TEST_MEMRCHR
|
||||
#if defined(__linux__) || defined(__MINT__)
|
||||
#define _GNU_SOURCE /* See test-*.c what needs this. */
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const char *buf = "abcdef";
|
||||
void *res;
|
||||
|
||||
res = memrchr(buf, 'a', strlen(buf));
|
||||
return(NULL == res ? 1 : 0);
|
||||
}
|
||||
#endif /* TEST_MEMRCHR */
|
||||
#if TEST_MEMSET_S
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char buf[10];
|
||||
memset_s(buf, 0, 'c', sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_MEMSET_S */
|
||||
#if TEST_PATH_MAX
|
||||
/*
|
||||
* POSIX allows PATH_MAX to not be defined, see
|
||||
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html;
|
||||
* the GNU Hurd is an example of a system not having it.
|
||||
*
|
||||
* Arguably, it would be better to test sysconf(_SC_PATH_MAX),
|
||||
* but since the individual *.c files include "config.h" before
|
||||
* <limits.h>, overriding an excessive value of PATH_MAX from
|
||||
* "config.h" is impossible anyway, so for now, the simplest
|
||||
* fix is to provide a value only on systems not having any.
|
||||
* So far, we encountered no system defining PATH_MAX to an
|
||||
* impractically large value, even though POSIX explicitly
|
||||
* allows that.
|
||||
*
|
||||
* The real fix would be to replace all static buffers of size
|
||||
* PATH_MAX by dynamically allocated buffers. But that is
|
||||
* somewhat intrusive because it touches several files and
|
||||
* because it requires changing struct mlink in mandocdb.c.
|
||||
* So i'm postponing that for now.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("PATH_MAX is defined to be %ld\n", (long)PATH_MAX);
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_PATH_MAX */
|
||||
#if TEST_PLEDGE
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return !!pledge("stdio", NULL);
|
||||
}
|
||||
#endif /* TEST_PLEDGE */
|
||||
#if TEST_PROGRAM_INVOCATION_SHORT_NAME
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
return !program_invocation_short_name;
|
||||
}
|
||||
#endif /* TEST_PROGRAM_INVOCATION_SHORT_NAME */
|
||||
#if TEST_REALLOCARRAY
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return !reallocarray(NULL, 2, 2);
|
||||
}
|
||||
#endif /* TEST_REALLOCARRAY */
|
||||
#if TEST_RECALLOCARRAY
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return !recallocarray(NULL, 0, 2, 2);
|
||||
}
|
||||
#endif /* TEST_RECALLOCARRAY */
|
||||
#if TEST_SANDBOX_INIT
|
||||
#include <sandbox.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *ep;
|
||||
int rc;
|
||||
|
||||
rc = sandbox_init(kSBXProfileNoInternet, SANDBOX_NAMED, &ep);
|
||||
if (-1 == rc)
|
||||
sandbox_free_error(ep);
|
||||
return(-1 == rc);
|
||||
}
|
||||
#endif /* TEST_SANDBOX_INIT */
|
||||
#if TEST_SECCOMP_FILTER
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <errno.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
|
||||
return(EFAULT == errno ? 0 : 1);
|
||||
}
|
||||
#endif /* TEST_SECCOMP_FILTER */
|
||||
#if TEST_SOCK_NONBLOCK
|
||||
/*
|
||||
* Linux doesn't (always?) have this.
|
||||
*/
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int fd[2];
|
||||
socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0, fd);
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_SOCK_NONBLOCK */
|
||||
#if TEST_STRLCAT
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char buf[3] = "a";
|
||||
return ! (strlcat(buf, "b", sizeof(buf)) == 2 &&
|
||||
buf[0] == 'a' && buf[1] == 'b' && buf[2] == '\0');
|
||||
}
|
||||
#endif /* TEST_STRLCAT */
|
||||
#if TEST_STRLCPY
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char buf[2] = "";
|
||||
return ! (strlcpy(buf, "a", sizeof(buf)) == 1 &&
|
||||
buf[0] == 'a' && buf[1] == '\0');
|
||||
}
|
||||
#endif /* TEST_STRLCPY */
|
||||
#if TEST_STRTONUM
|
||||
/*
|
||||
* Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const char *errstr;
|
||||
|
||||
if (strtonum("1", 0, 2, &errstr) != 1)
|
||||
return 1;
|
||||
if (errstr != NULL)
|
||||
return 2;
|
||||
if (strtonum("1x", 0, 2, &errstr) != 0)
|
||||
return 3;
|
||||
if (errstr == NULL)
|
||||
return 4;
|
||||
if (strtonum("2", 0, 1, &errstr) != 0)
|
||||
return 5;
|
||||
if (errstr == NULL)
|
||||
return 6;
|
||||
if (strtonum("0", 1, 2, &errstr) != 0)
|
||||
return 7;
|
||||
if (errstr == NULL)
|
||||
return 8;
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_STRTONUM */
|
||||
#if TEST_SYSTRACE
|
||||
#include <sys/param.h>
|
||||
#include <dev/systrace.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* TEST_SYSTRACE */
|
||||
#if TEST_ZLIB
|
||||
#include <stddef.h>
|
||||
#include <zlib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
gzFile gz;
|
||||
|
||||
if (NULL == (gz = gzopen("/dev/null", "w")))
|
||||
return(1);
|
||||
gzputs(gz, "foo");
|
||||
gzclose(gz);
|
||||
return(0);
|
||||
}
|
||||
#endif /* TEST_ZLIB */
|
||||
+6
-5
@@ -2,12 +2,13 @@ html, body { margin: 0;
|
||||
padding: 0; }
|
||||
body { color: #333;
|
||||
font-family: "Alegreya sans", Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
font-weight: 400;
|
||||
font-size: 13pt;
|
||||
line-height: 17pt; }
|
||||
code, pre { font-size: 11pt; }
|
||||
a { text-decoration: none;
|
||||
color: blue; }
|
||||
strong, b { font-weight: 700; }
|
||||
body > header { box-shadow: 0 1px 4px #888;
|
||||
background-color: #333;
|
||||
padding: 2em 20% 1ex 20%;
|
||||
@@ -26,7 +27,7 @@ body > header nav .version { border-right: thin solid silver;
|
||||
h1 { font-size: 24pt;
|
||||
margin: 0;
|
||||
margin-bottom: 8pt;
|
||||
font-weight: normal; }
|
||||
font-weight: 400; }
|
||||
.nm, .file { font-style: italic; }
|
||||
h1 .nm { text-shadow: 1px 1px #666;
|
||||
font-style: inherit; }
|
||||
@@ -39,7 +40,7 @@ footer a { color: #000; }
|
||||
footer span { border-left: thin solid #ccc;
|
||||
padding-left: 1ex; }
|
||||
article h2 { font-size: x-large;
|
||||
font-weight: 400;
|
||||
font-weight: 500;
|
||||
color: #333; }
|
||||
article h3 { font-size: large;
|
||||
color: #333; }
|
||||
@@ -57,13 +58,13 @@ article[data-sblg-article] img { width: 100%;
|
||||
figure { margin: 0;
|
||||
text-align: center;
|
||||
color: #444; }
|
||||
figcaption span { font-weight: 400; }
|
||||
figcaption span { font-weight: 500; }
|
||||
dd { margin: 0 0 1em 0; }
|
||||
#permlink { color: #888;
|
||||
margin-top: 1em; }
|
||||
.sample { text-align: left; }
|
||||
body > header nav { overflow: hidden; }
|
||||
body > header nav .title { font-weight: 400;
|
||||
body > header nav .title { font-weight: 500;
|
||||
margin-bottom: 0.5em; }
|
||||
body > header nav li + li { margin-top: 1.5em; }
|
||||
pre.prettyprint { border: none;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<title>kcgi | ${sblg-titletext}</title>
|
||||
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=sons-of-obsidian"></script>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:300,300italic,400" />
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,500,700" />
|
||||
<link rel="stylesheet" href="tutorial.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+1
-2
@@ -14,9 +14,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
Reference in new issue
Block a user