aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2013-10-20 13:58:13 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2013-10-20 13:58:13 +0000
commitd3bd2e886f118d4cc94f7f2861f7107f1f5ebecf (patch)
tree24f498ae839aeef22275b6a496668d19c6dabc8d /src
parent3284f66514d28551172f9e589ca4a57a7194c4b1 (diff)
-trying to implement revocation
git-svn-id: https://gnunet.org/svn/gnunet@30357 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src')
-rw-r--r--src/gns/Makefile.am2
-rw-r--r--src/gns/gnunet-service-gns_resolver.c61
2 files changed, 62 insertions, 1 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index d2dc3179e5..c96f4969c8 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -159,6 +159,7 @@ gnunet_service_gns_SOURCES = \
gnunet_service_gns_LDADD = \
-lm \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/revocation/libgnunetrevocation.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/dns/libgnunetdns.la \
@@ -171,6 +172,7 @@ gnunet_service_gns_LDADD = \
$(GN_LIBINTL)
gnunet_service_gns_DEPENDENCIES = \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/revocation/libgnunetrevocation.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/dns/libgnunetdns.la \
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index e4f5be6f00..4f4875a441 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -39,6 +39,7 @@
#include "gnunet_namestore_service.h"
#include "gnunet_dns_service.h"
#include "gnunet_resolver_service.h"
+#include "gnunet_revocation_service.h"
#include "gnunet_dnsparser_lib.h"
#include "gnunet_gns_service.h"
#include "gns.h"
@@ -270,6 +271,11 @@ struct GNS_ResolverHandle
struct GNUNET_NAMECACHE_QueueEntry *namecache_qe;
/**
+ * Pending revocation check.
+ */
+ struct GNUNET_REVOCATION_Query *rev_check;
+
+ /**
* Heap node associated with this lookup. Used to limit number of
* concurrent requests.
*/
@@ -1890,6 +1896,54 @@ recursive_gns_resolution_namestore (struct GNS_ResolverHandle *rh)
/**
+ * Function called with the result from a revocation check.
+ *
+ * @param cls the `struct GNS_ResovlerHandle`
+ * @param is_valid #GNUNET_YES if the zone was not yet revoked
+ */
+static void
+handle_revocation_result (void *cls,
+ int is_valid)
+{
+ struct GNS_ResolverHandle *rh = cls;
+ struct AuthorityChain *ac = rh->ac_tail;
+
+ rh->rev_check = NULL;
+ if (GNUNET_YES != is_valid)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Zone %s was revoked, resolution fails\n"),
+ GNUNET_GNSRECORD_z2s (&ac->authority_info.gns_authority));
+ rh->proc (rh->proc_cls, 0, NULL);
+ GNS_resolver_lookup_cancel (rh);
+ return;
+ }
+ recursive_gns_resolution_namestore (rh);
+}
+
+
+/**
+ * Perform revocation check on tail of our authority chain.
+ *
+ * @param rh query we are processing
+ */
+static void
+recursive_gns_resolution_revocation (struct GNS_ResolverHandle *rh)
+{
+ struct AuthorityChain *ac = rh->ac_tail;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Starting revocation check for zone %s\n",
+ GNUNET_GNSRECORD_z2s (&ac->authority_info.gns_authority));
+ rh->rev_check = GNUNET_REVOCATION_query (cfg,
+ &ac->authority_info.gns_authority,
+ &handle_revocation_result,
+ rh);
+ GNUNET_assert (NULL != rh->rev_check);
+}
+
+
+/**
* Task scheduled to continue with the resolution process.
*
* @param cls the `struct GNS_ResolverHandle` of the resolution
@@ -1912,7 +1966,7 @@ recursive_resolution (void *cls,
return;
}
if (GNUNET_YES == rh->ac_tail->gns_authority)
- recursive_gns_resolution_namestore (rh);
+ recursive_gns_resolution_revocation (rh);
else
recursive_dns_resolution (rh);
}
@@ -2112,6 +2166,11 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh)
GNUNET_NAMECACHE_cancel (rh->namecache_qe);
rh->namecache_qe = NULL;
}
+ if (NULL != rh->rev_check)
+ {
+ GNUNET_REVOCATION_query_cancel (rh->rev_check);
+ rh->rev_check = NULL;
+ }
if (NULL != rh->std_resolve)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,