winrm 1.0.0rc2 → 1.0.0rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/winrm/http/transport.rb +14 -5
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0rc2
1
+ 1.0.0rc3
@@ -73,7 +73,7 @@ module WinRM
73
73
 
74
74
  def send_request(msg)
75
75
  original_length = msg.length
76
- emsg = winrm_encrypt(msg)
76
+ pad_len, emsg = winrm_encrypt(msg)
77
77
  hdr = {
78
78
  "Connection" => "Keep-Alive",
79
79
  "Content-Type" => "multipart/encrypted;protocol=\"application/HTTP-Kerberos-session-encrypted\";boundary=\"Encrypted Boundary\""
@@ -82,7 +82,7 @@ module WinRM
82
82
  body = <<-EOF
83
83
  --Encrypted Boundary\r
84
84
  Content-Type: application/HTTP-Kerberos-session-encrypted\r
85
- OriginalContent: type=application/soap+xml;charset=UTF-8;Length=#{original_length}\r
85
+ OriginalContent: type=application/soap+xml;charset=UTF-8;Length=#{original_length + pad_len}\r
86
86
  --Encrypted Boundary\r
87
87
  Content-Type: application/octet-stream\r
88
88
  #{emsg}--Encrypted Boundary\r
@@ -115,7 +115,7 @@ Content-Type: application/octet-stream\r
115
115
 
116
116
  # @return [String] the encrypted request string
117
117
  def winrm_encrypt(str)
118
- iov_cnt = 2
118
+ iov_cnt = 3
119
119
  iov = FFI::MemoryPointer.new(GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * iov_cnt)
120
120
 
121
121
  iov0 = GSSAPI::LibGSSAPI::GssIOVBufferDesc.new(FFI::Pointer.new(iov.address))
@@ -125,20 +125,26 @@ Content-Type: application/octet-stream\r
125
125
  iov1[:type] = (GSSAPI::LibGSSAPI::GSS_IOV_BUFFER_TYPE_DATA)
126
126
  iov1[:buffer].value = str
127
127
 
128
+ iov2 = GSSAPI::LibGSSAPI::GssIOVBufferDesc.new(FFI::Pointer.new(iov.address + (GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * 2)))
129
+ iov2[:type] = (GSSAPI::LibGSSAPI::GSS_IOV_BUFFER_TYPE_PADDING | GSSAPI::LibGSSAPI::GSS_IOV_BUFFER_FLAG_ALLOCATE)
130
+
128
131
  conf_state = FFI::MemoryPointer.new :uint32
129
132
  min_stat = FFI::MemoryPointer.new :uint32
130
133
 
131
- maj_stat = GSSAPI::LibGSSAPI.gss_wrap_iov(min_stat, @gsscli.context, 1, 0, conf_state, iov, iov_cnt)
134
+ maj_stat = GSSAPI::LibGSSAPI.gss_wrap_iov(min_stat, @gsscli.context, 1, GSSAPI::LibGSSAPI::GSS_C_QOP_DEFAULT, conf_state, iov, iov_cnt)
132
135
 
133
136
  token = [iov0[:buffer].length].pack('L')
134
137
  token += iov0[:buffer].value
135
138
  token += iov1[:buffer].value
139
+ pad_len = iov2[:buffer].length
140
+ token += iov2[:buffer].value if pad_len > 0
141
+ [pad_len, token]
136
142
  end
137
143
 
138
144
 
139
145
  # @return [String] the unencrypted response string
140
146
  def winrm_decrypt(str)
141
- iov_cnt = 2
147
+ iov_cnt = 3
142
148
  iov = FFI::MemoryPointer.new(GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * iov_cnt)
143
149
 
144
150
  iov0 = GSSAPI::LibGSSAPI::GssIOVBufferDesc.new(FFI::Pointer.new(iov.address))
@@ -147,6 +153,9 @@ Content-Type: application/octet-stream\r
147
153
  iov1 = GSSAPI::LibGSSAPI::GssIOVBufferDesc.new(FFI::Pointer.new(iov.address + (GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * 1)))
148
154
  iov1[:type] = (GSSAPI::LibGSSAPI::GSS_IOV_BUFFER_TYPE_DATA)
149
155
 
156
+ iov2 = GSSAPI::LibGSSAPI::GssIOVBufferDesc.new(FFI::Pointer.new(iov.address + (GSSAPI::LibGSSAPI::GssIOVBufferDesc.size * 2)))
157
+ iov2[:type] = (GSSAPI::LibGSSAPI::GSS_IOV_BUFFER_TYPE_DATA)
158
+
150
159
  str.force_encoding('BINARY')
151
160
  str.sub!(/^.*Content-Type: application\/octet-stream\r\n(.*)--Encrypted.*$/m, '\1')
152
161
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: winrm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 5
5
- version: 1.0.0rc2
5
+ version: 1.0.0rc3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Wanek
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-03 00:00:00 -06:00
13
+ date: 2011-03-18 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency