[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/03: build: Fix most warnings
From: |
gnunet |
Subject: |
[gnunet] 02/03: build: Fix most warnings |
Date: |
Tue, 24 Sep 2024 15:59:50 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit fb34c9f0fe9329f681cf1c9c78428104d9bc2aad
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Sep 24 15:56:01 2024 +0200
build: Fix most warnings
---
.../util/test_common_logging_runtime_loglevels.c | 30 +-
src/plugin/peerstore/plugin_peerstore_sqlite.c | 6 +-
src/service/dns/gnunet-helper-dns.c | 68 ++---
src/service/exit/gnunet-daemon-exit.c | 54 ++--
src/service/exit/gnunet-helper-exit.c | 46 +--
src/service/gns/gnunet-bcd.c | 319 +++++++++++----------
src/service/gns/gnunet-service-gns.c | 5 +-
src/service/gns/nss/nss_gns.c | 26 +-
src/service/gns/nss/nss_gns_query.c | 4 +-
src/service/namestore/gnunet-service-namestore.c | 3 +-
.../reclaim/gnunet-service-reclaim_tickets.c | 2 +-
src/service/rest/identity_plugin.c | 3 +-
src/service/rest/namestore_plugin.c | 116 ++++----
src/service/rest/oidc_helper.c | 4 +-
src/service/revocation/gnunet-service-revocation.c | 10 +-
src/service/setu/gnunet-service-setu.c | 103 +++----
src/service/vpn/gnunet-helper-vpn.c | 21 +-
17 files changed, 445 insertions(+), 375 deletions(-)
diff --git a/src/lib/util/test_common_logging_runtime_loglevels.c
b/src/lib/util/test_common_logging_runtime_loglevels.c
index 61f0d413c..8b1f3f79d 100644
--- a/src/lib/util/test_common_logging_runtime_loglevels.c
+++ b/src/lib/util/test_common_logging_runtime_loglevels.c
@@ -359,49 +359,49 @@ runone ()
return;
}
- putenv ("GNUNET_LOG=");
- putenv ("GNUNET_FORCE_LOG=");
- putenv ("GNUNET_FORCE_LOGFILE=");
+ putenv ((char*) "GNUNET_LOG=");
+ putenv ((char*) "GNUNET_FORCE_LOG=");
+ putenv ((char*) "GNUNET_FORCE_LOGFILE=");
switch (phase)
{
case 0:
- putenv ("GNUNET_LOG=;;;;ERROR");
+ putenv ((char*) "GNUNET_LOG=;;;;ERROR");
break;
case 1:
- putenv ("GNUNET_LOG=;;;;WARNING");
+ putenv ((char*) "GNUNET_LOG=;;;;WARNING");
break;
case 2:
- putenv ("GNUNET_LOG=;;;;INFO");
+ putenv ((char*) "GNUNET_LOG=;;;;INFO");
break;
case 3:
- putenv ("GNUNET_LOG=;;;;DEBUG");
+ putenv ((char*) "GNUNET_LOG=;;;;DEBUG");
break;
case 4:
- putenv ("GNUNET_FORCE_LOG=;;;;ERROR");
+ putenv ((char*) "GNUNET_FORCE_LOG=;;;;ERROR");
break;
case 5:
- putenv ("GNUNET_FORCE_LOG=;;;;WARNING");
+ putenv ((char*) "GNUNET_FORCE_LOG=;;;;WARNING");
break;
case 6:
- putenv ("GNUNET_FORCE_LOG=;;;;INFO");
+ putenv ((char*) "GNUNET_FORCE_LOG=;;;;INFO");
break;
case 7:
- putenv ("GNUNET_FORCE_LOG=;;;;DEBUG");
+ putenv ((char*) "GNUNET_FORCE_LOG=;;;;DEBUG");
break;
case 8:
- putenv ("GNUNET_LOG=blah;;;;ERROR");
+ putenv ((char*) "GNUNET_LOG=blah;;;;ERROR");
break;
case 9:
- putenv ("GNUNET_FORCE_LOG=blah;;;;ERROR");
+ putenv ((char*) "GNUNET_FORCE_LOG=blah;;;;ERROR");
break;
}
@@ -410,8 +410,8 @@ runone ()
"./test_common_logging_dummy",
"test_common_logging_dummy", NULL);
GNUNET_assert (NULL != proc);
- putenv ("GNUNET_FORCE_LOG=");
- putenv ("GNUNET_LOG=");
+ putenv ((char*) "GNUNET_FORCE_LOG=");
+ putenv ((char*) "GNUNET_LOG=");
/* Close the write end of the read pipe */
GNUNET_DISK_pipe_close_end (pipe_stdout, GNUNET_DISK_PIPE_END_WRITE);
diff --git a/src/plugin/peerstore/plugin_peerstore_sqlite.c
b/src/plugin/peerstore/plugin_peerstore_sqlite.c
index e53f10aec..30d777521 100644
--- a/src/plugin/peerstore/plugin_peerstore_sqlite.c
+++ b/src/plugin/peerstore/plugin_peerstore_sqlite.c
@@ -29,7 +29,7 @@
#include "gnunet_peerstore_plugin.h"
#include "gnunet_peerstore_service.h"
#include "gnunet_sq_lib.h"
-#include "../../service/peerstore/peerstore.h"
+#include "gnunet_peerstore_service.h"
#include <sqlite3.h>
/**
@@ -352,8 +352,6 @@ peerstore_sqlite_iterate_records (void *cls,
break;
}
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Returning a matched record.\n");
struct GNUNET_SQ_ResultSpec rs[] = {
GNUNET_SQ_result_spec_uint64 (&seq),
GNUNET_SQ_result_spec_string (&rec.sub_system),
@@ -363,6 +361,8 @@ peerstore_sqlite_iterate_records (void *cls,
GNUNET_SQ_result_spec_absolute_time (&rec.expiry),
GNUNET_SQ_result_spec_end
};
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Returning a matched record.\n");
if (GNUNET_OK !=
GNUNET_SQ_extract_result (stmt,
diff --git a/src/service/dns/gnunet-helper-dns.c
b/src/service/dns/gnunet-helper-dns.c
index 2ff89f940..e6b3c6697 100644
--- a/src/service/dns/gnunet-helper-dns.c
+++ b/src/service/dns/gnunet-helper-dns.c
@@ -198,7 +198,7 @@ open_dev_null (int target_fd,
*/
static int
fork_and_exec (const char *file,
- char *const cmd[])
+ const char *const cmd[])
{
int status;
pid_t pid;
@@ -221,7 +221,7 @@ fork_and_exec (const char *file,
open_dev_null (0, O_RDONLY);
(void) close (1);
open_dev_null (1, O_WRONLY);
- (void) execv (file, cmd);
+ (void) execv (file, (char *const*)cmd);
/* can only get here on error */
fprintf (stderr,
"exec `%s' failed: %s\n",
@@ -910,12 +910,10 @@ main (int argc, char *const*argv)
/* Disable rp filtering */
if (0 == nortsetup)
{
- char *const sysctl_args[] = { (char*) "sysctl", (char*) "-w",
- (char*) "net.ipv4.conf.all.rp_filter=0", NULL
- };
- char *const sysctl_args2[] = { (char*) "sysctl", (char*) "-w",
- (char*) "net.ipv4.conf.default.rp_filter=0",
- NULL };
+ const char *const sysctl_args[] = { "sysctl", "-w",
+ "net.ipv4.conf.all.rp_filter=0", NULL };
+ const char *const sysctl_args2[] = { "sysctl", "-w",
+ "net.ipv4.conf.default.rp_filter=0", NULL };
if ((0 != fork_and_exec (sbin_sysctl, sysctl_args)) ||
(0 != fork_and_exec (sbin_sysctl, sysctl_args2)))
{
@@ -978,23 +976,19 @@ main (int argc, char *const*argv)
{
r = 8; /* failed to fully setup routing table */
{
- char *const mangle_args[] = {
- (char*) "iptables", (char*) "-m",
- (char*) "owner", (char*) "-t", (char*) "mangle",
- (char*) "-I", (char*) "OUTPUT", (char*) "1", (char*) "-p",
- (char*) "udp", (char*) "--gid-owner", mygid, (char*) "--dport",
- (char*) DNS_PORT, (char*) "-j", (char*) "ACCEPT", NULL
+ const char *const mangle_args[] = {
+ "iptables", "-m", "owner", "-t", "mangle", "-I", "OUTPUT", "1", "-p",
+ "udp", "--gid-owner", mygid, "--dport", DNS_PORT, "-j",
+ "ACCEPT", NULL
};
if (0 != fork_and_exec (sbin_iptables, mangle_args))
goto cleanup_rest;
}
{
- char *const mangle_args[] = {
- (char*) "ip6tables", (char*) "-m", (char*) "owner",
- (char*) "-t", (char*) "mangle", (char*) "-I", (char*) "OUTPUT",
- (char*) "1", (char*) "-p", (char*) "udp", (char*) "--gid-owner",
- mygid, (char*) "--dport", (char*) DNS_PORT, (char*) "-j",
- (char*) "ACCEPT", NULL
+ const char *const mangle_args[] = {
+ "ip6tables", "-m", "owner", "-t", "mangle", "-I", "OUTPUT", "1", "-p",
+ "udp", "--gid-owner", mygid, "--dport", DNS_PORT, "-j",
+ "ACCEPT", NULL
};
if (0 != fork_and_exec (sbin_ip6tables, mangle_args))
goto cleanup_mangle_1b;
@@ -1002,17 +996,17 @@ main (int argc, char *const*argv)
/* Mark all of the other DNS traffic using our mark DNS_MARK,
unless it is on a link-local IPv6 address, which we cannot support. */
{
- char *const mark_args[] = {
- (char*) "iptables", "-t", "mangle", "-I", "OUTPUT", "2", "-p",
- (char*) "udp", "--dport", DNS_PORT,
- (char*) "-j", "MARK", "--set-mark", DNS_MARK,
+ const char *const mark_args[] = {
+ "iptables", "-t", "mangle", "-I", "OUTPUT", "2", "-p",
+ "udp", "--dport", DNS_PORT,
+ "-j", "MARK", "--set-mark", DNS_MARK,
NULL
};
if (0 != fork_and_exec (sbin_iptables, mark_args))
goto cleanup_mangle_1;
}
{
- char *const mark_args[] = {
+ const char *const mark_args[] = {
"ip6tables", "-t", "mangle", "-I", "OUTPUT", "2", "-p",
"udp", "--dport", DNS_PORT,
"!", "-s", "fe80::/10", /* this line excludes link-local traffic */
@@ -1024,14 +1018,14 @@ main (int argc, char *const*argv)
}
/* Forward all marked DNS traffic to our DNS_TABLE */
{
- char *const forward_args[] = {
+ const char *const forward_args[] = {
"ip", "rule", "add", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (sbin_ip, forward_args))
goto cleanup_mark_2;
}
{
- char *const forward_args[] = {
+ const char *const forward_args[] = {
"ip", "-6", "rule", "add", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (sbin_ip, forward_args))
@@ -1039,7 +1033,7 @@ main (int argc, char *const*argv)
}
/* Finally, add rule in our forwarding table to pass to our virtual
interface */
{
- char *const route_args[] = {
+ const char *const route_args[] = {
"ip", "route", "add", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
@@ -1047,7 +1041,7 @@ main (int argc, char *const*argv)
goto cleanup_forward_3;
}
{
- char *const route_args[] = {
+ const char *const route_args[] = {
"ip", "-6", "route", "add", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
@@ -1103,7 +1097,7 @@ main (int argc, char *const*argv)
cleanup_route_4:
if (0 == nortsetup)
{
- char *const route_clean_args[] = {
+ const char *const route_clean_args[] = {
"ip", "-6", "route", "del", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
@@ -1113,7 +1107,7 @@ cleanup_route_4:
cleanup_route_4b:
if (0 == nortsetup)
{
- char *const route_clean_args[] = {
+ const char *const route_clean_args[] = {
"ip", "route", "del", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
@@ -1123,7 +1117,7 @@ cleanup_route_4b:
cleanup_forward_3:
if (0 == nortsetup)
{
- char *const forward_clean_args[] = {
+ const char *const forward_clean_args[] = {
"ip", "-6", "rule", "del", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (sbin_ip, forward_clean_args))
@@ -1132,7 +1126,7 @@ cleanup_forward_3:
cleanup_forward_3b:
if (0 == nortsetup)
{
- char *const forward_clean_args[] = {
+ const char *const forward_clean_args[] = {
"ip", "rule", "del", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (sbin_ip, forward_clean_args))
@@ -1141,7 +1135,7 @@ cleanup_forward_3b:
cleanup_mark_2:
if (0 == nortsetup)
{
- char *const mark_clean_args[] = {
+ const char *const mark_clean_args[] = {
"ip6tables", "-t", "mangle", "-D", "OUTPUT", "-p", "udp",
"--dport", DNS_PORT,
"!", "-s", "fe80::/10", /* this line excludes link-local traffic */
@@ -1153,7 +1147,7 @@ cleanup_mark_2:
cleanup_mark_2b:
if (0 == nortsetup)
{
- char *const mark_clean_args[] = {
+ const char *const mark_clean_args[] = {
"iptables", "-t", "mangle", "-D", "OUTPUT", "-p", "udp",
"--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK, NULL
};
@@ -1163,7 +1157,7 @@ cleanup_mark_2b:
cleanup_mangle_1:
if (0 == nortsetup)
{
- char *const mangle_clean_args[] = {
+ const char *const mangle_clean_args[] = {
"ip6tables", "-m", "owner", "-t", "mangle", "-D", "OUTPUT", "-p", "udp",
"--gid-owner", mygid, "--dport", DNS_PORT, "-j", "ACCEPT",
NULL
@@ -1174,7 +1168,7 @@ cleanup_mangle_1:
cleanup_mangle_1b:
if (0 == nortsetup)
{
- char *const mangle_clean_args[] = {
+ const char *const mangle_clean_args[] = {
"iptables", "-m", "owner", "-t", "mangle", "-D", "OUTPUT", "-p", "udp",
"--gid-owner", mygid, "--dport", DNS_PORT, "-j", "ACCEPT",
NULL
diff --git a/src/service/exit/gnunet-daemon-exit.c
b/src/service/exit/gnunet-daemon-exit.c
index 74365d406..4457e8012 100644
--- a/src/service/exit/gnunet-daemon-exit.c
+++ b/src/service/exit/gnunet-daemon-exit.c
@@ -41,7 +41,6 @@
#include "gnunet_dht_service.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
-#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_regex_service.h"
#include "exit.h"
@@ -64,26 +63,26 @@
* How frequently do we re-announce the regex for the exit?
*/
#define REGEX_REFRESH_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MINUTES, 30)
+ GNUNET_TIME_UNIT_MINUTES, 30)
/**
* How frequently do we re-announce the DNS exit in the DHT?
*/
#define DHT_PUT_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MINUTES, 15)
+ GNUNET_TIME_UNIT_MINUTES, 15)
/**
* How long do we typically sign the DNS exit advertisement for?
*/
#define DNS_ADVERTISEMENT_TIMEOUT GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_HOURS, 3)
+ GNUNET_TIME_UNIT_HOURS, 3)
/**
* Generic logging shorthand
*/
#define LOG(kind, ...) \
- GNUNET_log_from (kind, "exit", __VA_ARGS__);
+ GNUNET_log_from (kind, "exit", __VA_ARGS__);
/**
@@ -691,7 +690,8 @@ get_redirect_state (int af,
/* Mark this connection as freshly used */
if (NULL == state_key)
GNUNET_CONTAINER_heap_update_cost (state->specifics.tcp_udp.heap_node,
- GNUNET_TIME_absolute_get
().abs_value_us);
+ GNUNET_TIME_absolute_get
().abs_value_us)
+ ;
return state;
}
@@ -1309,7 +1309,8 @@ setup_state_record (struct ChannelState *state)
while (NULL !=
get_redirect_state (state->specifics.tcp_udp.ri.remote_address.af,
state->specifics.tcp_udp.ri.remote_address.proto,
-
&state->specifics.tcp_udp.ri.remote_address.address,
+
&state->specifics.tcp_udp.ri.remote_address.address
+ ,
state->specifics.tcp_udp.ri.remote_address.port,
&state->specifics.tcp_udp.ri.local_address.address,
state->specifics.tcp_udp.ri.local_address.port,
@@ -2085,7 +2086,8 @@ handle_icmp_remote (void *cls,
GNUNET_break_op (0);
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv4 packets dropped (type not
allowed)"),
+ "# ICMPv4 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -2150,7 +2152,8 @@ handle_icmp_remote (void *cls,
GNUNET_break_op (0);
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv6 packets dropped (type not
allowed)"),
+ "# ICMPv6 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -2360,7 +2363,8 @@ handle_icmp_service (void *cls,
GNUNET_break_op (0);
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv4 packets dropped (type not
allowed)"),
+ "# ICMPv4 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -2427,7 +2431,8 @@ handle_icmp_service (void *cls,
GNUNET_break_op (0);
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv6 packets dropped (type not
allowed)"),
+ "# ICMPv6 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -2730,7 +2735,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader
*icmp,
default:
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv4 packets dropped (type not
allowed)"),
+ "# ICMPv4 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -2771,7 +2777,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader
*icmp,
default:
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "# ICMPv6 packets dropped (type not
allowed)"),
+ "# ICMPv6 packets dropped (type not
allowed)")
+ ,
1, GNUNET_NO);
return;
}
@@ -3358,6 +3365,8 @@ add_services (int proto,
struct LocalService *serv;
char *n;
size_t slen;
+ int local_port;
+ int remote_port;
slen = strlen (name);
GNUNET_assert (slen >= 8);
@@ -3370,7 +3379,8 @@ add_services (int proto,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "Option `%s' for domain `%s' is not formatted
correctly!\n"),
+ "Option `%s' for domain `%s' is not formatted
correctly!\n")
+ ,
redirect,
name);
continue;
@@ -3381,7 +3391,8 @@ add_services (int proto,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "Option `%s' for domain `%s' is not formatted
correctly!\n"),
+ "Option `%s' for domain `%s' is not formatted
correctly!\n")
+ ,
redirect,
name);
continue;
@@ -3389,8 +3400,8 @@ add_services (int proto,
hostport[0] = '\0';
hostport++;
- int local_port = atoi (redirect);
- int remote_port = atoi (hostport);
+ local_port = atoi (redirect);
+ remote_port = atoi (hostport);
if (! ((local_port > 0) && (local_port < 65536)))
{
@@ -3445,7 +3456,8 @@ add_services (int proto,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "No addresses found for hostname `%s' of service
`%s'!\n"),
+ "No addresses found for hostname `%s' of service
`%s'!\n")
+ ,
hostname,
n);
GNUNET_free (serv);
@@ -3728,7 +3740,8 @@ advertise_dns_exit ()
dns_advertisement.purpose.size = htonl (sizeof(struct
GNUNET_DNS_Advertisement)
- sizeof(struct
-
GNUNET_CRYPTO_EddsaSignature));
+
GNUNET_CRYPTO_EddsaSignature)
+ );
dns_advertisement.purpose.purpose = htonl (
GNUNET_SIGNATURE_PURPOSE_DNS_RECORD);
GNUNET_CRYPTO_hash ("dns",
@@ -3940,7 +3953,8 @@ run (void *cls,
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
GNUNET_YES,
- "gnunet-vpn - - - 169.1.3.7
255.255.255.0")) // no nat, ipv4 only
+ "gnunet-vpn - - - 169.1.3.7
255.255.255.0"))
+ // no nat, ipv4 only
{
GNUNET_free (binary);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/service/exit/gnunet-helper-exit.c
b/src/service/exit/gnunet-helper-exit.c
index d9578cfa0..619a34ce9 100644
--- a/src/service/exit/gnunet-helper-exit.c
+++ b/src/service/exit/gnunet-helper-exit.c
@@ -136,7 +136,7 @@ open_dev_null (int target_fd,
*/
static int
fork_and_exec (const char *file,
- char *const cmd[])
+ const char *const cmd[])
{
int status;
pid_t pid;
@@ -159,7 +159,7 @@ fork_and_exec (const char *file,
open_dev_null (0, O_RDONLY);
(void) close (1);
open_dev_null (1, O_WRONLY);
- (void) execv (file, cmd);
+ (void) execv (file, (char *const *) cmd);
/* can only get here on error */
fprintf (stderr,
"exec `%s' failed: %s\n",
@@ -493,6 +493,7 @@ run (int fd_tun)
/* write refers to reading from stdin, writing to fd_tun */
int write_open = 1;
+ int r;
while ((1 == read_open) && (1 == write_open))
{
@@ -527,7 +528,7 @@ run (int fd_tun)
if (write_open && (NULL != bufin_read))
FD_SET (fd_tun, &fds_w);
- int r = select (fd_tun + 1, &fds_r, &fds_w, NULL, NULL);
+ r = select (fd_tun + 1, &fds_r, &fds_w, NULL, NULL);
if (-1 == r)
{
@@ -566,9 +567,9 @@ run (int fd_tun)
}
else
{
- buftun_read = buftun;
struct GNUNET_MessageHeader *hdr =
(struct GNUNET_MessageHeader *) buftun;
+ buftun_read = buftun;
buftun_size += sizeof(struct GNUNET_MessageHeader);
hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
hdr->size = htons (buftun_size);
@@ -777,7 +778,7 @@ main (int argc, char **argv)
}
if (0 != strcmp (argv[2], "-"))
{
- char *const sysctl_args[] = {
+ const char *const sysctl_args[] = {
"sysctl", "-w", "net.ipv6.conf.all.forwarding=1", NULL
};
if (0 != fork_and_exec (sbin_sysctl,
@@ -800,18 +801,19 @@ main (int argc, char **argv)
if (0 != strcmp (argv[2], "-"))
{
{
- char *const sysctl_args[] = {
+ const char *const sysctl_args[] = {
"sysctl", "-w", "net.ipv4.ip_forward=1", NULL
};
if (0 != fork_and_exec (sbin_sysctl,
sysctl_args))
{
fprintf (stderr,
- "Failed to enable IPv4 forwarding. Will continue
anyway.\n");
+ "Failed to enable IPv4 forwarding. Will continue
anyway.\n")
+ ;
}
}
{
- char *const iptables_args[] = {
+ const char *const iptables_args[] = {
"iptables", "-t", "nat", "-A", "POSTROUTING", "-o", argv[2], "-j",
"MASQUERADE", NULL
};
@@ -825,22 +827,24 @@ main (int argc, char **argv)
}
}
- uid_t uid = getuid ();
-#ifdef HAVE_SETRESUID
- if (0 != setresuid (uid, uid, uid))
{
- fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
- global_ret = 2;
- goto cleanup;
- }
+ uid_t uid = getuid ();
+#ifdef HAVE_SETRESUID
+ if (0 != setresuid (uid, uid, uid))
+ {
+ fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
+ global_ret = 2;
+ goto cleanup;
+ }
#else
- if (0 != (setuid (uid) | seteuid (uid)))
- {
- fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
- global_ret = 2;
- goto cleanup;
- }
+ if (0 != (setuid (uid) | seteuid (uid)))
+ {
+ fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
+ global_ret = 2;
+ goto cleanup;
+ }
#endif
+ }
if (SIG_ERR == signal (SIGPIPE, SIG_IGN))
{
diff --git a/src/service/gns/gnunet-bcd.c b/src/service/gns/gnunet-bcd.c
index c41a5629f..2fe65fe75 100644
--- a/src/service/gns/gnunet-bcd.c
+++ b/src/service/gns/gnunet-bcd.c
@@ -27,7 +27,6 @@
#include "platform.h"
#include <microhttpd.h>
#include "gnunet_util_lib.h"
-#include "gnunet_identity_service.h"
#include "gnunet_mhd_compat.h"
struct StaticResource
@@ -206,6 +205,7 @@ do_shutdown (void *cls)
}
}
+
/**
* Called when the HTTP server has some pending operations.
*
@@ -223,6 +223,9 @@ run_httpd (void)
fd_set rs;
fd_set ws;
fd_set es;
+ int max = -1;
+ unsigned MHD_LONG_LONG timeout = 0;
+ struct GNUNET_TIME_Relative gtime = GNUNET_TIME_UNIT_FOREVER_REL;
struct GNUNET_NETWORK_FDSet *grs = GNUNET_NETWORK_fdset_create ();
struct GNUNET_NETWORK_FDSet *gws = GNUNET_NETWORK_fdset_create ();
@@ -232,11 +235,8 @@ run_httpd (void)
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,
@@ -258,6 +258,7 @@ run_httpd (void)
GNUNET_NETWORK_fdset_destroy (ges);
}
+
/**
* Called when the HTTP server has some pending operations.
*
@@ -271,6 +272,7 @@ do_httpd (void *cls)
run_httpd ();
}
+
/**
* Send a response back to a connected client.
*
@@ -294,15 +296,32 @@ create_response (void *cls,
size_t *upload_data_size,
void **ptr)
{
+ struct GNUNET_CRYPTO_PublicKey pk;
+ bool isget = (0 == strcmp (method, MHD_HTTP_METHOD_GET));
+ bool ishead = (0 == strcmp (method, MHD_HTTP_METHOD_HEAD));
+ bool isfull = (0 == strcmp ("/submit/full", url));
+ bool issimple = (0 == strcmp ("/submit/simple", url));
+ char *tmpd;
+ char *defpath = NULL;
+ const char *gpgfp = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "gpgfingerprint");
+ const char *gnsnick = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "gnsnick");
+ const char *gnskey = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "gnskey");
+ const char *qrpng = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "gnspng");
+
(void) cls;
(void) version;
(void) upload_data;
(void) upload_data_size;
- bool isget = (0 == strcmp (method, MHD_HTTP_METHOD_GET));
- bool ishead = (0 == strcmp (method, MHD_HTTP_METHOD_HEAD));
-
- if (!isget && !ishead)
+ if (! isget && ! ishead)
{
return MHD_queue_response (connection,
MHD_HTTP_NOT_IMPLEMENTED,
@@ -341,30 +360,15 @@ create_response (void *cls,
index_full->response);
}
- bool isfull = (0 == strcmp ("/submit/full", url));
- bool issimple = (0 == strcmp ("/submit/simple", url));
- if (!isfull && !issimple)
+ if (! isfull && ! issimple)
{
return MHD_queue_response (connection,
MHD_HTTP_NOT_FOUND,
notfound_error->response);
}
- const char *gpgfp = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "gpgfingerprint");
- const char *gnsnick = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "gnsnick");
- const char *gnskey = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "gnskey");
- const char *qrpng = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "gnspng");
- struct GNUNET_CRYPTO_PublicKey pk;
if (NULL == gnskey
|| GNUNET_OK != GNUNET_CRYPTO_public_key_from_string (gnskey, &pk))
{
@@ -373,7 +377,7 @@ create_response (void *cls,
key_error->response);
}
- char *tmpd = GNUNET_DISK_mkdtemp (gnskey);
+ tmpd = GNUNET_DISK_mkdtemp (gnskey);
if (NULL == tmpd)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mktemp", gnskey);
@@ -382,125 +386,133 @@ create_response (void *cls,
internal_error->response);
}
- char *defpath = NULL;
GNUNET_asprintf (&defpath, "%s%s%s", tmpd, DIR_SEPARATOR_STR, "def.tex");
- FILE *deffile = fopen (defpath, "w");
- if (NULL == deffile)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", defpath);
+ FILE *deffile = fopen (defpath, "w");
+ if (NULL == deffile)
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", defpath);
+ GNUNET_free (defpath);
+ GNUNET_DISK_directory_remove (tmpd);
+ GNUNET_free (tmpd);
+ return MHD_queue_response (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ internal_error->response);
+ }
+
GNUNET_free (defpath);
- GNUNET_DISK_directory_remove (tmpd);
- GNUNET_free (tmpd);
- return MHD_queue_response (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- internal_error->response);
- }
- GNUNET_free (defpath);
+ for (size_t i = 0; NULL!=pmap[i].name; ++i)
+ {
+ const char *value = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ pmap[i].name);
+ fprintf (deffile,
+ "\\def\\%s{%s}\n",
+ pmap[i].definition,
+ (NULL == value) ? "" : value);
+ }
+
+ if (NULL != gpgfp)
+ {
+ size_t len = strlen (gpgfp);
+ char *line1 = GNUNET_strndup (gpgfp, len / 2);
+ char *line2 = GNUNET_strdup (&gpgfp[len / 2]);
+ fprintf (deffile,
+ "\\def\\gpglineone{%s}\n\\def\\gpglinetwo{%s}\n",
+ line1,
+ line2);
+ GNUNET_free (line1);
+ GNUNET_free (line2);
+ }
- for (size_t i=0; NULL!=pmap[i].name; ++i)
- {
- const char *value = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- pmap[i].name);
fprintf (deffile,
- "\\def\\%s{%s}\n",
- pmap[i].definition,
- (NULL == value) ? "" : value);
- }
+ "\\def\\gns{%s/%s}\n",
+ gnskey,
+ (NULL == gnsnick) ? "" : gnsnick);
- if (NULL != gpgfp)
- {
- size_t len = strlen (gpgfp);
- char *line1 = GNUNET_strndup (gpgfp, len/2);
- char *line2 = GNUNET_strdup (&gpgfp[len/2]);
- fprintf (deffile,
- "\\def\\gpglineone{%s}\n\\def\\gpglinetwo{%s}\n",
- line1,
- line2);
- GNUNET_free (line1);
- GNUNET_free (line2);
+ fclose (deffile);
}
-
- fprintf (deffile,
- "\\def\\gns{%s/%s}\n",
- gnskey,
- (NULL == gnsnick) ? "" : gnsnick);
-
- fclose (deffile);
-
- char *command = NULL;
- GNUNET_asprintf (&command,
- "cd %s; cp %s gns-bcd.tex; "
- "pdflatex %s gns-bcd.tex >/dev/null 2>&1",
- tmpd,
- (isfull) ? tex_file_full :
- ((NULL == qrpng) ? tex_file_simple : tex_file_png),
- (NULL == qrpng) ? "" : "-shell-escape");
-
- int ret = system (command);
-
- GNUNET_free (command);
-
- if (WIFSIGNALED (ret) || 0 != WEXITSTATUS (ret))
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "system", command);
+ char *command = NULL;
+ int ret;
+ GNUNET_asprintf (&command,
+ "cd %s; cp %s gns-bcd.tex; "
+ "pdflatex %s gns-bcd.tex >/dev/null 2>&1",
+ tmpd,
+ (isfull) ? tex_file_full :
+ ((NULL == qrpng) ? tex_file_simple : tex_file_png),
+ (NULL == qrpng) ? "" : "-shell-escape");
+
+ ret = system (command);
+
+ if (WIFSIGNALED (ret) || 0 != WEXITSTATUS (ret))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "system", command);
+ }
+
+ GNUNET_free (command);
}
-
GNUNET_asprintf (&defpath,
"%s%s%s",
tmpd,
DIR_SEPARATOR_STR,
(NULL == qrpng) ? "gns-bcd.pdf" : "gns-bcd.png");
-
- int pdf = open (defpath, O_RDONLY);
- if (-1 == pdf)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", defpath);
- GNUNET_free (defpath);
- GNUNET_DISK_directory_remove (tmpd);
- GNUNET_free (tmpd);
- return MHD_queue_response (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- internal_error->response);
- }
-
- struct stat statret;
- GNUNET_break (0 == stat (defpath, &statret));
+ MHD_RESULT r;
+ struct MHD_Response *pdfrs;
+ struct stat statret;
+ int pdf = open (defpath, O_RDONLY);
+ if (-1 == pdf)
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", defpath);
+ GNUNET_free (defpath);
+ GNUNET_DISK_directory_remove (tmpd);
+ GNUNET_free (tmpd);
+ return MHD_queue_response (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ internal_error->response);
+ }
+
+ GNUNET_break (0 == stat (defpath, &statret));
- GNUNET_free (defpath);
+ GNUNET_free (defpath);
- struct MHD_Response *pdfrs =
- MHD_create_response_from_fd ((size_t) statret.st_size, pdf);
- if (NULL == pdfrs)
- {
- GNUNET_break (0);
- GNUNET_break (0 == close (pdf));
+ pdfrs = MHD_create_response_from_fd ((size_t) statret.st_size, pdf);
+ if (NULL == pdfrs)
+ {
+ GNUNET_break (0);
+ GNUNET_break (0 == close (pdf));
+ GNUNET_DISK_directory_remove (tmpd);
+ GNUNET_free (tmpd);
+ return MHD_queue_response (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ internal_error->response);
+ }
+
+ GNUNET_assert (MHD_NO != MHD_add_response_header (pdfrs,
+
MHD_HTTP_HEADER_CONTENT_TYPE,
+ (NULL == qrpng) ?
+ "application/pdf" :
+ "image/png"));
+ GNUNET_assert (MHD_NO !=
+ MHD_add_response_header (pdfrs,
+
MHD_HTTP_HEADER_CONTENT_DISPOSITION,
+ (NULL == qrpng) ?
+ "attachment;
filename=\"gns-business-card.pdf\""
+ :
+ "attachment;
filename=\"gns-qr-code.png\""));
+ r = MHD_queue_response (connection, MHD_HTTP_OK, pdfrs);
+
+ MHD_destroy_response (pdfrs);
GNUNET_DISK_directory_remove (tmpd);
GNUNET_free (tmpd);
- return MHD_queue_response (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- internal_error->response);
+ return r;
}
-
- GNUNET_assert (MHD_NO != MHD_add_response_header (pdfrs,
- MHD_HTTP_HEADER_CONTENT_TYPE,
- (NULL == qrpng) ? "application/pdf" : "image/png"));
- GNUNET_assert (MHD_NO != MHD_add_response_header (pdfrs,
- MHD_HTTP_HEADER_CONTENT_DISPOSITION,
- (NULL == qrpng) ?
- "attachment; filename=\"gns-business-card.pdf\"" :
- "attachment; filename=\"gns-qr-code.png\""));
- MHD_RESULT r = MHD_queue_response (connection, MHD_HTTP_OK, pdfrs);
-
- MHD_destroy_response (pdfrs);
- GNUNET_DISK_directory_remove (tmpd);
- GNUNET_free (tmpd);
-
- return r;
}
+
/**
* Open a file on disk and generate a response for it.
*
@@ -512,12 +524,15 @@ static struct StaticResource *
open_static_resource (const char *name, const char *basedir)
{
char *fullname = NULL;
+ off_t size = 0;
+ struct GNUNET_DISK_FileHandle *f;
+ struct MHD_Response *response;
+ struct StaticResource *res;
GNUNET_asprintf (&fullname, "%s%s%s", basedir, DIR_SEPARATOR_STR, name);
- struct GNUNET_DISK_FileHandle *f =
- GNUNET_DISK_file_open (fullname,
- GNUNET_DISK_OPEN_READ,
- GNUNET_DISK_PERM_NONE);
+ f = GNUNET_DISK_file_open (fullname,
+ GNUNET_DISK_OPEN_READ,
+ GNUNET_DISK_PERM_NONE);
GNUNET_free (fullname);
@@ -526,14 +541,13 @@ open_static_resource (const char *name, const char
*basedir)
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);
+ response = MHD_create_response_from_fd64 (size, f->fd);
if (NULL == response)
{
@@ -541,7 +555,7 @@ open_static_resource (const char *name, const char *basedir)
return NULL;
}
- struct StaticResource *res = GNUNET_new (struct StaticResource);
+ res = GNUNET_new (struct StaticResource);
res->handle = f;
res->size = (uint64_t) size;
res->response = response;
@@ -549,6 +563,7 @@ open_static_resource (const char *name, const char *basedir)
return res;
}
+
/**
* Main function that will be run.
*
@@ -563,6 +578,7 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ char *datadir;
(void) cls;
(void) args;
(void) cfgfile;
@@ -578,7 +594,7 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
- char *datadir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ datadir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_assert (NULL != datadir);
GNUNET_asprintf (&tex_file_full,
@@ -591,17 +607,18 @@ run (void *cls,
datadir,
DIR_SEPARATOR_STR,
"gns-bcd-simple.tex");
- GNUNET_asprintf(&tex_file_png,
- "%s%s%s",
- datadir,
- DIR_SEPARATOR_STR,
- "gns-bcd-png.tex");
+ GNUNET_asprintf (&tex_file_png,
+ "%s%s%s",
+ datadir,
+ DIR_SEPARATOR_STR,
+ "gns-bcd-png.tex");
index_simple = open_static_resource ("gns-bcd-simple.html", datadir);
index_full = open_static_resource ("gns-bcd.html", datadir);
key_error = open_static_resource ("gns-bcd-invalid-key.html", datadir);
notfound_error = open_static_resource ("gns-bcd-not-found.html", datadir);
- internal_error = open_static_resource ("gns-bcd-internal-error.html",
datadir);
+ internal_error = open_static_resource ("gns-bcd-internal-error.html",
datadir)
+ ;
forbidden_error = open_static_resource ("gns-bcd-forbidden.html", datadir);
GNUNET_free (datadir);
@@ -616,21 +633,22 @@ run (void *cls,
return;
}
- int flags = MHD_USE_DUAL_STACK | MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME;
- do
{
- httpd = MHD_start_daemon (flags,
- port,
- NULL, NULL,
- &create_response, NULL,
- MHD_OPTION_CONNECTION_LIMIT, 512,
- MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2,
- MHD_OPTION_CONNECTION_TIMEOUT, 60,
- MHD_OPTION_CONNECTION_MEMORY_LIMIT, 16 * 1024,
- MHD_OPTION_END);
- flags = MHD_USE_DEBUG;
- } while (NULL == httpd && flags != MHD_USE_DEBUG);
-
+ int flags = MHD_USE_DUAL_STACK | MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME;
+ do
+ {
+ httpd = MHD_start_daemon (flags,
+ port,
+ NULL, NULL,
+ &create_response, NULL,
+ MHD_OPTION_CONNECTION_LIMIT, 512,
+ MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2,
+ MHD_OPTION_CONNECTION_TIMEOUT, 60,
+ MHD_OPTION_CONNECTION_MEMORY_LIMIT, 16 * 1024,
+ MHD_OPTION_END);
+ flags = MHD_USE_DEBUG;
+ } while (NULL == httpd && flags != MHD_USE_DEBUG);
+ }
if (NULL == httpd)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -642,6 +660,7 @@ run (void *cls,
run_httpd ();
}
+
/**
* The main function for gnunet-gns.
*
@@ -666,7 +685,8 @@ main (int argc, char *const *argv)
GNUNET_PROGRAM_run (argc,
argv,
"gnunet-bcd",
- _ ("GNUnet HTTP server to create business
cards"),
+ _ ("GNUnet HTTP server to create business
cards")
+ ,
options,
&run,
NULL))
@@ -674,4 +694,5 @@ main (int argc, char *const *argv)
: 1);
}
+
/* end of gnunet-bcd.c */
diff --git a/src/service/gns/gnunet-service-gns.c
b/src/service/gns/gnunet-service-gns.c
index 7003c29f5..973104a42 100644
--- a/src/service/gns/gnunet-service-gns.c
+++ b/src/service/gns/gnunet-service-gns.c
@@ -26,11 +26,9 @@
#include "gnunet_common.h"
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_dns_service.h"
#include "gnunet_dht_service.h"
#include "gnunet_namecache_service.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_gns_service.h"
#include "gnunet_statistics_service.h"
#include "gns.h"
#include "gnunet-service-gns.h"
@@ -476,8 +474,7 @@ handle_lookup (void *cls,
clh->lookup = GNS_resolver_lookup (&zone,
ntohl (sh_msg->type),
name,
- (enum GNUNET_GNS_LocalOptions) ntohs (
- sh_msg->options),
+ ntohs (sh_msg->options),
ntohs (sh_msg->recursion_depth_limit),
&send_lookup_response, clh);
GNUNET_STATISTICS_update (statistics,
diff --git a/src/service/gns/nss/nss_gns.c b/src/service/gns/nss/nss_gns.c
index b05cfff55..b18b72aef 100644
--- a/src/service/gns/nss/nss_gns.c
+++ b/src/service/gns/nss/nss_gns.c
@@ -41,6 +41,14 @@
idx += (sizeof(void*) - idx % sizeof(void*)); /* Align on 32 bit
boundary */ \
} while (0)
+enum nss_status
+_nss_gns_gethostbyname2_r (const char *name,
+ int af,
+ struct hostent *result,
+ char *buffer,
+ size_t buflen,
+ int *errnop,
+ int *h_errnop);
/**
* The gethostbyname hook executed by nsswitch
@@ -185,7 +193,13 @@ finish:
return status;
}
-
+enum nss_status
+_nss_gns_gethostbyname_r (const char *name,
+ struct hostent *result,
+ char *buffer,
+ size_t buflen,
+ int *errnop,
+ int *h_errnop);
/**
* The gethostbyname hook executed by nsswitch
*
@@ -214,7 +228,15 @@ _nss_gns_gethostbyname_r (const char *name,
h_errnop);
}
-
+enum nss_status
+_nss_gns_gethostbyaddr_r (const void*addr,
+ int len,
+ int af,
+ struct hostent *result,
+ char *buffer,
+ size_t buflen,
+ int *errnop,
+ int *h_errnop);
/**
* The gethostbyaddr hook executed by nsswitch
* We can't do this so we always return NSS_STATUS_UNAVAIL
diff --git a/src/service/gns/nss/nss_gns_query.c
b/src/service/gns/nss/nss_gns_query.c
index 96e8e10da..ef7dbe599 100644
--- a/src/service/gns/nss/nss_gns_query.c
+++ b/src/service/gns/nss/nss_gns_query.c
@@ -75,7 +75,7 @@ query_gns:
return -1;
if (0 == pid)
{
- char *argv[] = { "gnunet-gns",
+ const char *argv[] = { "gnunet-gns",
"-r", /* Raw output for easier parsing */
"-d", /* DNS compatibility (allow IDNA names, no UTF-8) */
"-t",
@@ -90,7 +90,7 @@ query_gns:
if ((0 != close (out[0])) ||
(STDOUT_FILENO != dup2 (out[1], STDOUT_FILENO)))
_exit (1);
- (void) execvp ("gnunet-gns", argv);
+ (void) execvp ("gnunet-gns", (char* const*)argv);
_exit (1);
}
(void) close (out[1]);
diff --git a/src/service/namestore/gnunet-service-namestore.c
b/src/service/namestore/gnunet-service-namestore.c
index 43d1c4679..80e12bce7 100644
--- a/src/service/namestore/gnunet-service-namestore.c
+++ b/src/service/namestore/gnunet-service-namestore.c
@@ -689,7 +689,7 @@ send_lookup_response_with_filter (struct NamestoreClient
*nc,
struct GNUNET_GNSRECORD_Data *nick;
struct GNUNET_GNSRECORD_Data *res;
struct GNUNET_GNSRECORD_Data rd_nf[rd_count];
- struct GNUNET_TIME_Absolute block_exp = GNUNET_TIME_UNIT_ZERO_ABS;;
+ struct GNUNET_TIME_Absolute block_exp;
unsigned int res_count;
unsigned int rd_nf_count;
size_t name_len;
@@ -699,6 +699,7 @@ send_lookup_response_with_filter (struct NamestoreClient
*nc,
char *rd_ser;
char *emsg;
+ block_exp = GNUNET_TIME_UNIT_ZERO_ABS;
nick = get_nick_record (zone_key);
GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (rd_count, rd));
diff --git a/src/service/reclaim/gnunet-service-reclaim_tickets.c
b/src/service/reclaim/gnunet-service-reclaim_tickets.c
index 9ebe217f9..64ef22fd5 100644
--- a/src/service/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/service/reclaim/gnunet-service-reclaim_tickets.c
@@ -1455,11 +1455,11 @@ issue_ticket (struct TicketIssueHandle *ih)
ih);
for (j = 0; j < i; j++)
{
+ char *ptr = (char*) attrs_record[j].data;
if (attrs_record[j].record_type
!= GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION)
continue;
// Yes, we are allowed to do this because we allocated it above
- char *ptr = (char*) attrs_record[j].data;
GNUNET_free (ptr);
}
GNUNET_free (tkt_data);
diff --git a/src/service/rest/identity_plugin.c
b/src/service/rest/identity_plugin.c
index 475558f87..b535cebff 100644
--- a/src/service/rest/identity_plugin.c
+++ b/src/service/rest/identity_plugin.c
@@ -782,6 +782,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
struct GNUNET_CRYPTO_PrivateKey pk;
struct GNUNET_CRYPTO_PrivateKey *pk_ptr;
int json_unpack_state;
+ int type;
char term_data[handle->data_size + 1];
if (strlen (GNUNET_REST_API_NS_IDENTITY) != strlen (handle->url))
@@ -820,7 +821,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
json_decref (data_js);
return;
}
- int type = GNUNET_PUBLIC_KEY_TYPE_ECDSA;
+ type = GNUNET_PUBLIC_KEY_TYPE_ECDSA;
if ((NULL != egotype) && (0 == strcasecmp (egotype, "EDDSA")))
type = GNUNET_PUBLIC_KEY_TYPE_EDDSA;
if (NULL == egoname)
diff --git a/src/service/rest/namestore_plugin.c
b/src/service/rest/namestore_plugin.c
index 9b1cc22a6..ae5d7e129 100644
--- a/src/service/rest/namestore_plugin.c
+++ b/src/service/rest/namestore_plugin.c
@@ -729,6 +729,7 @@ static void
import_next_cb (void *cls, enum GNUNET_ErrorCode ec)
{
struct RequestHandle *handle = cls;
+ unsigned int remaining;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Import finished (%d)\n", ec);
@@ -739,7 +740,7 @@ import_next_cb (void *cls, enum GNUNET_ErrorCode ec)
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- unsigned int remaining = handle->rd_set_count - handle->rd_set_pos;
+ remaining = handle->rd_set_count - handle->rd_set_pos;
if (0 == remaining)
{
struct MHD_Response *resp;
@@ -758,24 +759,26 @@ import_next_cb (void *cls, enum GNUNET_ErrorCode ec)
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
return;
}
- unsigned int sent_rds = 0;
- // Find the smallest set of records we can send with our message size
- // restriction of 16 bit
- handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->nc,
- handle->zone_pkey,
- remaining,
- &handle->ri[handle->
- rd_set_pos],
- &sent_rds,
- &import_next_cb,
- handle);
- if ((NULL == handle->ns_qe) && (0 == sent_rds))
{
- handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN;
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
+ unsigned int sent_rds = 0;
+ // Find the smallest set of records we can send with our message size
+ // restriction of 16 bit
+ handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->nc,
+ handle->zone_pkey,
+ remaining,
+ &handle->ri[handle->
+ rd_set_pos],
+ &sent_rds,
+ &import_next_cb,
+ handle);
+ if ((NULL == handle->ns_qe) && (0 == sent_rds))
+ {
+ handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+ handle->rd_set_pos += sent_rds;
}
- handle->rd_set_pos += sent_rds;
}
@@ -784,6 +787,7 @@ bulk_tx_start (struct RequestHandle *handle)
{
json_t *data_js;
json_error_t err;
+ char term_data[handle->rest_handle->data_size + 1];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transaction started...\n");
@@ -793,7 +797,6 @@ bulk_tx_start (struct RequestHandle *handle)
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- char term_data[handle->rest_handle->data_size + 1];
term_data[handle->rest_handle->data_size] = '\0';
GNUNET_memcpy (term_data,
handle->rest_handle->data,
@@ -819,50 +822,53 @@ bulk_tx_start (struct RequestHandle *handle)
* sizeof (struct GNUNET_NAMESTORE_RecordInfo));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got record set of size %d\n", handle->rd_set_count);
- char *albl;
- size_t index;
- json_t *value;
- json_array_foreach (data_js, index, value) {
- {
- struct GNUNET_GNSRECORD_Data *rd;
- struct GNUNET_JSON_Specification gnsspec[] =
- { GNUNET_GNSRECORD_JSON_spec_gnsrecord (&rd,
- &handle->ri[index].a_rd_count,
- &albl),
- GNUNET_JSON_spec_end () };
- if (GNUNET_OK != GNUNET_JSON_parse (value, gnsspec, NULL, NULL))
+ {
+ char *albl;
+ size_t index;
+ json_t *value;
+ json_array_foreach (data_js, index, value) {
{
- handle->ec = GNUNET_EC_NAMESTORE_RECORD_DATA_INVALID;
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- json_decref (data_js);
- return;
+ struct GNUNET_GNSRECORD_Data *rd;
+ struct GNUNET_JSON_Specification gnsspec[] =
+ { GNUNET_GNSRECORD_JSON_spec_gnsrecord (&rd,
+ &handle->ri[index].a_rd_count,
+ &albl),
+ GNUNET_JSON_spec_end () };
+ if (GNUNET_OK != GNUNET_JSON_parse (value, gnsspec, NULL, NULL))
+ {
+ handle->ec = GNUNET_EC_NAMESTORE_RECORD_DATA_INVALID;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ json_decref (data_js);
+ return;
+ }
+ handle->ri[index].a_rd = rd;
+ handle->ri[index].a_label = albl;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Parsed record set for name %s\n",
+ handle->ri[index].a_label);
}
- handle->ri[index].a_rd = rd;
- handle->ri[index].a_label = albl;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Parsed record set for name %s\n",
- handle->ri[index].a_label);
}
}
// json_decref (data_js);
-
- unsigned int sent_rds = 0;
- // Find the smallest set of records we can send with our message size
- // restriction of 16 bit
- handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->nc,
- handle->zone_pkey,
- handle->rd_set_count,
- handle->ri,
- &sent_rds,
- &import_next_cb,
- handle);
- if ((NULL == handle->ns_qe) && (0 == sent_rds))
{
- handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN;
- GNUNET_SCHEDULER_add_now (&do_error, handle);
- return;
+ unsigned int sent_rds = 0;
+ // Find the smallest set of records we can send with our message size
+ // restriction of 16 bit
+ handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->nc,
+ handle->zone_pkey,
+ handle->rd_set_count,
+ handle->ri,
+ &sent_rds,
+ &import_next_cb,
+ handle);
+ if ((NULL == handle->ns_qe) && (0 == sent_rds))
+ {
+ handle->ec = GNUNET_EC_NAMESTORE_UNKNOWN;
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+ handle->rd_set_pos += sent_rds;
}
- handle->rd_set_pos += sent_rds;
}
diff --git a/src/service/rest/oidc_helper.c b/src/service/rest/oidc_helper.c
index a07d34ba8..124f43865 100644
--- a/src/service/rest/oidc_helper.c
+++ b/src/service/rest/oidc_helper.c
@@ -360,7 +360,7 @@ OIDC_generate_userinfo (const struct
GNUNET_CRYPTO_PublicKey *sub_key,
}
-char *
+static char *
generate_id_token_body (const char *rp_uri,
const struct GNUNET_CRYPTO_PublicKey *sub_key,
const struct GNUNET_RECLAIM_AttributeList *attrs,
@@ -693,7 +693,7 @@ OIDC_build_authz_code (const struct
GNUNET_CRYPTO_PrivateKey *issuer,
}
-enum GNUNET_GenericReturnValue
+static enum GNUNET_GenericReturnValue
check_code_challenge (const char *code_challenge,
uint32_t code_challenge_len,
const char *code_verifier)
diff --git a/src/service/revocation/gnunet-service-revocation.c
b/src/service/revocation/gnunet-service-revocation.c
index 1edf30fe9..4d783c84c 100644
--- a/src/service/revocation/gnunet-service-revocation.c
+++ b/src/service/revocation/gnunet-service-revocation.c
@@ -38,7 +38,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_block_lib.h"
+#include "gnunet_dht_block_types.h"
#include "gnunet_protocols.h"
#include "gnunet_statistics_service.h"
#include "gnunet_core_service.h"
@@ -875,8 +875,10 @@ run (void *cls,
};
char *fn;
uint64_t left;
+ ssize_t ksize;
struct RevokeMessage *rm;
struct GNUNET_HashCode hc;
+ struct GNUNET_GNSRECORD_PowP *pow;
const struct GNUNET_CRYPTO_PublicKey *pk;
GNUNET_CRYPTO_hash ("revocation-set-union-application-id",
@@ -978,9 +980,7 @@ run (void *cls,
GNUNET_free (fn);
return;
}
- struct GNUNET_GNSRECORD_PowP *pow = (struct
- GNUNET_GNSRECORD_PowP *) &rm[1];
- ssize_t ksize;
+ pow = (struct GNUNET_GNSRECORD_PowP *) &rm[1];
pk = (const struct GNUNET_CRYPTO_PublicKey *) &pow[1];
ksize = GNUNET_CRYPTO_public_key_get_length (pk);
if (0 > ksize)
@@ -1044,6 +1044,8 @@ GNUNET_SERVICE_MAIN
#if defined(__linux__) && defined(__GLIBC__)
#include <malloc.h>
+void
+GNUNET_REVOCATION_memory_init (void);
/**
* MINIMIZE heap size (way below 128k) since this process doesn't need much.
*/
diff --git a/src/service/setu/gnunet-service-setu.c
b/src/service/setu/gnunet-service-setu.c
index 8c2d65b47..262112382 100644
--- a/src/service/setu/gnunet-service-setu.c
+++ b/src/service/setu/gnunet-service-setu.c
@@ -1119,66 +1119,71 @@ estimate_best_mode_of_operation (uint64_t
avg_element_size,
{
ibf_bucket_count = IBF_MIN_SIZE;
}
- uint64_t ibf_message_count = ceil ( ((float) ibf_bucket_count)
- / ((float) MAX_BUCKETS_PER_MESSAGE));
-
- uint64_t estimated_counter_size = ceil (
- MIN (2 * log2l (((float) local_set_size)
- / ((float) ibf_bucket_count)),
- log2l (local_set_size)));
-
- long double counter_bytes = (float) estimated_counter_size / 8;
-
- uint64_t ibf_bytes = ceil ((sizeof (struct IBFMessage) * ibf_message_count)
- * 1.2 \
- + (ibf_bucket_count * sizeof(struct IBF_Key))
- * 1.2 \
- + (ibf_bucket_count * sizeof(struct
IBF_KeyHash))
- * 1.2 \
- + (ibf_bucket_count * counter_bytes) * 1.2);
-
- /* Estimate full byte count for differential sync */
- uint64_t element_size = (avg_element_size
- + sizeof (struct GNUNET_SETU_ElementMessage)) \
- * estimated_total_diff;
- uint64_t done_size = sizeof_done_header;
- uint64_t inquery_size = (sizeof (struct IBF_Key)
- + sizeof (struct InquiryMessage))
+ {
+ uint64_t ibf_message_count = ceil ( ((float) ibf_bucket_count)
+ / ((float) MAX_BUCKETS_PER_MESSAGE));
+
+ uint64_t estimated_counter_size = ceil (
+ MIN (2 * log2l (((float) local_set_size)
+ / ((float) ibf_bucket_count)),
+ log2l (local_set_size)));
+
+ long double counter_bytes = (float) estimated_counter_size / 8;
+
+ uint64_t ibf_bytes = ceil ((sizeof (struct IBFMessage) *
ibf_message_count
+ )
+ * 1.2 \
+ + (ibf_bucket_count * sizeof(struct IBF_Key))
+ * 1.2 \
+ + (ibf_bucket_count * sizeof(struct
+ IBF_KeyHash))
+ * 1.2 \
+ + (ibf_bucket_count * counter_bytes) * 1.2);
+
+ /* Estimate full byte count for differential sync */
+ uint64_t element_size = (avg_element_size
+ + sizeof (struct GNUNET_SETU_ElementMessage))
\
+ * estimated_total_diff;
+ uint64_t done_size = sizeof_done_header;
+ uint64_t inquery_size = (sizeof (struct IBF_Key)
+ + sizeof (struct InquiryMessage))
+ * estimated_total_diff;
+ uint64_t demand_size =
+ (sizeof(struct GNUNET_HashCode) + sizeof(struct GNUNET_MessageHeader))
+ * estimated_total_diff;
+ uint64_t offer_size = (sizeof (struct GNUNET_HashCode)
+ + sizeof (struct GNUNET_MessageHeader))
* estimated_total_diff;
- uint64_t demand_size =
- (sizeof(struct GNUNET_HashCode) + sizeof(struct GNUNET_MessageHeader))
- * estimated_total_diff;
- uint64_t offer_size = (sizeof (struct GNUNET_HashCode)
- + sizeof (struct GNUNET_MessageHeader))
- * estimated_total_diff;
- uint64_t total_bytes_diff = (element_size + done_size + inquery_size
- + demand_size + offer_size + ibf_bytes) \
- + (DIFFERENTIAL_RTT_MEAN
- * bandwith_latency_tradeoff);
+ uint64_t total_bytes_diff = (element_size + done_size + inquery_size
+ + demand_size + offer_size + ibf_bytes) \
+ + (DIFFERENTIAL_RTT_MEAN
+ * bandwith_latency_tradeoff);
- uint64_t full_min = MIN (total_bytes_full_local_send_first,
- total_bytes_full_remote_send_first);
+ uint64_t full_min = MIN (total_bytes_full_local_send_first,
+ total_bytes_full_remote_send_first);
- /* Decide between full and differential sync */
+ /* Decide between full and differential sync */
- if (full_min < total_bytes_diff)
- {
- /* Decide between sending all element first or receiving all elements */
- if (total_bytes_full_remote_send_first >
total_bytes_full_local_send_first
- )
+ if (full_min < total_bytes_diff)
{
- return FULL_SYNC_LOCAL_SENDING_FIRST;
+ /* Decide between sending all element first or receiving all elements
*/
+ if (total_bytes_full_remote_send_first >
+ total_bytes_full_local_send_first
+ )
+ {
+ return FULL_SYNC_LOCAL_SENDING_FIRST;
+ }
+ else
+ {
+ return FULL_SYNC_REMOTE_SENDING_FIRST;
+ }
}
else
{
- return FULL_SYNC_REMOTE_SENDING_FIRST;
+ return DIFFERENTIAL_SYNC;
}
}
- else
- {
- return DIFFERENTIAL_SYNC;
- }
}
}
diff --git a/src/service/vpn/gnunet-helper-vpn.c
b/src/service/vpn/gnunet-helper-vpn.c
index 30901da45..dcb226fe5 100644
--- a/src/service/vpn/gnunet-helper-vpn.c
+++ b/src/service/vpn/gnunet-helper-vpn.c
@@ -398,6 +398,7 @@ run (int fd_tun)
ssize_t bufin_size = 0;
size_t bufin_rpos = 0;
unsigned char *bufin_read = NULL;
+ int r;
fd_set fds_w;
fd_set fds_r;
@@ -441,7 +442,7 @@ run (int fd_tun)
if (write_open && (NULL != bufin_read))
FD_SET (fd_tun, &fds_w);
- int r = select (fd_tun + 1, &fds_r, &fds_w, NULL, NULL);
+ r = select (fd_tun + 1, &fds_r, &fds_w, NULL, NULL);
if (-1 == r)
{
@@ -480,9 +481,9 @@ run (int fd_tun)
}
else
{
- buftun_read = buftun;
struct GNUNET_MessageHeader *hdr =
(struct GNUNET_MessageHeader *) buftun;
+ buftun_read = buftun;
buftun_size += sizeof(struct GNUNET_MessageHeader);
hdr->type = htons (GNUNET_MESSAGE_TYPE_VPN_HELPER);
hdr->size = htons (buftun_size);
@@ -671,15 +672,17 @@ main (int argc, char **argv)
set_address4 (dev, address, mask);
}
- uid_t uid = getuid ();
#ifdef HAVE_SETRESUID
- if (0 != setresuid (uid, uid, uid))
{
- fprintf (stderr,
- "Failed to setresuid: %s\n",
- strerror (errno));
- global_ret = 2;
- goto cleanup;
+ uid_t uid = getuid ();
+ if (0 != setresuid (uid, uid, uid))
+ {
+ fprintf (stderr,
+ "Failed to setresuid: %s\n",
+ strerror (errno));
+ global_ret = 2;
+ goto cleanup;
+ }
}
#else
if (0 != (setuid (uid) | seteuid (uid)))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.