* [sup-devel] [PATCH] Add hook gpg-args to allow the user to add/remove flags
@ 2010-02-17 22:30 Michael Stapelberg
2010-02-27 8:37 ` Rich Lane
0 siblings, 1 reply; 2+ messages in thread
From: Michael Stapelberg @ 2010-02-17 22:30 UTC (permalink / raw)
To: sup-devel
[-- Attachment #1: Type: text/plain, Size: 501 bytes --]
Hi,
attached you find a patch allowing the user to add/remove flags before running
GPG. This is useful for specifying "--trust-model always" only for certain
GPG calls without introducing a whole bunch of new configuration options.
An example hook (which will add the ability to send encrypted email to
people to whom you have no trust relation):
if args =~ /--encrypt/
"--trust-model always #{args}"
else
args
end
Please merge this patch for the next release
Best regards,
Michael
[-- Attachment #2: 0001-Add-hook-gpg-args-to-allow-the-user-to-add-remove-fl.patch --]
[-- Type: application/octet-stream, Size: 1551 bytes --]
From 42e922fab4b1c20df042f01324fc276cb2452571 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Wed, 17 Feb 2010 23:24:26 +0100
Subject: [PATCH] Add hook gpg-args to allow the user to add/remove flags
This is useful for specifying --trust-model always only for certain
GPG calls without introducing a whole bunch of new configuration options.
An example hook (which will add the ability to send encrypted email to
people to whom you have no trust relation):
if args =~ /--encrypt/
"--trust-model always #{args}"
else
args
end
---
lib/sup/crypto.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 4f75936..abbcb98 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -11,6 +11,17 @@ class CryptoManager
[:encrypt, "Encrypt only"]
)
+ HookManager.register "gpg-args", <<EOS
+Runs before gpg is executed, allowing you to modify the arguments (most
+likely you would want to add something to certain commands, like
+--trust-model always to signing/encrypting a message, but who knows).
+
+Variables:
+args: arguments for running GPG
+
+Return value: the arguments for running GPG
+EOS
+
def initialize
@mutex = Mutex.new
@@ -198,6 +209,7 @@ private
end
def run_gpg args, opts={}
+ args = HookManager.run("gpg-args", { :args => args }) || args
cmd = "#{@cmd} #{args}"
if opts[:interactive] && BufferManager.instantiated?
output_fn = Tempfile.new "redwood.output"
--
1.6.5
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-devel] [PATCH] Add hook gpg-args to allow the user to add/remove flags
2010-02-17 22:30 [sup-devel] [PATCH] Add hook gpg-args to allow the user to add/remove flags Michael Stapelberg
@ 2010-02-27 8:37 ` Rich Lane
0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-02-27 8:37 UTC (permalink / raw)
To: Michael Stapelberg; +Cc: sup-devel
Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-27 8:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-17 22:30 [sup-devel] [PATCH] Add hook gpg-args to allow the user to add/remove flags Michael Stapelberg
2010-02-27 8:37 ` Rich Lane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox