gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29473 - in gnunet/src: block gns include


From: gnunet
Subject: [GNUnet-SVN] r29473 - in gnunet/src: block gns include
Date: Mon, 23 Sep 2013 10:29:19 +0200

Author: grothoff
Date: 2013-09-23 10:29:18 +0200 (Mon, 23 Sep 2013)
New Revision: 29473

Modified:
   gnunet/src/block/plugin_block_test.c
   gnunet/src/gns/gnunet-gns-proxy.c
   gnunet/src/include/gnunet_block_lib.h
Log:
-doxygen

Modified: gnunet/src/block/plugin_block_test.c
===================================================================
--- gnunet/src/block/plugin_block_test.c        2013-09-22 19:18:15 UTC (rev 
29472)
+++ gnunet/src/block/plugin_block_test.c        2013-09-23 08:29:18 UTC (rev 
29473)
@@ -43,11 +43,11 @@
  * @param type block type
  * @param query original query (hash)
  * @param bf pointer to bloom filter associated with query; possibly updated 
(!)
- * @param bf_mutator mutation value for bf
+ * @param bf_mutator mutation value for @a bf
  * @param xquery extrended query data (can be NULL, depending on type)
- * @param xquery_size number of bytes in xquery
+ * @param xquery_size number of bytes in @a xquery
  * @param reply_block response to validate
- * @param reply_block_size number of bytes in reply block
+ * @param reply_block_size number of bytes in @a reply_block
  * @return characterization of result
  */
 static enum GNUNET_BLOCK_EvaluationResult
@@ -96,7 +96,7 @@
  * @param cls closure
  * @param type block type
  * @param block block to get the key for
- * @param block_size number of bytes in block
+ * @param block_size number of bytes in @a block
  * @param key set to the key (query) for the given block
  * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)

Modified: gnunet/src/gns/gnunet-gns-proxy.c
===================================================================
--- gnunet/src/gns/gnunet-gns-proxy.c   2013-09-22 19:18:15 UTC (rev 29472)
+++ gnunet/src/gns/gnunet-gns-proxy.c   2013-09-23 08:29:18 UTC (rev 29473)
@@ -791,33 +791,42 @@
 static int
 check_ssl_certificate (struct Socks5Request *s5r)
 {
+  unsigned int i;
   union {
-    struct curl_slist    *to_info;
-    struct curl_certinfo *to_certinfo;
-  } ptr;
-  int i;
-  struct curl_slist *slist;
-  
-  ptr.to_info = NULL;  
+    gnutls_session session;
+    struct curl_slist    * to_slist;
+  } gptr;
+  unsigned int cert_list_size; 
+  const gnutls_datum *chainp;
+
+  gptr.to_slist = NULL;  
   if (CURLE_OK != 
       curl_easy_getinfo (s5r->curl, 
-                        CURLINFO_CERTINFO, 
-                        &ptr.to_info))
+                        CURLINFO_GNUTLS_SESSION, 
+                        &gptr))
     return GNUNET_SYSERR;
-  /* FIXME: for now, we just output the certs to stderr, we should
-     check them against LEHO / TLSA record information here! (#3038) */
-  if(NULL != ptr.to_info) 
-  {     
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-               "Got %d certs!\n", 
-               ptr.to_certinfo->num_of_certs);      
-    for (i = 0; i < ptr.to_certinfo->num_of_certs; i++) 
-    {    
-      for (slist = ptr.to_certinfo->certinfo[i]; NULL != slist; slist = 
slist->next)
+
+  chainp = gnutls_certificate_get_peers(gptr.session, &cert_list_size);
+  if(!chainp)
+    return GNUNET_SYSERR;
+
+  for(i=0;i<cert_list_size;i++) {
+    gnutls_x509_crt_t cert;
+    gnutls_datum_t dn;
+
+    if(GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&cert)) {
+      if((GNUTLS_E_SUCCESS ==
+         gnutls_x509_crt_import (cert, &chainp[i],
+                                 GNUTLS_X509_FMT_DER)) &&
+        (GNUTLS_E_SUCCESS ==
+         gnutls_x509_crt_print (cert,
+                                GNUTLS_CRT_PRINT_FULL,
+                                &dn))) {
        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                   "Certificate #%d: %s\n",
-                   i,
-                   slist->data);       
+                   "Certificate #%d: %.*s", i, dn.size, dn.data);
+       gnutls_free (dn.data);
+        gnutls_x509_crt_deinit (cert);
+      }
     }
   }
   return GNUNET_OK;

Modified: gnunet/src/include/gnunet_block_lib.h
===================================================================
--- gnunet/src/include/gnunet_block_lib.h       2013-09-22 19:18:15 UTC (rev 
29472)
+++ gnunet/src/include/gnunet_block_lib.h       2013-09-23 08:29:18 UTC (rev 
29473)
@@ -52,9 +52,9 @@
    */
   GNUNET_BLOCK_TYPE_FS_DBLOCK = 1,
 
-    /**
-     * Inner block in the CHK tree.
-     */
+  /**
+   * Inner block in the CHK tree.
+   */
   GNUNET_BLOCK_TYPE_FS_IBLOCK = 2,
 
   /**
@@ -128,46 +128,46 @@
  */
 enum GNUNET_BLOCK_EvaluationResult
 {
-    /**
-     * Valid result, and there may be more.
-     */
+  /**
+   * Valid result, and there may be more.
+   */
   GNUNET_BLOCK_EVALUATION_OK_MORE = 0,
-
-    /**
-     * Last possible valid result.
-     */
+  
+  /**
+   * Last possible valid result.
+   */
   GNUNET_BLOCK_EVALUATION_OK_LAST = 1,
 
-    /**
-     * Valid result, but suppressed because it is a duplicate.
-     */
+  /**
+   * Valid result, but suppressed because it is a duplicate.
+   */
   GNUNET_BLOCK_EVALUATION_OK_DUPLICATE = 2,
 
-    /**
-     * Block does not match query (invalid result)
-     */
+  /**
+   * Block does not match query (invalid result)
+   */
   GNUNET_BLOCK_EVALUATION_RESULT_INVALID = 3,
 
-    /**
-     * Block does not match xquery (valid result, not relevant for the request)
-     */
+  /**
+   * Block does not match xquery (valid result, not relevant for the request)
+   */
   GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT = 4,
 
-    /**
-     * Query is valid, no reply given.
-     */
+  /**
+   * Query is valid, no reply given.
+   */
   GNUNET_BLOCK_EVALUATION_REQUEST_VALID = 10,
 
-    /**
-     * Query format does not match block type (invalid query).  For
-     * example, xquery not given or xquery_size not appropriate for
-     * type.
-     */
+  /**
+   * Query format does not match block type (invalid query).  For
+   * example, xquery not given or xquery_size not appropriate for
+   * type.
+   */
   GNUNET_BLOCK_EVALUATION_REQUEST_INVALID = 11,
 
-    /**
-     * Specified block type not supported by this plugin.
-     */
+  /**
+   * Specified block type not supported by this plugin.
+   */
   GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED = 20
 };
 
@@ -220,11 +220,11 @@
  * @param type block type
  * @param query original query (hash)
  * @param bf pointer to bloom filter associated with query; possibly updated 
(!)
- * @param bf_mutator mutation value for bf
+ * @param bf_mutator mutation value for @a bf
  * @param xquery extrended query data (can be NULL, depending on type)
- * @param xquery_size number of bytes in xquery
+ * @param xquery_size number of bytes in @a xquery
  * @param reply_block response to validate
- * @param reply_block_size number of bytes in reply block
+ * @param reply_block_size number of bytes in @a reply_block
  * @return characterization of result
  */
 enum GNUNET_BLOCK_EvaluationResult
@@ -243,11 +243,11 @@
  * @param ctx block context
  * @param type block type
  * @param block block to get the key for
- * @param block_size number of bytes in block
+ * @param block_size number of bytes in @a block
  * @param key set to the key (query) for the given block
- * @return GNUNET_YES on success,
- *         GNUNET_NO if the block is malformed
- *         GNUNET_SYSERR if type not supported
+ * @return #GNUNET_YES on success,
+ *         #GNUNET_NO if the block is malformed
+ *         #GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)
  */
 int
@@ -263,7 +263,7 @@
  *
  * @param bf_mutator mutation value to use
  * @param seen_results results already seen
- * @param seen_results_count number of entries in 'seen_results'
+ * @param seen_results_count number of entries in @a seen_results
  * @return NULL if seen_results_count is 0, otherwise a BF
  *         that would match the given results.
  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]