ZONEKEY = $SERVICEHOME/gns/zonekey.zkey
HIJACK_DNS = YES
AUTO_IMPORT_PKEY = YES
+AUTO_IMPORT_CONFIRMATION_REQ = NO
MAX_PARALLEL_BACKGROUND_QUERIES = 25
DEFAULT_LOOKUP_TIMEOUT = 10
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
unsigned long long max_parallel_bg_queries = 0;
unsigned long long default_lookup_timeout_secs = 0;
+ int ignore_pending = GNUNET_NO;
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
{&handle_shorten, NULL, GNUNET_MESSAGE_TYPE_GNS_SHORTEN, 0},
return;
}
- /**
- * handle to the dht
- */
- dht_handle = GNUNET_DHT_connect(c, 1); //FIXME get ht_len from cfg
-
- if (NULL == dht_handle)
- {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
- }
+
auto_import_pkey = GNUNET_NO;
}
if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_number(c, "gns",
+ GNUNET_CONFIGURATION_get_value_number (c, "gns",
"MAX_PARALLEL_BACKGROUND_QUERIES",
&max_parallel_bg_queries))
{
max_parallel_bg_queries);
}
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (c, "gns",
+ "AUTO_IMPORT_CONFIRMATION_REQ"))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ "Auto import requires user confirmation\n");
+ ignore_pending = GNUNET_YES;
+ }
+
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_number(c, "gns",
"DEFAULT_LOOKUP_TIMEOUT",
default_lookup_timeout_secs);
}
+ /**
+ * handle to the dht
+ */
+ dht_handle = GNUNET_DHT_connect(c,
+ max_parallel_bg_queries); //FIXME get ht_len from cfg
+
+ if (NULL == dht_handle)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
+ }
+
if (gns_resolver_init(namestore_handle, dht_handle, zone_hash,
- max_parallel_bg_queries)
+ max_parallel_bg_queries,
+ ignore_pending)
== GNUNET_SYSERR)
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
*/
static unsigned long long max_allowed_background_queries;
+/**
+ * Wheather or not to ignore pending records
+ */
+static int ignore_pending_records;
+
/**
* Our local zone
*/
GNUNET_NAMESTORE_lookup_record(namestore_handle,
&gph->zone,
gph->new_name,
- GNUNET_GNS_RECORD_PSEU,
+ GNUNET_NAMESTORE_TYPE_ANY,
&process_pseu_lookup_ns,
gph);
return;
* @param dh the dht handle
* @param lz the local zone's hash
* @param max_bg_queries maximum number of parallel background queries in dht
+ * @param ignore_pending ignore records that still require user confirmation
+ * on lookup
* @return GNUNET_OK on success
*/
int
gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
struct GNUNET_DHT_Handle *dh,
struct GNUNET_CRYPTO_ShortHashCode lz,
- unsigned long long max_bg_queries)
+ unsigned long long max_bg_queries,
+ int ignore_pending)
{
namestore_handle = nh;
dht_handle = dh;
dht_lookup_heap =
GNUNET_CONTAINER_heap_create(GNUNET_CONTAINER_HEAP_ORDER_MIN);
max_allowed_background_queries = max_bg_queries;
+ ignore_pending_records = ignore_pending;
if ((namestore_handle != NULL) && (dht_handle != NULL))
{
if (rd[i].record_type != rlh->record_type)
continue;
+
+ if (ignore_pending_records &&
+ (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING))
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_REC-%d: Record %s is awaiting user confirmation. Skipping\n",
+ rh->id, name);
+ continue;
+ }
if ((GNUNET_TIME_absolute_get_remaining (rd[i].expiration)).rel_value
== 0)
if (rd[i].record_type != GNUNET_GNS_RECORD_PKEY)
continue;
- if (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING)
+ if (ignore_pending_records &&
+ (rd[i].flags & GNUNET_NAMESTORE_RF_PENDING))
{
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_PHASE_DELEGATE_NS-%llu: PKEY for %s is pending user confirmation.\n",
* @param dh handle to the dht
* @param lz the local zone
* @param max_bg_queries maximum amount of background queries
+ * @param ignore_pending ignore records that still require user confirmation
+ * on lookup
* @returns GNUNET_OK on success
*/
int
gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
struct GNUNET_DHT_Handle *dh,
struct GNUNET_CRYPTO_ShortHashCode lz,
- unsigned long long max_bg_queries);
+ unsigned long long max_bg_queries,
+ int ignore_pending);
/**
* Cleanup resolver: Terminate pending lookups