From 11130397a626a666cbb70fcabfa61bc5186028f4 Mon Sep 17 00:00:00 2001
From: Alexander Olofsson <alexander.olofsson@liu.se>
Date: Wed, 8 May 2019 14:03:47 +0200
Subject: [PATCH] Fix an assortment of connection issues

---
 lib/passwordstate/client.rb | 2 +-
 lib/passwordstate/util.rb   | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/passwordstate/client.rb b/lib/passwordstate/client.rb
index b59d341..c4ed1f7 100644
--- a/lib/passwordstate/client.rb
+++ b/lib/passwordstate/client.rb
@@ -18,7 +18,7 @@ module Passwordstate
       @headers = DEFAULT_HEADERS
       @auth_data = options.select { |k, _v| %i[apikey username password].include? k }
       @api_type = options.fetch(:api_type) if options.key? :api_type
-      @timeout = options.fetch(:timeout, 0)
+      @timeout = options.fetch(:timeout, 15)
     end
 
     def logger
diff --git a/lib/passwordstate/util.rb b/lib/passwordstate/util.rb
index bae79e3..46d8c3f 100644
--- a/lib/passwordstate/util.rb
+++ b/lib/passwordstate/util.rb
@@ -11,7 +11,9 @@ module Net
         password: password
       }
       @ntlm_auth_information[:domain] = domain unless domain.nil?
-      @ntlm_auth_options = {}
+      @ntlm_auth_options = {
+        ntlmv2: true
+      }
       @ntlm_auth_options[:workstation] = workstation unless workstation.nil?
     end
   end
@@ -59,7 +61,7 @@ module Passwordstate
 
       if challenge && res.code == '401'
         type2 = Net::NTLM::Message.decode64 challenge
-        type3 = type2.response(req.ntlm_auth_information, req.ntlm_auth_options)
+        type3 = type2.response(req.ntlm_auth_information, req.ntlm_auth_options.dup)
 
         req['authorization'] = 'NTLM ' + type3.encode64
         req.body_stream.rewind if req.body_stream
-- 
GitLab