Added FreeBSD portmaster package_method
Fix filestat test pass condition.

Pass when all conditions are met, not when any condition is met.
Redmine #2691: missing group name spec for some platforms in test

The 10_files/02_maintain/205.cf has a test_perms body which sets the
owner and group of the test file by "root" user and a group name,
then the rest of the test run compares the UID and GID numbers to
verify the test. The group names are defined for either linux or freebsd,
but no other platforms.

In the absence of a specification, the file created by the test takes the
default group of the process owner, which for root is "sys" GID 3 on
HP-UX 11.11, causing the test to show "0 3" instead of "0 0" and thus
failing.

This commit adds correct GID 0 group names for hpux, solaris, netbsd,
openbsd, darwin, aix, and cray platforms.

The "sys" group for Cray:
   http://docs.cray.com/books/S-2311-22/html-S-2311-22/z1055890212.html

The "system" group for AIX:
   http://publib.boulder.ibm.com/tividd/td/user_admin/GC32-0661-01/en_US/HTML/admusref34.htm

I was unable to find documentation for unix_sv, sco, qnx, dragonfly, or
vmware platforms.

With this update, the test now passes on HP-UX:

mphp1# ./testall --agent=/var/cfengine/bin/cf-agent 10_files/02_maintain/205.cf
======================================================================
Testsuite started at May 21:19:06
----------------------------------------------------------------------
Total tests: 1

./10_files/02_maintain/205.cf Pass

======================================================================
Testsuite finished at May 21:19:24 (18 seconds)

Passed tests: 1
Failed tests: 0
Failed to crash tests: 0
Skipped tests: 0
mphp1# uname -a
HP-UX mphp1 B.11.11 U 9000/785 2007997283 unlimited-user license
mphp1#
Redmine #2693: some 10_files tests check for unpromised gid numbers

Some platforms, such as HP-UX, do not have root in group 0 by default.
Certain tests expect a string showing mode, nlinks, uid, gid, and size
to show a uid and gid of zero for the test file, but without promising
the GID the file defaults to root's primary group. On HP-UX this is 3,
causing the test to fail.

The tests have been updated to promise the same mode, uid, and gid that
are expected in the "expect" string for the test file that is created.
Redmine #2702: add missing uid/gid name mapping for hpux & aix

Tests 01_vars/02_functions/001.cf and 002.cf fail on HP-UX and AIX
because the hard classes don't cover the uid and gid mappings for
those platforms. This commit adds the necessary information to
allow the tests to pass on those two platforms.

HP-UX information was gathered from and tested on my own HP-UX
system, and for AIX see the following links for sample passwd
and group files:

http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.security%2Fdoc%2Fsecurity%2Fpasswords_etc_passwd_file.htm

http://www.rootunix.org/AIX/migrate.txt
Redmine #2704: fix canonify issue with negative signed chars

On HP-UX 11.11, the "isalnum()" call expects a range of values from
-1 to 255. However the range of a signed char is -127 to 127, and
when an out-of-range negative number is passed to isalnum() on this
platform, the results in the case of the Yen symbol in acceptance
test 01_vars/02_functions/007.cf, with a signed char value of -91,
isalnum() returns "2" which is taken to mean that the Yen symbol
is alphanumeric.

By casting to "unsigned char" before the cast to "int" for the call,
the "-91" value is converted to a valid character set value of 165,
which is properly handled by isalnum() and thus allows the test to
pass.
Change configure test for getaddrinfo

The problem is that with the default AC_REPLACE_FUNCS, autoconf declares it as
"char getaddrinfo(void)". However on Windows, because of stdcall calling
convention, the symbol emitted differs because of the missing calling
convention directive and the different the number of arguments.

See http://lists.gnu.org/archive/html/autoconf/2013-05/msg00085.html for more
info.
Make the getaddrinfo check even simpler.

Amending the previous commit, this one removes completely the linking test for
getaddrinfo. So to replace the function, it is enough now for the platform to
be missing getaddrinfo declaration.
Merge pull request #687 from jimis/win32

Fix for MinGW 32-bit build.
Don't read free()'d pointer in loop increment.
Fix memory leak in refcount.
Add SeqSoftDestroy to destroy a sequence without destroying its items.
Fixed memory leaks in policy.c.
Fix memory leaks in evaluation.
Fixed memory leak in cf-serverd.
Fix memory leak in logging.
Fix many parser and lexer memory leaks.
Merge branch 'master' of git://github.com/cfengine/core into memFixes

Conflicts:
	libpromises/expand.c
Update README.md
Squashed commit of the following:

commit 5880c565888195490663b89a2b4b7b56d0495ad1
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Wed May 22 19:03:44 2013 +0200

    Don't register a thread-ID callback on Windows.

    pthread_t on MinGW32 is a struct, and long is not large enough to hold the void*
    within.

    OpenSSL documentation states: If the application does not register such a callback
    using CRYPTO_THREADID_set_callback(), then a default implementation is used - on
    Windows and BeOS this uses the system's default thread identifying APIs

    So not setting this callback at all will be safe.

commit 32408d29c3d87576446f5d12523fbe2fcd26da12
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Wed May 22 17:12:26 2013 +0200

    Compile on systems where alternative API is avaiable

commit 1f7beb743656c0d11f0b0b0880b2dd3f1ee03d76
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 08:04:26 2013 +0200

    With OpenSSL initialized to be made thread-safe, we don't have to serialize
    access to the OpenSSL functions anymore.

    Some other things were protected here by the cft_system locking:

    - the ServerConnectionState *conn

    This structure is initialized in the main thread, and then passed to the
    thread handler, which takes exclusive ownership. No access to this object
    from other threads is possible or allowed.

    - malloc calls

    Those are implicily threadsafe on all supported platforms today

    Conflicts:

    	src/cf-serverd.c

commit 3cc7c617b0f035a107101bc511126086befde5a5
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 07:55:14 2013 +0200

    Initialize OpenSSL with callback functions for threadlocking.

    This makes OpenSSL threadsafe, and allows us to remove locking around the
    calls to the RSA encryption functions in cf-serverd's AuthenticationDialogue.
    Implements #2678

    Note: the functions used - as well as most other functions used from
    OpenSSL - are marked as deprecated on Mac OSX 10.7 and later.
    Compiler warnings explicitly disabled. Functions documented in OpenSSL
    documentation (http://www.openssl.org/docs/crypto/threads.html) to replace
    some of these functions (such as CRYPTO_THREADID_set_callback) are not
    available. This implementation follows the example provided on
    http://www.opensource.apple.com/source/OpenSSL/OpenSSL-10/openssl/crypto/threads/mttest.c

    Conflicts:

    	src/crypto.c
    	src/generic_agent.c

commit 80d71ade7999c12c31902f7baa1513bd7d3e3ddb
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 07:43:26 2013 +0200

    Silence deprecated warnings when compiling on Mac OSX.

    Majority of functions in /usr/include/openssl/crypto.h are marked as
    deprecated for Mac OSX 10.7 and later. Silence warnings.

    Conflicts:

    	src/crypto.c