sync

Backup service to store encrypted wallet databases (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 96021ddc5aa65ae1d473a31c91009c53639fc6b2
parent 2a386f2493e28398c28036420de9f7ff2548b731
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sat, 10 Feb 2024 19:24:46 +0100

bump-merge

Diffstat:
Mdebian/changelog | 8+++++++-
Mdebian/sync-httpd.service | 2++
Msrc/include/platform.h | 29+++++++++++++++++++++++++++++
Msrc/lib/Makefile.am | 4++--
Msrc/lib/sync_api_curl_defaults.c | 9++++-----
Msrc/sync/sync-httpd.c | 14+++++++-------
Msrc/sync/sync-httpd_backup_post.c | 1-
Msrc/sync/sync-httpd_config.c | 4+++-
Msrc/syncdb/Makefile.am | 10+++++-----
9 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/debian/changelog b/debian/changelog @@ -1,9 +1,15 @@ -sync (0.9.4) unstable; urgency=low +sync (0.9.4-1) unstable; urgency=low * Actual v0.9.4 release. -- Christian Grothoff <grothoff@gnu.org> Sat, 10 Feb 2024 03:50:12 +0200 +sync (0.9.4) unstable; urgency=low + + * First work towards packaging v0.9.4. + + -- Christian Grothoff <grothoff@gnu.org> Sun, 21 Jan 2024 23:50:12 +0200 + sync (0.9.3-1) unstable; urgency=low * Actual v0.9.3 release. diff --git a/debian/sync-httpd.service b/debian/sync-httpd.service @@ -5,7 +5,9 @@ Description=Sync backup backend User=sync-httpd Type=simple Restart=always +RestartMode=direct RestartSec=1s +RestartPreventExitStatus=2 3 4 5 6 9 RuntimeMaxSec=3600s ExecStart=/usr/bin/sync-httpd -c /etc/sync/sync.conf diff --git a/src/include/platform.h b/src/include/platform.h @@ -243,22 +243,42 @@ atoll (const char *nptr); /* LSB-style exit status codes */ #ifndef EXIT_INVALIDARGUMENT +/** + * Command-line arguments are invalid. + * Restarting useless. + */ #define EXIT_INVALIDARGUMENT 2 #endif #ifndef EXIT_NOTIMPLEMENTED +/** + * The requested operation is not implemented. + * Restarting useless. + */ #define EXIT_NOTIMPLEMENTED 3 #endif #ifndef EXIT_NOPERMISSION +/** + * Permissions needed to run are not available. + * Restarting useless. + */ #define EXIT_NOPERMISSION 4 #endif #ifndef EXIT_NOTINSTALLED +/** + * Key resources are not installed. + * Restarting useless. + */ #define EXIT_NOTINSTALLED 5 #endif #ifndef EXIT_NOTCONFIGURED +/** + * Key configuration settings are missing or invalid. + * Restarting useless. + */ #define EXIT_NOTCONFIGURED 6 #endif @@ -267,6 +287,15 @@ atoll (const char *nptr); #endif +#ifndef EXIT_NO_RESTART +/** + * Exit code from 'main' if we do not want to be restarted, + * except by manual intervention (hard failure). + */ +#define EXIT_NO_RESTART 9 +#endif + + /* Ignore MHD deprecations for now as we want to be compatible to "ancient" MHD releases. */ #define MHD_NO_DEPRECATION 1 diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am @@ -7,7 +7,7 @@ if USE_COVERAGE endif lib_LTLIBRARIES = \ - libsync.la + libsync.la libsync_la_LDFLAGS = \ -version-info 0:0:0 \ @@ -20,8 +20,8 @@ libsync_la_LIBADD = \ -lgnunetcurl \ -lgnunetjson \ -ltalerjson \ + -ltalercurl \ -ltalerutil \ -lgnunetutil \ -ljansson \ $(XLIB) - diff --git a/src/lib/sync_api_curl_defaults.c b/src/lib/sync_api_curl_defaults.c @@ -19,7 +19,8 @@ * @brief curl easy handle defaults * @author Florian Dold */ - +#include "platform.h" +#include <taler/taler_curl_lib.h> #include "sync_api_curl_defaults.h" /** @@ -43,10 +44,8 @@ SYNC_curl_easy_get_ (const char *url) curl_easy_setopt (eh, CURLOPT_URL, url)); - GNUNET_assert (CURLE_OK == - curl_easy_setopt (eh, - CURLOPT_FOLLOWLOCATION, - 1L)); + TALER_curl_set_secure_redirect_policy (eh, + url); GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_TCP_FASTOPEN, diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c @@ -77,7 +77,7 @@ static struct GNUNET_SCHEDULER_Task *mhd_task; /** * Global return code */ -static int result; +static int global_ret; /** * The MHD Daemon @@ -539,7 +539,7 @@ run (void *cls, if (SH_sync_connection_close) go |= TALER_MHD_GO_FORCE_CONNECTION_CLOSE; TALER_MHD_setup (go); - result = EXIT_NOTCONFIGURED; + global_ret = EXIT_NOTCONFIGURED; GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); if (GNUNET_OK != @@ -642,7 +642,7 @@ run (void *cls, if (NULL == (db = SYNC_DB_plugin_load (config))) { - result = EXIT_NOTINSTALLED; + global_ret = EXIT_NOTCONFIGURED; GNUNET_SCHEDULER_shutdown (); return; } @@ -660,7 +660,7 @@ run (void *cls, if ( (0 == port) && (-1 == fh) ) { - result = EXIT_NOPERMISSION; + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } @@ -676,13 +676,13 @@ run (void *cls, MHD_OPTION_END); if (NULL == mhd) { - result = EXIT_FAILURE; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to launch HTTP service, exiting.\n"); + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } - result = EXIT_SUCCESS; + global_ret = EXIT_SUCCESS; mhd_task = prepare_daemon (); } @@ -741,5 +741,5 @@ main (int argc, return EXIT_SUCCESS; if (GNUNET_SYSERR == ret) return EXIT_INVALIDARGUMENT; - return result; + return global_ret; } diff --git a/src/sync/sync-httpd_backup_post.c b/src/sync/sync-httpd_backup_post.c @@ -517,7 +517,6 @@ await_payment (struct BackupContext *bc, SH_backend_url, order_id, NULL /* our payments are NOT session-bound */, - false, timeout, &check_payment_cb, bc); diff --git a/src/sync/sync-httpd_config.c b/src/sync/sync-httpd_config.c @@ -54,6 +54,8 @@ SH_handler_config (struct SH_RequestHandler *rh, MHD_HTTP_OK, GNUNET_JSON_pack_string ("name", "sync"), + GNUNET_JSON_pack_string ("implementation", + "urn:net:taler:specs:sync:c-reference"), GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", SH_upload_limit_mb), TALER_JSON_pack_amount ("liability_limit", @@ -61,7 +63,7 @@ SH_handler_config (struct SH_RequestHandler *rh, TALER_JSON_pack_amount ("annual_fee", &SH_annual_fee), GNUNET_JSON_pack_string ("version", - "2:0:0")); + "2:1:0")); } diff --git a/src/syncdb/Makefile.am b/src/syncdb/Makefile.am @@ -58,14 +58,14 @@ libsyncdb_la_LDFLAGS = \ libsync_plugin_db_postgres_la_SOURCES = \ plugin_syncdb_postgres.c -libsync_plugin_db_postgres_la_LIBADD = \ - $(LTLIBINTL) libsync_plugin_db_postgres_la_LDFLAGS = \ - $(SYNC_PLUGIN_LDFLAGS) \ - -lgnunetpq \ - -lpq \ + $(SYNC_PLUGIN_LDFLAGS) +libsync_plugin_db_postgres_la_LIBADD = \ + $(LTLIBINTL) \ -ltalerpq \ + -lgnunetpq \ -lgnunetutil \ + -lpq \ $(XLIB) check_PROGRAMS = \