session: Reorder shutdown sequence

By calling __connman_session_cleanup() before __connman_plugin_cleanup()
we make sure all resources allocated can released in the correct order.
The code assumes after an successful allocation, free will always work
and therefore we double free allocated memory.
session: Do not access initialized hash table

Make sure we never try to cleanup when the hash table has
been destroyed. In this case all resources have been
freed already.
session: Empty policy list indicated no match all

Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty
list means no match.
session_policy_local: Set default policy using common code

Use connman_sessoin_set_default_config() instead of open coded
version.

This prepars the next fix.
session_policy_local: Empty policy list indicated no match all

Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty
list means no match.
session_policy_local: Do not free policy on load error

We should not unref the policy on parsing errors becase the policy
lifetime is attached to the lifetime of the file. When the file
is removed we remove it from the hash table.
session_policy_local: Load policy when a new file is added

When a file is added (not modified) we need to parse it as well
session: Add "_t" postfix to callback typedef

Be more consistent with the rest. Also shorten the a bit to verbose
name of the callback function.
session_policy_local: Use callback helpers

Use the generic callback helpers to encapsulate struct create_data.
In a later patch we will add some more data elemets to struct
create_data. That is the reason why it is not remove here.
dbus: Use callback helpers

Use the global callback helpers instead using the local version.
dbus: Add connman_dbus_get_connnection_unix_user()
session: Do not fail when creating default policy configuration

Do not handle the small alloc failures because glib will abort
when memory is tight anyway.
session_policy_local: Do not handle small allocation

Let's remove the small allocations error path because glib will
abort on memory exhausting anyway. Basically we remove dead code.
session_policy_local: Refactor SELinux context parser

selinux_context_reply() should handle the 'type' conversion of
data it gets from D-Bus.
session_policy_local: Add some more debug infos
session_policy_local: Print warning if loading of policy fails

Also continue reading the rest of the policy files when starting up.
This makes the startup behavior consistent with the runtime
behavior.
session_policy_local: Track policy data structure in a separate list

We want to make the lifetime of the policy data structure independent
of the policy_hash table.
session_policy_local: Use policy_hash only to track the policy files

Let's move the owner ship to the policy_list. The policy_hash is
only used to lookup the policy data structure.

This patch removes the requirement that the 'ident' is key to lookup
the policy data. Now we are able to define set of rules how we want
associate the file with a session.
session_policy_local: Rename policy_hash to file_hash

Which reflects the new usage of the hash much better.
session_policy_local: Rename ident to filename

ident is not shared anymore between the session policy and
the file policy. Let's make this clear be renaming this member.