(PUP-2632) Make Type be subtype of Object

Without this change, a reference to "any" must be written
Optional[Variant[Type, Object]] which is quite horrible.
There is no harm in making Type an Object since that is the most
abstract type as seen from the Puppet Programming Language.
(PUP-2314) Make assert_type handle lambda and user handling

This adds the ability to handle a Callable as the value, as well
as supporting a lambda that takes over the built in raising of
an error. This means that assert_type can be customized to fail
with special message, or to issue a warning and use a default.

assert_type(String, 1) |$expected, $actual| {
  warning("a $actual is not a $expected")
  "Free Beer, is the default"
}
Merge branch 'stable'
Merge branch 'ticket/master/PUP-2385-FFI-Windows-File'

* ticket/master/PUP-2385-FFI-Windows-File:
  (PUP-2385) FFI Puppet::Util::Windows::File
  (PUP-2385) Puppet::Util::Windows::File refactor
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (maint) Test a different cert for extensions
Merge branch 'stable'

* stable:
  (packaging) Update PUPPETVERSION to 3.6.1
(PUP-2642) Make default in selector be out of band, raise error nomatch

This makes the selector expression in the future evaluator have
the same semantics as the 3.6.1 current evaluator. The future evauator
did not process default out of band, and did not raise an error when
there was no match.

This fixes both problems.
(PUP-836) FFI Puppet::Util::Windows::User

 - LogonUserW, LoadUserProfile, UnloadUserProfile and PROFILEINFO
   have been converted from manually packing params with Win32API.new to
   automatically managed with FFI definitions.
 - Use MemoryPointer where appropriate.
 - Note that wide character LogonUserW is used rather than platform
   varying LogonUser as FFI is unable to use that.  The pointer
   widths of PROFILEINFO vary depending on platform, which is handled
   by using :pointer.  With LogonUserW the string pointed to is always
   wide character, which is properly handled by using wide_string.
 - Add FFI::MemoryPointer helper read_handle
 - Add FFI::MemoryPointer.from_wide_string and corresponding tests that
   ensure that a properly terminated UTF-16LE string is passed in
 - Add FFI::MemoryPointer#read_wide_string that reads a wide string buffer
   into a Ruby string with Encoding.default_external and corresponding tests
 - Add additional tests around User methods that make native Win32 API calls
   that will intentionally fail
 - Fix wide_string helper to return nil when given nil so that can be passed
   directly to Win32 as a null pointer
(PUP-836) FFI Puppet::Util::Windows::User

 - Remove dependence on Win32 API calls defined in the win32-security
   gem, including CreateWellKnownSid, IsValidSid, CheckTokenMembership
 - These calls have all been FFI'd accordingly
 - Add FFI::MemoryPointer helper read_bool
(PUP-836) Remove Win32::Security.elevated_security

 - Refactor Puppet::Util::Windows::Process to implement new method
   elevated_security? that was in win32-security gem
 - Refactor get_token_information to return an FFI::MemoryPointer buffer
   instead of a parsed structure, since GetTokenInformation is a generic
   call that can return many structure types, including TOKEN_ELEVATION.
 - Remove any reliance on win32-security gem from user.rb
 - Adjust tests accordingly
Merge pull request #2675 from Iristyle/ticket/master/PUP-836-FFI-Windows-User

(PUP-836) FFI Puppet::Util::Windows::User
(PUP-2544) Util::ADSI -> Util::Windows::ADSI

 - Move Windows ADSI code out of puppet/util and into
   puppet/util/windows
 - Update namespace from Puppet::Util::ADSI to
   Puppet::Util::Windows::ADSI
 - Add module / class definitions for ADSI to util/windows.rb
   to prevent tests from blowing up on non-Windows
 - Moving Puppet.features.microsoft_windows? checks to top of
   user and group provider tests for ADSI
 - Update all dependent code, remove unnecessary references
(PUP-2554) FFI Puppet::Util::ADSI

 - Convert ADSI GetComputerName to FFI
 - Add missing error handling for GetComputerName Win32 function
 - Add test that verifies GetComputerName returns a non-empty string
 - Add FFI MemoryPointer aliases for dwords

Conflicts:
  spec/unit/util/windows/adsi_spec.rb
Merge branch 'pr/2677'

* pr/2677:
  (PUP-2554) FFI Puppet::Util::ADSI
  (PUP-2544) Util::ADSI -> Util::Windows::ADSI

Closes GH-2677
(PUP-2514) Remove ability to search for String type in String.

While philosophically true, a String consists of a number of
substrings, it is not very meaningful to support only the ability to
assert that. In order to be useful it would need to answer a much wider
variety is Enum[red, blue, green] in "it was blue, orange, and red", is
there a String of 1-5 characters in length inside the string "1234" etc.

This commit removes the naive support for String/Data-type search
in String as it is more confusing than helpful. If we later find it to
be of value, a more elaborate implementation is needed.
Merge pull request #2687 from hlindberg/PUP-2642_selector-default-out-of-band

(PUP-2642) Make default in selector be out of band, raise error nomatch
(PUP-2382) FFI typedef for win32_bool / fix User

 - Previously check_token_membership was failing in 2003 spec tests
   due to 2 issues
   - FFI::Pointer::NULL cannot be used in place of our :handle typedef,
     and therefore we must add a new constant of 0 to be used for NULL
     handles
   - FFI defines a :bool as variable width "(?? 1 byte in C++)", while
     Win32 defines a BOOL as int, and is fixed to 4 bytes on x86 and x64
 - Fortunately the bool issue really only bit us in the one spot where
   we were using a pointer to a bool, but by adding a new typedef for
   :win32_bool, all call sites comparing the return value needed to be
   updated for correctness to compare against FFI::WIN32_FALSE
 - A test was added to ensure these APIs are called during spec tests
   on all Windows platforms, and not just 2003
(PUP-840) FFI Puppet::Util::Colors

 - Replace WriteConsole / WriteConsoleOutputCharacter calls with FFI
   equivalents
 - Remove string_encode function as it's no longer necessary and the
   test that was using it
Merge pull request #2691 from Iristyle/ticket/master/PUP-2382-FFI-win32-bool

(PUP-2382) FFI typedef for win32_bool / fix User
Merge pull request #2685 from hlindberg/PUP-2314_assert-type-lambda-and-message

(PUP-2314)(PUP-2632) Fix assert_type's API