From 9364a3bac26ef41632c20da196f8df2fbc46840c Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
Date: Mon, 9 Jul 2018 10:11:05 -0300
Subject: [PATCH] radsecproxy: bump to 1.7.1

Version 1.7.1 brings compatibility with openssl 1.1.0.

Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
---
 net/radsecproxy/Makefile                      | 11 ++--
 .../patches/100-fix-debug-tid.patch           | 11 ++++
 .../patches/100-missing-return.patch          | 58 -------------------
 .../patches/200-logdest-on-foreground.patch   | 22 +++----
 4 files changed, 25 insertions(+), 77 deletions(-)
 create mode 100644 net/radsecproxy/patches/100-fix-debug-tid.patch
 delete mode 100644 net/radsecproxy/patches/100-missing-return.patch

diff --git a/net/radsecproxy/Makefile b/net/radsecproxy/Makefile
index 2a37ad3b6..340000067 100644
--- a/net/radsecproxy/Makefile
+++ b/net/radsecproxy/Makefile
@@ -8,16 +8,17 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=radsecproxy
-PKG_VERSION:=1.6.8
+PKG_VERSION:=1.7.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://software.uninett.no/radsecproxy/
-PKG_HASH:=9923203c3aaf17e31d5bc7a61b99e5a6aa0ef19a8397616f6ef9c0c41948f7d2
+PKG_SOURCE_URL:=https://github.com/radsecproxy/radsecproxy/releases/download/$(PKG_VERSION)/
+PKG_HASH:=49fd644684c6ea502d896d31e29f1acf2ae9b61b02b231a8ffd0cec11857dd07
 
 PKG_LICENSE:=GPL-2.0+
 PKG_LICENSE_FILES:=LICENSE
 
+PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -25,9 +26,9 @@ include $(INCLUDE_DIR)/package.mk
 define Package/radsecproxy
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libopenssl +libpthread
+  DEPENDS:=+libopenssl +libpthread +libnettle
   TITLE:=radsecproxy
-  URL:=http://software.uninett.no/radsecproxy
+  URL:=https://radsecproxy.github.io/
   MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
 endef
 
diff --git a/net/radsecproxy/patches/100-fix-debug-tid.patch b/net/radsecproxy/patches/100-fix-debug-tid.patch
new file mode 100644
index 000000000..c170e3ffb
--- /dev/null
+++ b/net/radsecproxy/patches/100-fix-debug-tid.patch
@@ -0,0 +1,11 @@
+--- a/debug.c
++++ b/debug.c
+@@ -153,7 +153,7 @@ void debug_logit(uint8_t level, const ch
+ 
+     if (debug_tid) {
+         tidbuf = malloc((3*sizeof(pthread_t)+5)+strlen(format));
+-        sprintf(tidbuf, "(%ld) %s", pthread_self(), format);
++        sprintf(tidbuf, "(%ld) %s", (long int)pthread_self(), format);
+         format = tidbuf;
+     } else
+         tidbuf = NULL;
diff --git a/net/radsecproxy/patches/100-missing-return.patch b/net/radsecproxy/patches/100-missing-return.patch
deleted file mode 100644
index 871fc6e10..000000000
--- a/net/radsecproxy/patches/100-missing-return.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- a/dtls.c
-+++ b/dtls.c
-@@ -523,6 +523,7 @@ void *udpdtlsserverrd(void *arg) {
- 	free(params);
- 	cacheexpire(sessioncache, &lastexpiry);
-     }
-+    return NULL;
- }
- 
- int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text) {
-@@ -642,6 +643,7 @@ void *udpdtlsclientrd(void *arg) {
- 	if (udp2bio(s, conf->servers->rbios, cnt))
- 	    debug(DBG_DBG, "radudpget: got DTLS in UDP from %s", addr2string((struct sockaddr *)&from));
-     }
-+    return NULL;
- }
- 
- void *dtlsclientrd(void *arg) {
---- a/radsecproxy.c
-+++ b/radsecproxy.c
-@@ -3203,6 +3203,8 @@ void *sighandler(void *arg) {
-             debug(DBG_WARN, "sighandler: ignoring signal %d", sig);
-         }
-     }
-+
-+    return NULL;
- }
- 
- int createpidfile(const char *pidfile) {
-@@ -3289,6 +3291,8 @@ int radsecproxy_main(int argc, char **ar
-     /* just hang around doing nothing, anything to do here? */
-     for (;;)
- 	sleep(1000);
-+
-+    return 0;
- }
- 
- /* Local Variables: */
---- a/udp.c
-+++ b/udp.c
-@@ -266,6 +266,8 @@ void *udpclientrd(void *arg) {
- 	buf = radudpget(*s, NULL, &server, NULL);
- 	replyh(server, buf);
-     }
-+
-+    return NULL;
- }
- 
- void *udpserverrd(void *arg) {
-@@ -310,6 +312,8 @@ void *udpserverwr(void *arg) {
- 	debug(DBG_DBG, "udpserverwr: refcount %d", reply->refcount);
- 	freerq(reply);
-     }
-+
-+    return NULL;
- }
- 
- void addclientudp(struct client *client) {
diff --git a/net/radsecproxy/patches/200-logdest-on-foreground.patch b/net/radsecproxy/patches/200-logdest-on-foreground.patch
index 6678448ac..9af20b7f3 100644
--- a/net/radsecproxy/patches/200-logdest-on-foreground.patch
+++ b/net/radsecproxy/patches/200-logdest-on-foreground.patch
@@ -1,8 +1,6 @@
-diff --git a/radsecproxy.c b/radsecproxy.c
-index 563c4a8..9fa076d 100644
 --- a/radsecproxy.c
 +++ b/radsecproxy.c
-@@ -3382,18 +3382,16 @@ int radsecproxy_main(int argc, char **argv) {
+@@ -3385,15 +3385,13 @@ int radsecproxy_main(int argc, char **ar
  	options.loglevel = loglevel;
      else if (options.loglevel)
  	debug_set_level(options.loglevel);
@@ -10,22 +8,18 @@ index 563c4a8..9fa076d 100644
 -	debug_set_destination(options.logdestination
 -                              ? options.logdestination
 -                              : "x-syslog:///", LOG_TYPE_DEBUG);
-+    debug_set_destination(options.logdestination
-+			  ? options.logdestination
-+			  : "x-syslog:///", LOG_TYPE_DEBUG);
- #if defined(WANT_FTICKS)
 -    	if (options.ftickssyslogfacility) {
 -            debug_set_destination(options.ftickssyslogfacility,
 -                                  LOG_TYPE_FTICKS);
 -            free(options.ftickssyslogfacility);
 -    	}
--#endif
++    debug_set_destination(options.logdestination
++                          ? options.logdestination
++                          : "x-syslog:///", LOG_TYPE_DEBUG);
 +    if (options.ftickssyslogfacility) {
-+	debug_set_destination(options.ftickssyslogfacility,
-+			      LOG_TYPE_FTICKS);
-+	free(options.ftickssyslogfacility);
++        debug_set_destination(options.ftickssyslogfacility,
++                              LOG_TYPE_FTICKS);
++        free(options.ftickssyslogfacility);
      }
-+#endif
      free(options.logdestination);
- 
-     if (!list_first(clconfs))
+     if (options.logtid)