[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 01/02: NAMESTORE: Remove fcfsd
From: |
gnunet |
Subject: |
[gnunet] 01/02: NAMESTORE: Remove fcfsd |
Date: |
Wed, 13 Dec 2023 19:42:36 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 0936d5e6aab110d6116376e2eec2829e5d0c9dd4
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Dec 13 19:40:46 2023 +0100
NAMESTORE: Remove fcfsd
---
contrib/Makefile.am | 1 -
contrib/apparmor/gnunet-namestore-fcfsd | 13 -
contrib/apparmor/gnunet-service-arm | 2 -
data/Makefile.am | 3 -
data/fcfsd/fcfsd-forbidden.html | 11 -
data/fcfsd/fcfsd-index.html | 345 -------
data/fcfsd/fcfsd-notfound.html | 11 -
data/meson.build | 3 -
doc/man/Makefile.am | 1 -
doc/man/gnunet-dns2gns.1 | 1 -
doc/man/gnunet-namestore-fcfsd.1 | 103 ---
doc/man/meson.build | 1 -
po/POTFILES.in | 1 -
src/service/namestore/Makefile.am | 16 -
src/service/namestore/gnunet-namestore-fcfsd.c | 1160 ------------------------
src/service/namestore/meson.build | 15 -
src/service/namestore/namestore.conf.in | 11 -
17 files changed, 1698 deletions(-)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index b3dccbbd1..b7507d224 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -143,7 +143,6 @@ EXTRA_DIST = \
apparmor/gnunet-namestore-gtk \
apparmor/gnunet-service-testbed-logger \
apparmor/gnunet-peerstore \
- apparmor/gnunet-namestore-fcfsd \
apparmor/gnunet-core \
apparmor/gnunet-gns-import.sh \
apparmor/gnunet-gns-proxy \
diff --git a/contrib/apparmor/gnunet-namestore-fcfsd
b/contrib/apparmor/gnunet-namestore-fcfsd
deleted file mode 100644
index 8ac09e69b..000000000
--- a/contrib/apparmor/gnunet-namestore-fcfsd
+++ /dev/null
@@ -1,13 +0,0 @@
-# Last Modified: Tue Jul 21 17:25:12 2015
-#include <tunables/global>
-#include <tunables/gnunet>
-
-profile @{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-namestore-fcfsd {
- #include <abstractions/base>
- #include <abstractions/gnunet-common>
-
- @{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-namestore-fcfsd mr,
-
- # Site-specific additions and overrides. See local/README for details.
- #include <local/gnunet>
-}
diff --git a/contrib/apparmor/gnunet-service-arm
b/contrib/apparmor/gnunet-service-arm
index 546e6332e..2ad8d6140 100644
--- a/contrib/apparmor/gnunet-service-arm
+++ b/contrib/apparmor/gnunet-service-arm
@@ -32,8 +32,6 @@ profile
@{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-service-arm {
@{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-gns-proxy Px,
- @{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-namestore-fcfsd Px,
-
#GNUnet service
@{GNUNET_PREFIX}/lib/gnunet/libexec/gnunet-service-* Px,
diff --git a/data/Makefile.am b/data/Makefile.am
index b40007e94..cebfc9e0d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -14,9 +14,6 @@ dist_pkgdata_DATA = \
gns/gns-bcd-png.tex \
gns/gns-bcd-simple.html \
gns/gns-bcd-simple.tex \
- fcfsd/fcfsd-index.html \
- fcfsd/fcfsd-forbidden.html \
- fcfsd/fcfsd-notfound.html \
branding/logo/gnunet-logo.png \
branding/logo/gnunet-logo-dark-text.svg \
branding/logo/gnunet-logo-dark-only-text.svg \
diff --git a/data/fcfsd/fcfsd-forbidden.html b/data/fcfsd/fcfsd-forbidden.html
deleted file mode 100644
index 57ebb4c61..000000000
--- a/data/fcfsd/fcfsd-forbidden.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8"/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Forbidden - GNUnet FCFS Authority Name Registration Service</title>
- </head>
- <body>
- <h1>You can not access this resource.</h1>
- </body>
-</html>
diff --git a/data/fcfsd/fcfsd-index.html b/data/fcfsd/fcfsd-index.html
deleted file mode 100644
index 3fa71d7c8..000000000
--- a/data/fcfsd/fcfsd-index.html
+++ /dev/null
@@ -1,345 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8"/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>GNUnet FCFS Authority Name Registration Service</title>
- <style>
- html {
- box-sizing: border-box;
- font-family: sans-serif;
- }
-
- *, *:before, *:after {
- box-sizing: inherit;
- }
-
- header {
- width: 800px;
- margin: 0 auto;
- }
-
- main {
- width: 800px;
- margin: 0 auto;
- }
-
- section h4 {
- text-align: center;
- width: 100%;
- }
-
- section input {
- width: 100%;
- padding: 8px 17px;
- font-size: 1rem;
- border: 1px solid #aaa;
- border-radius: 7px;
- background-color: white;
- margin-bottom: 7px;
- }
-
- section input:focus {
- box-shadow: 0px 0px 5px 3px lightblue;
- }
-
- section button {
- font-size: 1rem;
- font-weight: bold;
- background-color: #8b008b;
- color: white;
- border: none;
- padding: 7px;
- }
-
- section button:hover {
- background-color: #bf00bf;
- }
-
- section button:disabled {
- background-color: gray;
- }
-
- section h3 {
- text-align: center;
- width: 100%;
- }
-
- section small {
- display: block;
- margin-bottom: 5px;
- }
-
- .error-message {
- color: red;
- }
-
- .success-message {
- color: green;
- }
-
- @media screen and (max-width: 991px) {
- header, main {
- width: 100%;
- }
- }
-
- footer {
- margin-top: 30px;
- text-align: center;
- }
-
- nav {
- border-bottom: 1px solid black;
- }
-
- nav button {
- font-size: 1rem;
- font-weight: bold;
- background-color: #ccc;
- border: 1px solid black;
- border-bottom: none;
- border-top-right-radius: 7px;
- border-top-left-radius: 7px;
- padding: 7px;
- }
-
- nav button:hover {
- background-color: #f0f0f0;
- cursor: pointer;
- }
-
- nav button.selected {
- background-color: #f0f0f0;
- }
- </style>
- </head>
- <body>
- <header>
- <h1>Name Registration Service</h1>
- <p>Here you can register a name for your zone as part of this service's
- delegated names.</p>
- <p>The registration is based on a <em>First Come First Served</em>
- policy, meaning a name is given to the first user requesting it.</p>
- <p>Use the search bar below to see if your desired name is available and
- then use the form to submit your registration request.</p>
- </header>
- <main>
- <div class="form-container">
- <nav>
- <button id="tab-search">Search</button>
- <button id="tab-register">Register</button>
- </nav>
- <section id="search-form">
- <h4>Is your name available?</h4>
- <h3 id="search-result-message"></h3>
- <input id="search-name"
- name="search-name"
- type="text"
- placeholder="Your name..."
- autocomplete="name"
- maxlength="63"
- minlength="1">
- <small class="error-message" id="search-name-error"></small>
- <button>Search</button>
- </section>
- <section id="submit-form">
- <h4>Submit a registration request</h4>
- <h3 id="submit-result-message"></h3>
- <input id="register-name"
- name="register-name"
- type="text"
- placeholder="Your name..."
- autocomplete="off"
- maxlength="63"
- minlength="1">
- <input id="register-value"
- name="register-value"
- type="text"
- placeholder="Your zone key..."
- autocomplete="off"
- minlength="1">
- <small class="error-message" id="submit-error"></small>
- <button>Submit</button>
- </section>
- </div>
- </main>
- <footer>
- <a href="https://gnunet.org">GNUnet homepage</a>
- </footer>
- <script>
- const buttons = document.querySelectorAll('nav button');
- for (let i=0; i<buttons.length; ++i) {
- buttons[i].onclick = function (e) {
- let selected = document.querySelector('nav button.selected');
- if (selected) {
- selected.classList.toggle('selected');
- }
- e.target.classList.toggle('selected');
-
- let show = '';
- let hide = '';
- if (e.target.id === 'tab-search') {
- show = 'search-form';
- hide = 'submit-form';
- } else {
- show = 'submit-form';
- hide = 'search-form'
- }
-
- document.getElementById(hide).style.display = 'none';
- document.getElementById(show).style.display = 'block';
- };
- }
-
- buttons[0].click({target: buttons[0]});
-
- const searchbutton = document.querySelector('#search-form button');
- const submitbutton = document.querySelector('#submit-form button');
-
- document.getElementById('search-name').onkeydown = function (e) {
- if (e.key !== 'Enter') {
- return;
- }
-
- searchbutton.click();
- };
-
- for (let n of ['register-name', 'register-value']) {
- document.getElementById(n).onkeydown = function (e) {
- if (e.key !== 'Enter') {
- return;
- }
-
- submitbutton.click();
- };
- }
-
- searchbutton.onclick = function (e) {
- const searchname = document.getElementById('search-name');
- const errormsg = document.getElementById('search-name-error');
- const resultmsg = document.getElementById('search-result-message');
-
- if (0 === searchname.value.length) {
- errormsg.innerText = 'The field can not be empty';
- searchname.setCustomValidity('The field can not be empty');
- return;
- }
-
- if (-1 !== searchname.value.indexOf('.')) {
- errormsg.innerText = 'The name can not contain dots';
- searchname.setCustomValidity('The name can not contain dots');
- return;
- }
-
- searchname.setCustomValidity('');
- errormsg.innerText = '';
-
- const name = searchname.value.toLowerCase();
-
- searchbutton.disabled = true;
- submitbutton.disabled = true;
-
- fetch(`/search?name=${name}`)
- .then(function (response) {
- if (!response.ok) {
- throw 'error';
- }
-
- return response.json()
- })
- .then(function (data) {
- if ("true" === data.free) {
- resultmsg.innerText = `'${name}' is available!`;
- resultmsg.classList.add('success-message');
- resultmsg.classList.remove('error-message');
- } else {
- resultmsg.innerText = `'${name}' is not available`;
- resultmsg.classList.remove('success-message');
- resultmsg.classList.add('error-message');
- }
- searchbutton.disabled = false;
- submitbutton.disabled = false;
- })
- .catch(function (error) {
- resultmsg.innerText = 'An error occurred while processing
your query';
- resultmsg.classList.remove('success-message');
- resultmsg.classList.add('error-message');
- console.error(error);
- searchbutton.disabled = false;
- submitbutton.disabled = false;
- });
- };
-
- submitbutton.onclick = function (e) {
- const registername = document.getElementById('register-name');
- const registervalue = document.getElementById('register-value');
- const errormsg = document.getElementById('submit-error');
- const resultmsg = document.getElementById('submit-result-message');
-
- let errors = 0;
- let errs = [];
-
- if (0 === registername.value.length) {
- errs.push('The name field can not be empty');
- registername.setCustomValidity('The name field can not be
empty');
- ++errors;
- }
- if (-1 !== registername.value.indexOf('.')) {
- errs.push('The name can not contain dots');
- registername.setCustomValidity('The name can not contain dots');
- ++errors;
- }
- if (0 === registervalue.value.length) {
- errs.push('The value field can not be empty');
- registervalue.setCustomValidity('The value field can not be
empty');
- ++errors;
- }
-
- if (0 < errors) {
- errormsg.innerHTML = 'The form contains invalid values:';
- for (let e of errs) {
- errormsg.innerHTML += '<br/>' + e;
- }
- return;
- }
-
- searchbutton.disabled = true;
- submitbutton.disabled = true;
-
- fetch('/register', {
- method: 'POST',
- cache: 'no-cache',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- name: registername.value,
- key: registervalue.value,
- }),
- }).then(function (response) {
- return response.json();
- }).then(function (data) {
- if (data.error === "false") {
- resultmsg.innerText = `'${registername.value}' was
registered successfully!`;
- resultmsg.classList.add('success-message');
- resultmsg.classList.remove('error-message');
- } else {
- resultmsg.innerText = `'${registername.value}' could not be
registered! (${data.message})`;
- resultmsg.classList.remove('success-message');
- resultmsg.classList.add('error-message');
- }
- searchbutton.disabled = false;
- submitbutton.disabled = false;
- }).catch(function (error) {
- resultmsg.innerText = 'An error occurred while processing your
query';
- resultmsg.classList.remove('success-message');
- resultmsg.classList.add('error-message');
- console.error(error);
- searchbutton.disabled = false;
- submitbutton.disabled = false;
- });
- };
- </script>
- </body>
-</html>
diff --git a/data/fcfsd/fcfsd-notfound.html b/data/fcfsd/fcfsd-notfound.html
deleted file mode 100644
index 676bf4a9a..000000000
--- a/data/fcfsd/fcfsd-notfound.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8"/>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Not Found - GNUnet FCFS Authority Name Registration Service</title>
- </head>
- <body>
- <h1>The requested resource could not be found</h1>
- </body>
-</html>
diff --git a/data/meson.build b/data/meson.build
index 20de89900..1564780ed 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -11,9 +11,6 @@ install_data(['gns'/'def.tex',
'gns'/'gns-bcd-png.tex',
'gns'/'gns-bcd-simple.html',
'gns'/'gns-bcd-simple.tex',
- 'fcfsd'/'fcfsd-index.html',
- 'fcfsd'/'fcfsd-forbidden.html',
- 'fcfsd'/'fcfsd-notfound.html',
'branding'/'logo'/'gnunet-logo.png',
'branding'/'logo'/'gnunet-logo-dark-text.svg',
'branding'/'logo'/'gnunet-logo-dark-only-text.svg',
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 17a23da92..75ddc4276 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -66,7 +66,6 @@ man_MANS = \
gnunet-messenger.1 \
gnunet-namecache.1 \
gnunet-namestore.1 \
- gnunet-namestore-fcfsd.1 \
gnunet-namestore-dbtool.1 \
gnunet-namestore-zonefile.1 \
gnunet-nat.1 \
diff --git a/doc/man/gnunet-dns2gns.1 b/doc/man/gnunet-dns2gns.1
index 0993fb419..72a7785d7 100644
--- a/doc/man/gnunet-dns2gns.1
+++ b/doc/man/gnunet-dns2gns.1
@@ -57,7 +57,6 @@ Valid values are DEBUG, INFO, WARNING and ERROR.
Print GNUnet version number.
.El
.Sh SEE ALSO
-.Xr gnunet-gns-fcfs 1 ,
.Xr gnunet-gns 1 ,
.Xr gnunet-identity 1
.Pp
diff --git a/doc/man/gnunet-namestore-fcfsd.1 b/doc/man/gnunet-namestore-fcfsd.1
deleted file mode 100644
index 39bb9fcbc..000000000
--- a/doc/man/gnunet-namestore-fcfsd.1
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" This file is part of GNUnet.
-.\" Copyright (C) 2001-2019 GNUnet e.V.
-.\"
-.\" Permission is granted to copy, distribute and/or modify this document
-.\" under the terms of the GNU Free Documentation License, Version 1.3 or
-.\" any later version published by the Free Software Foundation; with no
-.\" Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
-.\" copy of the license is included in the file
-.\" FDL-1.3.
-.\"
-.\" A copy of the license is also available from the Free Software
-.\" Foundation Web site at http://www.gnu.org/licenses/fdl.html}.
-.\"
-.\" Alternately, this document is also available under the General
-.\" Public License, version 3 or later, as published by the Free Software
-.\" Foundation. A copy of the license is included in the file
-.\" GPL3.
-.\"
-.\" A copy of the license is also available from the Free Software
-.\" Foundation Web site at http://www.gnu.org/licenses/gpl.html
-.\"
-.\" SPDX-License-Identifier: GPL3.0-or-later OR FDL1.3-or-later
-.\"
-.Dd September 5, 2013
-.Dt GNUNET-NAMESTORE-FCFSD 1
-.Os
-.Sh NAME
-.Nm gnunet-namestore-fcfsd
-.Nd HTTP server for GNU Name System First-Come-First-Served name registration
-.Sh SYNOPSIS
-.Nm
-.Op Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME
-.Op Fl h | -help
-.Op Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL
-.Op Fl v | -version
-.Op Fl z Ar EGO | -zone= Ns Ar EGO
-.Sh DESCRIPTION
-Most users will not want to run an FCFS-zone and thus will not need this
program.
-.Pp
-.Nm
-runs a web server where users can register names to be mapped to their GNS
zone.
-Names are made available on a First Come First Served basis (hence fcfs).
-Registered names do not expire.
-The HTTP server is run on the port that is specified in the configuration file
in section "[fcfsd]" under the name "HTTPPORT".
-.Pp
-It is possible to manage gnunet-gns-fcfsd using gnunet-(service-arm) by
starting the daemon using "gnunet-arm -i fcfsd" or by setting
"IMMEDIATE_START=YES" in the "fcfds" section of your configuration and the "-z
ZONE" in as the "OPTION".
-.Pp
-An FCFS-zone is run at
-.Lk http://gnunet.org/fcfs/ .
-GNS users are encouraged to register their zone with the gnunet.org FCFS
authority.
-.Pp
-If you want to run your own FCFS registrar, you need to first create a
pseudonym (using "gnunet-identity -C NAME"), and use it with the
-.Fl z
-option.
-After that, you can start the FCFSD service (possibly using
-.Xr gnunet-arm 1 Ns ).
-.Pp
-The options are as follows:
-.Bl -tag -width indent
-.It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME
-Use the configuration file FILENAME.
-.It Fl h | -help
-Print short help on options.
-.It Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL
-Use LOGLEVEL for logging.
-Valid values are DEBUG, INFO, WARNING and ERROR.
-.It Fl v | -version
-Print GNUnet version number.
-.It Fl z Ar EGO | -zone= Ns Ar EGO
-Specifies for which
-.Ar EGO
-FCFSD should manage the zone.
-.El
-.\".Sh EXAMPLES
-.\".Sh FILES
-.Sh SEE ALSO
-.Xr gnunet-identity 1 ,
-.Xr gnunet-gns 1 ,
-.Xr gnunet-gns-proxy 1
-.sp
-The full documentation for gnunet is maintained as a Texinfo manual.
-If the
-.Xr info 1
-and gnunet programs are properly installed at your site, the command
-.Pp
-.Dl info gnunet
-.Pp
-should give you access to the complete handbook,
-.Pp
-.Dl info gnunet-c-tutorial
-.Pp
-will give you access to a tutorial for developers.
-.sp
-Depending on your installation, this information is also available in
-.Xr gnunet 7 and
-.Xr gnunet-c-tutorial 7 .
-.\".Sh HISTORY
-.\".Sh AUTHORS
-.Sh BUGS
-Report bugs by using
-.Lk https://bugs.gnunet.org
-or by sending electronic mail to
-.Aq Mt gnunet-developers@gnu.org .
diff --git a/doc/man/meson.build b/doc/man/meson.build
index 6a271ff3c..74679053f 100644
--- a/doc/man/meson.build
+++ b/doc/man/meson.build
@@ -36,7 +36,6 @@ install_man(
'gnunet-messenger.1',
'gnunet-namecache.1',
'gnunet-namestore.1',
- 'gnunet-namestore-fcfsd.1',
'gnunet-namestore-dbtool.1',
'gnunet-namestore-zonefile.1',
'gnunet-nat.1',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 689864e1a..9e1826d13 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -373,7 +373,6 @@ src/service/messenger/messenger_api_room.c
src/service/messenger/messenger_api_util.c
src/service/namecache/gnunet-service-namecache.c
src/service/namecache/namecache_api.c
-src/service/namestore/gnunet-namestore-fcfsd.c
src/service/namestore/gnunet-service-namestore.c
src/service/namestore/namestore_api.c
src/service/namestore/namestore_api_monitor.c
diff --git a/src/service/namestore/Makefile.am
b/src/service/namestore/Makefile.am
index 01c6e9096..514c8bec6 100644
--- a/src/service/namestore/Makefile.am
+++ b/src/service/namestore/Makefile.am
@@ -21,10 +21,6 @@ lib_LTLIBRARIES = \
libexec_PROGRAMS = \
gnunet-service-namestore
-libexec_PROGRAMS += \
- gnunet-namestore-fcfsd
-
-
libgnunetnamestore_la_SOURCES = \
namestore_api.c \
namestore_api_monitor.c \
@@ -39,18 +35,6 @@ libgnunetnamestore_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 0:1:0
-gnunet_namestore_fcfsd_SOURCES = \
- gnunet-namestore-fcfsd.c
-gnunet_namestore_fcfsd_LDADD = $(MHD_LIBS) \
- $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
- $(top_builddir)/src/service/identity/libgnunetidentity.la \
- libgnunetnamestore.la \
- $(top_builddir)/src/lib/util/libgnunetutil.la \
- $(top_builddir)/src/lib/json/libgnunetjson.la \
- $(GN_LIBINTL) -ljansson
-gnunet_namestore_fcfsd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
-
-
gnunet_service_namestore_SOURCES = \
gnunet-service-namestore.c
gnunet_service_namestore_LDADD = \
diff --git a/src/service/namestore/gnunet-namestore-fcfsd.c
b/src/service/namestore/gnunet-namestore-fcfsd.c
deleted file mode 100644
index 03ded7fcb..000000000
--- a/src/service/namestore/gnunet-namestore-fcfsd.c
+++ /dev/null
@@ -1,1160 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2012-2021 GNUnet e.V.
-
- GNUnet 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 Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file gnunet-namestore-fcfsd.c
- * @brief HTTP daemon that offers first-come-first-serve GNS domain
registration
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include <microhttpd.h>
-#include "gnunet_util_lib.h"
-#include "gnunet_identity_service.h"
-#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_namestore_service.h"
-#include "gnunet_mhd_compat.h"
-#include "gnunet_json_lib.h"
-
-/**
- * Structure representing a static page.
- * "Static" means that the server does not process the page before sending it
- * to the client. Clients can still process the received data, for example
- * because there are scripting elements within.
- */
-struct StaticPage
-{
- /**
- * Handle to file on disk.
- */
- struct GNUNET_DISK_FileHandle *handle;
-
- /**
- * Size in bytes of the file.
- */
- uint64_t size;
-
- /**
- * Cached response object to send to clients.
- */
- struct MHD_Response *response;
-};
-
-/**
- * Structure containing some request-specific data.
- */
-struct RequestData
-{
- /**
- * The connection this request was sent in.
- */
- struct MHD_Connection *c;
-
- /**
- * Body of the response object.
- */
- char *body;
-
- /**
- * Length in bytes of the body.
- */
- size_t body_length;
-
- /**
- * Response code.
- */
- int code;
-
- /**
- * Task started to search for an entry in the namestore.
- */
- struct GNUNET_NAMESTORE_QueueEntry *searching;
-
- /**
- * Task started to iterate over the namestore.
- */
- struct GNUNET_NAMESTORE_ZoneIterator *iterating;
-
- /**
- * Pointer used while processing POST data.
- */
- void *ptr;
-
- /**
- * Name requested to be registered.
- */
- char *register_name;
-
- /**
- * Key (encoded as a string) to be associated with the requested name.
- */
- char *register_key;
-
- /**
- * Key to be associated with the requested name.
- */
- struct GNUNET_CRYPTO_PublicKey key;
-};
-
-/**
- * Name of the zone being managed.
- */
-static char *zone = NULL;
-
-/**
- * The port the daemon is listening to for HTTP requests.
- */
-static unsigned long long port = 18080;
-
-/**
- * Connection with the namestore service.
- */
-static struct GNUNET_NAMESTORE_Handle *namestore = NULL;
-
-/**
- * Connection with the identity service.
- */
-static struct GNUNET_IDENTITY_Handle *identity = NULL;
-
-/**
- * Private key of the zone.
- */
-static const struct GNUNET_CRYPTO_PrivateKey *zone_key = NULL;
-
-/**
- * The HTTP daemon.
- */
-static struct MHD_Daemon *httpd = NULL;
-
-/**
- * Task executing the HTTP daemon.
- */
-static struct GNUNET_SCHEDULER_Task *httpd_task = NULL;
-
-/**
- * The main page, a.k.a. "index.html"
- */
-static struct StaticPage *main_page = NULL;
-
-/**
- * Page indicating the requested resource could not be found.
- */
-static struct StaticPage *notfound_page = NULL;
-
-/**
- * Page indicating the requested resource could not be accessed, and other
- * errors.
- */
-static struct StaticPage *forbidden_page = NULL;
-
-/**
- * The relative expiration time for added records
- */
-static struct GNUNET_TIME_Relative record_exp;
-
-/**
- * Task ran at shutdown to clean up everything.
- *
- * @param cls unused
- */
-static void
-do_shutdown (void *cls)
-{
- /* We cheat a bit here: the file descriptor is implicitly closed by MHD, so
- calling `GNUNET_DISK_file_close' would generate a spurious warning message
- in the log. Since that function does nothing but close the descriptor and
- free the allocated memory, After destroying the response all that's left to
- do is call `GNUNET_free'. */
- if (NULL != main_page)
- {
- MHD_destroy_response (main_page->response);
- GNUNET_free (main_page->handle);
- GNUNET_free (main_page);
- }
- if (NULL != notfound_page)
- {
- MHD_destroy_response (notfound_page->response);
- GNUNET_free (notfound_page->handle);
- GNUNET_free (notfound_page);
- }
- if (NULL != forbidden_page)
- {
- MHD_destroy_response (forbidden_page->response);
- GNUNET_free (forbidden_page->handle);
- GNUNET_free (forbidden_page);
- }
-
- if (NULL != namestore)
- {
- GNUNET_NAMESTORE_disconnect (namestore);
- }
-
- if (NULL != identity)
- {
- GNUNET_IDENTITY_disconnect (identity);
- }
-
- if (NULL != httpd_task)
- {
- GNUNET_SCHEDULER_cancel (httpd_task);
- }
- if (NULL != httpd)
- {
- MHD_stop_daemon (httpd);
- }
-}
-
-
-/**
- * Called when the HTTP server has some pending operations.
- *
- * @param cls unused
- */
-static void
-do_httpd (void *cls);
-
-/**
- * Schedule a task to run MHD.
- */
-static void
-run_httpd (void)
-{
- fd_set rs;
- fd_set ws;
- fd_set es;
-
- struct GNUNET_NETWORK_FDSet *grs = GNUNET_NETWORK_fdset_create ();
- struct GNUNET_NETWORK_FDSet *gws = GNUNET_NETWORK_fdset_create ();
- struct GNUNET_NETWORK_FDSet *ges = GNUNET_NETWORK_fdset_create ();
-
- FD_ZERO (&rs);
- FD_ZERO (&ws);
- FD_ZERO (&es);
-
- int max = -1;
- GNUNET_assert (MHD_YES == MHD_get_fdset (httpd, &rs, &ws, &es, &max));
-
- unsigned MHD_LONG_LONG timeout = 0;
- struct GNUNET_TIME_Relative gtime = GNUNET_TIME_UNIT_FOREVER_REL;
- if (MHD_YES == MHD_get_timeout (httpd, &timeout))
- {
- gtime = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
- timeout);
- }
-
- GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1);
- GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1);
- GNUNET_NETWORK_fdset_copy_native (ges, &es, max + 1);
-
- httpd_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
- gtime,
- grs,
- gws,
- &do_httpd,
- NULL);
- GNUNET_NETWORK_fdset_destroy (grs);
- GNUNET_NETWORK_fdset_destroy (gws);
- GNUNET_NETWORK_fdset_destroy (ges);
-}
-
-
-/**
- * Called when the HTTP server has some pending operations.
- *
- * @param cls unused
- */
-static void
-do_httpd (void *cls)
-{
- httpd_task = NULL;
- MHD_run (httpd);
- run_httpd ();
-}
-
-
-static void
-run_httpd_now (void)
-{
- if (NULL != httpd_task)
- {
- GNUNET_SCHEDULER_cancel (httpd_task);
- httpd_task = NULL;
- }
- httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd, NULL);
-}
-
-
-/**
- * Generate a JSON object.
- *
- * @param key the key for the first element
- * @param value the value for the first element
- * @param ... key-value pairs of the object, terminated by NULL
- * @return a JSON string (allocated)
- */
-static char *
-make_json (const char *key, const char *value, ...)
-{
- va_list args;
- va_start (args, value);
-
- json_t *obj = NULL;
-
- obj = json_object ();
- if ((NULL == key) || (NULL == value))
- {
- va_end (args);
- return json_dumps (obj, JSON_COMPACT);
- }
-
- json_object_set (obj, key, json_string (value));
-
- char *k = va_arg (args, char *);
- if (NULL == k)
- {
- va_end (args);
- return json_dumps (obj, JSON_COMPACT);
- }
- char *v = va_arg (args, char *);
- if (NULL == v)
- {
- va_end (args);
- return json_dumps (obj, JSON_COMPACT);
- }
-
- while (NULL != k && NULL != v)
- {
- json_object_set (obj, k, json_string (v));
- k = va_arg (args, char *);
- if (NULL != k)
- {
- v = va_arg (args, char *);
- }
- }
-
- va_end (args);
-
- char *json = json_dumps (obj, JSON_COMPACT);
- json_decref (obj);
-
- return json;
-}
-
-
-/**
- * The namestore search task failed.
- *
- * @param cls the request data
- */
-static void
-search_error_cb (void *cls)
-{
- struct RequestData *rd = cls;
- MHD_resume_connection (rd->c);
- rd->searching = NULL;
- rd->body = make_json ("error", "true",
- "message", _ ("can not search the namestore"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- run_httpd_now ();
-}
-
-
-/**
- * The lookup terminated with some results.
- *
- * @param cls closure
- * @param zone the private key of the zone
- * @param label the result label
- * @param count number of records found
- * @param d records found
- */
-static void
-search_done_cb (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *zone,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *d)
-{
- (void) zone;
- (void) d;
-
- struct RequestData *rd = cls;
- MHD_resume_connection (rd->c);
-
- rd->searching = NULL;
- rd->body = make_json ("error", "false",
- "free", (0 == count) ? "true" : "false",
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_OK;
-
- run_httpd_now ();
-}
-
-
-/**
- * An error occurred while registering a name.
- *
- * @param cls the connection
- */
-static void
-register_error_cb (void *cls)
-{
- struct RequestData *rd = cls;
-
- MHD_resume_connection (rd->c);
- rd->searching = NULL;
- rd->body = make_json ("error", "true",
- "message", _ ("unable to scan namestore"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- run_httpd_now ();
-}
-
-
-static void
-register_done_cb (void *cls,
- enum GNUNET_ErrorCode ec)
-{
- struct RequestData *rd = cls;
-
- MHD_resume_connection (rd->c);
- rd->searching = NULL;
-
- if (GNUNET_EC_NONE != ec)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Failed to create record for `%s': %s\n"),
- rd->register_name,
- GNUNET_ErrorCode_get_hint (ec));
- rd->body = make_json ("error", "true",
- "message",
- GNUNET_ErrorCode_get_hint (ec),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- }
- else
- {
- rd->body = make_json ("error", "false",
- "message", _ ("no errors"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_OK;
- }
-
- run_httpd_now ();
-}
-
-
-/**
- * Attempt to register the requested name.
- *
- * @param cls the connection
- * @param key the zone key
- * @param label name of the record
- * @param count number of records found
- * @param d records
- */
-static void
-register_do_cb (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *key,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *d)
-{
- (void) key;
- (void) d;
-
- struct RequestData *rd = cls;
-
- rd->searching = NULL;
-
- if (0 != count)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("The requested key `%s' exists as `%s'\n"),
- rd->register_key,
- label);
-
- MHD_resume_connection (rd->c);
- rd->searching = NULL;
- rd->body = make_json ("error", "true",
- "message", _ ("key exists"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_FORBIDDEN;
- run_httpd_now ();
- return;
- }
-
- struct GNUNET_GNSRECORD_Data gd;
- char *gdraw = NULL;
-
- if (GNUNET_OK != GNUNET_GNSRECORD_data_from_identity (&(rd->key),
- &gdraw,
- &(gd.data_size),
- &(gd.record_type)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Error creating record data\n"));
- MHD_resume_connection (rd->c);
- rd->searching = NULL;
- rd->body = make_json ("error", "true",
- "message", _ ("unable to store record"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- run_httpd_now ();
- return;
- }
-
- gd.data = gdraw;
- gd.expiration_time = record_exp.rel_value_us;
- gd.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
-
- rd->searching = GNUNET_NAMESTORE_record_set_store (namestore,
- zone_key,
- rd->register_name,
- 1,
- &gd,
- ®ister_done_cb,
- rd);
-
- GNUNET_free (gdraw);
-}
-
-
-/**
- * An error occurred while iterating the namestore.
- *
- * @param cls the connection
- */
-static void
-iterate_error_cb (void *cls)
-{
- struct RequestData *rd = cls;
-
- MHD_resume_connection (rd->c);
- rd->iterating = NULL;
- rd->body = make_json ("error", "true",
- "message", _ ("unable to scan namestore"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- run_httpd_now ();
-}
-
-
-/**
- * A block was received from the namestore.
- *
- * @param cls the connection
- * @param key the zone key
- * @param label the records' label
- * @param count number of records found
- * @param d the found records
- */
-static void
-iterate_do_cb (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *key,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *d)
-{
- (void) key;
- (void) label;
- (void) d;
-
- struct RequestData *rd = cls;
-
- if (0 == strcmp (label, rd->register_name))
- {
- GNUNET_break (0 != count);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Requested name `%s' exists with `%u' records\n"),
- rd->register_name,
- count);
-
- MHD_resume_connection (rd->c);
- rd->body = make_json ("error", "true",
- "message", _ ("name exists\n"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_FORBIDDEN;
- GNUNET_NAMESTORE_zone_iteration_stop (rd->iterating);
- run_httpd_now ();
- return;
- }
-
- GNUNET_NAMESTORE_zone_iterator_next (rd->iterating, 1);
-}
-
-
-/**
- * All entries in the namestore have been iterated over.
- *
- * @param cls the connection
- */
-static void
-iterate_done_cb (void *cls)
-{
- struct RequestData *rd = cls;
-
- rd->iterating = NULL;
-
- /* See if the key was not registered already */
- rd->searching = GNUNET_NAMESTORE_zone_to_name (namestore,
- zone_key,
- &(rd->key),
- ®ister_error_cb,
- rd,
- ®ister_do_cb,
- rd);
-}
-
-
-/**
- * Generate a response containing JSON and send it to the client.
- *
- * @param c the connection
- * @param body the response body
- * @param length the body length in bytes
- * @param code the response code
- * @return MHD_NO on error
- */
-static MHD_RESULT
-serve_json (struct MHD_Connection *c,
- char *body,
- size_t length,
- int code)
-{
- struct MHD_Response *response =
- MHD_create_response_from_buffer (length,
- body,
- MHD_RESPMEM_PERSISTENT);
- MHD_RESULT r = MHD_queue_response (c, code, response);
- MHD_destroy_response (response);
- return r;
-}
-
-
-/**
- * Send a response back to a connected client.
- *
- * @param cls unused
- * @param connection the connection with the client
- * @param url the requested address
- * @param method the HTTP method used
- * @param version the protocol version (including the "HTTP/" part)
- * @param upload_data data sent with a POST request
- * @param upload_data_size length in bytes of the POST data
- * @param ptr used to pass data between request handling phases
- * @return MHD_NO on error
- */
-static MHD_RESULT
-create_response (void *cls,
- struct MHD_Connection *connection,
- const char *url,
- const char *method,
- const char *version,
- const char *upload_data,
- size_t *upload_data_size,
- void **ptr)
-{
- (void) cls;
- (void) version;
-
- struct RequestData *rd = *ptr;
-
- if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
- {
- /* Handle a previously suspended request */
- if (NULL != rd)
- {
- return serve_json (rd->c, rd->body, rd->body_length, rd->code);
- }
-
- if (0 == strcmp ("/", url))
- {
- return MHD_queue_response (connection,
- MHD_HTTP_OK,
- main_page->response);
- }
-
- if (0 == strcmp ("/search", url))
- {
- const char *name = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "name");
- if (NULL == name)
- {
- return MHD_queue_response (connection,
- MHD_HTTP_BAD_REQUEST,
- forbidden_page->response);
- }
-
- MHD_suspend_connection (connection);
- rd = GNUNET_new (struct RequestData);
- rd->c = connection;
- rd->searching = GNUNET_NAMESTORE_records_lookup (namestore,
- zone_key,
- name,
- &search_error_cb,
- rd,
- &search_done_cb,
- rd);
- *ptr = rd;
- return MHD_YES;
- }
-
- return MHD_queue_response (connection,
- MHD_HTTP_NOT_FOUND,
- notfound_page->response);
- }
-
- if (0 == strcmp (method, MHD_HTTP_METHOD_HEAD))
- {
- /* We take a shortcut here by always serving the main page: starting a
- namestore lookup, allocating the necessary resources, waiting for the
- lookup to complete and then discard everything just because it was a HEAD
- and thus only the headers are significative, is an unnecessary waste of
- resources. The handling of this method could be smarter, for example by
- sending a proper content type header based on the endpoint, but this is
- not a service in which HEAD requests are significant, so there's no need
- to spend too much time here. */
- return MHD_queue_response (connection,
- MHD_HTTP_OK,
- main_page->response);
- }
-
- if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
- {
- if (0 == strcmp ("/register", url))
- {
- /* Handle a previously suspended request */
- if ((NULL != rd) && (NULL != rd->body))
- {
- return serve_json (rd->c, rd->body, rd->body_length, rd->code);
- }
-
- if (NULL == rd)
- {
- rd = GNUNET_new (struct RequestData);
- rd->c = connection;
- rd->body = NULL;
- rd->ptr = NULL;
- *ptr = rd;
- }
-
- json_t *json = NULL;
- enum GNUNET_JSON_PostResult result =
- GNUNET_JSON_post_parser (32 * 1024,
- connection,
- &(rd->ptr),
- upload_data,
- upload_data_size,
- &json);
-
- switch (result)
- {
- case GNUNET_JSON_PR_CONTINUE:
- /* Keep processing POST data */
- return MHD_YES;
- case GNUNET_JSON_PR_OUT_OF_MEMORY:
- case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
- rd->body = make_json ("error", "true",
- "message", _ ("unable to process submitted
data"),
- NULL);
- rd->body_length = strlen (rd->body);
-#ifdef MHD_HTTP_CONTENT_TOO_LARGE
- rd->code = MHD_HTTP_CONTENT_TOO_LARGE;
-#else
- rd->code = MHD_HTTP_PAYLOAD_TOO_LARGE;
-#endif
- return MHD_YES;
- case GNUNET_JSON_PR_JSON_INVALID:
- rd->body = make_json ("error", "true",
- "message", _ ("the submitted data is invalid"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_BAD_REQUEST;
- return MHD_YES;
- default:
- break;
- }
-
- /* POST data has been read in its entirety */
-
- const char *name = json_string_value (json_object_get (json, "name"));
- const char *key = json_string_value (json_object_get (json, "key"));
- if ((NULL == name) || (NULL == key) || (0 == strlen (name)) || (0 ==
- strlen (
- key)))
- {
- json_decref (json);
- rd->body = make_json ("error", "true",
- "message", _ ("invalid parameters"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_BAD_REQUEST;
- return MHD_YES;
- }
-
- rd->register_name = strdup (name);
- rd->register_key = strdup (key);
-
- json_decref (json);
- GNUNET_JSON_post_parser_cleanup (rd->ptr);
-
- if ((NULL != strchr (rd->register_name, '.')) ||
- (NULL != strchr (rd->register_name, '+')))
- {
- rd->body = make_json ("error", "true",
- "message", _ ("invalid name"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_BAD_REQUEST;
- return MHD_YES;
- }
-
- if (GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (rd->register_key,
- &(rd->key)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Unable to parse key %s\n"),
- rd->register_key);
-
- rd->body = make_json ("error", "true",
- "message", _ ("unable to parse key"),
- NULL);
- rd->body_length = strlen (rd->body);
- rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
- return MHD_YES;
- }
-
- MHD_suspend_connection (connection);
- /* See if the requested name is free */
- rd->iterating =
- GNUNET_NAMESTORE_zone_iteration_start (namestore,
- zone_key,
- &iterate_error_cb,
- rd,
- &iterate_do_cb,
- rd,
- &iterate_done_cb,
- rd);
- return MHD_YES;
- }
-
- return MHD_queue_response (connection,
- MHD_HTTP_FORBIDDEN,
- forbidden_page->response);
- }
-
- return MHD_queue_response (connection,
- MHD_HTTP_NOT_IMPLEMENTED,
- forbidden_page->response);
-}
-
-
-/**
- * Called when a request is completed.
- *
- * @param cls unused
- * @param connection the connection
- * @param ptr connection-specific data
- * @param status status code
- */
-static void
-completed_cb (void *cls,
- struct MHD_Connection *connection,
- void **ptr,
- enum MHD_RequestTerminationCode status)
-{
- (void) cls;
- (void) connection;
- (void) status;
-
- struct RequestData *rd = *ptr;
-
- if (NULL == rd)
- {
- return;
- }
-
- if (NULL == rd->body)
- {
- GNUNET_free (rd->body);
- }
-
- if (NULL != rd->searching)
- {
- GNUNET_NAMESTORE_cancel (rd->searching);
- }
-
- if (NULL != rd->register_name)
- {
- GNUNET_free (rd->register_name);
- }
-
- if (NULL != rd->register_key)
- {
- GNUNET_free (rd->register_key);
- }
-
- if (NULL != rd->iterating)
- {
- GNUNET_NAMESTORE_zone_iteration_stop (rd->iterating);
- }
-
- GNUNET_free (rd);
-}
-
-
-/**
- * Called for each ego provided by the identity service.
- *
- * @param cls closure
- * @param ego the ego
- * @param ctx application-provided data for the ego
- * @param name the ego name
- */
-static void
-identity_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- (void) cls;
- (void) ctx;
-
- if ((NULL == name) || (0 != strcmp (name, zone)))
- {
- return;
- }
-
- if (NULL == ego)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("No ego configured for `fcfsd` subsystem\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
- zone_key = GNUNET_IDENTITY_ego_get_private_key (ego);
-
- int flags = MHD_USE_DUAL_STACK | MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME;
- do
- {
- httpd = MHD_start_daemon (flags,
- (uint16_t) port,
- NULL, NULL,
- &create_response, NULL,
- MHD_OPTION_CONNECTION_LIMIT, 128,
- MHD_OPTION_PER_IP_CONNECTION_LIMIT, 1,
- MHD_OPTION_CONNECTION_TIMEOUT, 4 * 1024,
- MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
- MHD_OPTION_END);
- flags = MHD_USE_DEBUG;
- } while (NULL == httpd && flags != MHD_USE_DEBUG);
-
- if (NULL == httpd)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to start HTTP server\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
- run_httpd ();
-}
-
-
-/**
- * Open a file on disk and generate a response object for it.
- *
- * @param name name of the file to open
- * @param basedir directory where the file is located
- * @return NULL on error
- */
-static struct StaticPage *
-open_static_page (const char *name, const char *basedir)
-{
- char *fullname = NULL;
- GNUNET_asprintf (&fullname, "%s/fcfsd-%s", basedir, name);
-
- struct GNUNET_DISK_FileHandle *f =
- GNUNET_DISK_file_open (fullname,
- GNUNET_DISK_OPEN_READ,
- GNUNET_DISK_PERM_NONE);
- GNUNET_free (fullname);
-
- if (NULL == f)
- {
- return NULL;
- }
-
- off_t size = 0;
- if (GNUNET_SYSERR == GNUNET_DISK_file_handle_size (f, &size))
- {
- GNUNET_DISK_file_close (f);
- return NULL;
- }
-
- struct MHD_Response *response =
- MHD_create_response_from_fd64 (size,
- f->fd);
-
- if (NULL == response)
- {
- GNUNET_DISK_file_close (f);
- return NULL;
- }
-
- struct StaticPage *page = GNUNET_new (struct StaticPage);
- page->handle = f;
- page->size = (uint64_t) size;
- page->response = response;
- return page;
-}
-
-
-/**
- * Called after the service is up.
- *
- * @param cls closure
- * @param args remaining command line arguments
- * @param cfgfile name of the configuration file
- * @param cfg the service configuration
- */
-static void
-run_service (void *cls,
- char *const *args,
- const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- (void) cls;
- (void) args;
- (void) cfgfile;
-
- GNUNET_log_setup ("fcfsd", "WARNING", NULL);
-
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
- "fcfsd",
-
"RELATIVE_RECORD_EXPIRATION",
- &record_exp))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("No expiration specified for records.\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
- "fcfsd",
- "HTTPPORT",
- &port))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("No port specified, using default value\n"));
- }
-
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
-
- namestore = GNUNET_NAMESTORE_connect (cfg);
- if (NULL == namestore)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to connect to namestore\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
- identity = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
- if (NULL == identity)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to connect to identity\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-
- char *basedir = NULL;
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg,
- "fcfsd",
- "HTMLDIR",
- &basedir))
- {
- basedir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
- }
-
- main_page = open_static_page ("index.html", basedir);
- notfound_page = open_static_page ("notfound.html", basedir);
- forbidden_page = open_static_page ("forbidden.html", basedir);
-
- GNUNET_free (basedir);
-
- if ((NULL == main_page) || (NULL == notfound_page) || (NULL ==
- forbidden_page) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Unable to set up the daemon\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
-}
-
-
-/**
- * The main function of the fcfs daemon.
- *
- * @param argc number of arguments from the command line
- * @param argv the command line arguments
- * @return 0 successful exit, a different value otherwise
- */
-int
-main (int argc, char *const *argv)
-{
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_mandatory
- (GNUNET_GETOPT_option_string ('z',
- "zone",
- "EGO",
- gettext_noop (
- "name of the zone managed by FCFSD"),
- &zone)),
- GNUNET_GETOPT_OPTION_END
- };
-
- return ((GNUNET_OK == GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-namestore-fcfsd",
- _ (
- "GNU Name System
First-Come-First-Served name registration service"),
- options,
- &run_service,
- NULL)) ?
- 0 :
- 1);
-}
diff --git a/src/service/namestore/meson.build
b/src/service/namestore/meson.build
index 62512c405..a2183d630 100644
--- a/src/service/namestore/meson.build
+++ b/src/service/namestore/meson.build
@@ -40,21 +40,6 @@ executable ('gnunet-service-namestore',
include_directories: [incdir, configuration_inc],
install: true,
install_dir: get_option('libdir')/'gnunet'/'libexec')
-executable ('gnunet-namestore-fcfsd',
- ['gnunet-namestore-fcfsd.c'],
- dependencies: [libgnunetnamestore_dep,
- libgnunetutil_dep,
- libgnunetnamecache_dep,
- libgnunetgnsrecord_dep,
- libgnunetidentity_dep,
- mhd_dep,
- json_dep,
- libgnunetjson_dep,
- libgnunetstatistics_dep],
- include_directories: [incdir, configuration_inc],
- install: true,
- install_dir: get_option('libdir')/'gnunet'/'libexec')
-
configure_file(copy: true,
input: 'test_namestore_api.conf',
diff --git a/src/service/namestore/namestore.conf.in
b/src/service/namestore/namestore.conf.in
index d817f3f95..8c467c5ac 100644
--- a/src/service/namestore/namestore.conf.in
+++ b/src/service/namestore/namestore.conf.in
@@ -34,14 +34,3 @@ SQL_DIR = ${DATADIR}/sql/
[uri]
gns = gnunet-namestore -e 1a -u
-
-
-[fcfsd]
-# Name of the fcfs registration service binary (for ARM)
-BINARY = gnunet-namestore-fcfsd
-START_ON_DEMAND = NO
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-fcfsd.sock
-RELATIVE_RECORD_EXPIRATION = 7 d
-
-# On what port does the FCFS daemon listen for HTTP clients?
-HTTPPORT = 18080
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.