You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocserv/ocserv-http-parser.patch

140 lines
5.0 KiB

diff -ur ocserv-0.2.1.orig/configure.ac ocserv-0.2.1/configure.ac
--- ocserv-0.2.1.orig/configure.ac 2013-11-06 20:47:34.000000000 +0100
+++ ocserv-0.2.1/configure.ac 2013-11-11 13:48:45.536372275 +0100
@@ -94,6 +94,27 @@
AC_DEFINE([ANYCONNECT_CLIENT_COMPAT], [], [Enable Anyconnect compatibility])
fi
+dnl Test for http_parser library
+with_local_http_parser=yes
+LIBS="$oldlibs -lhttp_parser"
+AC_MSG_CHECKING([for http_parser library])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ #include <http_parser.h>],[
+ http_parser_init(0, 0);])],
+ [AC_MSG_RESULT(yes)
+ AC_SUBST([HTTP_PARSER_LIBS], [-lhttp_parser])
+ AC_SUBST([HTTP_PARSER_CFLAGS], [])
+ with_local_http_parser=no],
+ [AC_MSG_RESULT(no)
+ AC_MSG_WARN([[
+***
+*** libhttp-parser not found.
+*** An included version of the library will be used.
+*** ]])])
+LIBS="$oldlibs"
+AM_CONDITIONAL(LOCAL_HTTP_PARSER, test "x$with_local_http_parser" != xno)
+
+
dnl needed in the included PCL
AC_C_VOLATILE
AC_C_CONST
diff -ur ocserv-0.2.1.orig/src/Makefile.am ocserv-0.2.1/src/Makefile.am
--- ocserv-0.2.1.orig/src/Makefile.am 2013-11-05 19:59:45.000000000 +0100
+++ ocserv-0.2.1/src/Makefile.am 2013-11-11 13:48:45.536372275 +0100
@@ -3,10 +3,18 @@
AM_CPPFLAGS = -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \
-I$(srcdir)/ -I$(builddir)/../ $(LIBOPTS_CFLAGS)
+if LOCAL_HTTP_PARSER
+AM_CPPFLAGS += -I$(srcdir)/http-parser/
+HTTP_PARSER_SOURCES = http-parser/http_parser.c http-parser/http_parser.h
+NEEDED_HTTP_PARSER_LIBS =
+else
+NEEDED_HTTP_PARSER_LIBS = $(HTTP_PARSER_LIBS)
+endif
+
if NEED_LIBOPTS
-LIBOPTS = ../libopts/libopts.a
+NEEDED_LIBOPTS = ../libopts/libopts.a
else
-LIBOPTS = $(LIBOPTS_LDADD)
+NEEDED_LIBOPTS = $(LIBOPTS_LDADD)
endif
EXTRA_DIST = ccan/licenses/BSD-MIT version.inc.in \
@@ -24,21 +32,21 @@
ocserv_SOURCES = ocserv-args.def ocserv-args.c ocserv-args.h
ocserv_SOURCES += main.c main-auth.c worker-vpn.c worker-auth.c tlslib.c \
- http-parser/http_parser.c ipc.h cookies.c worker-tun.c main-misc.c \
+ ipc.h cookies.c worker-tun.c main-misc.c \
main-config.c ip-lease.c ip-lease.h \
- vpn.h cookies.h tlslib.h http-parser/http_parser.h log.c tun.c tun.h \
+ vpn.h cookies.h tlslib.h log.c tun.c tun.h \
config.c pam.c pam.h worker-resume.c worker.h main-resume.c main.h \
worker-extras.c main-auth.h html.c html.h \
main-user.c worker-misc.c setproctitle.h route-add.c route-add.h \
setproctitle.c worker-privs.c plain.c plain.h common.h common.c \
sec-mod.c sec-mod.h script-list.h system.c system.h icmp-ping.c icmp-ping.h \
worker-bandwidth.c worker-bandwidth.h \
- str.c str.h gettime.h $(CCAN_SOURCES)
+ str.c str.h gettime.h $(CCAN_SOURCES) $(HTTP_PARSER_SOURCES)
-ocserv_LDADD = ../gl/libgnu.a $(LIBOPTS)
+ocserv_LDADD = ../gl/libgnu.a $(NEEDED_LIBOPTS)
ocserv_LDADD += $(LIBGNUTLS_LIBS) $(PAM_LIBS) $(LIBUTIL) \
- $(LIBSECCOMP) $(LIBWRAP) $(LIBCRYPT)
+ $(LIBSECCOMP) $(LIBWRAP) $(LIBCRYPT) $(NEEDED_HTTP_PARSER_LIBS)
if PCL
ocserv_LDADD += $(PCL_LIBS)
@@ -54,7 +62,7 @@
ocpasswd_SOURCES = ocpasswd-args.def ocpasswd-args.c ocpasswd-args.h \
ocpasswd.c
-ocpasswd_LDADD = ../gl/libgnu.a $(LIBOPTS)
+ocpasswd_LDADD = ../gl/libgnu.a $(NEEDED_LIBOPTS)
ocpasswd_LDADD += $(LIBGNUTLS_LIBS) $(LIBCRYPT)
ocpasswd-args.c ocpasswd-args.h: $(srcdir)/ocpasswd-args.def
diff -ur ocserv-0.2.1.orig/src/vpn.h ocserv-0.2.1/src/vpn.h
--- ocserv-0.2.1.orig/src/vpn.h 2013-11-05 19:34:54.000000000 +0100
+++ ocserv-0.2.1/src/vpn.h 2013-11-11 13:49:03.608470106 +0100
@@ -23,7 +23,7 @@
#include <config.h>
#include <gnutls/gnutls.h>
-#include <http-parser/http_parser.h>
+#include <http_parser.h>
#include <ccan/htable/htable.h>
#include <syslog.h>
#include <sys/types.h>
diff -ur ocserv-0.2.1.orig/src/worker-auth.c ocserv-0.2.1/src/worker-auth.c
--- ocserv-0.2.1.orig/src/worker-auth.c 2013-11-05 19:38:09.000000000 +0100
+++ ocserv-0.2.1/src/worker-auth.c 2013-11-11 13:48:45.537372280 +0100
@@ -41,7 +41,7 @@
#include <common.h>
#include <tlslib.h>
-#include <http-parser/http_parser.h>
+#include <http_parser.h>
#define SUCCESS_MSG_HEAD "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<auth id=\"success\">\n" \
diff -ur ocserv-0.2.1.orig/src/worker-tun.c ocserv-0.2.1/src/worker-tun.c
--- ocserv-0.2.1.orig/src/worker-tun.c 2013-11-05 19:38:22.000000000 +0100
+++ ocserv-0.2.1/src/worker-tun.c 2013-11-11 13:48:45.537372280 +0100
@@ -45,8 +45,6 @@
#include <worker.h>
#include <tlslib.h>
-#include <http-parser/http_parser.h>
-
/* if local is non zero it returns the local, otherwise the remote */
static
int get_ip(struct worker_st* ws, int fd, int family, unsigned int local,
diff -ur ocserv-0.2.1.orig/src/worker-vpn.c ocserv-0.2.1/src/worker-vpn.c
--- ocserv-0.2.1.orig/src/worker-vpn.c 2013-11-05 20:06:51.000000000 +0100
+++ ocserv-0.2.1/src/worker-vpn.c 2013-11-11 13:48:45.537372280 +0100
@@ -49,7 +49,7 @@
#include <worker.h>
#include <tlslib.h>
-#include <http-parser/http_parser.h>
+#include <http_parser.h>
/* after that time (secs) of inactivity in the UDP part, connection switches to
* TCP (if activity occurs there).