fx-tftp 0.4 → 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/README.md +1 -0
- data/bin/tftpd +2 -1
- data/fx-tftp.gemspec +1 -0
- data/lib/tftp/tftp.rb +8 -4
- data/lib/tftp/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c1fdd0aa78b89936ecb5a77d442239e6e82bcd6
|
4
|
+
data.tar.gz: 097bd1a749e6f113c6471c793b4123bb0690b10e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd91bf0c2ddb9ce72c5d803a42f1b8287e6e7f51e0738896386e5d0aec81e0986b25f8e6a73db721b8c6c5df7940385c768af7869684a46dbbaa4880b8ec06b9
|
7
|
+
data.tar.gz: b76310c67e90158dd9aeae33c4f53a068d9dc6929e7ab5a6de7f09a0c2a1f9a4984d3be5857efdd205c8032ddc48a9d09ae69d0f1aafd2de7a16b5307b736a22
|
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -39,6 +39,7 @@ When you combine filename inspection and `#send` and `#recv` methods working on
|
|
39
39
|
-m, --mode MODE Run in R/W only mode
|
40
40
|
-h, --host HOST Bind do host
|
41
41
|
-p, --path PATH Serving root directory
|
42
|
+
-o, --overwrite Overwrite existing files
|
42
43
|
|
43
44
|
## Contributing
|
44
45
|
|
data/bin/tftpd
CHANGED
@@ -9,7 +9,7 @@ require 'tftp'
|
|
9
9
|
|
10
10
|
config = {:path => Dir.pwd, :host => '127.0.0.1', :fork => false,
|
11
11
|
:ver => false, :loglevel => Logger::INFO, :logfile => STDOUT,
|
12
|
-
:no_read => false, :no_write => false}
|
12
|
+
:no_read => false, :no_write => false, :overwrite => false}
|
13
13
|
|
14
14
|
def die!(msg)
|
15
15
|
STDERR.puts msg
|
@@ -34,6 +34,7 @@ op = OptionParser.new do |o|
|
|
34
34
|
end
|
35
35
|
o.on('-h', '--host HOST', String, 'Bind do host') {|a| config[:host] = a }
|
36
36
|
o.on('-p', '--path PATH', String, 'Serving root directory') {|a| config[:path] = a }
|
37
|
+
o.on('-o', '--overwrite', 'Overwrite existing files') { config[:overwrite] = true }
|
37
38
|
end
|
38
39
|
op.parse! or die!(op)
|
39
40
|
die!(op) if config[:bad_mode]
|
data/fx-tftp.gemspec
CHANGED
data/lib/tftp/tftp.rb
CHANGED
@@ -255,10 +255,14 @@ module TFTP
|
|
255
255
|
end
|
256
256
|
log :info, "#{tag} Write request for #{req.filename} (#{req.mode})"
|
257
257
|
if File.exist? path
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
258
|
+
if @opts[:overwrite]
|
259
|
+
log :info, "#{tag} Overwrite existing file #{req.filename}"
|
260
|
+
else
|
261
|
+
log :warn, "#{tag} Refuse to overwrite existing file #{req.filename}"
|
262
|
+
sock.send(Packet::ERROR.new(6, 'File already exists.').encode, 0)
|
263
|
+
sock.close
|
264
|
+
return
|
265
|
+
end
|
262
266
|
end
|
263
267
|
mode = 'w'
|
264
268
|
mode += 'b' if req.mode == :octet
|
data/lib/tftp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fx-tftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr S. Staszewski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubygems-tasks
|
@@ -43,7 +43,8 @@ description: Got carried away a bit with the OOness of the whole thing, so while
|
|
43
43
|
ones. With all the infastructure already in place adding a client should be a breeze,
|
44
44
|
should anyone need it.
|
45
45
|
email: p.staszewski@gmail.com
|
46
|
-
executables:
|
46
|
+
executables:
|
47
|
+
- tftpd
|
47
48
|
extensions: []
|
48
49
|
extra_rdoc_files: []
|
49
50
|
files:
|
@@ -51,6 +52,7 @@ files:
|
|
51
52
|
- ".gitignore"
|
52
53
|
- ".travis.yml"
|
53
54
|
- ".yardopts"
|
55
|
+
- Gemfile
|
54
56
|
- LICENSE.txt
|
55
57
|
- README.md
|
56
58
|
- Rakefile
|