summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-19 10:40:11 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-19 10:40:11 +0100
commitfbf87011b5129a44e2494758effc7bd6716d6d3b (patch)
tree0cd208dbe833d4eee7b2babea394fe9b84318706
parent1ccd17d515d43b524dc06e3a4d206f19f873d0dd (diff)
downloadanastasis-fbf87011b5129a44e2494758effc7bd6716d6d3b.tar.gz
anastasis-fbf87011b5129a44e2494758effc7bd6716d6d3b.tar.bz2
anastasis-fbf87011b5129a44e2494758effc7bd6716d6d3b.zip
-first rough implementation of meta handler
-rw-r--r--src/backend/Makefile.am1
-rw-r--r--src/backend/anastasis-httpd.c1
-rw-r--r--src/backend/anastasis-httpd_policy.c3
-rw-r--r--src/backend/anastasis-httpd_policy.h2
-rw-r--r--src/stasis/plugin_anastasis_postgres.c26
5 files changed, 22 insertions, 11 deletions
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 1046810..0f3a969 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -18,6 +18,7 @@ anastasis_httpd_SOURCES = \
anastasis-httpd.c anastasis-httpd.h \
anastasis-httpd_mhd.c anastasis-httpd_mhd.h \
anastasis-httpd_policy.c anastasis-httpd_policy.h \
+ anastasis-httpd_policy-meta.c anastasis-httpd_policy-meta.h \
anastasis-httpd_policy_upload.c \
anastasis-httpd_truth.c anastasis-httpd_truth.h \
anastasis-httpd_terms.c anastasis-httpd_terms.h \
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index ba5417b..e2b363c 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -26,6 +26,7 @@
#include "anastasis-httpd_mhd.h"
#include "anastasis_database_lib.h"
#include "anastasis-httpd_policy.h"
+#include "anastasis-httpd_policy-meta.h"
#include "anastasis-httpd_truth.h"
#include "anastasis-httpd_terms.h"
#include "anastasis-httpd_config.h"
diff --git a/src/backend/anastasis-httpd_policy.c b/src/backend/anastasis-httpd_policy.c
index 99ed719..a26d11e 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -32,8 +32,7 @@
/**
- * Return the current recoverydocument of @a account on @a connection
- * using @a default_http_status on success.
+ * Return the current recoverydocument of @a account on @a connection.
*
* @param connection MHD connection to use
* @param account_pub account to query
diff --git a/src/backend/anastasis-httpd_policy.h b/src/backend/anastasis-httpd_policy.h
index 33d51cf..2735db6 100644
--- a/src/backend/anastasis-httpd_policy.h
+++ b/src/backend/anastasis-httpd_policy.h
@@ -1,6 +1,6 @@
/*
This file is part of Anastasis
- Copyright (C) 2014, 2015, 2016 Anastasis SARL
+ Copyright (C) 2019-2021 Anastasis SARL
Anastasis is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
diff --git a/src/stasis/plugin_anastasis_postgres.c b/src/stasis/plugin_anastasis_postgres.c
index 801552d..ef13c6c 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -343,8 +343,18 @@ prepare_statements (void *cls)
",encrypted_truth"
",truth_mime"
" FROM anastasis_truth"
- " WHERE truth_uuid =$1;",
+ " WHERE truth_uuid=$1;",
1),
+ GNUNET_PQ_make_prepare ("recoverydocument_select_meta",
+ "SELECT "
+ " version"
+ ",recovery_meta_data"
+ " FROM anastasis_recoverydocument"
+ " WHERE user_id=$1"
+ " AND version < $2"
+ " ORDER BY version DESC"
+ " LIMIT 1000;",
+ 2),
GNUNET_PQ_make_prepare ("latest_recoverydocument_select",
"SELECT "
" version"
@@ -352,7 +362,7 @@ prepare_statements (void *cls)
",recovery_data_hash"
",recovery_data"
" FROM anastasis_recoverydocument"
- " WHERE user_id =$1 "
+ " WHERE user_id=$1"
" ORDER BY version DESC"
" LIMIT 1;",
1),
@@ -384,12 +394,12 @@ prepare_statements (void *cls)
" AND payment_identifier=$2;",
2),
GNUNET_PQ_make_prepare ("postcounter_update",
- "UPDATE "
- "anastasis_recdoc_payment "
- "SET "
- "post_counter=$1 "
- "WHERE user_id =$2 "
- "AND payment_identifier=$3;",
+ "UPDATE"
+ " anastasis_recdoc_payment"
+ " SET"
+ " post_counter=$1"
+ " WHERE user_id =$2"
+ " AND payment_identifier=$3;",
3),
GNUNET_PQ_make_prepare ("key_share_select",
"SELECT "