projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RPS: Forgot to add header
[oweals/gnunet.git]
/
src
/
peerinfo
/
gnunet-service-peerinfo.c
diff --git
a/src/peerinfo/gnunet-service-peerinfo.c
b/src/peerinfo/gnunet-service-peerinfo.c
index af1eb2d1d6e6566716d559b11676a13f989fbb7f..75e99d1f8712096915587dbbeac23da65a74d57d 100644
(file)
--- a/
src/peerinfo/gnunet-service-peerinfo.c
+++ b/
src/peerinfo/gnunet-service-peerinfo.c
@@
-2,20
+2,20
@@
This file is part of GNUnet.
Copyright (C) 2001-2016 GNUnet e.V.
This file is part of GNUnet.
Copyright (C) 2001-2016 GNUnet e.V.
- GNUnet is free software
; you can redistribute it and/or modify
-
it under the terms of the GNU
General Public License as published
- by the Free Software Foundation
; either version 3, or (at your
- option) any later version.
+ 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,
+ o
r (at your o
ption) 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
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
- General Public License for more details.
+ 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/>.
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
*/
/**
@@
-198,6
+198,8
@@
count_addresses (void *cls,
{
unsigned int *cnt = cls;
{
unsigned int *cnt = cls;
+ (void) address;
+ (void) expiration;
(*cnt)++;
return GNUNET_OK;
}
(*cnt)++;
return GNUNET_OK;
}
@@
-290,7
+292,7
@@
read_host_file (const char *fn,
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_HELLO_Message *hello_clean;
size_t read_pos;
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_HELLO_Message *hello_clean;
size_t read_pos;
-
in
t size_hello;
+
uint16_
t size_hello;
r->friend_only_hello = NULL;
r->hello = NULL;
r->friend_only_hello = NULL;
r->hello = NULL;
@@
-304,7
+306,8
@@
read_host_file (const char *fn,
"Read %d bytes from `%s'\n",
(int) size_total,
fn);
"Read %d bytes from `%s'\n",
(int) size_total,
fn);
- if (size_total < sizeof (struct GNUNET_MessageHeader))
+ if ( (size_total < 0) ||
+ (((size_t) size_total) < sizeof (struct GNUNET_MessageHeader)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to parse HELLO in file `%s': %s\n"),
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to parse HELLO in file `%s': %s\n"),
@@
-320,12
+323,12
@@
read_host_file (const char *fn,
}
read_pos = 0;
}
read_pos = 0;
- while (read_pos < size_total)
+ while (read_pos <
(size_t)
size_total)
{
hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos];
size_hello = GNUNET_HELLO_size (hello);
if ( (0 == size_hello) ||
{
hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos];
size_hello = GNUNET_HELLO_size (hello);
if ( (0 == size_hello) ||
- (
size_total
- read_pos < size_hello) )
+ (
((size_t) size_total)
- read_pos < size_hello) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to parse HELLO in file `%s'\n"),
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to parse HELLO in file `%s'\n"),
@@
-559,11
+562,11
@@
hosts_directory_scan_callback (void *cls,
if (GNUNET_OK !=
GNUNET_HELLO_get_id (r.friend_only_hello,
&id_friend))
if (GNUNET_OK !=
GNUNET_HELLO_get_id (r.friend_only_hello,
&id_friend))
+ {
if (GNUNET_YES == dsc->remove_files)
if (GNUNET_YES == dsc->remove_files)
- {
remove_garbage (fullname);
remove_garbage (fullname);
-
return GNUNET_OK;
-
}
+ return GNUNET_OK;
+ }
id = id_friend;
}
if (NULL != r.hello)
id = id_friend;
}
if (NULL != r.hello)
@@
-571,11
+574,11
@@
hosts_directory_scan_callback (void *cls,
if (GNUNET_OK !=
GNUNET_HELLO_get_id (r.hello,
&id_public))
if (GNUNET_OK !=
GNUNET_HELLO_get_id (r.hello,
&id_public))
+ {
if (GNUNET_YES == dsc->remove_files)
if (GNUNET_YES == dsc->remove_files)
- {
remove_garbage (fullname);
remove_garbage (fullname);
-
return GNUNET_OK;
-
}
+ return GNUNET_OK;
+ }
id = id_public;
}
id = id_public;
}
@@
-640,6
+643,7
@@
cron_scan_directory_data_hosts (void *cls)
static unsigned int retries;
struct DirScanContext dsc;
static unsigned int retries;
struct DirScanContext dsc;
+ (void) cls;
cron_scan = NULL;
if (GNUNET_SYSERR ==
GNUNET_DISK_directory_create (networkIdDirectory))
cron_scan = NULL;
if (GNUNET_SYSERR ==
GNUNET_DISK_directory_create (networkIdDirectory))
@@
-730,7
+734,7
@@
update_hello (const struct GNUNET_PeerIdentity *peer,
int friend_hello_type;
int store_hello;
int store_friend_hello;
int friend_hello_type;
int store_hello;
int store_friend_hello;
- int pos;
+
unsigned
int pos;
char *buffer;
host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer);
char *buffer;
host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer);
@@
-849,8
+853,8
@@
update_hello (const struct GNUNET_PeerIdentity *peer,
if (GNUNET_YES == store_friend_hello)
{
GNUNET_memcpy (&buffer[pos],
if (GNUNET_YES == store_friend_hello)
{
GNUNET_memcpy (&buffer[pos],
- host->friend_only_hello,
- GNUNET_HELLO_size (host->friend_only_hello));
+
host->friend_only_hello,
+
GNUNET_HELLO_size (host->friend_only_hello));
pos += GNUNET_HELLO_size (host->friend_only_hello);
}
GNUNET_assert (pos == size);
pos += GNUNET_HELLO_size (host->friend_only_hello);
}
GNUNET_assert (pos == size);
@@
-988,16
+992,31
@@
discard_hosts_helper (void *cls,
unsigned int cnt;
char *writebuffer;
uint64_t fsize;
unsigned int cnt;
char *writebuffer;
uint64_t fsize;
+
+ if (GNUNET_OK !=
+ GNUNET_DISK_file_size (fn,
+ &fsize,
+ GNUNET_YES,
+ GNUNET_YES))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
+ GNUNET_ERROR_TYPE_BULK,
+ "fstat",
+ fn);
+ return GNUNET_OK;
+ }
+ read_size = GNUNET_DISK_fn_read (fn,
+ buffer,
+ sizeof (buffer));
- GNUNET_DISK_file_size (fn, &fsize, GNUNET_YES, GNUNET_YES);
- read_size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer));
-
- if ((read_size < (int) sizeof (struct GNUNET_MessageHeader)) ||
- (fsize > GNUNET_MAX_MESSAGE_SIZE))
+ if ( (read_size < (int) sizeof (struct GNUNET_MessageHeader)) ||
+ (fsize > GNUNET_MAX_MESSAGE_SIZE) )
{
if (0 != UNLINK (fn))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
{
if (0 != UNLINK (fn))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
- GNUNET_ERROR_TYPE_BULK, "unlink", fn);
+ GNUNET_ERROR_TYPE_BULK,
+ "unlink",
+ fn);
return GNUNET_OK;
}
return GNUNET_OK;
}
@@
-1074,6
+1093,7
@@
cron_clean_data_hosts (void *cls)
{
struct GNUNET_TIME_Absolute now;
{
struct GNUNET_TIME_Absolute now;
+ (void) cls;
cron_clean = NULL;
now = GNUNET_TIME_absolute_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
cron_clean = NULL;
now = GNUNET_TIME_absolute_get ();
GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
@@
-1101,6
+1121,7
@@
check_hello (void *cls,
{
struct GNUNET_PeerIdentity pid;
{
struct GNUNET_PeerIdentity pid;
+ (void) cls;
if (GNUNET_OK !=
GNUNET_HELLO_get_id (hello,
&pid))
if (GNUNET_OK !=
GNUNET_HELLO_get_id (hello,
&pid))
@@
-1125,12
+1146,12
@@
handle_hello (void *cls,
struct GNUNET_SERVICE_Client *client = cls;
struct GNUNET_PeerIdentity pid;
struct GNUNET_SERVICE_Client *client = cls;
struct GNUNET_PeerIdentity pid;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "HELLO message received for peer `%s'\n",
- GNUNET_i2s (&pid));
GNUNET_assert (GNUNET_OK ==
GNUNET_HELLO_get_id (hello,
&pid));
GNUNET_assert (GNUNET_OK ==
GNUNET_HELLO_get_id (hello,
&pid));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "HELLO message received for peer `%s'\n",
+ GNUNET_i2s (&pid));
add_host_to_known_hosts (&pid);
update_hello (&pid,
hello);
add_host_to_known_hosts (&pid);
update_hello (&pid,
hello);
@@
-1252,6
+1273,8
@@
client_connect_cb (void *cls,
struct GNUNET_SERVICE_Client *client,
struct GNUNET_MQ_Handle *mq)
{
struct GNUNET_SERVICE_Client *client,
struct GNUNET_MQ_Handle *mq)
{
+ (void) cls;
+ (void) mq;
return client;
}
return client;
}
@@
-1268,6
+1291,7
@@
client_disconnect_cb (void *cls,
struct GNUNET_SERVICE_Client *client,
void *app_ctx)
{
struct GNUNET_SERVICE_Client *client,
void *app_ctx)
{
+ (void) cls;
GNUNET_assert (app_ctx == client);
}
GNUNET_assert (app_ctx == client);
}
@@
-1287,6
+1311,8
@@
free_host_entry (void *cls,
{
struct HostEntry *he = value;
{
struct HostEntry *he = value;
+ (void) cls;
+ (void) key;
GNUNET_free_non_null (he->hello);
GNUNET_free_non_null (he->friend_only_hello);
GNUNET_free (he);
GNUNET_free_non_null (he->hello);
GNUNET_free_non_null (he->friend_only_hello);
GNUNET_free (he);
@@
-1302,6
+1328,7
@@
free_host_entry (void *cls,
static void
shutdown_task (void *cls)
{
static void
shutdown_task (void *cls)
{
+ (void) cls;
GNUNET_notification_context_destroy (notify_list);
notify_list = NULL;
GNUNET_notification_context_destroy (notify_friend_only_list);
GNUNET_notification_context_destroy (notify_list);
notify_list = NULL;
GNUNET_notification_context_destroy (notify_friend_only_list);
@@
-1353,6
+1380,8
@@
run (void *cls,
int noio;
int use_included;
int noio;
int use_included;
+ (void) cls;
+ (void) service;
hostmap
= GNUNET_CONTAINER_multipeermap_create (1024,
GNUNET_YES);
hostmap
= GNUNET_CONTAINER_multipeermap_create (1024,
GNUNET_YES);