commit c0b2b00adf87b7a1ad5269f4320b42b17c9f3116
parent a9a639e9d46e151c6af4dc0aa13aea3bd7a1cce7
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 27 Aug 2024 01:02:53 +0200
-style fixes
Diffstat:
5 files changed, 63 insertions(+), 36 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -163,34 +163,59 @@ PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3],
*** You need libjansson to build this program.
***]])])
+# Save before checking libcurl
+CFLAGS_SAVE=$CFLAGS
+LDFLAGS_SAVE=$LDFLAGS
+LIBS_SAVE=$LIBS
+
# libcurl-gnutls
-LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
-AS_IF([test "x$curl" = xtrue],
- [LDFLAGS="-L$with_libcurl/lib $LDFLAGS"
- CPPFLAGS="-I$with_libcurl/include $CPPFLAGS"
- AC_CHECK_HEADERS([curl/curl.h],
- [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,
- [curl=true],
- [curl=false],
- [[#include <curl/curl.h>]])],
- [curl=false])
- # need libcurl-gnutls.so, everything else is not acceptable
- AC_CHECK_LIB([curl-gnutls],
- [curl_easy_getinfo],,
- [curl=false])])
- # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
-
-# Check for curl/curl.h and gnurl/curl.h so we can use #ifdef
-# HAVE_CURL_CURL_H later (the above LIBCURL_CHECK_CONFIG accepted
-# *either* header set).
-AC_CHECK_HEADERS([curl/curl.h],,
- curl=false)
-
-# libgnurl
-AS_IF([test "x$curl" = "x0"],
- [AC_MSG_ERROR([libcurl not found..])])
-AM_CONDITIONAL(HAVE_LIBCURL, true)
-AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL])
+LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0])
+
+# cURL must support CURLINFO_TLS_SESSION, version >= 7.34
+AS_IF([test "x$curl" = x1],[
+ AC_CHECK_HEADER([curl/curl.h],
+ [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]])],
+ [curl=0])
+])
+
+# libcurl should be mutually exclusive
+AS_IF([test "$curl" = 1],
+ AM_CONDITIONAL(HAVE_LIBCURL, true)
+ AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])
+ [LIBCURL_LIBS="-lcurl"],
+ [AC_MSG_ERROR([FATAL: No libcurl])])
+
+AC_SUBST([LIBCURL_LIBS])
+
+
+# Check for GNUnet's libgnunetcurl.
+libgnunetcurl=0
+AC_MSG_CHECKING([for libgnunetcurl])
+AC_ARG_WITH(gnunet,
+ [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
+ [AC_MSG_RESULT([given as $with_gnunet])],
+ [AC_MSG_RESULT(not given)
+ with_gnunet=yes])
+AS_CASE([$with_gnunet],
+ [yes], [],
+ [no], [AC_MSG_ERROR([--with-gnunet is required])],
+ [LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
+ CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
+AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h],
+ [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)])
+AS_IF([test $libgnunetcurl != 1],
+ [AC_MSG_ERROR([[
+***
+*** You need libgnunetcurl to build this program.
+*** Make sure you have libcurl installed while
+*** building GNUnet.
+*** ]])])
+
+# Restore after curl checks messed up these values
+CFLAGS=$CFLAGS_SAVE
+LDFLAGS=$LDFLAGS_SAVE
+LIBS=$LIBS_SAVE
+
# gcov compilation
AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
diff --git a/src/challenger/challenger-httpd_common.c b/src/challenger/challenger-httpd_common.c
@@ -196,6 +196,12 @@ TALER_MHD_redirect_with_oauth_status (
if (0 == CH_get_output_type (connection))
{
+ char *url;
+ char *enc_err;
+ char *enc_state;
+ char *enc_desc = NULL;
+ char *enc_uri = NULL;
+
response = MHD_create_response_from_buffer (strlen (oauth_error),
(void *) oauth_error,
MHD_RESPMEM_PERSISTENT);
@@ -209,12 +215,6 @@ TALER_MHD_redirect_with_oauth_status (
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"text/plain"));
- char *url;
- char *enc_err;
- char *enc_state;
- char *enc_desc = NULL;
- char *enc_uri = NULL;
-
enc_err = TALER_urlencode (oauth_error);
enc_state = TALER_urlencode (state);
if (NULL != oauth_error_description)
@@ -249,6 +249,7 @@ TALER_MHD_redirect_with_oauth_status (
else
{
json_t *args;
+
args = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("state",
state),
diff --git a/src/challenger/challenger-httpd_spa.c b/src/challenger/challenger-httpd_spa.c
@@ -381,6 +381,7 @@ CH_spa_redirect (struct CH_HandlerContext *hc,
const char *text = "Redirecting to /webui/";
struct MHD_Response *response;
char *dst;
+ const char *rparams;
response = MHD_create_response_from_buffer (strlen (text),
(void *) text,
@@ -396,7 +397,7 @@ CH_spa_redirect (struct CH_HandlerContext *hc,
MHD_HTTP_HEADER_CONTENT_TYPE,
"text/plain"));
- const char *rparams = strchr (hc->full_url, '?');
+ rparams = strchr (hc->full_url, '?');
if (NULL == rparams)
dst = GNUNET_strdup ("/webui/");
else
diff --git a/src/challengerdb/challenger_db_plugin.c b/src/challengerdb/challenger_db_plugin.c
@@ -20,7 +20,7 @@
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
-#include "challenger_database_plugin.h"
+#include "challenger_database_lib.h"
#include <ltdl.h>
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
@@ -25,7 +25,7 @@
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
-
+#include "challenger_util.h"
/**
* Default project data used for installation path detection