[Libguestfs] [PATCH 08/10] builder: expose Sigchecker.verifying_signatures

Pino Toscano
Tue, 28 Jul 2015 09:24:48 -0000

Useful to know whether a Sigchecker instance is verifying signatures,
hence it is possible to decide whether download signed content or not.
---
 builder/sigchecker.ml  | 3 +++
 builder/sigchecker.mli | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index 06c60ae..86e60ac 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -163,6 +163,9 @@ and getxdigit = function
   | 'A'..'F' as c -> Some (Char.code c - Char.code
'A')
   | _ -> None

+let verifying_signatures t +  t.check_signature
+
 let rec verify t filename    if t.check_signature then (
     let args = quote filename in
diff --git a/builder/sigchecker.mli b/builder/sigchecker.mli
index 47bf2a3..f233514 100644
--- a/builder/sigchecker.mli
+++ b/builder/sigchecker.mli
@@ -20,6 +20,10 @@ type t

 val create : gpg:string -> gpgkey:Utils.gpgkey_type ->
check_signature:bool -> t

+val verifying_signatures : t -> bool
+(** Return whether signatures are being verified by this
+    Sigchecker.t. *)
+
 val verify : t -> string -> unit
 (** Verify the file is signed (if check_signature is true). *)

--
2.1.0