struct sockaddr *addr;
socklen_t len;
- fd = dup (GNUNET_NETWORK_get_fd (h));
+ fd = GNUNET_NETWORK_get_fd (h);
addr = GNUNET_NETWORK_get_addr (h);
len = GNUNET_NETWORK_get_addrlen (h);
mhd_unix_sock_addr.sun_family = AF_UNIX;
strcpy (mhd_unix_sock_addr.sun_path, proxy_sockfile);
- unlink (proxy_sockfile);
+ if (0 != unlink (proxy_sockfile))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to unlink sockfile!\n");
+ return;
+ }
+
len = strlen (proxy_sockfile) + sizeof(AF_UNIX);
GNUNET_free (proxy_sockfile);
{
GNUNET_GNS_get_authority(gns, auth_name, &process_auth_result, auth_name);
}
+
+ GNUNET_CRYPTO_rsa_key_free (shorten_key);
// FIXME: do work here...
//GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
char* tok;
ndup = GNUNET_strdup (name);
- tok = strtok (ndup, ".");
+ strtok (ndup, ".");
for (tok = strtok (NULL, "."); tok != NULL; tok = strtok (NULL, "."))
{
strcpy (nsh->result, result);
}
- if (0 != strcmp (nsh->private_zone_name, ""))
+ if (NULL != nsh->private_zone)
{
/* backtrack authorities for names in priv zone */
rh->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle,
&process_zone_to_name_shorten_private,
rh);
}
- else if (0 != strcmp (nsh->shorten_zone_name, ""))
+ else if (NULL != nsh->shorten_zone)
{
/* backtrack authorities for names in shorten zone */
rh->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle,
strcpy (nsh->result, result);
}
- else if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
- nsh->private_zone) == 0)
+ else if (NULL != nsh->private_zone)
{
/**
* This is our zone append .gnunet unless name is empty
* (it shouldn't be, usually FIXME what happens if we
* shorten to our zone to a "" record??)
*/
- if (0 != strcmp (nsh->private_zone_name, ""))
+ if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
+ nsh->private_zone) == 0)
{
sprintf (result, "%s.%s.%s",
strcpy (nsh->result, result);
}
}
- else if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
- nsh->shorten_zone) == 0)
+ else if (NULL != nsh->shorten_zone)
{
/**
* This is our zone append .gnunet unless name is empty
* (it shouldn't be, usually FIXME what happens if we
* shorten to our zone to a "" record??)
*/
- if (0 != strcmp (nsh->shorten_zone_name, ""))
+ if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
+ nsh->shorten_zone) == 0)
{
sprintf (result, "%s.%s.%s",
rh->name, nsh->private_zone_name, GNUNET_GNS_TLD);
{
int i;
char* string_val;
- const char* typename;
if (rd_count == 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
for (i=0; i<rd_count; i++)
{
- typename = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type);
string_val = GNUNET_NAMESTORE_value_to_string(rd[i].record_type,
rd[i].data,
rd[i].data_size);
const struct GNUNET_CONFIGURATION_Handle *cfg;
+struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded priv_pkey;
+struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded short_pkey;
+struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
+struct GNUNET_CRYPTO_RsaPrivateKey *short_key;
+
+struct GNUNET_CRYPTO_ShortHashCode priv_zone;
+struct GNUNET_CRYPTO_ShortHashCode short_zone;
+
/**
* Check whether peers successfully shut down.
*/
return;
}
- GNUNET_GNS_shorten(gns_handle, TEST_DOMAIN, &process_shorten_result,
+ GNUNET_GNS_shorten(gns_handle, TEST_DOMAIN,
+ &priv_zone,
+ &short_zone,
+ &process_shorten_result,
TEST_DOMAIN);
}
struct GNUNET_CRYPTO_ShortHashCode alice_hash;
struct GNUNET_CRYPTO_RsaSignature *sig;
char* our_keyfile;
+ char* private_keyfile;
+ char* shorten_keyfile;
cfg = _cfg;
ok = -1;
return;
}
+
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
+ "SHORTEN_ZONEKEY",
+ &shorten_keyfile))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+ "Failed to get shorten zone key from cfg\n");
+ ok = -1;
+ return;
+ }
+
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
+ "PRIVATE_ZONEKEY",
+ &private_keyfile))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+ "Failed to get private zone key from cfg\n");
+ ok = -1;
+ return;
+ }
our_key = GNUNET_CRYPTO_rsa_key_create_from_file (our_keyfile);
GNUNET_free(our_keyfile);
bob_key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE_BOB);
alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE_ALICE);
+ priv_key = GNUNET_CRYPTO_rsa_key_create_from_file (private_keyfile);
+ short_key = GNUNET_CRYPTO_rsa_key_create_from_file (shorten_keyfile);
+
+ GNUNET_free(shorten_keyfile);
+ GNUNET_free(private_keyfile);
GNUNET_CRYPTO_rsa_key_get_public (our_key, &our_pkey);
GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey);
+ GNUNET_CRYPTO_rsa_key_get_public (priv_key, &priv_pkey);
+ GNUNET_CRYPTO_rsa_key_get_public (short_key, &short_pkey);
+
+ GNUNET_CRYPTO_short_hash(&priv_pkey, sizeof(priv_pkey), &priv_zone);
+ GNUNET_CRYPTO_short_hash(&short_pkey, sizeof(short_pkey), &short_zone);
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
GNUNET_CRYPTO_rsa_key_free(our_key);
GNUNET_CRYPTO_rsa_key_free(bob_key);
GNUNET_CRYPTO_rsa_key_free(alice_key);
+ GNUNET_CRYPTO_rsa_key_free(priv_key);
+ GNUNET_CRYPTO_rsa_key_free(short_key);
}
static void