puppet 4.3.2-x64-mingw32 → 4.4.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/COMMITTERS.md +2 -2
- data/CONTRIBUTING.md +6 -6
- data/LICENSE +1 -1
- data/README.md +8 -9
- data/conf/auth.conf +2 -2
- data/ext/README.environment +1 -1
- data/ext/debian/README.source +1 -1
- data/ext/debian/control +1 -1
- data/ext/debian/copyright +4 -4
- data/ext/debian/puppetmaster.README.debian +11 -9
- data/ext/emacs/puppet-mode.el +1 -1
- data/ext/envpuppet +2 -2
- data/ext/ips/puppetagent.xml +1 -1
- data/ext/ips/puppetmaster.xml +1 -1
- data/ext/project_data.yaml +8 -0
- data/ext/puppet-test +3 -3
- data/ext/rack/example-passenger-vhost.conf +1 -1
- data/ext/redhat/puppet.spec.erb +2 -2
- data/ext/regexp_nodes/regexp_nodes.rb +1 -1
- data/ext/solaris/pkginfo +1 -1
- data/ext/solaris/smf/puppet.xml +1 -1
- data/ext/suse/puppet.spec +2 -2
- data/ext/upload_facts.rb +1 -1
- data/ext/windows/puppet_interactive.bat +6 -0
- data/ext/windows/puppet_shell.bat +9 -0
- data/ext/windows/run_puppet_interactive.bat +9 -0
- data/ext/yaml_nodes.rb +1 -1
- data/install.rb +30 -20
- data/lib/puppet/agent.rb +1 -1
- data/lib/puppet/application/agent.rb +4 -2
- data/lib/puppet/application/apply.rb +7 -4
- data/lib/puppet/application/cert.rb +1 -1
- data/lib/puppet/application/device.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/lookup.rb +4 -4
- data/lib/puppet/application/master.rb +2 -2
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/configurer.rb +100 -22
- data/lib/puppet/data_providers/hiera_config.rb +28 -3
- data/lib/puppet/data_providers/hiera_interpolate.rb +30 -15
- data/lib/puppet/data_providers/hiera_support.rb +1 -1
- data/lib/puppet/data_providers/json_data_provider_factory.rb +2 -2
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -2
- data/lib/puppet/defaults.rb +65 -19
- data/lib/puppet/environments.rb +3 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/epp.rb +1 -1
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/module/install.rb +6 -6
- data/lib/puppet/face/parser.rb +12 -9
- data/lib/puppet/face/status.rb +2 -1
- data/lib/puppet/feature/cfpropertylist.rb +3 -0
- data/lib/puppet/feature/telnet.rb +9 -0
- data/lib/puppet/file_serving/http_metadata.rb +46 -0
- data/lib/puppet/file_serving/metadata.rb +18 -2
- data/lib/puppet/file_serving/terminus_selector.rb +2 -0
- data/lib/puppet/file_system.rb +2 -2
- data/lib/puppet/file_system/file_impl.rb +2 -2
- data/lib/puppet/file_system/memory_impl.rb +1 -1
- data/lib/puppet/file_system/uniquefile.rb +1 -1
- data/lib/puppet/forge.rb +1 -1
- data/lib/puppet/forge/repository.rb +1 -31
- data/lib/puppet/functions.rb +45 -6
- data/lib/puppet/functions/assert_type.rb +9 -9
- data/lib/puppet/functions/each.rb +5 -13
- data/lib/puppet/functions/filter.rb +5 -14
- data/lib/puppet/functions/map.rb +6 -14
- data/lib/puppet/functions/reduce.rb +5 -13
- data/lib/puppet/functions/reverse_each.rb +82 -0
- data/lib/puppet/functions/scanf.rb +15 -18
- data/lib/puppet/functions/slice.rb +22 -36
- data/lib/puppet/functions/split.rb +2 -2
- data/lib/puppet/functions/step.rb +88 -0
- data/lib/puppet/functions/type.rb +70 -0
- data/lib/puppet/graph/rb_tree_map.rb +1 -1
- data/lib/puppet/indirector/catalog/compiler.rb +188 -5
- data/lib/puppet/indirector/file_content/http.rb +15 -0
- data/lib/puppet/indirector/file_metadata/http.rb +27 -0
- data/lib/puppet/indirector/generic_http.rb +16 -0
- data/lib/puppet/indirector/node/exec.rb +1 -1
- data/lib/puppet/indirector/node/ldap.rb +1 -1
- data/lib/puppet/indirector/rest.rb +2 -1
- data/lib/puppet/info_service/class_information_service.rb +13 -12
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/module.rb +3 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +9 -2
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +2 -2
- data/lib/puppet/module_tool/tar/mini.rb +3 -3
- data/lib/puppet/network/http/pool.rb +9 -0
- data/lib/puppet/node.rb +1 -1
- data/lib/puppet/node/environment.rb +11 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +19 -22
- data/lib/puppet/parser/compiler.rb +3 -3
- data/lib/puppet/parser/environment_compiler.rb +0 -1
- data/lib/puppet/parser/functions.rb +28 -16
- data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
- data/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/lib/puppet/parser/functions/map.rb +1 -1
- data/lib/puppet/parser/functions/scanf.rb +15 -26
- data/lib/puppet/parser/functions/slice.rb +17 -24
- data/lib/puppet/parser/functions/split.rb +1 -1
- data/lib/puppet/parser/resource.rb +19 -17
- data/lib/puppet/parser/scope.rb +176 -5
- data/lib/puppet/plugins/data_providers/data_provider.rb +54 -13
- data/lib/puppet/pops.rb +0 -8
- data/lib/puppet/pops/adaptable.rb +4 -1
- data/lib/puppet/pops/adapters.rb +38 -13
- data/lib/puppet/pops/binder/binder.rb +21 -17
- data/lib/puppet/pops/binder/binder_issues.rb +8 -6
- data/lib/puppet/pops/binder/bindings_checker.rb +12 -8
- data/lib/puppet/pops/binder/bindings_composer.rb +16 -12
- data/lib/puppet/pops/binder/bindings_factory.rb +108 -104
- data/lib/puppet/pops/binder/bindings_model.rb +49 -47
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +10 -6
- data/lib/puppet/pops/binder/injector.rb +53 -48
- data/lib/puppet/pops/binder/key_factory.rb +10 -6
- data/lib/puppet/pops/binder/producers.rb +67 -62
- data/lib/puppet/pops/evaluator/access_operator.rb +95 -93
- data/lib/puppet/pops/evaluator/closure.rb +84 -68
- data/lib/puppet/pops/evaluator/collector_transformer.rb +18 -14
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +0 -1
- data/lib/puppet/pops/evaluator/compare_operator.rb +13 -9
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +9 -8
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +78 -76
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +85 -0
- data/lib/puppet/pops/evaluator/relationship_operator.rb +13 -11
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +5 -0
- data/lib/puppet/pops/evaluator/runtime3_support.rb +41 -45
- data/lib/puppet/pops/issue_reporter.rb +6 -4
- data/lib/puppet/pops/issues.rb +34 -11
- data/lib/puppet/pops/loader/base_loader.rb +1 -1
- data/lib/puppet/pops/loader/loader.rb +1 -1
- data/lib/puppet/pops/loader/loader_paths.rb +15 -0
- data/lib/puppet/pops/loader/module_loaders.rb +17 -13
- data/lib/puppet/pops/loader/puppet_function_instantiator.rb +16 -12
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +16 -3
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +55 -0
- data/lib/puppet/pops/loaders.rb +51 -9
- data/lib/puppet/pops/lookup.rb +14 -12
- data/lib/puppet/pops/merge_strategy.rb +16 -19
- data/lib/puppet/pops/model/factory.rb +26 -2
- data/lib/puppet/pops/model/model.rb +8 -8
- data/lib/puppet/pops/model/model_label_provider.rb +13 -7
- data/lib/puppet/pops/model/model_meta.rb +17 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +8 -0
- data/lib/puppet/pops/parser/egrammar.ra +38 -14
- data/lib/puppet/pops/parser/eparser.rb +1353 -1276
- data/lib/puppet/pops/parser/epp_support.rb +11 -7
- data/lib/puppet/pops/parser/evaluating_parser.rb +14 -10
- data/lib/puppet/pops/parser/heredoc_support.rb +15 -11
- data/lib/puppet/pops/parser/lexer2.rb +26 -19
- data/lib/puppet/pops/parser/lexer_support.rb +85 -7
- data/lib/puppet/pops/parser/locator.rb +21 -0
- data/lib/puppet/pops/parser/parser_support.rb +19 -16
- data/lib/puppet/pops/parser/slurp_support.rb +11 -7
- data/lib/puppet/pops/types/class_loader.rb +23 -19
- data/lib/puppet/pops/types/enumeration.rb +9 -26
- data/lib/puppet/pops/types/iterable.rb +308 -0
- data/lib/puppet/pops/types/recursion_guard.rb +82 -0
- data/lib/puppet/pops/types/type_acceptor.rb +25 -0
- data/lib/puppet/pops/types/type_asserter.rb +10 -9
- data/lib/puppet/pops/types/type_calculator.rb +138 -381
- data/lib/puppet/pops/types/type_factory.rb +91 -57
- data/lib/puppet/pops/types/type_formatter.rb +334 -0
- data/lib/puppet/pops/types/type_mismatch_describer.rb +226 -59
- data/lib/puppet/pops/types/type_parser.rb +159 -112
- data/lib/puppet/pops/types/types.rb +2057 -1247
- data/lib/puppet/pops/utils.rb +11 -10
- data/lib/puppet/pops/validation.rb +11 -9
- data/lib/puppet/pops/validation/checker4_0.rb +83 -55
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +8 -4
- data/lib/puppet/provider/aixobject.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +10 -9
- data/lib/puppet/provider/nameservice/directoryservice.rb +35 -50
- data/lib/puppet/provider/package/appdmg.rb +3 -2
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +5 -8
- data/lib/puppet/provider/package/pip3.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +3 -2
- data/lib/puppet/provider/package/pkgng.rb +13 -4
- data/lib/puppet/provider/package/windows.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +19 -0
- data/lib/puppet/provider/service/debian.rb +2 -2
- data/lib/puppet/provider/service/launchd.rb +6 -18
- data/lib/puppet/provider/service/systemd.rb +9 -2
- data/lib/puppet/provider/sshkey/parsed.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +1 -1
- data/lib/puppet/provider/user/directoryservice.rb +33 -58
- data/lib/puppet/provider/zfs/zfs.rb +1 -1
- data/lib/puppet/provider/zpool/zpool.rb +1 -1
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reference/providers.rb +1 -1
- data/lib/puppet/resource.rb +15 -12
- data/lib/puppet/resource/capability_finder.rb +20 -13
- data/lib/puppet/resource/catalog.rb +60 -3
- data/lib/puppet/resource/status.rb +11 -2
- data/lib/puppet/resource/type.rb +28 -38
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/settings/config_file.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +13 -5
- data/lib/puppet/ssl/certificate_factory.rb +3 -3
- data/lib/puppet/ssl/certificate_request.rb +4 -4
- data/lib/puppet/ssl/certificate_signer.rb +1 -1
- data/lib/puppet/ssl/validator/default_validator.rb +1 -1
- data/lib/puppet/test/test_helper.rb +16 -4
- data/lib/puppet/transaction.rb +15 -2
- data/lib/puppet/transaction/additional_resource_generator.rb +6 -2
- data/lib/puppet/transaction/report.rb +31 -1
- data/lib/puppet/transaction/resource_harness.rb +0 -25
- data/lib/puppet/type.rb +11 -11
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/cron.rb +12 -12
- data/lib/puppet/type/file.rb +91 -39
- data/lib/puppet/type/file/checksum_value.rb +53 -0
- data/lib/puppet/type/file/content.rb +26 -111
- data/lib/puppet/type/file/data_sync.rb +84 -0
- data/lib/puppet/type/file/ensure.rb +17 -14
- data/lib/puppet/type/file/selcontext.rb +1 -1
- data/lib/puppet/type/file/source.rb +103 -18
- data/lib/puppet/type/filebucket.rb +1 -1
- data/lib/puppet/type/interface.rb +8 -3
- data/lib/puppet/type/macauthorization.rb +1 -1
- data/lib/puppet/type/package.rb +6 -0
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/type/user.rb +19 -17
- data/lib/puppet/type/yumrepo.rb +20 -0
- data/lib/puppet/util.rb +109 -22
- data/lib/puppet/util/autoload.rb +16 -11
- data/lib/puppet/util/checksums.rb +74 -31
- data/lib/puppet/util/execution.rb +1 -1
- data/lib/puppet/util/http_proxy.rb +72 -0
- data/lib/puppet/util/log.rb +2 -0
- data/lib/puppet/util/logging.rb +43 -1
- data/lib/puppet/util/monkey_patches.rb +2 -2
- data/lib/puppet/util/multi_match.rb +51 -0
- data/lib/puppet/util/network_device/cisco/device.rb +10 -2
- data/lib/puppet/util/network_device/cisco/interface.rb +21 -8
- data/lib/puppet/util/network_device/transport/ssh.rb +7 -3
- data/lib/puppet/util/network_device/transport/telnet.rb +39 -36
- data/lib/puppet/util/plist.rb +130 -0
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/run_mode.rb +2 -2
- data/lib/puppet/util/skip_tags.rb +9 -0
- data/lib/puppet/util/windows/access_control_entry.rb +1 -1
- data/lib/puppet/util/windows/access_control_list.rb +3 -3
- data/lib/puppet/util/windows/adsi.rb +4 -4
- data/lib/puppet/util/windows/api_types.rb +24 -18
- data/lib/puppet/util/windows/com.rb +3 -3
- data/lib/puppet/util/windows/error.rb +1 -1
- data/lib/puppet/util/windows/file.rb +8 -8
- data/lib/puppet/util/windows/principal.rb +23 -14
- data/lib/puppet/util/windows/process.rb +78 -11
- data/lib/puppet/util/windows/registry.rb +1 -1
- data/lib/puppet/util/windows/root_certs.rb +5 -5
- data/lib/puppet/util/windows/security.rb +33 -35
- data/lib/puppet/util/windows/security_descriptor.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +42 -4
- data/lib/puppet/util/windows/taskscheduler.rb +15 -15
- data/lib/puppet/util/windows/user.rb +10 -10
- data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +1 -1
- data/lib/puppet/vendor/pathspec/LICENSE +2 -2
- data/lib/puppet/vendor/pathspec/README.md +1 -1
- data/lib/puppet/vendor/rgen/README.rdoc +1 -1
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +14 -0
- data/lib/puppet/version.rb +1 -1
- data/lib/semver.rb +17 -1
- data/man/man5/puppet.conf.5 +12 -12
- data/man/man8/extlookup2hiera.8 +1 -1
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-ca.8 +2 -2
- data/man/man8/puppet-catalog.8 +2 -2
- data/man/man8/puppet-cert.8 +2 -2
- data/man/man8/puppet-certificate.8 +2 -2
- data/man/man8/puppet-certificate_request.8 +2 -2
- data/man/man8/puppet-certificate_revocation_list.8 +2 -2
- data/man/man8/puppet-config.8 +3 -3
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +2 -2
- data/man/man8/puppet-facts.8 +2 -2
- data/man/man8/puppet-file.8 +2 -2
- data/man/man8/puppet-filebucket.8 +2 -2
- data/man/man8/puppet-help.8 +2 -2
- data/man/man8/puppet-inspect.8 +2 -2
- data/man/man8/puppet-key.8 +2 -2
- data/man/man8/puppet-man.8 +2 -2
- data/man/man8/puppet-master.8 +2 -2
- data/man/man8/puppet-module.8 +9 -9
- data/man/man8/puppet-node.8 +2 -2
- data/man/man8/puppet-parser.8 +2 -2
- data/man/man8/puppet-plugin.8 +2 -2
- data/man/man8/puppet-report.8 +2 -2
- data/man/man8/puppet-resource.8 +2 -2
- data/man/man8/puppet-resource_type.8 +2 -2
- data/man/man8/puppet-status.8 +3 -3
- data/man/man8/puppet.8 +1 -1
- data/spec/fixtures/module.tar.gz +0 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/lib/puppet/functions/bad_data/data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/manifests/init.pp +0 -1
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_json/data/empty.json +0 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/data/empty.yaml +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +2 -1
- data/spec/fixtures/unit/module/trailing-comma.json +1 -1
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/manifests/init.pp +3 -1
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/types/zero.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseeone.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseezero.pp +1 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-broken-notices.txt +187 -0
- data/spec/fixtures/unit/provider/sshkey/parsed/sample_with_blank_lines +8 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +197 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +205 -0
- data/spec/integration/defaults_spec.rb +14 -2
- data/spec/integration/file_system/uniquefile_spec.rb +29 -0
- data/spec/integration/module_tool/tar/mini_spec.rb +28 -0
- data/spec/integration/node/environment_spec.rb +13 -0
- data/spec/integration/parser/dynamic_scoping_spec.rb +67 -0
- data/spec/integration/parser/parameter_defaults_spec.rb +336 -0
- data/spec/integration/parser/undef_param_spec.rb +8 -0
- data/spec/integration/provider/yumrepo_spec.rb +1 -1
- data/spec/integration/test/test_helper_spec.rb +28 -0
- data/spec/integration/transaction/report_spec.rb +16 -0
- data/spec/integration/transaction_spec.rb +11 -0
- data/spec/integration/type/file_spec.rb +194 -4
- data/spec/integration/type/package_spec.rb +5 -1
- data/spec/integration/type/tidy_spec.rb +21 -9
- data/spec/integration/util/execution_spec.rb +22 -0
- data/spec/integration/util/windows/principal_spec.rb +90 -4
- data/spec/integration/util/windows/process_spec.rb +31 -0
- data/spec/integration/util/windows/security_spec.rb +6 -6
- data/spec/integration/util/windows/user_spec.rb +1 -1
- data/spec/integration/util_spec.rb +49 -27
- data/spec/lib/puppet_spec/compiler.rb +17 -0
- data/spec/lib/puppet_spec/files.rb +2 -2
- data/spec/lib/puppet_spec/pops.rb +13 -0
- data/spec/shared_behaviours/iterative_functions.rb +1 -1
- data/spec/shared_contexts/types_setup.rb +96 -0
- data/spec/unit/agent_spec.rb +1 -0
- data/spec/unit/application/agent_spec.rb +10 -0
- data/spec/unit/application/apply_spec.rb +9 -0
- data/spec/unit/configurer/downloader_spec.rb +5 -5
- data/spec/unit/configurer_spec.rb +271 -39
- data/spec/unit/data_providers/hiera_interpolation_spec.rb +57 -0
- data/spec/unit/defaults_spec.rb +15 -0
- data/spec/unit/environments_spec.rb +24 -4
- data/spec/unit/face/parser_spec.rb +43 -2
- data/spec/unit/file_serving/http_metadata_spec.rb +85 -0
- data/spec/unit/file_serving/metadata_spec.rb +50 -0
- data/spec/unit/file_serving/terminus_selector_spec.rb +12 -2
- data/spec/unit/file_system_spec.rb +26 -0
- data/spec/unit/functions/assert_type_spec.rb +36 -2
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/epp_spec.rb +11 -3
- data/spec/unit/functions/lookup_spec.rb +58 -13
- data/spec/unit/functions/regsubst_spec.rb +1 -1
- data/spec/unit/functions/reverse_each_spec.rb +108 -0
- data/spec/unit/functions/step_spec.rb +113 -0
- data/spec/unit/functions/type_spec.rb +35 -0
- data/spec/unit/functions4_spec.rb +61 -5
- data/spec/unit/indirector/catalog/compiler_spec.rb +705 -4
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +1 -1
- data/spec/unit/indirector/indirection_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +94 -32
- data/spec/unit/module_spec.rb +14 -0
- data/spec/unit/module_tool/applications/builder_spec.rb +4 -4
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/http/connection_spec.rb +1 -0
- data/spec/unit/network/http/pool_spec.rb +30 -0
- data/spec/unit/node_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +16 -0
- data/spec/unit/parser/scope_spec.rb +28 -11
- data/spec/unit/pops/evaluator/access_ops_spec.rb +3 -3
- data/spec/unit/pops/evaluator/comparison_ops_spec.rb +3 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +7 -1
- data/spec/unit/pops/evaluator/evaluator_rspec_helper.rb +4 -4
- data/spec/unit/pops/evaluator/json_strict_literal_evaluator_spec.rb +63 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +6 -0
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +53 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +44 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +112 -3
- data/spec/unit/pops/parser/parse_calls_spec.rb +8 -0
- data/spec/unit/pops/parser/parser_spec.rb +10 -0
- data/spec/unit/pops/parser/source_pos_adapter_spec.rb +26 -0
- data/spec/unit/pops/types/iterable_spec.rb +262 -0
- data/spec/unit/pops/types/recursion_guard_spec.rb +91 -0
- data/spec/unit/pops/types/type_acceptor_spec.rb +105 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +43 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +275 -373
- data/spec/unit/pops/types/type_formatter_spec.rb +280 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +152 -0
- data/spec/unit/pops/types/type_parser_spec.rb +58 -13
- data/spec/unit/pops/types/types_spec.rb +241 -0
- data/spec/unit/pops/validator/validator_spec.rb +100 -43
- data/spec/unit/provider/cron/parsed_spec.rb +1 -0
- data/spec/unit/provider/macauthorization_spec.rb +5 -2
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +14 -19
- data/spec/unit/provider/package/appdmg_spec.rb +3 -3
- data/spec/unit/provider/package/dnf_spec.rb +16 -0
- data/spec/unit/provider/package/pip3_spec.rb +60 -42
- data/spec/unit/provider/package/pip_spec.rb +47 -34
- data/spec/unit/provider/package/pkgdmg_spec.rb +18 -9
- data/spec/unit/provider/package/pkgng_spec.rb +4 -2
- data/spec/unit/provider/package/yum_spec.rb +11 -0
- data/spec/unit/provider/package/zypper_spec.rb +14 -0
- data/spec/unit/provider/service/launchd_spec.rb +17 -35
- data/spec/unit/provider/service/systemd_spec.rb +7 -0
- data/spec/unit/provider/sshkey/parsed_spec.rb +20 -19
- data/spec/unit/provider/user/directoryservice_spec.rb +40 -59
- data/spec/unit/resource/capability_finder_spec.rb +28 -15
- data/spec/unit/resource/catalog_spec.rb +33 -1
- data/spec/unit/resource/type_spec.rb +149 -7
- data/spec/unit/resource_spec.rb +96 -57
- data/spec/unit/settings/environment_conf_spec.rb +18 -1
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +3 -3
- data/spec/unit/transaction/report_spec.rb +27 -0
- data/spec/unit/transaction/resource_harness_spec.rb +0 -47
- data/spec/unit/transaction_spec.rb +5 -0
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/checksum_value_spec.rb +286 -0
- data/spec/unit/type/file/content_spec.rb +12 -193
- data/spec/unit/type/file/source_spec.rb +211 -119
- data/spec/unit/type/file_spec.rb +133 -34
- data/spec/unit/type/interface_spec.rb +32 -0
- data/spec/unit/type/macauthorization_spec.rb +4 -1
- data/spec/unit/type/yumrepo_spec.rb +2 -2
- data/spec/unit/util/filetype_spec.rb +1 -1
- data/spec/unit/util/http_proxy_spec.rb +2 -2
- data/spec/unit/util/log/destinations_spec.rb +0 -2
- data/spec/unit/util/logging_spec.rb +69 -0
- data/spec/unit/util/multi_match_spec.rb +39 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +253 -216
- data/spec/unit/util/network_device/transport/telnet_spec.rb +60 -58
- data/spec/unit/util/plist_spec.rb +110 -0
- data/spec/unit/util/resource_template_spec.rb +2 -2
- data/spec/unit/util/run_mode_spec.rb +27 -3
- data/spec/unit/util/windows/adsi_spec.rb +4 -4
- data/spec/unit/util/windows/api_types_spec.rb +42 -0
- data/spec/unit/util/windows/security_descriptor_spec.rb +3 -3
- data/spec/unit/util/windows/sid_spec.rb +1 -1
- data/spec/unit/util_spec.rb +123 -13
- data/tasks/cfpropertylist.rake +15 -0
- metadata +114 -26
- data/lib/puppet/vendor/load_plist.rb +0 -1
- data/lib/puppet/vendor/plist/CHANGELOG +0 -82
- data/lib/puppet/vendor/plist/MIT-LICENSE +0 -21
- data/lib/puppet/vendor/plist/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/plist/README +0 -36
- data/lib/puppet/vendor/plist/Rakefile +0 -144
- data/lib/puppet/vendor/plist/docs/USAGE +0 -104
- data/lib/puppet/vendor/plist/docs/jamis-template.rb +0 -591
- data/lib/puppet/vendor/plist/lib/plist.rb +0 -22
- data/lib/puppet/vendor/plist/lib/plist/generator.rb +0 -224
- data/lib/puppet/vendor/plist/lib/plist/parser.rb +0 -225
- data/lib/puppet/vendor/plist/test/assets/AlbumData.xml +0 -203
- data/lib/puppet/vendor/plist/test/assets/Cookies.plist +0 -104
- data/lib/puppet/vendor/plist/test/assets/commented.plist +0 -9
- data/lib/puppet/vendor/plist/test/assets/example_data.bin +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.jpg +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.plist +0 -259
- data/lib/puppet/vendor/plist/test/assets/test_data_elements.plist +0 -24
- data/lib/puppet/vendor/plist/test/assets/test_empty_key.plist +0 -13
- data/lib/puppet/vendor/plist/test/test_data_elements.rb +0 -115
- data/lib/puppet/vendor/plist/test/test_generator.rb +0 -59
- data/lib/puppet/vendor/plist/test/test_generator_basic_types.rb +0 -58
- data/lib/puppet/vendor/plist/test/test_generator_collections.rb +0 -82
- data/lib/puppet/vendor/plist/test/test_parser.rb +0 -90
@@ -49,7 +49,7 @@ module Puppet::Util::Windows::COM
|
|
49
49
|
CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER
|
50
50
|
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER
|
51
51
|
|
52
|
-
#
|
52
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615(v=vs.85).aspx
|
53
53
|
# HRESULT CoCreateInstance(
|
54
54
|
# _In_ REFCLSID rclsid,
|
55
55
|
# _In_ LPUNKNOWN pUnkOuter,
|
@@ -202,14 +202,14 @@ module Puppet::Util::Windows::COM
|
|
202
202
|
|
203
203
|
Unknown = Instance[IUnknown]
|
204
204
|
|
205
|
-
#
|
205
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms678543(v=vs.85).aspx
|
206
206
|
# HRESULT CoInitialize(
|
207
207
|
# _In_opt_ LPVOID pvReserved
|
208
208
|
# );
|
209
209
|
ffi_lib :ole32
|
210
210
|
attach_function_private :CoInitialize, [:lpvoid], :hresult
|
211
211
|
|
212
|
-
#
|
212
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms688715(v=vs.85).aspx
|
213
213
|
# void CoUninitialize(void);
|
214
214
|
ffi_lib :ole32
|
215
215
|
attach_function_private :CoUninitialize, [], :void
|
@@ -66,7 +66,7 @@ class Puppet::Util::Windows::Error < Puppet::Error
|
|
66
66
|
|
67
67
|
ffi_convention :stdcall
|
68
68
|
|
69
|
-
#
|
69
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx
|
70
70
|
# DWORD WINAPI FormatMessage(
|
71
71
|
# _In_ DWORD dwFlags,
|
72
72
|
# _In_opt_ LPCVOID lpSource,
|
@@ -272,7 +272,7 @@ module Puppet::Util::Windows::File
|
|
272
272
|
|
273
273
|
private
|
274
274
|
|
275
|
-
#
|
275
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx
|
276
276
|
FSCTL_GET_REPARSE_POINT = 0x900a8
|
277
277
|
|
278
278
|
def self.resolve_symlink(handle)
|
@@ -290,7 +290,7 @@ module Puppet::Util::Windows::File
|
|
290
290
|
|
291
291
|
ffi_convention :stdcall
|
292
292
|
|
293
|
-
#
|
293
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx
|
294
294
|
# BOOL WINAPI ReplaceFile(
|
295
295
|
# _In_ LPCTSTR lpReplacedFileName,
|
296
296
|
# _In_ LPCTSTR lpReplacementFileName,
|
@@ -305,7 +305,7 @@ module Puppet::Util::Windows::File
|
|
305
305
|
attach_function_private :ReplaceFileW,
|
306
306
|
[:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpvoid, :lpvoid], :win32_bool
|
307
307
|
|
308
|
-
#
|
308
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx
|
309
309
|
# BOOL WINAPI MoveFileEx(
|
310
310
|
# _In_ LPCTSTR lpExistingFileName,
|
311
311
|
# _In_opt_ LPCTSTR lpNewFileName,
|
@@ -328,7 +328,7 @@ module Puppet::Util::Windows::File
|
|
328
328
|
rescue LoadError
|
329
329
|
end
|
330
330
|
|
331
|
-
#
|
331
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx
|
332
332
|
# DWORD WINAPI GetFileAttributes(
|
333
333
|
# _In_ LPCTSTR lpFileName
|
334
334
|
# );
|
@@ -336,7 +336,7 @@ module Puppet::Util::Windows::File
|
|
336
336
|
attach_function_private :GetFileAttributesW,
|
337
337
|
[:lpcwstr], :dword
|
338
338
|
|
339
|
-
#
|
339
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365535(v=vs.85).aspx
|
340
340
|
# BOOL WINAPI SetFileAttributes(
|
341
341
|
# _In_ LPCTSTR lpFileName,
|
342
342
|
# _In_ DWORD dwFileAttributes
|
@@ -358,7 +358,7 @@ module Puppet::Util::Windows::File
|
|
358
358
|
attach_function_private :CreateFileW,
|
359
359
|
[:lpcwstr, :dword, :dword, :pointer, :dword, :dword, :handle], :handle
|
360
360
|
|
361
|
-
#
|
361
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx
|
362
362
|
# BOOL WINAPI DeviceIoControl(
|
363
363
|
# _In_ HANDLE hDevice,
|
364
364
|
# _In_ DWORD dwIoControlCode,
|
@@ -376,8 +376,8 @@ module Puppet::Util::Windows::File
|
|
376
376
|
MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384
|
377
377
|
|
378
378
|
# REPARSE_DATA_BUFFER
|
379
|
-
#
|
380
|
-
#
|
379
|
+
# https://msdn.microsoft.com/en-us/library/cc232006.aspx
|
380
|
+
# https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx
|
381
381
|
# struct is always MAXIMUM_REPARSE_DATA_BUFFER_SIZE bytes
|
382
382
|
class REPARSE_DATA_BUFFER < FFI::Struct
|
383
383
|
layout :ReparseTag, :win32_ulong,
|
@@ -6,18 +6,24 @@ module Puppet::Util::Windows::SID
|
|
6
6
|
attr_reader :account, :sid_bytes, :sid, :domain, :domain_account, :account_type
|
7
7
|
|
8
8
|
def initialize(account, sid_bytes, sid, domain, account_type)
|
9
|
-
#
|
10
|
-
#
|
11
|
-
@account = account
|
9
|
+
# This is only ever called from lookup_account_sid which has already
|
10
|
+
# removed the potential for passing in an account like host\user
|
11
|
+
@account = account
|
12
12
|
@sid_bytes = sid_bytes
|
13
13
|
@sid = sid
|
14
14
|
@domain = domain
|
15
|
-
# when domain is available, combine it with parsed account
|
16
|
-
# otherwise use the account value directly
|
17
|
-
@domain_account = domain && !domain.empty? ?
|
18
|
-
"#{domain}\\#{@account}" : account
|
19
|
-
|
20
15
|
@account_type = account_type
|
16
|
+
# When domain is available and it is a Domain principal, use domain only
|
17
|
+
# otherwise if domain is available then combine it with parsed account
|
18
|
+
# otherwise when the domain is not available, use the account value directly
|
19
|
+
# WinNT naming standard https://msdn.microsoft.com/en-us/library/windows/desktop/aa746534(v=vs.85).aspx
|
20
|
+
if (domain && !domain.empty? && @account_type == :SidTypeDomain)
|
21
|
+
@domain_account = @domain
|
22
|
+
elsif (domain && !domain.empty?)
|
23
|
+
@domain_account = "#{domain}\\#{@account}"
|
24
|
+
else
|
25
|
+
@domain_account = account
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
# added for backward compatibility
|
@@ -68,12 +74,11 @@ module Puppet::Util::Windows::SID
|
|
68
74
|
raise Puppet::Util::Windows::Error.new('Failed to call LookupAccountNameW')
|
69
75
|
end
|
70
76
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
SID_NAME_USE[name_use_enum_ptr.read_uint32])
|
77
|
+
# with a SID returned, loop back through lookup_account_sid to retrieve official name
|
78
|
+
# necessary when accounts like . or '' are passed in
|
79
|
+
return lookup_account_sid(
|
80
|
+
system_name,
|
81
|
+
sid_ptr.read_bytes(sid_length_ptr.read_dword).unpack('C*'))
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
@@ -87,6 +92,10 @@ module Puppet::Util::Windows::SID
|
|
87
92
|
|
88
93
|
def self.lookup_account_sid(system_name = nil, sid_bytes)
|
89
94
|
system_name_ptr = FFI::Pointer::NULL
|
95
|
+
if (sid_bytes.nil? || (!sid_bytes.is_a? Array) || (sid_bytes.length == 0))
|
96
|
+
raise Puppet::Util::Windows::Error.new('Byte array for lookup_account_sid must not be nil and must be at least 1 byte long')
|
97
|
+
end
|
98
|
+
|
90
99
|
begin
|
91
100
|
if system_name
|
92
101
|
system_name_wide = Puppet::Util::Windows::String.wide_string(system_name)
|
@@ -224,6 +224,51 @@ module Puppet::Util::Windows::Process
|
|
224
224
|
end
|
225
225
|
module_function :windows_major_version
|
226
226
|
|
227
|
+
# Returns a hash of the current environment variables encoded as UTF-8
|
228
|
+
# The memory block returned from GetEnvironmentStringsW is double-null terminated and the vars are paired as below;
|
229
|
+
# Var1=Value1\0
|
230
|
+
# Var2=Value2\0
|
231
|
+
# VarX=ValueX\0\0
|
232
|
+
# Note - Some env variable names start with '=' and are excluded from the return value
|
233
|
+
# Note - The env_ptr MUST be freed using the FreeEnvironmentStringsW function
|
234
|
+
# Note - There is no technical limitation to the size of the environment block returned.
|
235
|
+
# However a pracitcal limit of 64K is used as no single environment variable can exceed 32KB
|
236
|
+
def get_environment_strings
|
237
|
+
env_ptr = GetEnvironmentStringsW()
|
238
|
+
|
239
|
+
pairs = env_ptr.read_arbitrary_wide_string_up_to(65534, :double_null)
|
240
|
+
.split(?\x00)
|
241
|
+
.reject { |env_str| env_str.nil? || env_str.empty? || env_str[0] == '=' }
|
242
|
+
.map { |env_pair| env_pair.split('=', 2) }
|
243
|
+
Hash[ pairs ]
|
244
|
+
ensure
|
245
|
+
if env_ptr && ! env_ptr.null?
|
246
|
+
if FreeEnvironmentStringsW(env_ptr) == FFI::WIN32_FALSE
|
247
|
+
Puppet.debug "FreeEnvironmentStringsW memory leak"
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
module_function :get_environment_strings
|
252
|
+
|
253
|
+
def set_environment_variable(name, val)
|
254
|
+
raise Puppet::Util::Windows::Error('environment variable name must not be nil or empty') if ! name || name.empty?
|
255
|
+
|
256
|
+
FFI::MemoryPointer.from_string_to_wide_string(name) do |name_ptr|
|
257
|
+
if (val.nil?)
|
258
|
+
if SetEnvironmentVariableW(name_ptr, FFI::MemoryPointer::NULL) == FFI::WIN32_FALSE
|
259
|
+
raise Puppet::Util::Windows::Error.new("Failed to remove environment variable: #{name}")
|
260
|
+
end
|
261
|
+
else
|
262
|
+
FFI::MemoryPointer.from_string_to_wide_string(val) do |val_ptr|
|
263
|
+
if SetEnvironmentVariableW(name_ptr, val_ptr) == FFI::WIN32_FALSE
|
264
|
+
raise Puppet::Util::Windows::Error.new("Failed to set environment variable: #{name}")
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
module_function :set_environment_variable
|
271
|
+
|
227
272
|
# Returns whether or not the OS has the ability to set elevated
|
228
273
|
# token information.
|
229
274
|
#
|
@@ -243,7 +288,7 @@ module Puppet::Util::Windows::Process
|
|
243
288
|
|
244
289
|
ffi_convention :stdcall
|
245
290
|
|
246
|
-
#
|
291
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx
|
247
292
|
# DWORD WINAPI WaitForSingleObject(
|
248
293
|
# _In_ HANDLE hHandle,
|
249
294
|
# _In_ DWORD dwMilliseconds
|
@@ -252,7 +297,7 @@ module Puppet::Util::Windows::Process
|
|
252
297
|
attach_function_private :WaitForSingleObject,
|
253
298
|
[:handle, :dword], :dword
|
254
299
|
|
255
|
-
#
|
300
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683189(v=vs.85).aspx
|
256
301
|
# BOOL WINAPI GetExitCodeProcess(
|
257
302
|
# _In_ HANDLE hProcess,
|
258
303
|
# _Out_ LPDWORD lpExitCode
|
@@ -261,12 +306,34 @@ module Puppet::Util::Windows::Process
|
|
261
306
|
attach_function_private :GetExitCodeProcess,
|
262
307
|
[:handle, :lpdword], :win32_bool
|
263
308
|
|
264
|
-
#
|
309
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx
|
265
310
|
# HANDLE WINAPI GetCurrentProcess(void);
|
266
311
|
ffi_lib :kernel32
|
267
312
|
attach_function_private :GetCurrentProcess, [], :handle
|
268
313
|
|
269
|
-
#
|
314
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx
|
315
|
+
# LPTCH GetEnvironmentStrings(void);
|
316
|
+
ffi_lib :kernel32
|
317
|
+
attach_function_private :GetEnvironmentStringsW, [], :pointer
|
318
|
+
|
319
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx
|
320
|
+
# BOOL FreeEnvironmentStrings(
|
321
|
+
# _In_ LPTCH lpszEnvironmentBlock
|
322
|
+
# );
|
323
|
+
ffi_lib :kernel32
|
324
|
+
attach_function_private :FreeEnvironmentStringsW,
|
325
|
+
[:pointer], :win32_bool
|
326
|
+
|
327
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms686206(v=vs.85).aspx
|
328
|
+
# BOOL WINAPI SetEnvironmentVariableW(
|
329
|
+
# _In_ LPCTSTR lpName,
|
330
|
+
# _In_opt_ LPCTSTR lpValue
|
331
|
+
# );
|
332
|
+
ffi_lib :kernel32
|
333
|
+
attach_function_private :SetEnvironmentVariableW,
|
334
|
+
[:lpcwstr, :lpcwstr], :win32_bool
|
335
|
+
|
336
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379295(v=vs.85).aspx
|
270
337
|
# BOOL WINAPI OpenProcessToken(
|
271
338
|
# _In_ HANDLE ProcessHandle,
|
272
339
|
# _In_ DWORD DesiredAccess,
|
@@ -277,7 +344,7 @@ module Puppet::Util::Windows::Process
|
|
277
344
|
[:handle, :dword, :phandle], :win32_bool
|
278
345
|
|
279
346
|
|
280
|
-
#
|
347
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379261(v=vs.85).aspx
|
281
348
|
# typedef struct _LUID {
|
282
349
|
# DWORD LowPart;
|
283
350
|
# LONG HighPart;
|
@@ -287,7 +354,7 @@ module Puppet::Util::Windows::Process
|
|
287
354
|
:HighPart, :win32_long
|
288
355
|
end
|
289
356
|
|
290
|
-
#
|
357
|
+
# https://msdn.microsoft.com/en-us/library/Windows/desktop/aa379180(v=vs.85).aspx
|
291
358
|
# BOOL WINAPI LookupPrivilegeValue(
|
292
359
|
# _In_opt_ LPCTSTR lpSystemName,
|
293
360
|
# _In_ LPCTSTR lpName,
|
@@ -297,7 +364,7 @@ module Puppet::Util::Windows::Process
|
|
297
364
|
attach_function_private :LookupPrivilegeValueW,
|
298
365
|
[:lpcwstr, :lpcwstr, :pointer], :win32_bool
|
299
366
|
|
300
|
-
#
|
367
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379626(v=vs.85).aspx
|
301
368
|
TOKEN_INFORMATION_CLASS = enum(
|
302
369
|
:TokenUser, 1,
|
303
370
|
:TokenGroups,
|
@@ -342,7 +409,7 @@ module Puppet::Util::Windows::Process
|
|
342
409
|
:MaxTokenInfoClass
|
343
410
|
)
|
344
411
|
|
345
|
-
#
|
412
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379263(v=vs.85).aspx
|
346
413
|
# typedef struct _LUID_AND_ATTRIBUTES {
|
347
414
|
# LUID Luid;
|
348
415
|
# DWORD Attributes;
|
@@ -352,7 +419,7 @@ module Puppet::Util::Windows::Process
|
|
352
419
|
:Attributes, :dword
|
353
420
|
end
|
354
421
|
|
355
|
-
#
|
422
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379630(v=vs.85).aspx
|
356
423
|
# typedef struct _TOKEN_PRIVILEGES {
|
357
424
|
# DWORD PrivilegeCount;
|
358
425
|
# LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
|
@@ -362,7 +429,7 @@ module Puppet::Util::Windows::Process
|
|
362
429
|
:Privileges, [LUID_AND_ATTRIBUTES, 1] # placeholder for offset
|
363
430
|
end
|
364
431
|
|
365
|
-
#
|
432
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb530717(v=vs.85).aspx
|
366
433
|
# typedef struct _TOKEN_ELEVATION {
|
367
434
|
# DWORD TokenIsElevated;
|
368
435
|
# } TOKEN_ELEVATION, *PTOKEN_ELEVATION;
|
@@ -370,7 +437,7 @@ module Puppet::Util::Windows::Process
|
|
370
437
|
layout :TokenIsElevated, :dword
|
371
438
|
end
|
372
439
|
|
373
|
-
#
|
440
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa446671(v=vs.85).aspx
|
374
441
|
# BOOL WINAPI GetTokenInformation(
|
375
442
|
# _In_ HANDLE TokenHandle,
|
376
443
|
# _In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
|
@@ -5,7 +5,7 @@ module Puppet::Util::Windows
|
|
5
5
|
require 'ffi'
|
6
6
|
extend FFI::Library
|
7
7
|
|
8
|
-
#
|
8
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx
|
9
9
|
KEY64 = 0x100
|
10
10
|
KEY32 = 0x200
|
11
11
|
|
@@ -34,7 +34,7 @@ class Puppet::Util::Windows::RootCerts
|
|
34
34
|
certs = []
|
35
35
|
|
36
36
|
# This is based on a patch submitted to openssl:
|
37
|
-
#
|
37
|
+
# https://www.mail-archive.com/openssl-dev@openssl.org/msg26958.html
|
38
38
|
ptr = FFI::Pointer::NULL
|
39
39
|
store = CertOpenSystemStoreA(nil, "ROOT")
|
40
40
|
begin
|
@@ -57,7 +57,7 @@ class Puppet::Util::Windows::RootCerts
|
|
57
57
|
ffi_convention :stdcall
|
58
58
|
# typedef void *HCERTSTORE;
|
59
59
|
|
60
|
-
#
|
60
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa377189(v=vs.85).aspx
|
61
61
|
# typedef struct _CERT_CONTEXT {
|
62
62
|
# DWORD dwCertEncodingType;
|
63
63
|
# BYTE *pbCertEncoded;
|
@@ -75,7 +75,7 @@ class Puppet::Util::Windows::RootCerts
|
|
75
75
|
)
|
76
76
|
end
|
77
77
|
|
78
|
-
#
|
78
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa376560(v=vs.85).aspx
|
79
79
|
# HCERTSTORE
|
80
80
|
# WINAPI
|
81
81
|
# CertOpenSystemStoreA(
|
@@ -86,7 +86,7 @@ class Puppet::Util::Windows::RootCerts
|
|
86
86
|
ffi_lib :crypt32
|
87
87
|
attach_function_private :CertOpenSystemStoreA, [:ulong_ptr, :lpcstr], :handle
|
88
88
|
|
89
|
-
#
|
89
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa376050(v=vs.85).aspx
|
90
90
|
# PCCERT_CONTEXT
|
91
91
|
# WINAPI
|
92
92
|
# CertEnumCertificatesInStore(
|
@@ -96,7 +96,7 @@ class Puppet::Util::Windows::RootCerts
|
|
96
96
|
ffi_lib :crypt32
|
97
97
|
attach_function_private :CertEnumCertificatesInStore, [:handle, :pointer], :pointer
|
98
98
|
|
99
|
-
#
|
99
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa376026(v=vs.85).aspx
|
100
100
|
# BOOL
|
101
101
|
# WINAPI
|
102
102
|
# CertCloseStore(
|
@@ -41,7 +41,7 @@
|
|
41
41
|
# must be running with elevated privileges.
|
42
42
|
# * A file/dir can be deleted by anyone with the DELETE access right
|
43
43
|
# OR by anyone that has the FILE_DELETE_CHILD access right for the
|
44
|
-
# parent. See
|
44
|
+
# parent. See https://support.microsoft.com/kb/238018. But on Unix,
|
45
45
|
# the user must have write access to the file/dir AND execute access
|
46
46
|
# to all of the parent path components.
|
47
47
|
# * Many access control entries are inherited from parent directories,
|
@@ -65,8 +65,6 @@ require 'puppet/util/windows'
|
|
65
65
|
require 'pathname'
|
66
66
|
require 'ffi'
|
67
67
|
|
68
|
-
require 'win32/security'
|
69
|
-
|
70
68
|
module Puppet::Util::Windows::Security
|
71
69
|
include Puppet::Util::Windows::String
|
72
70
|
|
@@ -199,9 +197,9 @@ module Puppet::Util::Windows::Security
|
|
199
197
|
def get_mode(path)
|
200
198
|
return unless supports_acl?(path)
|
201
199
|
|
202
|
-
well_known_world_sid =
|
203
|
-
well_known_nobody_sid =
|
204
|
-
well_known_system_sid =
|
200
|
+
well_known_world_sid = Puppet::Util::Windows::SID::Everyone
|
201
|
+
well_known_nobody_sid = Puppet::Util::Windows::SID::Nobody
|
202
|
+
well_known_system_sid = Puppet::Util::Windows::SID::LocalSystem
|
205
203
|
|
206
204
|
mode = S_ISYSTEM_MISSING
|
207
205
|
|
@@ -278,9 +276,9 @@ module Puppet::Util::Windows::Security
|
|
278
276
|
# that they do not have read and write access to.
|
279
277
|
def set_mode(mode, path, protected = true)
|
280
278
|
sd = get_security_descriptor(path)
|
281
|
-
well_known_world_sid =
|
282
|
-
well_known_nobody_sid =
|
283
|
-
well_known_system_sid =
|
279
|
+
well_known_world_sid = Puppet::Util::Windows::SID::Everyone
|
280
|
+
well_known_nobody_sid = Puppet::Util::Windows::SID::Nobody
|
281
|
+
well_known_system_sid = Puppet::Util::Windows::SID::LocalSystem
|
284
282
|
|
285
283
|
owner_allow = FILE::STANDARD_RIGHTS_ALL |
|
286
284
|
FILE::FILE_READ_ATTRIBUTES |
|
@@ -361,12 +359,12 @@ module Puppet::Util::Windows::Security
|
|
361
359
|
inherit_only = Puppet::Util::Windows::AccessControlEntry::INHERIT_ONLY_ACE
|
362
360
|
if isdir
|
363
361
|
inherit = inherit_only | Puppet::Util::Windows::AccessControlEntry::CONTAINER_INHERIT_ACE
|
364
|
-
dacl.allow(
|
365
|
-
dacl.allow(
|
362
|
+
dacl.allow(Puppet::Util::Windows::SID::CreatorOwner, owner_allow, inherit)
|
363
|
+
dacl.allow(Puppet::Util::Windows::SID::CreatorGroup, group_allow, inherit)
|
366
364
|
|
367
365
|
inherit = inherit_only | Puppet::Util::Windows::AccessControlEntry::OBJECT_INHERIT_ACE
|
368
|
-
dacl.allow(
|
369
|
-
dacl.allow(
|
366
|
+
dacl.allow(Puppet::Util::Windows::SID::CreatorOwner, owner_allow & ~FILE::FILE_EXECUTE, inherit)
|
367
|
+
dacl.allow(Puppet::Util::Windows::SID::CreatorGroup, group_allow & ~FILE::FILE_EXECUTE, inherit)
|
370
368
|
end
|
371
369
|
|
372
370
|
new_sd = Puppet::Util::Windows::SecurityDescriptor.new(sd.owner, sd.group, dacl, protected)
|
@@ -579,7 +577,7 @@ module Puppet::Util::Windows::Security
|
|
579
577
|
end
|
580
578
|
|
581
579
|
def get_max_generic_acl_size(ace_count)
|
582
|
-
#
|
580
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa378853(v=vs.85).aspx
|
583
581
|
# To calculate the initial size of an ACL, add the following together, and then align the result to the nearest DWORD:
|
584
582
|
# * Size of the ACL structure.
|
585
583
|
# * Size of each ACE structure that the ACL is to contain minus the SidStart member (DWORD) of the ACE.
|
@@ -643,7 +641,7 @@ module Puppet::Util::Windows::Security
|
|
643
641
|
|
644
642
|
ffi_convention :stdcall
|
645
643
|
|
646
|
-
#
|
644
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
|
647
645
|
# HANDLE WINAPI CreateFile(
|
648
646
|
# _In_ LPCTSTR lpFileName,
|
649
647
|
# _In_ DWORD dwDesiredAccess,
|
@@ -657,7 +655,7 @@ module Puppet::Util::Windows::Security
|
|
657
655
|
attach_function_private :CreateFileW,
|
658
656
|
[:lpcwstr, :dword, :dword, :pointer, :dword, :dword, :handle], :handle
|
659
657
|
|
660
|
-
#
|
658
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx
|
661
659
|
# BOOL WINAPI GetVolumeInformation(
|
662
660
|
# _In_opt_ LPCTSTR lpRootPathName,
|
663
661
|
# _Out_opt_ LPTSTR lpVolumeNameBuffer,
|
@@ -672,7 +670,7 @@ module Puppet::Util::Windows::Security
|
|
672
670
|
attach_function_private :GetVolumeInformationW,
|
673
671
|
[:lpcwstr, :lpwstr, :dword, :lpdword, :lpdword, :lpdword, :lpwstr, :dword], :win32_bool
|
674
672
|
|
675
|
-
#
|
673
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374951(v=vs.85).aspx
|
676
674
|
# BOOL WINAPI AddAccessAllowedAceEx(
|
677
675
|
# _Inout_ PACL pAcl,
|
678
676
|
# _In_ DWORD dwAceRevision,
|
@@ -684,7 +682,7 @@ module Puppet::Util::Windows::Security
|
|
684
682
|
attach_function_private :AddAccessAllowedAceEx,
|
685
683
|
[:pointer, :dword, :dword, :dword, :pointer], :win32_bool
|
686
684
|
|
687
|
-
#
|
685
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374964(v=vs.85).aspx
|
688
686
|
# BOOL WINAPI AddAccessDeniedAceEx(
|
689
687
|
# _Inout_ PACL pAcl,
|
690
688
|
# _In_ DWORD dwAceRevision,
|
@@ -696,7 +694,7 @@ module Puppet::Util::Windows::Security
|
|
696
694
|
attach_function_private :AddAccessDeniedAceEx,
|
697
695
|
[:pointer, :dword, :dword, :dword, :pointer], :win32_bool
|
698
696
|
|
699
|
-
#
|
697
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374931(v=vs.85).aspx
|
700
698
|
# typedef struct _ACL {
|
701
699
|
# BYTE AclRevision;
|
702
700
|
# BYTE Sbz1;
|
@@ -712,9 +710,9 @@ module Puppet::Util::Windows::Security
|
|
712
710
|
:Sbz2, :word
|
713
711
|
end
|
714
712
|
|
715
|
-
#
|
713
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374912(v=vs.85).aspx
|
716
714
|
# ACE types
|
717
|
-
#
|
715
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374919(v=vs.85).aspx
|
718
716
|
# typedef struct _ACE_HEADER {
|
719
717
|
# BYTE AceType;
|
720
718
|
# BYTE AceFlags;
|
@@ -726,17 +724,17 @@ module Puppet::Util::Windows::Security
|
|
726
724
|
:AceSize, :word
|
727
725
|
end
|
728
726
|
|
729
|
-
#
|
727
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374892(v=vs.85).aspx
|
730
728
|
# ACCESS_MASK
|
731
729
|
|
732
|
-
#
|
730
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374847(v=vs.85).aspx
|
733
731
|
# typedef struct _ACCESS_ALLOWED_ACE {
|
734
732
|
# ACE_HEADER Header;
|
735
733
|
# ACCESS_MASK Mask;
|
736
734
|
# DWORD SidStart;
|
737
735
|
# } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
|
738
736
|
#
|
739
|
-
#
|
737
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa374879(v=vs.85).aspx
|
740
738
|
# typedef struct _ACCESS_DENIED_ACE {
|
741
739
|
# ACE_HEADER Header;
|
742
740
|
# ACCESS_MASK Mask;
|
@@ -751,12 +749,12 @@ module Puppet::Util::Windows::Security
|
|
751
749
|
:SidStart, :dword
|
752
750
|
end
|
753
751
|
|
754
|
-
#
|
752
|
+
# https://stackoverflow.com/a/1792930
|
755
753
|
MAXIMUM_SID_BYTES_LENGTH = 68
|
756
754
|
MAXIMUM_GENERIC_ACE_SIZE = GENERIC_ACCESS_ACE.offset_of(:SidStart) +
|
757
755
|
MAXIMUM_SID_BYTES_LENGTH
|
758
756
|
|
759
|
-
#
|
757
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa446634(v=vs.85).aspx
|
760
758
|
# BOOL WINAPI GetAce(
|
761
759
|
# _In_ PACL pAcl,
|
762
760
|
# _In_ DWORD dwAceIndex,
|
@@ -766,7 +764,7 @@ module Puppet::Util::Windows::Security
|
|
766
764
|
attach_function_private :GetAce,
|
767
765
|
[:pointer, :dword, :pointer], :win32_bool
|
768
766
|
|
769
|
-
#
|
767
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa375202(v=vs.85).aspx
|
770
768
|
# BOOL WINAPI AdjustTokenPrivileges(
|
771
769
|
# _In_ HANDLE TokenHandle,
|
772
770
|
# _In_ BOOL DisableAllPrivileges,
|
@@ -779,9 +777,9 @@ module Puppet::Util::Windows::Security
|
|
779
777
|
attach_function_private :AdjustTokenPrivileges,
|
780
778
|
[:handle, :win32_bool, :pointer, :dword, :pointer, :pdword], :win32_bool
|
781
779
|
|
782
|
-
#
|
783
|
-
#
|
784
|
-
#
|
780
|
+
# https://msdn.microsoft.com/en-us/library/windows/hardware/ff556610(v=vs.85).aspx
|
781
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379561(v=vs.85).aspx
|
782
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa446647(v=vs.85).aspx
|
785
783
|
# typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
|
786
784
|
# BOOL WINAPI GetSecurityDescriptorControl(
|
787
785
|
# _In_ PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
@@ -792,7 +790,7 @@ module Puppet::Util::Windows::Security
|
|
792
790
|
attach_function_private :GetSecurityDescriptorControl,
|
793
791
|
[:pointer, :lpword, :lpdword], :win32_bool
|
794
792
|
|
795
|
-
#
|
793
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa378853(v=vs.85).aspx
|
796
794
|
# BOOL WINAPI InitializeAcl(
|
797
795
|
# _Out_ PACL pAcl,
|
798
796
|
# _In_ DWORD nAclLength,
|
@@ -802,7 +800,7 @@ module Puppet::Util::Windows::Security
|
|
802
800
|
attach_function_private :InitializeAcl,
|
803
801
|
[:pointer, :dword, :dword], :win32_bool
|
804
802
|
|
805
|
-
#
|
803
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379142(v=vs.85).aspx
|
806
804
|
# BOOL WINAPI IsValidAcl(
|
807
805
|
# _In_ PACL pAcl
|
808
806
|
# );
|
@@ -810,7 +808,7 @@ module Puppet::Util::Windows::Security
|
|
810
808
|
attach_function_private :IsValidAcl,
|
811
809
|
[:pointer], :win32_bool
|
812
810
|
|
813
|
-
#
|
811
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379593(v=vs.85).aspx
|
814
812
|
SE_OBJECT_TYPE = enum(
|
815
813
|
:SE_UNKNOWN_OBJECT_TYPE, 0,
|
816
814
|
:SE_FILE_OBJECT,
|
@@ -827,7 +825,7 @@ module Puppet::Util::Windows::Security
|
|
827
825
|
:SE_REGISTRY_WOW64_32KEY
|
828
826
|
)
|
829
827
|
|
830
|
-
#
|
828
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa446654(v=vs.85).aspx
|
831
829
|
# DWORD WINAPI GetSecurityInfo(
|
832
830
|
# _In_ HANDLE handle,
|
833
831
|
# _In_ SE_OBJECT_TYPE ObjectType,
|
@@ -842,7 +840,7 @@ module Puppet::Util::Windows::Security
|
|
842
840
|
attach_function_private :GetSecurityInfo,
|
843
841
|
[:handle, SE_OBJECT_TYPE, :dword, :pointer, :pointer, :pointer, :pointer, :pointer], :dword
|
844
842
|
|
845
|
-
#
|
843
|
+
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379588(v=vs.85).aspx
|
846
844
|
# DWORD WINAPI SetSecurityInfo(
|
847
845
|
# _In_ HANDLE handle,
|
848
846
|
# _In_ SE_OBJECT_TYPE ObjectType,
|