Fix for an exploitable local denial of service in tcsd

Reported-by: Peter Huewe <peterhuewe@gmx.de>
Tested-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by:  Andreas Fuchs <andreas.fuchs@sit.fraunhofer.de>
Acked-by: Hon Ching Lo <honclo2014@gmail.com>
[PATCH] Enable GetCompositeHash for PCRS_STRUCT_INFO (v1.1)

Tested-by: Richard Maciel<rmaciel@linux.vnet.ibm.com>
Signed-off by: Andreas Fuchs <andreas.fuchs@sit.fraunhofer.de>
Acked-by: Hon Ching Lo <honclo2014@gmail.com>
Merge branch 'tspi_pci' into develop
Fixed incorrect check of the result of getpeername(2)
Fixed the wrong type used while comparing IPv4 addresses

src/tcs/rpc/tcstp/rpc.c:access_control() checks if peer's address is
INADDR_LOOPBACK. There are two issues with the current code:

1. For correctness, in_addr_t should be used instead of uint32_t.
2. memcmp(3) is passed sizeof(struct sockaddr_in) that is larger than
sizeof(in_add_r) (or sizeof(uin32_t) for that matter), so the call
always fails.
Fixed the wrong type used while comparing IPv6 addresses

src/tcs/rpc/tcstp/rpc.c:access_control() checks if peer's address
is in6addr_loopback. memcmp(3) is passed sizeof(struct sockaddr_in6)
that is larger than sizeof(struct in6_addr), so the call always fails.
Fixed failure to recognise connections from localhost over IPv6

Misplaced closing curly bracket makes check for ::1 a dead code.
The attached patch fixes this issue.
Fixed failure to recognize connections from localhost over IPv6

Misplaced closing curly bracket makes check for ::1 a dead code.
The attached patch fixes this issue.
Merge branch 'dev'
Fixed the problem of the function Tspi_Context_Close when is enabled
remote connection uncommenting the remote_ops in the file tcsd.conf.

All the time that this function is called, it was returning:

*** double free or corruption (fasttop): 0x0000000001487af0 ***
Aborted (core dumped)

The functions RPC_OpenContext and obj_context_set_machine_name
in Tspi_Context_Connect were receiving the same memory address
from the variable machine_name.

With that, when Tspi_Context_Close called obj_close_context,
this function called the function free passing as argument the
variable machineName that had the same memory address from that
one pointed by RPC_OpenContext.

However remove_table_entry in RPC_CloseContext had already
called the function free to that memory address. The result is
the error message described above.
Removed misguided attempt to free memory in Tspi_Context_Close

The docs and note in the code state that Tspi_Context_FreeMemory
should be called explicitly before calling Close. Currently it
does not free memory anyway, because Tspi_Context_FreeMemory will
refuse to work on an already closed context.

Originally introduced in 6e789a06f34d51cd8c9da6138e17a5a8db35a129,
turned into no-op in 59af8e1b2d5537d82fce1d4990a880f7390fb248.
Fixed possible double free when freeing context memory

Use the right free call or else it will crash when freeing context
memory and an owner evict key has been loaded.