This file is part of GNUnet.
Copyright (C) 2009-2013 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,
+ 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
- General Public License for more details.
-
- 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.
+ Affero General Public License for more details.
*/
/**
GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd)
{
- unsigned int c;
- unsigned int c2;
struct GNUNET_TIME_Absolute expire;
struct GNUNET_TIME_Absolute at;
struct GNUNET_TIME_Relative rt;
if (NULL == rd)
return GNUNET_TIME_UNIT_ZERO_ABS;
expire = GNUNET_TIME_UNIT_FOREVER_ABS;
- for (c = 0; c < rd_count; c++)
+ for (unsigned int c = 0; c < rd_count; c++)
{
if (0 != (rd[c].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
{
at.abs_value_us = rd[c].expiration_time;
}
- for (c2 = 0; c2 < rd_count; c2++)
+ for (unsigned int c2 = 0; c2 < rd_count; c2++)
{
/* Check for shadow record */
- if ((c == c2) ||
- (rd[c].record_type != rd[c2].record_type) ||
- (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)))
+ if ( (c == c2) ||
+ (rd[c].record_type != rd[c2].record_type) ||
+ (0 == (rd[c2].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) )
continue;
/* We have a shadow record */
if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
{
at_shadow.abs_value_us = rd[c2].expiration_time;
}
- at = GNUNET_TIME_absolute_max (at, at_shadow);
+ at = GNUNET_TIME_absolute_max (at,
+ at_shadow);
}
- expire = GNUNET_TIME_absolute_min (at, expire);
+ expire = GNUNET_TIME_absolute_min (at,
+ expire);
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Determined expiration time for block with %u records to be %s\n",
pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey);
GNUNET_snprintf (ret,
sizeof (ret),
- "%s.zkey",
+ "%s",
pkeys);
GNUNET_free (pkeys);
return ret;
/**
- * Convert an absolute domain name in the ".zkey" pTLD to the
+ * Convert an absolute domain name to the
* respective public key.
*
- * @param zkey string "X.zkey" where X is the coordinates of the public
+ * @param zkey string encoding the coordinates of the public
* key in an encoding suitable for DNS labels.
* @param pkey set to a public key on the eliptic curve
* @return #GNUNET_SYSERR if @a zkey has the wrong syntax
GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
{
- char *cpy;
- char *dot;
- const char *x;
-
- cpy = GNUNET_strdup (zkey);
- x = cpy;
- if (NULL == (dot = strchr (x, (int) '.')))
- goto error;
- *dot = '\0';
- if (0 != strcasecmp (dot + 1,
- "zkey"))
- goto error;
-
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (x,
- strlen (x),
- pkey))
- goto error;
- GNUNET_free (cpy);
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey,
+ strlen (zkey),
+ pkey))
+ return GNUNET_SYSERR;
return GNUNET_OK;
- error:
- GNUNET_free (cpy);
- return GNUNET_SYSERR;
}