/*
This file is part of GNUnet.
- (C) 2009, 2010 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 2010 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
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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
{
ir = GNUNET_CONTAINER_multihashmap_get (ifm,
&ii->file_id);
+ GNUNET_assert (NULL != ir);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_
("Index request received for file `%s' is already indexed as `%s'. Permitting anyway.\n"),
ii->filename,
- ir->filename);
+ ir->filename);
GNUNET_SERVER_transmit_context_append_data (ii->tc, NULL, 0,
GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK);
GNUNET_SERVER_transmit_context_run (ii->tc, GNUNET_TIME_UNIT_MINUTES);
* @param msg error message
*/
static void
-remove_cont (void *cls, int success,
+remove_cont (void *cls, int success,
struct GNUNET_TIME_Absolute min_expiration,
const char *msg)
{
{
const struct OnDemandBlock *odb;
struct GNUNET_HashCode nkey;
- struct GNUNET_CRYPTO_AesSessionKey skey;
- struct GNUNET_CRYPTO_AesInitializationVector iv;
+ struct GNUNET_CRYPTO_SymmetricSessionKey skey;
+ struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
struct GNUNET_HashCode query;
ssize_t nsize;
char ndata[DBLOCK_SIZE];
{
GNUNET_break (0);
GNUNET_DATASTORE_remove (dsh, key, size, data, -1, -1,
- GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL);
+ &remove_cont, NULL);
return GNUNET_SYSERR;
}
odb = (const struct OnDemandBlock *) data;
off = GNUNET_ntohll (odb->offset);
ii = GNUNET_CONTAINER_multihashmap_get (ifm, &odb->file_id);
+ if (NULL == ii)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
fn = ii->filename;
if ((NULL == fn) || (0 != ACCESS (fn, R_OK)))
{
("# index blocks removed: original file inaccessible"),
1, GNUNET_YES);
GNUNET_DATASTORE_remove (dsh, key, size, data, -1, -1,
- GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL);
+ &remove_cont, NULL);
return GNUNET_SYSERR;
}
if ((NULL ==
if (fh != NULL)
GNUNET_DISK_file_close (fh);
GNUNET_DATASTORE_remove (dsh, key, size, data, -1, -1,
- GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL);
+ &remove_cont, NULL);
return GNUNET_SYSERR;
}
GNUNET_DISK_file_close (fh);
GNUNET_CRYPTO_hash (ndata, nsize, &nkey);
GNUNET_CRYPTO_hash_to_aes_key (&nkey, &skey, &iv);
- GNUNET_CRYPTO_aes_encrypt (ndata, nsize, &skey, &iv, edata);
+ GNUNET_CRYPTO_symmetric_encrypt (ndata, nsize, &skey, &iv, edata);
GNUNET_CRYPTO_hash (edata, nsize, &query);
if (0 != memcmp (&query, key, sizeof (struct GNUNET_HashCode)))
{
_("Indexed file `%s' changed at offset %llu\n"), fn,
(unsigned long long) off);
GNUNET_DATASTORE_remove (dsh, key, size, data, -1, -1,
- GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL);
+ &remove_cont, NULL);
return GNUNET_SYSERR;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,