anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit e64f50baffe7bb49e31072ed402852acbb1c78ef
parent fa1a115b06540f7427af41f8e2f022eb50da0eed
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  6 Oct 2024 12:13:27 +0200

fix misc compiler warnings

Diffstat:
Mconfigure.ac | 124+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mm4/libcurl.m4 | 2+-
Dm4/libgnurl.m4 | 250-------------------------------------------------------------------------------
Msrc/authorization/anastasis-helper-authorization-iban.c | 6+++---
Msrc/authorization/anastasis_authorization_plugin.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_email.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_file.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_iban.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_post.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_sms.c | 8++++++++
Msrc/authorization/anastasis_authorization_plugin_totp.c | 10+++++++++-
Msrc/backend/anastasis-httpd_policy-upload.c | 16+++++++++-------
Msrc/backend/anastasis-httpd_truth-challenge.c | 21+++++++++++----------
Msrc/backend/anastasis-httpd_truth-solve.c | 19++++++++++---------
Msrc/backend/anastasis-httpd_truth-upload.c | 142+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Msrc/cli/anastasis-cli-discover.c | 2+-
Msrc/cli/anastasis-cli-redux.c | 2+-
Msrc/lib/anastasis_recovery.c | 6+++---
Msrc/reducer/anastasis_api_backup_redux.c | 70+++++++++++++++++++++++++++++++---------------------------------------
Msrc/reducer/anastasis_api_recovery_redux.c | 91+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Msrc/reducer/anastasis_api_redux.c | 46+++++++++++++++++++++++++---------------------
Msrc/reducer/validation_CH_AHV.c | 4++++
Msrc/reducer/validation_CZ_BN.c | 4++++
Msrc/reducer/validation_DE_SVN.c | 4++++
Msrc/reducer/validation_DE_TIN.c | 4++++
Msrc/reducer/validation_ES_DNI.c | 4++++
Msrc/reducer/validation_FR_INSEE.c | 4++++
Msrc/reducer/validation_IN_AADHAR.c | 4++++
Msrc/reducer/validation_IT_CF.c | 4++++
Msrc/reducer/validation_NL_BSN.c | 4++++
Msrc/reducer/validation_XX_SQUARE.c | 4++++
Msrc/reducer/validation_XY_PRIME.c | 4++++
Msrc/restclient/Makefile.am | 9+--------
Msrc/restclient/anastasis_api_config.c | 4++--
Msrc/stasis/anastasis_db_plugin.c | 10+++++++++-
Msrc/stasis/plugin_anastasis_postgres.c | 69+++++++++++++++++++++++++++++++++++++++++----------------------------
Msrc/stasis/test_anastasis_db.c | 17+++++++++--------
Msrc/testing/test_anastasis.c | 2+-
Msrc/testing/test_anastasis_api.c | 2+-
Msrc/testing/testing_cmd_challenge_answer.c | 48++++++++++++++++++++++++++----------------------
Msrc/util/anastasis-crypto-tvg.c | 6+++---
Msrc/util/os_installation.c | 2+-
Msrc/util/test_anastasis_crypto.c | 7+++----
43 files changed, 478 insertions(+), 597 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -3,7 +3,7 @@ # # This configure file is in the public domain -AC_PREREQ([2.69]) +AC_PREREQ([2.71]) AC_INIT([anastasis],[0.4.2],[taler-bug@gnu.org]) AC_CONFIG_SRCDIR([src/backend/anastasis-httpd.c]) AC_CONFIG_HEADERS([anastasis_config.h]) @@ -65,63 +65,10 @@ AC_SUBST(ANASTASIS_LIB_LDFLAGS) AC_SUBST(ANASTASIS_PLUGIN_LDFLAGS) -# check for libgnurl -# libgnurl -LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0) -AS_IF([test "x$gnurl" = x1],[ - AM_CONDITIONAL(HAVE_LIBGNURL, true) - AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl]) -],[ - AM_CONDITIONAL(HAVE_LIBGNURL, false) -]) - -# 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 - AC_CHECK_HEADERS([gnurl/curl.h],, - gnurl=false)) - -# libgnurl -AS_IF([test "x$gnurl" = "x0"], - [AS_IF([test "x$curl" = "x0"], - [AC_MSG_NOTICE([NOTICE: libgnurl not found. taler-bank support will not be compiled.])], - [AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.])])]) - -AS_IF([test x$curl = xfalse], - [AM_CONDITIONAL(HAVE_LIBCURL, false) - AS_IF([test "x$gnurl" = "x0"], - [AC_MSG_WARN([GNU Taler requires libcurl-gnutls >= 7.34])])], - [AM_CONDITIONAL(HAVE_LIBCURL, true) - AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL])]) - -# gcov compilation -AC_MSG_CHECKING(whether to compile with support for code coverage analysis) -AC_ARG_ENABLE([coverage], - AS_HELP_STRING([--enable-coverage], - [compile the library with code coverage support]), - [use_gcov=${enableval}], - [use_gcov=no]) -AC_MSG_RESULT($use_gcov) -AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) +# Save before checks clobber them +CFLAGS_SAVE=$CFLAGS +LDFLAGS_SAVE=$LDFLAGS +LIBS_SAVE=$LIBS # Check for GNUnet's libgnunetutil. @@ -150,6 +97,66 @@ AS_IF([test $libgnunetutil != 1], *** ]])]) +# check for libcurl +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) +AC_ARG_ENABLE([coverage], + AS_HELP_STRING([--enable-coverage], + [compile the library with code coverage support]), + [use_gcov=${enableval}], + [use_gcov=no]) +AC_MSG_RESULT($use_gcov) +AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) + + # test for postgres AX_LIB_POSTGRESQL([15]) AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true]) @@ -311,7 +318,6 @@ AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) # logic if doc_only is set, make sure conditionals are still defined AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) AM_CONDITIONAL([HAVE_LIBCURL], [false]) -AM_CONDITIONAL([HAVE_LIBGNURL], [false]) AM_CONDITIONAL([USE_COVERAGE], [false]) AM_CONDITIONAL([ENABLE_DOC], [true]) diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 @@ -61,7 +61,7 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) AC_ARG_WITH(libcurl, - AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), + AS_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) if test "$_libcurl_with" != "no" ; then diff --git a/m4/libgnurl.m4 b/m4/libgnurl.m4 @@ -1,250 +0,0 @@ -# LIBGNURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], -# [ACTION-IF-YES], [ACTION-IF-NO]) -# ---------------------------------------------------------- -# David Shaw <dshaw@jabberwocky.com> May-09-2006 -# -# Checks for libgnurl. DEFAULT-ACTION is the string yes or no to -# specify whether to default to --with-libgnurl or --without-libgnurl. -# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the -# minimum version of libgnurl to accept. Pass the version as a regular -# version number like 7.10.1. If not supplied, any version is -# accepted. ACTION-IF-YES is a list of shell commands to run if -# libgnurl was successfully found and passed the various tests. -# ACTION-IF-NO is a list of shell commands that are run otherwise. -# Note that using --without-libgnurl does run ACTION-IF-NO. -# -# This macro #defines HAVE_LIBGNURL if a working libgnurl setup is -# found, and sets @LIBGNURL@ and @LIBGNURL_CPPFLAGS@ to the necessary -# values. Other useful defines are LIBGNURL_FEATURE_xxx where xxx are -# the various features supported by libgnurl, and LIBGNURL_PROTOCOL_yyy -# where yyy are the various protocols supported by libgnurl. Both xxx -# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of -# the macro for the complete list of possible defines. Shell -# variables $libgnurl_feature_xxx and $libgnurl_protocol_yyy are also -# defined to 'yes' for those features and protocols that were found. -# Note that xxx and yyy keep the same capitalization as in the -# gnurl-config list (e.g. it's "HTTP" and not "http"). -# -# Users may override the detected values by doing something like: -# LIBGNURL="-lgnurl" LIBGNURL_CPPFLAGS="-I/usr/myinclude" ./configure -# -# For the sake of sanity, this macro assumes that any libgnurl that is -# found is after version 7.7.2, the first version that included the -# gnurl-config script. Note that it is very important for people -# packaging binary versions of libgnurl to include this script! -# Without gnurl-config, we can only guess what protocols are available, -# or use gnurl_version_info to figure it out at runtime. - -AC_DEFUN([LIBGNURL_CHECK_CONFIG], -[ - AH_TEMPLATE([LIBGNURL_FEATURE_SSL],[Defined if libgnurl supports SSL]) - AH_TEMPLATE([LIBGNURL_FEATURE_KRB4],[Defined if libgnurl supports KRB4]) - AH_TEMPLATE([LIBGNURL_FEATURE_IPV6],[Defined if libgnurl supports IPv6]) - AH_TEMPLATE([LIBGNURL_FEATURE_LIBZ],[Defined if libgnurl supports libz]) - AH_TEMPLATE([LIBGNURL_FEATURE_ASYNCHDNS],[Defined if libgnurl supports AsynchDNS]) - AH_TEMPLATE([LIBGNURL_FEATURE_IDN],[Defined if libgnurl supports IDN]) - AH_TEMPLATE([LIBGNURL_FEATURE_SSPI],[Defined if libgnurl supports SSPI]) - AH_TEMPLATE([LIBGNURL_FEATURE_NTLM],[Defined if libgnurl supports NTLM]) - - AH_TEMPLATE([LIBGNURL_PROTOCOL_HTTP],[Defined if libgnurl supports HTTP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_HTTPS],[Defined if libgnurl supports HTTPS]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_FTP],[Defined if libgnurl supports FTP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_FTPS],[Defined if libgnurl supports FTPS]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_FILE],[Defined if libgnurl supports FILE]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_TELNET],[Defined if libgnurl supports TELNET]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_LDAP],[Defined if libgnurl supports LDAP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_DICT],[Defined if libgnurl supports DICT]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_TFTP],[Defined if libgnurl supports TFTP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_RTSP],[Defined if libgnurl supports RTSP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_POP3],[Defined if libgnurl supports POP3]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_IMAP],[Defined if libgnurl supports IMAP]) - AH_TEMPLATE([LIBGNURL_PROTOCOL_SMTP],[Defined if libgnurl supports SMTP]) - - AC_ARG_WITH(libgnurl, - AC_HELP_STRING([--with-libgnurl=PREFIX],[look for the gnurl library in PREFIX/lib and headers in PREFIX/include]), - [_libgnurl_with=$withval],[_libgnurl_with=ifelse([$1],,[yes],[$1])]) - - if test "$_libgnurl_with" != "no" ; then - - AC_PROG_AWK - - _libgnurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" - - _libgnurl_try_link=yes - - if test -d "$_libgnurl_with" ; then - LIBGNURL_CPPFLAGS="-I$withval/include" - _libgnurl_ldflags="-L$withval/lib" - AC_PATH_PROG([_libgnurl_config],[gnurl-config],[], - ["$withval/bin"]) - else - AC_PATH_PROG([_libgnurl_config],[gnurl-config],[],[$PATH]) - fi - - if test x$_libgnurl_config != "x" ; then - AC_CACHE_CHECK([for the version of libgnurl], - [libgnurl_cv_lib_gnurl_version], - [libgnurl_cv_lib_gnurl_version=`$_libgnurl_config --version | $AWK '{print $[]2}'`]) - - _libgnurl_version=`echo $libgnurl_cv_lib_gnurl_version | $_libgnurl_version_parse` - _libgnurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libgnurl_version_parse` - - if test $_libgnurl_wanted -gt 0 ; then - AC_CACHE_CHECK([for libgnurl >= version $2], - [libgnurl_cv_lib_version_ok], - [ - if test $_libgnurl_version -ge $_libgnurl_wanted ; then - libgnurl_cv_lib_version_ok=yes - else - libgnurl_cv_lib_version_ok=no - fi - ]) - fi - - if test $_libgnurl_wanted -eq 0 || test x$libgnurl_cv_lib_version_ok = xyes ; then - if test x"$LIBGNURL_CPPFLAGS" = "x" ; then - LIBGNURL_CPPFLAGS=`$_libgnurl_config --cflags` - fi - if test x"$LIBGNURL" = "x" ; then - LIBGNURL=`$_libgnurl_config --libs` - - # This is so silly, but Apple actually has a bug in their - # gnurl-config script. Fixed in Tiger, but there are still - # lots of Panther installs around. - case "${host}" in - powerpc-apple-darwin7*) - LIBGNURL=`echo $LIBGNURL | sed -e 's|-arch i386||g'` - ;; - esac - fi - - # All gnurl-config scripts support --feature - _libgnurl_features=`$_libgnurl_config --feature` - - # Is it modern enough to have --protocols? (7.12.4) - if test $_libgnurl_version -ge 461828 ; then - _libgnurl_protocols=`$_libgnurl_config --protocols` - fi - else - _libgnurl_try_link=no - fi - - unset _libgnurl_wanted - fi - - if test $_libgnurl_try_link = yes ; then - - # we didn't find gnurl-config, so let's see if the user-supplied - # link line (or failing that, "-lgnurl") is enough. - LIBGNURL=${LIBGNURL-"$_libgnurl_ldflags -lgnurl"} - - AC_CACHE_CHECK([whether libgnurl is usable], - [libgnurl_cv_lib_gnurl_usable], - [ - _libgnurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$LIBGNURL_CPPFLAGS $CPPFLAGS" - _libgnurl_save_libs=$LIBS - LIBS="$LIBGNURL $LIBS" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curl/curl.h>],[ -/* Try and use a few common options to force a failure if we are - missing symbols or can't link. */ -int x; -curl_easy_setopt(NULL,CURLOPT_URL,NULL); -x=CURL_ERROR_SIZE; -x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_FILE; -x=CURLOPT_ERRORBUFFER; -x=CURLOPT_STDERR; -x=CURLOPT_VERBOSE; -])],libgnurl_cv_lib_gnurl_usable=yes,libgnurl_cv_lib_gnurl_usable=no) - - CPPFLAGS=$_libgnurl_save_cppflags - LIBS=$_libgnurl_save_libs - unset _libgnurl_save_cppflags - unset _libgnurl_save_libs - ]) - - if test $libgnurl_cv_lib_gnurl_usable = yes ; then - - # Does gnurl_free() exist in this version of libgnurl? - # If not, fake it with free() - - _libgnurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LIBGNURL_CPPFLAGS" - _libgnurl_save_libs=$LIBS - LIBS="$LIBS $LIBGNURL" - - AC_CHECK_FUNC(curl_free,, - AC_DEFINE(curl_free,free, - [Define curl_free() as free() if our version of gnurl lacks curl_free.])) - - CPPFLAGS=$_libgnurl_save_cppflags - LIBS=$_libgnurl_save_libs - unset _libgnurl_save_cppflags - unset _libgnurl_save_libs - - AC_DEFINE(HAVE_LIBGNURL,1, - [Define to 1 if you have a functional gnurl library.]) - AC_SUBST(LIBGNURL_CPPFLAGS) - AC_SUBST(LIBGNURL) - - for _libgnurl_feature in $_libgnurl_features ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libgnurl_feature_$_libgnurl_feature),[1]) - eval AS_TR_SH(libgnurl_feature_$_libgnurl_feature)=yes - done - - if test "x$_libgnurl_protocols" = "x" ; then - - # We don't have --protocols, so just assume that all - # protocols are available - _libgnurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - - if test x$libgnurl_feature_SSL = xyes ; then - _libgnurl_protocols="$_libgnurl_protocols HTTPS" - - # FTPS wasn't standards-compliant until version - # 7.11.0 (0x070b00 == 461568) - if test $_libgnurl_version -ge 461568; then - _libgnurl_protocols="$_libgnurl_protocols FTPS" - fi - fi - - # RTSP, IMAP, POP3 and SMTP were added in - # 7.20.0 (0x071400 == 463872) - if test $_libgnurl_version -ge 463872; then - _libgnurl_protocols="$_libgnurl_protocols RTSP IMAP POP3 SMTP" - fi - fi - - for _libgnurl_protocol in $_libgnurl_protocols ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libgnurl_protocol_$_libgnurl_protocol),[1]) - eval AS_TR_SH(libgnurl_protocol_$_libgnurl_protocol)=yes - done - else - unset LIBGNURL - unset LIBGNURL_CPPFLAGS - fi - fi - - unset _libgnurl_try_link - unset _libgnurl_version_parse - unset _libgnurl_config - unset _libgnurl_feature - unset _libgnurl_features - unset _libgnurl_protocol - unset _libgnurl_protocols - unset _libgnurl_version - unset _libgnurl_ldflags - fi - - if test x$_libgnurl_with = xno || test x$libgnurl_cv_lib_gnurl_usable != xyes ; then - # This is the IF-NO path - ifelse([$4],,:,[$4]) - else - # This is the IF-YES path - ifelse([$3],,:,[$3]) - fi - - unset _libgnurl_with -])dnl diff --git a/src/authorization/anastasis-helper-authorization-iban.c b/src/authorization/anastasis-helper-authorization-iban.c @@ -48,7 +48,7 @@ static struct ANASTASIS_EUFIN_AuthenticationData auth; /** * Bank account IBAN this process is monitoring. */ -static char *iban; +static char *authorization_iban; /** * Active request for history. @@ -403,7 +403,7 @@ run (void *cls, GNUNET_CONFIGURATION_get_value_string (cfg, "authorization-iban", "CREDIT_IBAN", - &iban)) + &authorization_iban)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "authorization-iban", @@ -430,7 +430,7 @@ run (void *cls, enum GNUNET_DB_QueryStatus qs; qs = db_plugin->get_last_auth_iban_payment_row (db_plugin->cls, - iban, + authorization_iban, &latest_row_off); if (qs < 0) { diff --git a/src/authorization/anastasis_authorization_plugin.c b/src/authorization/anastasis_authorization_plugin.c @@ -172,6 +172,10 @@ static char *old_dlsearchpath; * Setup libtool paths. */ void __attribute__ ((constructor)) +anastasis_authorization_plugin_init (void); + +/* declaration to fix compiler warning */ +void __attribute__ ((constructor)) anastasis_authorization_plugin_init (void) { int err; @@ -213,6 +217,10 @@ anastasis_authorization_plugin_init (void) * Shutdown libtool. */ void __attribute__ ((destructor)) +anastasis_authorization_plugin_fini (void); + +/* declaration to fix compiler warning */ +void __attribute__ ((destructor)) anastasis_authorization_plugin_fini (void) { lt_dlsetsearchpath (old_dlsearchpath); diff --git a/src/authorization/anastasis_authorization_plugin_email.c b/src/authorization/anastasis_authorization_plugin_email.c @@ -536,6 +536,10 @@ email_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_email_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_email_init (void *cls) { const struct ANASTASIS_AuthorizationContext *ac = cls; @@ -625,6 +629,10 @@ libanastasis_plugin_authorization_email_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_email_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_email_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/authorization/anastasis_authorization_plugin_file.c b/src/authorization/anastasis_authorization_plugin_file.c @@ -291,6 +291,10 @@ file_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_file_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_file_init (void *cls) { const struct ANASTASIS_AuthorizationContext *ac = cls; @@ -317,6 +321,10 @@ libanastasis_plugin_authorization_file_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_file_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_file_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/authorization/anastasis_authorization_plugin_iban.c b/src/authorization/anastasis_authorization_plugin_iban.c @@ -635,6 +635,10 @@ iban_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_iban_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_iban_init (void *cls) { struct ANASTASIS_AuthorizationContext *ac = cls; @@ -733,6 +737,10 @@ libanastasis_plugin_authorization_iban_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_iban_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_iban_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/authorization/anastasis_authorization_plugin_post.c b/src/authorization/anastasis_authorization_plugin_post.c @@ -591,6 +591,10 @@ post_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_post_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_post_init (void *cls) { const struct ANASTASIS_AuthorizationContext *ac = cls; @@ -665,6 +669,10 @@ libanastasis_plugin_authorization_post_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_post_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_post_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/authorization/anastasis_authorization_plugin_sms.c b/src/authorization/anastasis_authorization_plugin_sms.c @@ -526,6 +526,10 @@ sms_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_sms_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_sms_init (void *cls) { const struct ANASTASIS_AuthorizationContext *ac = cls; @@ -614,6 +618,10 @@ libanastasis_plugin_authorization_sms_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_sms_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_sms_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/authorization/anastasis_authorization_plugin_totp.c b/src/authorization/anastasis_authorization_plugin_totp.c @@ -35,7 +35,7 @@ * How long is a TOTP code valid? */ #define TOTP_VALIDITY_PERIOD GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 30) + GNUNET_TIME_UNIT_SECONDS, 30) /** * Range of time we allow (plus-minus). @@ -345,6 +345,10 @@ totp_cleanup (struct ANASTASIS_AUTHORIZATION_State *as) * @return NULL on error, otherwise a `struct ANASTASIS_AuthorizationPlugin` */ void * +libanastasis_plugin_authorization_totp_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_totp_init (void *cls) { const struct ANASTASIS_AuthorizationContext *ac = cls; @@ -372,6 +376,10 @@ libanastasis_plugin_authorization_totp_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_authorization_totp_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_authorization_totp_done (void *cls) { struct ANASTASIS_AuthorizationPlugin *plugin = cls; diff --git a/src/backend/anastasis-httpd_policy-upload.c b/src/backend/anastasis-httpd_policy-upload.c @@ -35,7 +35,7 @@ * we are awaiting payment before giving up? */ #define CHECK_PAYMENT_GENERIC_TIMEOUT GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 30) + GNUNET_TIME_UNIT_SECONDS, 30) /** @@ -258,7 +258,7 @@ make_payment_request (struct PolicyUploadContext *puc) TALER_MHD_add_global_headers (resp); { char *hdr; - char *pfx; + const char *pfx; char *hn; if (0 == strncasecmp ("https://", @@ -536,7 +536,8 @@ await_payment (struct PolicyUploadContext *puc) puc->cpo = TALER_MERCHANT_merchant_order_get (AH_ctx, AH_backend_url, order_id, - NULL /* our payments are NOT session-bound */, + NULL /* our payments are NOT session-bound */ + , timeout, &check_payment_cb, puc); @@ -763,7 +764,8 @@ AH_handler_policy_post ( GNUNET_STRINGS_string_to_data (etag + 1, strlen (etag) - 2, &puc->new_policy_upload_hash, - sizeof (puc->new_policy_upload_hash))) ) + sizeof (puc->new_policy_upload_hash)) + ) ) { GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, @@ -941,7 +943,7 @@ AH_handler_policy_post ( /* Check if existing policy matches upload (and if, skip it) */ { - struct GNUNET_HashCode hc; + struct GNUNET_HashCode hash; enum ANASTASIS_DB_AccountStatus as; uint32_t version; struct GNUNET_TIME_Timestamp now; @@ -950,7 +952,7 @@ AH_handler_policy_post ( as = db->lookup_account (db->cls, account_pub, &puc->paid_until, - &hc, + &hash, &version); now = GNUNET_TIME_timestamp_get (); if (GNUNET_TIME_timestamp_cmp (puc->paid_until, @@ -988,7 +990,7 @@ AH_handler_policy_post ( /* continue below */ break; case ANASTASIS_DB_ACCOUNT_STATUS_VALID_HASH_RETURNED: - if (0 == GNUNET_memcmp (&hc, + if (0 == GNUNET_memcmp (&hash, &puc->new_policy_upload_hash)) { /* Refuse upload: we already have that backup! */ diff --git a/src/backend/anastasis-httpd_truth-challenge.c b/src/backend/anastasis-httpd_truth-challenge.c @@ -36,19 +36,19 @@ * clients to attempt to answer security questions? */ #define MAX_QUESTION_FREQ GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 30) + GNUNET_TIME_UNIT_SECONDS, 30) /** * How long should the wallet check for auto-refunds before giving up? */ #define AUTO_REFUND_TIMEOUT GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MINUTES, 2) + GNUNET_TIME_UNIT_MINUTES, 2) /** * How long should the wallet check for payment before giving up? */ #define PAYMENT_TIMEOUT GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 15) + GNUNET_TIME_UNIT_SECONDS, 15) /** @@ -720,7 +720,8 @@ check_payment_cb (void *cls, if (0 <= qs) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Order has been paid, continuing with request processing\n"); + "Order has been paid, continuing with request processing\n") + ; return; /* continue as planned */ } GNUNET_break (0); @@ -1043,17 +1044,17 @@ AH_handler_truth_challenge ( &gc->no_payment_identifier_provided), GNUNET_JSON_spec_end () }; - enum GNUNET_GenericReturnValue res; + enum GNUNET_GenericReturnValue pres; - res = TALER_MHD_parse_json_data (connection, - gc->root, - spec); - if (GNUNET_SYSERR == res) + pres = TALER_MHD_parse_json_data (connection, + gc->root, + spec); + if (GNUNET_SYSERR == pres) { GNUNET_break (0); return MHD_NO; /* hard failure */ } - if (GNUNET_NO == res) + if (GNUNET_NO == pres) { GNUNET_break_op (0); return MHD_YES; /* failure */ diff --git a/src/backend/anastasis-httpd_truth-solve.c b/src/backend/anastasis-httpd_truth-solve.c @@ -36,13 +36,13 @@ * clients to attempt to answer security questions? */ #define MAX_QUESTION_FREQ GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_SECONDS, 30) + GNUNET_TIME_UNIT_SECONDS, 30) /** * How long should the wallet check for auto-refunds before giving up? */ #define AUTO_REFUND_TIMEOUT GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MINUTES, 2) + GNUNET_TIME_UNIT_MINUTES, 2) /** @@ -567,7 +567,8 @@ check_payment_cb (void *cls, if (0 <= qs) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Order has been paid, continuing with request processing\n"); + "Order has been paid, continuing with request processing\n") + ; return; /* continue as planned */ } GNUNET_break (0); @@ -1213,17 +1214,17 @@ AH_handler_truth_solve ( &gc->no_payment_identifier_provided), GNUNET_JSON_spec_end () }; - enum GNUNET_GenericReturnValue res; + enum GNUNET_GenericReturnValue pres; - res = TALER_MHD_parse_json_data (connection, - gc->root, - spec); - if (GNUNET_SYSERR == res) + pres = TALER_MHD_parse_json_data (connection, + gc->root, + spec); + if (GNUNET_SYSERR == pres) { GNUNET_break (0); return MHD_NO; /* hard failure */ } - if (GNUNET_NO == res) + if (GNUNET_NO == pres) { GNUNET_break_op (0); return MHD_YES; /* failure */ diff --git a/src/backend/anastasis-httpd_truth-upload.c b/src/backend/anastasis-httpd_truth-upload.c @@ -484,7 +484,8 @@ begin_payment (struct TruthUploadContext *tuc) tuc->cpo = TALER_MERCHANT_merchant_order_get (AH_ctx, AH_backend_url, order_id, - NULL /* our payments are NOT session-bound */, + NULL /* our payments are NOT session-bound */ + , timeout, &check_payment_cb, tuc); @@ -521,7 +522,6 @@ AH_handler_truth_post ( size_t encrypted_truth_size; const char *truth_mime = NULL; const char *type; - enum GNUNET_DB_QueryStatus qs; uint32_t storage_years; struct GNUNET_TIME_Timestamp paid_until = GNUNET_TIME_UNIT_ZERO_TS; @@ -700,81 +700,85 @@ AH_handler_truth_post ( "Storing truth %s until %s!\n", TALER_B2S (truth_uuid), GNUNET_TIME_timestamp2s (paid_until)); - qs = db->store_truth (db->cls, - truth_uuid, - &key_share_data, - (NULL == truth_mime) + { + enum GNUNET_DB_QueryStatus qs; + + qs = db->store_truth (db->cls, + truth_uuid, + &key_share_data, + (NULL == truth_mime) ? "" : truth_mime, - encrypted_truth, - encrypted_truth_size, - type, - GNUNET_TIME_absolute_get_remaining ( - paid_until.abs_time)); - switch (qs) - { - case GNUNET_DB_STATUS_HARD_ERROR: - case GNUNET_DB_STATUS_SOFT_ERROR: - GNUNET_break (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_INVARIANT_FAILURE, - "store_truth"); - case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + encrypted_truth, + encrypted_truth_size, + type, + GNUNET_TIME_absolute_get_remaining ( + paid_until.abs_time)); + switch (qs) { - void *xtruth; - size_t xtruth_size; - char *xtruth_mime; - char *xmethod; - bool ok = false; - - if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == - db->get_escrow_challenge (db->cls, - truth_uuid, - &xtruth, - &xtruth_size, - &xtruth_mime, - &xmethod)) + case GNUNET_DB_STATUS_HARD_ERROR: + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + GNUNET_JSON_parse_free (spec); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, + "store_truth"); + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: { - ok = ( (xtruth_size == encrypted_truth_size) && - (0 == strcmp (xmethod, - type)) && - (0 == strcmp (((NULL == truth_mime) ? "" : truth_mime), - ((NULL == xtruth_mime) ? "" : xtruth_mime))) && - (0 == memcmp (xtruth, - encrypted_truth, - xtruth_size)) ); - GNUNET_free (encrypted_truth); - GNUNET_free (xtruth_mime); - GNUNET_free (xmethod); + void *xtruth; + size_t xtruth_size; + char *xtruth_mime; + char *xmethod; + bool ok = false; + + if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == + db->get_escrow_challenge (db->cls, + truth_uuid, + &xtruth, + &xtruth_size, + &xtruth_mime, + &xmethod)) + { + ok = ( (xtruth_size == encrypted_truth_size) && + (0 == strcmp (xmethod, + type)) && + (0 == strcmp (((NULL == truth_mime) ? "" : truth_mime), + ((NULL == xtruth_mime) ? "" : xtruth_mime))) && + (0 == memcmp (xtruth, + encrypted_truth, + xtruth_size)) ); + GNUNET_free (encrypted_truth); + GNUNET_free (xtruth_mime); + GNUNET_free (xmethod); + } + if (! ok) + { + GNUNET_JSON_parse_free (spec); + + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_CONFLICT, + TALER_EC_ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS, + NULL); + } + /* idempotency detected, intentional fall through! */ } - if (! ok) + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: { - GNUNET_JSON_parse_free (spec); + struct MHD_Response *resp; - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_CONFLICT, - TALER_EC_ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS, - NULL); + GNUNET_JSON_parse_free (spec); + resp = MHD_create_response_from_buffer (0, + NULL, + MHD_RESPMEM_PERSISTENT); + TALER_MHD_add_global_headers (resp); + ret = MHD_queue_response (connection, + MHD_HTTP_NO_CONTENT, + resp); + MHD_destroy_response (resp); + GNUNET_break (MHD_YES == ret); + return ret; } - /* idempotency detected, intentional fall through! */ - } - case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: - { - struct MHD_Response *resp; - - GNUNET_JSON_parse_free (spec); - resp = MHD_create_response_from_buffer (0, - NULL, - MHD_RESPMEM_PERSISTENT); - TALER_MHD_add_global_headers (resp); - ret = MHD_queue_response (connection, - MHD_HTTP_NO_CONTENT, - resp); - MHD_destroy_response (resp); - GNUNET_break (MHD_YES == ret); - return ret; } } GNUNET_JSON_parse_free (spec); diff --git a/src/cli/anastasis-cli-discover.c b/src/cli/anastasis-cli-discover.c @@ -162,9 +162,9 @@ run (void *cls, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - (void) cls; json_error_t error; + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting anastasis-discover\n"); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, diff --git a/src/cli/anastasis-cli-redux.c b/src/cli/anastasis-cli-redux.c @@ -208,9 +208,9 @@ run (void *cls, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - (void) cls; json_error_t error; + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting anastasis-reducer\n"); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c @@ -879,7 +879,7 @@ policy_lookup_cb (void *cls, { struct DecryptionPolicy *dp = &r->dps[j]; const json_t *uuids; - json_t *uuid; + json_t *juuid; size_t n_index; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_varsize ("master_key", @@ -924,9 +924,9 @@ policy_lookup_cb (void *cls, dp->pub_details.challenges = GNUNET_new_array (dp->pub_details.challenges_length, struct ANASTASIS_Challenge *); - json_array_foreach (uuids, n_index, uuid) + json_array_foreach (uuids, n_index, juuid) { - const char *uuid_str = json_string_value (uuid); + const char *uuid_str = json_string_value (juuid); struct ANASTASIS_CRYPTO_TruthUUIDP uuid; bool found = false; diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c @@ -354,7 +354,7 @@ add_authentication (json_t *state, json_object_foreach (auth_providers, url, details) { const json_t *methods = NULL; - json_t *method; + json_t *imethod; size_t index; uint32_t size_limit_in_mb = 0; const char *status; @@ -396,11 +396,11 @@ add_authentication (json_t *state, GNUNET_break (0); continue; } - json_array_foreach (methods, index, method) + json_array_foreach (methods, index, imethod) { const char *type; - type = json_string_value (json_object_get (method, + type = json_string_value (json_object_get (imethod, "type")); GNUNET_break (NULL != type); if ( (NULL != type) && @@ -971,9 +971,7 @@ eval_provider_selection (struct PolicyBuilder *pb, GNUNET_break (0); pb->ec = TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID; pb->hint = "'authentication_method' content malformed"; - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; + goto cleanup; } if (MHD_HTTP_OK != @@ -981,9 +979,7 @@ eval_provider_selection (struct PolicyBuilder *pb, "http_status"))) { GNUNET_JSON_parse_free (mspec); - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; /* skip providers that are down */ + goto cleanup; } if (GNUNET_OK != GNUNET_JSON_parse (provider_cfg, @@ -994,9 +990,7 @@ eval_provider_selection (struct PolicyBuilder *pb, "Skipping provider %s: no suitable configuration\n", prov_sel[i]); GNUNET_JSON_parse_free (mspec); - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; + goto cleanup; } json_array_foreach (provider_methods, index, md) { @@ -1018,9 +1012,7 @@ eval_provider_selection (struct PolicyBuilder *pb, GNUNET_break (0); pb->ec = TALER_EC_ANASTASIS_REDUCER_STATE_INVALID; pb->hint = "'methods' of provider"; - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; + goto cleanup; } if ( (0 == strcmp (type, method_type)) && @@ -1040,9 +1032,7 @@ eval_provider_selection (struct PolicyBuilder *pb, /* Provider does not OFFER this method, combination not possible. Cost is basically 'infinite', but we simply then skip this. */ GNUNET_JSON_parse_free (mspec); - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; + goto cleanup; } GNUNET_JSON_parse_free (mspec); } @@ -1073,10 +1063,9 @@ eval_provider_selection (struct PolicyBuilder *pb, #endif if (curr_diversity < pb->best_diversity) { - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; /* do not allow combinations that are bad - for provider diversity */ + /* do not allow combinations that are bad + for provider diversity */ + goto cleanup; } if (curr_diversity > pb->best_diversity) { @@ -1121,9 +1110,8 @@ eval_provider_selection (struct PolicyBuilder *pb, } if (equiv) { - for (unsigned int i = 0; i<pb->req_methods; i++) - free_costs (policy_ent[i].usage_fee); - return; /* equivalent to known allocation */ + /* equivalent to known allocation */ + goto cleanup; } } } @@ -1143,6 +1131,10 @@ eval_provider_selection (struct PolicyBuilder *pb, pb->current_policy->pm_tail, m); } + return; +cleanup: + for (unsigned int i = 0; i<pb->req_methods; i++) + free_costs (policy_ent[i].usage_fee); } @@ -1530,7 +1522,7 @@ select_policies (struct PolicyBuilder *pb) { struct PolicyMap best[cnt]; struct PolicyMap curr[cnt]; - unsigned int i; + unsigned int off; pb->best_map = best; pb->curr_map = curr; @@ -1542,12 +1534,12 @@ select_policies (struct PolicyBuilder *pb) "Assessed %u/%u policies\n", pb->evaluations, (unsigned int) MAX_EVALUATIONS); - i = 0; + off = 0; for (struct Policy *p = pb->p_head; NULL != p; p = p->next) { - struct PolicyMap *pm = &best[i++]; + struct PolicyMap *pm = &best[off++]; json_t *method_arr; #if DEBUG @@ -1938,16 +1930,16 @@ add_policy (json_t *state, /* Add all methods from 'arg_array' to 'methods' */ { - size_t index; + size_t aindex; json_t *method; - json_array_foreach (arg_array, index, method) + json_array_foreach (arg_array, aindex, method) { const char *provider_url; uint32_t method_idx; const char *method_type; const json_t *prov_methods; - struct GNUNET_JSON_Specification spec[] = { + struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_string ("provider", &provider_url), GNUNET_JSON_spec_uint32 ("authentication_method", @@ -1957,7 +1949,7 @@ add_policy (json_t *state, if (GNUNET_OK != GNUNET_JSON_parse (method, - spec, + ispec, NULL, NULL)) { GNUNET_break (0); @@ -2050,9 +2042,9 @@ add_policy (json_t *state, { bool found = false; - size_t index; + size_t mindex; json_t *pm; - json_array_foreach (prov_methods, index, pm) + json_array_foreach (prov_methods, mindex, pm) { struct TALER_Amount method_cost; const char *type; @@ -2097,7 +2089,7 @@ add_policy (json_t *state, GNUNET_assert (0 == json_array_append (methods, method)); - } /* end of json_array_foreach (arg_array, index, method) */ + } /* end of json_array_foreach (arg_array, mindex, method) */ } /* add new policy to array of existing policies */ @@ -3479,8 +3471,8 @@ share_secret (struct UploadContext *uc) uc->cb_cls, TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, "'providers' entry malformed"); - for (unsigned int i = 0; i<policies_len; i++) - ANASTASIS_policy_destroy (vpolicies[i]); + for (unsigned int p = 0; p<policies_len; p++) + ANASTASIS_policy_destroy (vpolicies[p]); upload_cancel_cb (uc); return; } @@ -4135,7 +4127,7 @@ upload (json_t *state, uint32_t am_idx; const char *provider_url; json_t *truth = NULL; - struct GNUNET_JSON_Specification spec[] = { + struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_string ("provider", &provider_url), GNUNET_JSON_spec_uint32 ("authentication_method", @@ -4149,7 +4141,7 @@ upload (json_t *state, if (GNUNET_OK != GNUNET_JSON_parse (auth_method, - spec, + ispec, NULL, NULL)) { ANASTASIS_redux_fail_ (cb, diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c @@ -20,7 +20,6 @@ * @author Dominik Meister * @author Dennis Neufeld */ - #include <platform.h> #include <jansson.h> #include "anastasis_redux.h" @@ -262,7 +261,7 @@ sctx_free (void *cls) * @param cb_cls closure for @a cb * @param rc error code to translate to JSON */ -void +static void fail_by_error (ANASTASIS_ActionCallback cb, void *cb_cls, enum ANASTASIS_RecoveryStatus rc) @@ -750,7 +749,8 @@ start_feedback_cb ( &csr->details.bank_transfer_required.amount), csr->details.bank_transfer_required.target_iban, csr->details.bank_transfer_required.target_business_name, - csr->details.bank_transfer_required.wire_transfer_subject); + csr->details.bank_transfer_required.wire_transfer_subject + ); reply = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "iban-instructions"), @@ -1068,7 +1068,6 @@ solve_challenge_cb (void *cls, &ps), GNUNET_JSON_spec_end () }; - json_t *challenge; if (NULL == ri) { @@ -1171,57 +1170,61 @@ solve_challenge_cb (void *cls, } /* end resuming async challenges */ /* Check if we got a payment_secret */ - challenge = find_challenge_in_ri (sctx->state, - &sctx->uuid); - if (NULL == challenge) { - GNUNET_break_op (0); - ANASTASIS_redux_fail_ (sctx->cb, - sctx->cb_cls, - TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, - "challenge not found"); - sctx_free (sctx); - return; - } + json_t *challenge; - if (NULL != - json_object_get (sctx->args, - "payment_secret")) - { - /* check if we got payment secret in args */ - if (GNUNET_OK != - GNUNET_JSON_parse (sctx->args, - pspec, - NULL, NULL)) + challenge = find_challenge_in_ri (sctx->state, + &sctx->uuid); + if (NULL == challenge) { GNUNET_break_op (0); ANASTASIS_redux_fail_ (sctx->cb, sctx->cb_cls, - TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, - "'payment_secret' malformed"); + TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, + "challenge not found"); sctx_free (sctx); return; } - psp = &ps; - } - else if (NULL != - json_object_get (challenge, - "payment_secret")) - { - if (GNUNET_OK != - GNUNET_JSON_parse (challenge, - pspec, - NULL, NULL)) + + if (NULL != + json_object_get (sctx->args, + "payment_secret")) { - GNUNET_break_op (0); - ANASTASIS_redux_fail_ (sctx->cb, - sctx->cb_cls, - TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, - "'payment_secret' malformed"); - sctx_free (sctx); - return; + /* check if we got payment secret in args */ + if (GNUNET_OK != + GNUNET_JSON_parse (sctx->args, + pspec, + NULL, NULL)) + { + GNUNET_break_op (0); + ANASTASIS_redux_fail_ (sctx->cb, + sctx->cb_cls, + TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID, + "'payment_secret' malformed"); + sctx_free (sctx); + return; + } + psp = &ps; + } + else if (NULL != + json_object_get (challenge, + "payment_secret")) + { + if (GNUNET_OK != + GNUNET_JSON_parse (challenge, + pspec, + NULL, NULL)) + { + GNUNET_break_op (0); + ANASTASIS_redux_fail_ (sctx->cb, + sctx->cb_cls, + TALER_EC_ANASTASIS_REDUCER_STATE_INVALID, + "'payment_secret' malformed"); + sctx_free (sctx); + return; + } + psp = &ps; } - psp = &ps; } /* start or solve selected challenge */ diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c @@ -497,16 +497,16 @@ notify_waiting (struct ConfigRequest *cr) while (NULL != (w = cr->w_head)) { - json_t *provider_list; + json_t *apl; json_t *prov; - if (NULL == (provider_list = json_object_get (w->state, - "authentication_providers"))) + if (NULL == (apl = json_object_get (w->state, + "authentication_providers"))) { GNUNET_assert (0 == json_object_set_new (w->state, "authentication_providers", - provider_list = json_object ())); + apl = json_object ())); } if (TALER_EC_NONE != cr->ec) { @@ -558,7 +558,7 @@ notify_waiting (struct ConfigRequest *cr) cr->http_status)); } GNUNET_assert (0 == - json_object_set_new (provider_list, + json_object_set_new (apl, cr->url, prov)); w->cb (w->cb_cls, @@ -1033,8 +1033,8 @@ select_continent (json_t *state, ANASTASIS_ActionCallback cb, void *cb_cls) { - const json_t *redux_countries = ANASTASIS_redux_countries_init_ (); - const json_t *root = json_object_get (redux_countries, + const json_t *rc = ANASTASIS_redux_countries_init_ (); + const json_t *root = json_object_get (rc, "countries"); const json_t *continent; json_t *countries; @@ -1129,7 +1129,6 @@ select_country (json_t *state, { const json_t *required_attrs; const json_t *country_code; - const json_t *redux_id_attr; if (NULL == arguments) { @@ -1194,18 +1193,23 @@ select_country (json_t *state, return NULL; } } - redux_id_attr = redux_id_attr_init (json_string_value (country_code)); - if (NULL == redux_id_attr) + { - GNUNET_break (0); - ANASTASIS_redux_fail_ (cb, - cb_cls, - TALER_EC_ANASTASIS_REDUCER_RESOURCE_MISSING, - json_string_value (country_code)); - return NULL; + const json_t *ria; + + ria = redux_id_attr_init (json_string_value (country_code)); + if (NULL == ria) + { + GNUNET_break (0); + ANASTASIS_redux_fail_ (cb, + cb_cls, + TALER_EC_ANASTASIS_REDUCER_RESOURCE_MISSING, + json_string_value (country_code)); + return NULL; + } + required_attrs = json_object_get (ria, + "required_attributes"); } - required_attrs = json_object_get (redux_id_attr, - "required_attributes"); if (NULL == required_attrs) { ANASTASIS_redux_fail_ (cb, @@ -2004,14 +2008,14 @@ ANASTASIS_REDUX_load_continents_ () { const json_t *countries; json_t *continents; - const json_t *redux_countries = ANASTASIS_redux_countries_init_ (); + const json_t *rc = ANASTASIS_redux_countries_init_ (); - if (NULL == redux_countries) + if (NULL == rc) { GNUNET_break (0); return NULL; } - countries = json_object_get (redux_countries, + countries = json_object_get (rc, "countries"); if (NULL == countries) { diff --git a/src/reducer/validation_CH_AHV.c b/src/reducer/validation_CH_AHV.c @@ -30,6 +30,10 @@ * @return true if validation passed, else false */ bool +CH_AHV_check (const char *ahv_number); + +/* declaration to fix compiler warning */ +bool CH_AHV_check (const char *ahv_number) { unsigned int checknum; diff --git a/src/reducer/validation_CZ_BN.c b/src/reducer/validation_CZ_BN.c @@ -31,6 +31,10 @@ * @return true if b_number is valid */ bool +CZ_BN_check (const char *b_number); + +/* declaration to fix compiler warning */ +bool CZ_BN_check (const char *b_number) { unsigned long long n; diff --git a/src/reducer/validation_DE_SVN.c b/src/reducer/validation_DE_SVN.c @@ -51,6 +51,10 @@ q (unsigned int v) * @return true if validation passed, else false */ bool +DE_SVN_check (const char *ssn_number); + +/* declaration to fix compiler warning */ +bool DE_SVN_check (const char *ssn_number) { static const unsigned int factors[] = { diff --git a/src/reducer/validation_DE_TIN.c b/src/reducer/validation_DE_TIN.c @@ -32,6 +32,10 @@ * @return true if validation passed, else false */ bool +DE_TIN_check (const char *tin_number); + +/* declaration to fix compiler warning */ +bool DE_TIN_check (const char *tin_number) { unsigned int csum; diff --git a/src/reducer/validation_ES_DNI.c b/src/reducer/validation_ES_DNI.c @@ -97,6 +97,10 @@ validate_cif (const char *cif) * @return true if validation passed, else false */ bool +ES_DNI_check (const char *dni_number); + +/* declaration to fix compiler warning */ +bool ES_DNI_check (const char *dni_number) { const char map[] = "TRWAGMYFPDXBNJZSQVHLCKE"; diff --git a/src/reducer/validation_FR_INSEE.c b/src/reducer/validation_FR_INSEE.c @@ -35,6 +35,10 @@ * @return true if validation passed, else false */ bool +FR_INSEE_check (const char *insee_number); + +/* declaration to fix compiler warning */ +bool FR_INSEE_check (const char *insee_number) { char pfx[14]; diff --git a/src/reducer/validation_IN_AADHAR.c b/src/reducer/validation_IN_AADHAR.c @@ -98,6 +98,10 @@ string_to_vals (const char *input, * @return true if validation passed, else false */ bool +IN_AADHAR_check (const char *aadhar_number); + +/* declaration to fix compiler warning */ +bool IN_AADHAR_check (const char *aadhar_number) { int c = 0; diff --git a/src/reducer/validation_IT_CF.c b/src/reducer/validation_IT_CF.c @@ -172,6 +172,10 @@ lookup (const struct MapEntry *map, * @return true if @a cf_number is a valid, else false */ bool +IT_CF_check (const char *cf_number); + +/* declaration to fix compiler warning */ +bool IT_CF_check (const char *cf_number) { unsigned int sum = 0; diff --git a/src/reducer/validation_NL_BSN.c b/src/reducer/validation_NL_BSN.c @@ -31,6 +31,10 @@ * @return true if validation passed, else false */ bool +NL_BSN_check (const char *bsn_number); + +/* declaration to fix compiler warning */ +bool NL_BSN_check (const char *bsn_number) { static const int factors[] = { diff --git a/src/reducer/validation_XX_SQUARE.c b/src/reducer/validation_XX_SQUARE.c @@ -32,6 +32,10 @@ * @return true if sq_number is a square, else false */ bool +XX_SQUARE_check (const char *sq_number); + +/* declaration to fix compiler warning */ +bool XX_SQUARE_check (const char *sq_number) { unsigned long long n; diff --git a/src/reducer/validation_XY_PRIME.c b/src/reducer/validation_XY_PRIME.c @@ -32,6 +32,10 @@ * @return true if pr_number is a prime, else false */ bool +XY_PRIME_check (const char *pr_number); + +/* declaration to fix compiler warning */ +bool XY_PRIME_check (const char *pr_number) { unsigned long long n; diff --git a/src/restclient/Makefile.am b/src/restclient/Makefile.am @@ -33,12 +33,5 @@ libanastasisrest_la_LIBADD = \ -ltalermerchant \ -ltalerjson \ -ltalerutil \ + -lcurl \ $(XLIB) - -if HAVE_LIBCURL -libanastasisrest_la_LIBADD += -lcurl -else -if HAVE_LIBGNURL -libanastasisrest_la_LIBADD += -lgnurl -endif -endif diff --git a/src/restclient/anastasis_api_config.c b/src/restclient/anastasis_api_config.c @@ -185,7 +185,7 @@ handle_config_finished (void *cls, for (unsigned int i = 0; i<acfg.details.ok.methods_length; i++) { struct ANASTASIS_AuthorizationMethodConfig *m = &mcfg[i]; - struct GNUNET_JSON_Specification spec[] = { + struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_string ("type", &m->type), TALER_JSON_spec_amount_any ("cost", @@ -196,7 +196,7 @@ handle_config_finished (void *cls, if ( (GNUNET_OK != GNUNET_JSON_parse (json_array_get (methods, i), - spec, + ispec, NULL, NULL)) ) { GNUNET_break_op (0); diff --git a/src/stasis/anastasis_db_plugin.c b/src/stasis/anastasis_db_plugin.c @@ -20,7 +20,7 @@ * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ #include "platform.h" -#include "anastasis_database_plugin.h" +#include "anastasis_database_lib.h" #include <ltdl.h> @@ -91,6 +91,10 @@ static char *old_dlsearchpath; * Setup libtool paths. */ void __attribute__ ((constructor)) +plugin_init (void); + +/* declaration to fix compiler warning */ +void __attribute__ ((constructor)) plugin_init () { int err; @@ -132,6 +136,10 @@ plugin_init () * Shutdown libtool. */ void __attribute__ ((destructor)) +plugin_fini (void); + +/* declaration to fix compiler warning */ +void __attribute__ ((destructor)) plugin_fini () { lt_dlsetsearchpath (old_dlsearchpath); diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c @@ -1129,7 +1129,7 @@ postgres_increment_lifetime ( else { /* user does not exist, create new one */ - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_timestamp (&expiration), GNUNET_PQ_query_param_end @@ -1145,7 +1145,7 @@ postgres_increment_lifetime ( true)); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "user_insert", - params); + iparams); } break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -1164,7 +1164,7 @@ postgres_increment_lifetime ( else { /* user exists, payment is new, update expiration_date */ - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_timestamp (&expiration), GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_end @@ -1184,7 +1184,7 @@ postgres_increment_lifetime ( *paid_until = expiration; qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "user_update", - params); + iparams); } break; } @@ -1301,7 +1301,7 @@ postgres_update_lifetime ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: { /* user does not exist, create new one */ - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_timestamp (&eol), GNUNET_PQ_query_param_end @@ -1310,7 +1310,7 @@ postgres_update_lifetime ( GNUNET_break (! GNUNET_TIME_absolute_is_never (eol.abs_time)); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "user_insert", - params); + iparams); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Created new account %s with expiration %s\n", TALER_B2S (account_pub), @@ -1320,7 +1320,7 @@ postgres_update_lifetime ( case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: { /* user exists, update expiration_date */ - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_timestamp (&expiration), GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_end @@ -1331,7 +1331,7 @@ postgres_update_lifetime ( GNUNET_break (! GNUNET_TIME_absolute_is_never (expiration.abs_time)); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "user_update", - params); + iparams); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Updated account %s to new expiration %s\n", TALER_B2S (account_pub), @@ -1409,7 +1409,7 @@ postgres_record_recdoc_payment ( /* because of constraint at user_id, first we have to verify if user exists, and if not, create one */ { - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_end }; @@ -1421,7 +1421,7 @@ postgres_record_recdoc_payment ( qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn, "user_select", - params, + iparams, rs); } switch (qs) @@ -1436,7 +1436,7 @@ postgres_record_recdoc_payment ( /* create new user with short lifetime */ struct GNUNET_TIME_Timestamp exp = GNUNET_TIME_relative_to_timestamp (TRANSIENT_LIFETIME); - struct GNUNET_PQ_QueryParam params[] = { + struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (account_pub), GNUNET_PQ_query_param_timestamp (&exp), GNUNET_PQ_query_param_end @@ -1444,7 +1444,7 @@ postgres_record_recdoc_payment ( qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "user_insert", - params); + iparams); switch (qs) { case GNUNET_DB_STATUS_HARD_ERROR: @@ -1963,7 +1963,7 @@ postgres_store_truth ( * @param[out] method type of the challenge * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_get_escrow_challenge ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2004,7 +2004,7 @@ postgres_get_escrow_challenge ( * @param[out] key_share contains the encrypted Keyshare * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_get_key_share ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2040,7 +2040,7 @@ postgres_get_key_share ( * @param[out] version set to the recovery policy version * @return transaction status */ -enum ANASTASIS_DB_AccountStatus +static enum ANASTASIS_DB_AccountStatus postgres_lookup_account ( void *cls, const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub, @@ -2136,7 +2136,7 @@ postgres_lookup_account ( * @param[out] version set to the version number of the policy being returned * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_get_latest_recovery_document ( void *cls, const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub, @@ -2309,7 +2309,7 @@ postgres_get_recovery_meta_data ( * @param[out] data blob which contains the recovery document * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_get_recovery_document ( void *cls, const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub, @@ -2481,7 +2481,7 @@ check_valid_code (void *cls, * @param[out] satisfied set to true if the challenge is set to satisfied * @return code validity status */ -enum ANASTASIS_DB_CodeStatus +static enum ANASTASIS_DB_CodeStatus postgres_verify_challenge_code ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2597,7 +2597,7 @@ postgres_test_challenge_code_satisfied ( * @param[out] payment_secret set to the challenge payment secret * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_lookup_challenge_payment ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2635,7 +2635,7 @@ postgres_lookup_challenge_payment ( * @param payment_identifier proof of payment, must be unique and match pending payment * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_update_challenge_payment ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2671,7 +2671,7 @@ postgres_update_challenge_payment ( * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if we are out of valid tries, * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if @a code is now in the DB */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_create_challenge_code ( void *cls, const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, @@ -2682,7 +2682,6 @@ postgres_create_challenge_code ( uint64_t *code) { struct PostgresClosure *pg = cls; - enum GNUNET_DB_QueryStatus qs; struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get (); struct GNUNET_TIME_Timestamp expiration_date; struct GNUNET_TIME_Absolute ex_rot; @@ -2766,6 +2765,7 @@ postgres_create_challenge_code ( GNUNET_PQ_query_param_uint32 (&retry_counter), GNUNET_PQ_query_param_end }; + enum GNUNET_DB_QueryStatus qs; qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "challengecode_insert", @@ -2788,11 +2788,16 @@ postgres_create_challenge_code ( break; } } - qs = commit_transaction (pg); - if (GNUNET_DB_STATUS_SOFT_ERROR == qs) - goto retry; - if (qs < 0) - return qs; + + { + enum GNUNET_DB_QueryStatus qs; + + qs = commit_transaction (pg); + if (GNUNET_DB_STATUS_SOFT_ERROR == qs) + goto retry; + if (qs < 0) + return qs; + } return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; retry: rollback (pg); @@ -2861,7 +2866,7 @@ postgres_mark_challenge_sent ( * * @return transaction status */ -enum GNUNET_DB_QueryStatus +static enum GNUNET_DB_QueryStatus postgres_challenge_gc (void *cls) { struct PostgresClosure *pg = cls; @@ -2887,6 +2892,10 @@ postgres_challenge_gc (void *cls) * @return NULL on error, otherwise a `struct TALER_ANASTASISDB_Plugin` */ void * +libanastasis_plugin_db_postgres_init (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_db_postgres_init (void *cls) { struct GNUNET_CONFIGURATION_Handle *cfg = cls; @@ -2965,6 +2974,10 @@ libanastasis_plugin_db_postgres_init (void *cls) * @return NULL (always) */ void * +libanastasis_plugin_db_postgres_done (void *cls); + +/* declaration to fix compiler warning */ +void * libanastasis_plugin_db_postgres_done (void *cls) { struct ANASTASIS_DatabasePlugin *plugin = cls; diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c @@ -26,14 +26,15 @@ #define FAILIF(cond) \ - do { \ - if (! (cond)) { break;} \ - GNUNET_break (0); \ - goto drop; \ - } while (0) + do { \ + if (! (cond)) { break;} \ + GNUNET_break (0); \ + goto drop; \ + } while (0) #define RND_BLK(ptr) \ - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (*ptr)) + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* \ + ptr)) /** * Global return value for the test. Initially -1, set to 0 upon @@ -68,8 +69,8 @@ run (void *cls) struct ANASTASIS_CRYPTO_TruthUUIDP truth_uuid; struct ANASTASIS_CRYPTO_EncryptedKeyShareP key_share; unsigned int post_counter; - char *mime_type; - char *method; + const char *mime_type; + const char *method; uint32_t docVersion; uint32_t res_version; size_t recoverydatasize; diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c @@ -104,7 +104,7 @@ static json_t *id_data; * @param label label to use for the command. */ static struct TALER_TESTING_Command -cmd_exec_wirewatch (char *label) +cmd_exec_wirewatch (const char *label) { return TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE); diff --git a/src/testing/test_anastasis_api.c b/src/testing/test_anastasis_api.c @@ -98,7 +98,7 @@ static char *file_secret; * @param label label to use for the command. */ static struct TALER_TESTING_Command -cmd_exec_wirewatch (char *label) +cmd_exec_wirewatch (const char *label) { return TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE); diff --git a/src/testing/testing_cmd_challenge_answer.c b/src/testing/testing_cmd_challenge_answer.c @@ -439,42 +439,46 @@ challenge_start_run (void *cls, { struct ChallengeState *cs = cls; const struct ANASTASIS_Challenge **c; - const struct TALER_TESTING_Command *ref; const struct ANASTASIS_PaymentSecretP *ps; cs->is = is; - ref = TALER_TESTING_interpreter_lookup_command ( - is, - cs->challenge_ref); - if (NULL == ref) { - GNUNET_break (0); - TALER_TESTING_interpreter_fail (cs->is); - return; - } - if (GNUNET_OK != - ANASTASIS_TESTING_get_trait_challenges (ref, - cs->challenge_index, - &c)) - { - GNUNET_break (0); - TALER_TESTING_interpreter_fail (cs->is); - return; + const struct TALER_TESTING_Command *ref; + + ref = TALER_TESTING_interpreter_lookup_command ( + is, + cs->challenge_ref); + if (NULL == ref) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (cs->is); + return; + } + if (GNUNET_OK != + ANASTASIS_TESTING_get_trait_challenges (ref, + cs->challenge_index, + &c)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (cs->is); + return; + } } + if (NULL != cs->payment_ref) { - const struct TALER_TESTING_Command *ref; + const struct TALER_TESTING_Command *pref; - ref = TALER_TESTING_interpreter_lookup_command (is, - cs->payment_ref); - if (NULL == ref) + pref = TALER_TESTING_interpreter_lookup_command (is, + cs->payment_ref); + if (NULL == pref) { GNUNET_break (0); TALER_TESTING_interpreter_fail (cs->is); return; } if (GNUNET_OK != - ANASTASIS_TESTING_get_trait_payment_secret (ref, + ANASTASIS_TESTING_get_trait_payment_secret (pref, &ps)) { GNUNET_break (0); diff --git a/src/util/anastasis-crypto-tvg.c b/src/util/anastasis-crypto-tvg.c @@ -328,7 +328,7 @@ output_vectors () { json_t *vec = vec_for (vecs, "hash"); struct GNUNET_HashCode hc; - char *str = "Hello, GNUnet"; + const char *str = "Hello, GNUnet"; GNUNET_CRYPTO_hash (str, strlen (str), &hc); @@ -391,7 +391,7 @@ output_vectors () { json_t *vec = vec_for (vecs, "recovery_document_encryption"); struct ANASTASIS_CRYPTO_UserIdentifierP id; - void *rec_doc = "my recovery doc"; + const void *rec_doc = "my recovery doc"; size_t rd_size = strlen (rec_doc) + 1; void *enc_rec_doc; size_t erd_size; @@ -413,7 +413,7 @@ output_vectors () json_t *vec = vec_for (vecs, "keyshare_encryption"); struct ANASTASIS_CRYPTO_KeyShareP key_share; struct ANASTASIS_CRYPTO_UserIdentifierP id; - char *xsalt = "myanswer"; + const char *xsalt = "myanswer"; struct ANASTASIS_CRYPTO_EncryptedKeyShareP enc_key_share; random_auto (&key_share); diff --git a/src/util/os_installation.c b/src/util/os_installation.c @@ -24,7 +24,7 @@ * @author Christian Grothoff */ #include "platform.h" -#include <gnunet/gnunet_util_lib.h> +#include <anastasis/anastasis_util_lib.h> /** diff --git a/src/util/test_anastasis_crypto.c b/src/util/test_anastasis_crypto.c @@ -43,7 +43,7 @@ test_user_identifier_derive (void) struct ANASTASIS_CRYPTO_UserIdentifierP id_3; struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt; - char *salt_str = "Server-Salt-Test"; + const char *salt_str = "Server-Salt-Test"; GNUNET_memcpy (&provider_salt, salt_str, @@ -102,7 +102,7 @@ test_recovery_document (void) json_t *id_data = json_object (); const char *test = "TEST_ERD"; - char *salt_str = "Server-Salt-Test"; + const char *salt_str = "Server-Salt-Test"; GNUNET_memcpy (&provider_salt, salt_str, @@ -219,13 +219,12 @@ test_core_secret (void) unsigned int policy_keys_length = 5; struct ANASTASIS_CRYPTO_MasterSaltP salt; struct ANASTASIS_CoreSecretEncryptionResult *cser; + struct ANASTASIS_CRYPTO_PolicyKeyP policy_keys[policy_keys_length]; GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &salt, sizeof (salt)); - // construction of PolicyKey-array - struct ANASTASIS_CRYPTO_PolicyKeyP policy_keys[policy_keys_length]; for (unsigned int i = 0; i < policy_keys_length; i++) { // construction of KeyShare-array