From e9f17216780cc658b2e867326b0bd65eb8052ca1 Mon Sep 17 00:00:00 2001 From: Bryce Chidester Date: Mon, 30 Apr 2018 15:05:06 -0700 Subject: [PATCH] http backend: Parse the correct argument when loading --tls-client-cert Previously, the function read from ARGV[1] (hardcoded) rather than the value passed to it, the command-line argument as it exists in globalOptions. Resolves #1745 --- changelog/unreleased/pull-1746 | 7 +++++++ internal/backend/http_transport.go | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/pull-1746 diff --git a/changelog/unreleased/pull-1746 b/changelog/unreleased/pull-1746 new file mode 100644 index 000000000..c909c9c80 --- /dev/null +++ b/changelog/unreleased/pull-1746 @@ -0,0 +1,7 @@ +Bugfix: Correctly parse the argument to --tls-client-cert + +Previously, the --tls-client-cert method attempt to read ARGV[1] (hardcoded) +instead of the argument that was passed to it. This has been corrected. + +https://github.com/restic/restic/issues/1745 +https://github.com/restic/restic/pull/1746 diff --git a/internal/backend/http_transport.go b/internal/backend/http_transport.go index 324874c63..30d25ba78 100644 --- a/internal/backend/http_transport.go +++ b/internal/backend/http_transport.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "net" "net/http" - "os" "strings" "time" @@ -28,7 +27,7 @@ type TransportOptions struct { // readPEMCertKey reads a file and returns the PEM encoded certificate and key // blocks. func readPEMCertKey(filename string) (certs []byte, key []byte, err error) { - data, err := ioutil.ReadFile(os.Args[1]) + data, err := ioutil.ReadFile(filename) if err != nil { return nil, nil, errors.Wrap(err, "ReadFile") }