sambal 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sambal/client.rb +6 -3
- data/lib/sambal/smb.conf.erb +15 -13
- data/lib/sambal/test_server.rb +3 -2
- data/lib/sambal/version.rb +1 -1
- data/spec/sambal/client_spec.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aa72cf029b53169fa955bba66735424b1947fbd
|
4
|
+
data.tar.gz: 78c1a1d13b7215826210ea6218a08c33f8d70714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf4c8fea3956f86d9f78d2142fb77d7e5763d20abe0f7674b1ce15a54f81aca07c9be017ea6c0681c0a349b0620e5b84caf0d9fc0faf129893151daac8ef523
|
7
|
+
data.tar.gz: 88ced4ce2d2be7272c735f83747ff033221b0034a41f3b44746ec3a41791a5d08776320eb6b322bd8a6df1c0f1af0542ffa38e7423120292b37398a43263415d
|
data/lib/sambal/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Sambal
|
|
15
15
|
host: '127.0.0.1',
|
16
16
|
share: '',
|
17
17
|
user: 'guest',
|
18
|
-
password:
|
18
|
+
password: false,
|
19
19
|
port: 445,
|
20
20
|
timeout: 10,
|
21
21
|
columns: 80
|
@@ -31,8 +31,11 @@ module Sambal
|
|
31
31
|
options = parsed_options(user_options)
|
32
32
|
@timeout = options[:timeout].to_i
|
33
33
|
|
34
|
-
option_flags = "-W \"#{options[:domain]}\" -U \"#{options[:user]}\"
|
35
|
-
|
34
|
+
option_flags = "-W \"#{options[:domain]}\" -U \"#{options[:user]}\""
|
35
|
+
option_flags = "#{option_flags} -I #{options[:ip_address]}" if options[:ip_address]
|
36
|
+
option_flags = "#{option_flags} -p #{options[:port]} -s /dev/null"
|
37
|
+
password = options[:password] ? "'#{options[:password]}'" : "--no-pass"
|
38
|
+
command = "COLUMNS=#{options[:columns]} smbclient \"//#{options[:host]}/#{options[:share]}\" #{password}"
|
36
39
|
|
37
40
|
@output, @input, @pid = PTY.spawn(command + ' ' + option_flags)
|
38
41
|
|
data/lib/sambal/smb.conf.erb
CHANGED
@@ -80,7 +80,7 @@ ncalrpc dir = <%= ncalrpc_dir %>
|
|
80
80
|
log file = <%= log_path %>/log.%m
|
81
81
|
|
82
82
|
# Cap the size of the individual log files (in KiB).
|
83
|
-
|
83
|
+
max log size = 1000
|
84
84
|
|
85
85
|
# If you want Samba to only log through syslog then set the following
|
86
86
|
# parameter to 'yes'.
|
@@ -89,7 +89,7 @@ log file = <%= log_path %>/log.%m
|
|
89
89
|
# We want Samba to log a minimum amount of information to syslog. Everything
|
90
90
|
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
|
91
91
|
# through syslog you should set the following parameter to something higher.
|
92
|
-
|
92
|
+
syslog = 0
|
93
93
|
|
94
94
|
# Do something sensible when Samba crashes: mail the admin a backtrace
|
95
95
|
# panic action = /usr/share/samba/panic-action %d
|
@@ -101,18 +101,20 @@ log file = <%= log_path %>/log.%m
|
|
101
101
|
# in this server for every user accessing the server. See
|
102
102
|
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
|
103
103
|
# in the samba-doc package for details.
|
104
|
-
|
104
|
+
security = user
|
105
105
|
# security = share
|
106
106
|
# we set it to whoever is running the specs
|
107
|
-
|
107
|
+
guest account = <%= local_user %>
|
108
|
+
|
109
|
+
map to guest = Bad User
|
108
110
|
|
109
111
|
# You may wish to use password encryption. See the section on
|
110
112
|
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
|
111
|
-
|
113
|
+
encrypt passwords = true
|
112
114
|
|
113
115
|
# If you are using encrypted passwords, Samba will need to know what
|
114
116
|
# password database type you are using.
|
115
|
-
|
117
|
+
passdb backend = tdbsam
|
116
118
|
|
117
119
|
# obey pam restrictions = yes
|
118
120
|
|
@@ -187,12 +189,13 @@ log file = <%= log_path %>/log.%m
|
|
187
189
|
|
188
190
|
# If you want to automatically load your printer list rather
|
189
191
|
# than setting them up individually then you'll need this
|
190
|
-
|
192
|
+
load printers = no
|
191
193
|
|
192
194
|
# lpr(ng) printing. You may wish to override the location of the
|
193
195
|
# printcap file
|
194
|
-
|
195
|
-
|
196
|
+
printing = bsd
|
197
|
+
printcap name = /dev/null
|
198
|
+
disable spoolss = yes
|
196
199
|
|
197
200
|
# CUPS printing. See also the cupsaddsmb(8) manpage in the
|
198
201
|
# cupsys-client package.
|
@@ -200,6 +203,7 @@ log file = <%= log_path %>/log.%m
|
|
200
203
|
; printcap name = cups
|
201
204
|
|
202
205
|
############ Misc ############
|
206
|
+
enable core files = no
|
203
207
|
|
204
208
|
# Using the following line enables you to customise your configuration
|
205
209
|
# on a per machine basis. The %m gets replaced with the netbios name
|
@@ -333,7 +337,7 @@ log file = <%= log_path %>/log.%m
|
|
333
337
|
comment = Spec directory
|
334
338
|
read only = no
|
335
339
|
writeable = yes
|
336
|
-
write list = <%= local_user %>,
|
340
|
+
write list = <%= local_user %>, @<%= `groups`.split(' ').first %>
|
337
341
|
locking = no
|
338
342
|
path = <%= samba_share %>
|
339
343
|
guest ok = yes
|
@@ -342,11 +346,9 @@ log file = <%= log_path %>/log.%m
|
|
342
346
|
directory mask = 777
|
343
347
|
force create mode = 777
|
344
348
|
force directory mode = 775
|
345
|
-
force group = staff
|
346
349
|
force user = <%= local_user %>
|
347
|
-
|
350
|
+
force group = <%= `groups`.split(' ').first %>
|
348
351
|
guest only = yes
|
349
|
-
security = share
|
350
352
|
acl check permissions = False
|
351
353
|
|
352
354
|
# The next two parameters show how to auto-mount a CD-ROM when the
|
data/lib/sambal/test_server.rb
CHANGED
@@ -53,6 +53,7 @@ module Sambal
|
|
53
53
|
@port = Random.new(Time.now.to_i).rand(2345..5678).to_i
|
54
54
|
@run_as = run_as
|
55
55
|
FileUtils.mkdir_p @share_path
|
56
|
+
File.chmod 0777, @share_path
|
56
57
|
write_config
|
57
58
|
end
|
58
59
|
|
@@ -70,11 +71,11 @@ module Sambal
|
|
70
71
|
def start
|
71
72
|
if RUBY_PLATFORM=="java"
|
72
73
|
@smb_server_pid = Thread.new do
|
73
|
-
`smbd -S -F -s #{@config_path} -p #{@port} --lockdir=#{@lock_path} --
|
74
|
+
`smbd -S -F -s #{@config_path} -p #{@port} --option="lockdir"=#{@lock_path} --option="pid directory"=#{@pid_dir} --option="private directory"=#{@private_dir} --option="cache directory"=#{@cache_dir} --option="state directory"=#{@state_dir} > #{@log_path}/smb.log`
|
74
75
|
end
|
75
76
|
else
|
76
77
|
@smb_server_pid = fork do
|
77
|
-
`smbd -S -F -s #{@config_path} -p #{@port} --lockdir=#{@lock_path} --
|
78
|
+
`smbd -S -F -s #{@config_path} -p #{@port} --option="lockdir"=#{@lock_path} --option="pid directory"=#{@pid_dir} --option="private directory"=#{@private_dir} --option="cache directory"=#{@cache_dir} --option="state directory"=#{@state_dir} > #{@log_path}/smb.log`
|
78
79
|
end
|
79
80
|
end
|
80
81
|
sleep 2 ## takes a short time to start up
|
data/lib/sambal/version.rb
CHANGED
data/spec/sambal/client_spec.rb
CHANGED
@@ -36,10 +36,10 @@ describe Sambal::Client do
|
|
36
36
|
File.open("#{test_server.share_path}/#{TEST_DIRECTORY}/#{TEST_SUB_DIRECTORY}/#{TESTFILE_SUB}", 'w') do |f|
|
37
37
|
f << "Hello"
|
38
38
|
end
|
39
|
-
FileUtils.chmod
|
40
|
-
FileUtils.chmod
|
41
|
-
FileUtils.chmod
|
42
|
-
FileUtils.chmod
|
39
|
+
FileUtils.chmod 0777, "#{test_server.share_path}/#{TEST_DIRECTORY_WITH_SPACE_IN_NAME}/#{TEST_FILE_IN_DIRECTORY_WITH_SPACE_IN_NAME}"
|
40
|
+
FileUtils.chmod 0777, "#{test_server.share_path}/#{TEST_DIRECTORY}/#{TEST_SUB_DIRECTORY}/#{TESTFILE_SUB}"
|
41
|
+
FileUtils.chmod 0777, "#{test_server.share_path}/#{TEST_DIRECTORY}/#{TEST_SUB_DIRECTORY}"
|
42
|
+
FileUtils.chmod 0777, "#{test_server.share_path}/#{TEST_DIRECTORY}"
|
43
43
|
FileUtils.chmod 0777, "#{test_server.share_path}/#{TESTFILE}"
|
44
44
|
@sambal_client.cd('/')
|
45
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sambal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Axel Eriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.
|
69
|
+
rubygems_version: 2.6.11
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Ruby Samba Client
|