gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 03/04: dht/client: (search-result) Raise more precise co


From: gnunet
Subject: [gnunet-scheme] 03/04: dht/client: (search-result) Raise more precise conditions.
Date: Fri, 21 Jan 2022 14:45:31 +0100

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 479a6e81a373c539c9182bb79e2e4095c658b947
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Fri Jan 21 13:09:34 2022 +0000

    dht/client: (search-result) Raise more precise conditions.
    
    * gnu/gnunet/dht/client.scm (datum->search-result): Set the 'what' in
      '&missing-capabilities' explicitely.
    * tests/distributed-hash-table.scm
      ("search-result get-path must be readable")
      ("search-result get-path must be readable"): New tests.
---
 gnu/gnunet/dht/client.scm        | 10 ++++++++--
 tests/distributed-hash-table.scm | 16 ++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/gnu/gnunet/dht/client.scm b/gnu/gnunet/dht/client.scm
index 5a95d48..5925c86 100644
--- a/gnu/gnunet/dht/client.scm
+++ b/gnu/gnunet/dht/client.scm
@@ -257,8 +257,14 @@ optional keyword arguments @code{get-path} and 
@code{put-path} are currently
 undocumented and untested."
           ;; TODO: get-path and put-path
           (%make (validate-datum datum)
-                 (and get-path (slice/read-only get-path))
-                 (and put-path (slice/read-only put-path)))))))
+                 (and get-path
+                      (begin
+                        (verify-slice-readable 'get-path get-path)
+                        (slice/read-only get-path)))
+                 (and put-path
+                      (begin
+                        (verify-slice-readable 'put-path put-path)
+                        (slice/read-only put-path))))))))
 
     (define (copy-search-result old)
       "Make a copy of the search result @var{old}, such that modifications to 
the
diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 54569fc..c588c82 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -295,4 +295,20 @@
   (list #false) ; TODO: drop 'list' when SRFI-64 bug is fixed
   (list (search-result-put-path (datum->search-result (make-a-datum)))))
 
+(test-missing-caps
+ "search-result get-path must be readable"
+ 'get-path
+ CAP_WRITE
+ CAP_READ
+ (datum->search-result
+  (make-a-datum) #:get-path (slice/write-only (make-slice/read-write 7))))
+
+(test-missing-caps
+ "search-result get-path must be readable"
+ 'put-path
+ CAP_WRITE
+ CAP_READ
+ (datum->search-result
+  (make-a-datum) #:put-path (slice/write-only (make-slice/read-write 7))))
+
 (test-end)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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