rails_pwnerer 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/lib/pwnage/base/atomics.rb +9 -1
- data/lib/pwnage/base/dirs.rb +5 -0
- data/lib/pwnage/config/repository.rb +3 -1
- data/lib/pwnage/scaffolds/config.rb +1 -1
- data/rails_pwnerer.gemspec +3 -3
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/pwnage/base/atomics.rb
CHANGED
@@ -33,13 +33,21 @@ module RailsPwnage::Base
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# writes data to a repository
|
36
|
-
def atomic_write(data, path, name)
|
36
|
+
def atomic_write(data, path, name, options = {})
|
37
37
|
main_file = File.join(path, name) + '.yml'
|
38
38
|
dup_file = File.join(path, name) + '.yml2'
|
39
39
|
|
40
40
|
# append verification info at the end of the file to guard from incomplete writes
|
41
41
|
ts = Time.now
|
42
42
|
ts_checksum = Digest::MD5.hexdigest("#{ts.tv_sec}.#{ts.tv_usec}")
|
43
|
+
if options[:owner]
|
44
|
+
# secure the file
|
45
|
+
File.open(dup_file, 'w').close
|
46
|
+
uid = uid_for_username options[:owner]
|
47
|
+
gid = gid_for_username options[:owner]
|
48
|
+
File.chown uid, gid, dup_file
|
49
|
+
File.chmod options[:permissions] || 0660, dup_file
|
50
|
+
end
|
43
51
|
File.open(dup_file, 'w') { |f| YAML::dump [data, ts.tv_sec, ts.tv_usec, ts_checksum], f }
|
44
52
|
|
45
53
|
# move the file atomically to the main copy
|
data/lib/pwnage/base/dirs.rb
CHANGED
@@ -24,6 +24,11 @@ module RailsPwnage::Base
|
|
24
24
|
return (group_entry.nil?) ? nil : group_entry.name
|
25
25
|
end
|
26
26
|
|
27
|
+
# gets the currently logged on user
|
28
|
+
def current_user
|
29
|
+
Etc.getpwuid.name
|
30
|
+
end
|
31
|
+
|
27
32
|
# executes a block in a temporary directory
|
28
33
|
def with_temp_dir(options = {})
|
29
34
|
temp_dir = "#{options[:root] ? '/' : ''}rbpwn_#{Time.now.to_i}"
|
@@ -81,7 +81,9 @@ module RailsPwnage::Config
|
|
81
81
|
if @@db_cache[db_name].nil?
|
82
82
|
atomic_erase db_path, db_name
|
83
83
|
else
|
84
|
-
|
84
|
+
host_config = get_db :host
|
85
|
+
atomic_write @@db_cache[db_name], db_path, db_name,
|
86
|
+
:owner => (host_config && host_config[:pwnerer_user])
|
85
87
|
end
|
86
88
|
@@db_dirty[db_name] = false
|
87
89
|
end
|
@@ -24,7 +24,7 @@ class RailsPwnage::Scaffolds::Config
|
|
24
24
|
# password for creating / dropping databases
|
25
25
|
host_info[:dbroot_pass] = ''
|
26
26
|
# the user owning the /prod subtrees
|
27
|
-
host_info[:pwnerer_user] =
|
27
|
+
host_info[:pwnerer_user] = current_user
|
28
28
|
|
29
29
|
RailsPwnage::Config.flush_db :host
|
30
30
|
|
data/rails_pwnerer.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rails_pwnerer-0.6.
|
2
|
+
# Gem::Specification for Rails_pwnerer-0.6.7
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: rails_pwnerer
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.6.
|
8
|
+
version: 0.6.7
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Victor Costan
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
|
15
|
-
date: 2008-09-
|
15
|
+
date: 2008-09-28 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_pwnerer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Costan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-28 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|