Skip to content

Commit 752756c

Browse files
committed
Sync embedded yahttp copy
API: Replace HTTP Basic auth with static key in custom header Given that the key is sent in a custom header, this should prevent any possible CSRF attacks. Fixes #1769. Conflicts: pdns/docs/httpapi/README.md pdns/docs/httpapi/api_spec.md pdns/docs/pdns.xml regression-tests.api/runtests.py Updated: pdns/webserver.cc to work with older recursor include files. pdns/dist-recursor to reflect changes in paths. Includes all yahttp updates from master. Disables auth API tests.
1 parent 6fdd40d commit 752756c

34 files changed

+1397
-1109
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ script:
5252
- sleep 3
5353
- ./clean.sh
5454
- cd ../regression-tests.api
55-
- ./runtests authoritative
5655
- ./runtests recursor
5756
- cd ../regression-tests
5857
- touch tests/verify-dnssec-zone/allow-missing

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS=modules codedocs @programdescend@
1+
SUBDIRS=pdns/ext/yahttp modules codedocs @programdescend@
22
DIST_SUBDIRS=modules codedocs pdns pdns/ext/rapidjson
33
EXTRA_DIST=README HACKING INSTALL NOTICE debian-pdns/* pdns.spec \
44
codedocs/doxygen.conf contrib/powerdns.solaris.init.d \

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ AC_PROG_LIBTOOL
3333
LT_INIT
3434
])
3535

36+
MC_TM_GMTOFF
37+
3638
AM_CONDITIONAL([RELEASE_BUILD], [test "$PACKAGE_VERSION" != "git"])
3739

3840
# Define full_libdir to be the fully expanded (${exec_prefix}, etc.)
@@ -320,6 +322,8 @@ AC_CONFIG_FILES([
320322
pdns/Makefile
321323
codedocs/Makefile
322324
pdns/pdns
325+
pdns/ext/yahttp/Makefile
326+
pdns/ext/yahttp/yahttp/Makefile
323327
modules/bindbackend/Makefile
324328
modules/db2backend/Makefile
325329
modules/geobackend/Makefile

m4/tm-gmtoff.m4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dnl Check for the tm_gmtoff field in struct tm
2+
dnl (Borrowed from the Gaim project)
3+
4+
AC_DEFUN([MC_TM_GMTOFF],
5+
[AC_REQUIRE([AC_STRUCT_TM])dnl
6+
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
7+
[AC_TRY_COMPILE([#include <sys/types.h>
8+
#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
9+
ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
10+
if test "$ac_cv_struct_tm_gmtoff" = yes; then
11+
AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm_gmtoff is available.])
12+
fi
13+
])

pdns/Makefile-recursor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ rec_channel.o rec_channel_rec.o selectmplexer.o sillyrecords.o \
2323
dns_random.o ext/polarssl-1.3.2/library/aes.o ext/polarssl-1.3.2/library/padlock.o dnslabeltext.o \
2424
lua-pdns.o lua-recursor.o randomhelper.o recpacketcache.o dns.o \
2525
reczones.o base32.o nsecrecords.o json.o ws-recursor.o ws-api.o \
26-
version.o responsestats.o webserver.o ext/yahttp/yahttp/reqresp.o \
26+
version.o responsestats.o webserver.o ext/yahttp/yahttp/reqresp.o ext/yahttp/yahttp/router.o \
2727
rec-carbon.o
2828

2929
REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o misc.o \

pdns/common_startup.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void declareArguments()
6565
::arg().set("retrieval-threads", "Number of AXFR-retrieval threads for slave operation")="2";
6666
::arg().setSwitch("experimental-json-interface", "If the webserver should serve JSON data")="no";
6767
::arg().setSwitch("experimental-api-readonly", "If the JSON API should disallow data modification")="no";
68+
::arg().set("experimental-api-key", "REST API Static authentication key (required for API use)")="";
6869
::arg().setSwitch("experimental-dname-processing", "If we should support DNAME records")="no";
6970

7071
::arg().setCmd("help","Provide a helpful message");

pdns/dist-recursor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ cp config-recursor.h $DIRNAME/config.h
5454
cat >>$DIRNAME/config.h <<EOF
5555
#define VERSION "$VERSION"
5656
#define DIST_HOST "$DIST_HOST"
57+
#define HAVE_BOOST 1
5758
EOF
5859
mkdir -p $DIRNAME/ext/rapidjson/include/rapidjson/internal
5960
cp -a ext/rapidjson/include/rapidjson/*.h $DIRNAME/ext/rapidjson/include/rapidjson/
@@ -63,6 +64,7 @@ cp -a ext/polarssl-1.3.2/include/polarssl/config.h ext/polarssl-1.3.2/include/po
6364
mkdir -p $DIRNAME/ext/polarssl-1.3.2/library
6465
cp -a ext/polarssl-1.3.2/library/aes.c ext/polarssl-1.3.2/library/padlock.c $DIRNAME/ext/polarssl-1.3.2/library
6566
cp -a ext/yahttp/ $DIRNAME/ext/yahttp
67+
echo '#include "../../../config.h"' > $DIRNAME/ext/yahttp/yahttp/yahttp-config.h
6668
mkdir $DIRNAME/rrd
6769
cp tools/rrd/{create,update,makegraphs,index.html} $DIRNAME/rrd
6870
cp dnslabeltext.rl $DIRNAME

pdns/ext/yahttp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
yahttp/libyahttp.a
22
*.o
3+
Makefile
4+
Makefile.in

pdns/ext/yahttp/LICENSE

Lines changed: 21 additions & 502 deletions
Large diffs are not rendered by default.

pdns/ext/yahttp/Makefile

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)