summaryrefslogtreecommitdiff
path: root/vendor/github.com/mtrmac/gpgme/unset_agent_info.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-02-03 16:09:04 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-02-05 09:55:50 +0100
commit801977b40d8500ff68cf5a6facd82f035735076a (patch)
tree3e67e319511dce7b84a6ab16dfa8ecc3d8ec5e7a /vendor/github.com/mtrmac/gpgme/unset_agent_info.go
parent5092c078ec635c9f1598989b27ccf53369b3cf2b (diff)
downloadpodman-801977b40d8500ff68cf5a6facd82f035735076a.tar.gz
podman-801977b40d8500ff68cf5a6facd82f035735076a.tar.bz2
podman-801977b40d8500ff68cf5a6facd82f035735076a.zip
vendor github.com/containers/image/v5@v5.2.0
See release notes: https://github.com/containers/image/releases/tag/v5.2.0 Fixes: #4877 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/mtrmac/gpgme/unset_agent_info.go')
-rw-r--r--vendor/github.com/mtrmac/gpgme/unset_agent_info.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/mtrmac/gpgme/unset_agent_info.go b/vendor/github.com/mtrmac/gpgme/unset_agent_info.go
new file mode 100644
index 000000000..986aca59f
--- /dev/null
+++ b/vendor/github.com/mtrmac/gpgme/unset_agent_info.go
@@ -0,0 +1,18 @@
+// +build !windows
+
+package gpgme
+
+// #include <stdlib.h>
+import "C"
+import (
+ "unsafe"
+)
+
+// This is somewhat of a horrible hack. We need to unset GPG_AGENT_INFO so that gpgme does not pass --use-agent to GPG.
+// os.Unsetenv should be enough, but that only calls the underlying C library (which gpgme uses) if cgo is involved
+// - and cgo can't be used in tests. So, provide this helper for test initialization.
+func unsetenvGPGAgentInfo() {
+ v := C.CString("GPG_AGENT_INFO")
+ defer C.free(unsafe.Pointer(v))
+ C.unsetenv(v)
+}