facebook: Add fallback to get presentation id

After the facebook login, the email address from the returned json
object is used as presentation identity. Seems that the email is not
always availale. In this case, use the username from the json object as
fallback.

https://bugzilla.gnome.org/show_bug.cgi?id=739168
daemon: Free presentation identity when finished with it

The update_account_object function reads an account's presentation
identity from the accounts configuration.  GKeyFile returns a
duped string and so the presentation identity needs to be freed.

https://bugzilla.gnome.org/show_bug.cgi?id=739590
kerberos: Plug leak in error handling

It's a little tedious to convert a kerberos error into a GError,
so there's a helper function to do it: set_error_from_krb5_error_code

That helper function leaks the format string use for constructing the
GError's message.

This commit fixes that.

https://bugzilla.gnome.org/show_bug.cgi?id=739590
identity: plug leak in identity service

When the identity service first starts up, it gets a list
of preexisting kerberos principals and then exports them
over the bus.

The object path used for the exported objects is getting leaked.
This commit fixes that.

https://bugzilla.gnome.org/show_bug.cgi?id=739590
kerberos: drop weird, superfluous assignment in query function

goa_kerberos_identity_inquiry_answer_query has this strange code:

g_return_if_fail (inquiry == kerberos_query->inquiry);
...
inquiry = kerberos_query->inquiry;

It's completely redundant and makes no sense so drop it.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
kerberos: Zero initialize operation structure

We need zero initialize the structure so we don't end up
freeing unused members when cleaning up the operation.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
identity: Destroy alarms from main thread, even on dispose

These days we defer destroying alarms to the main thread when
alarms are reset.  We still dispose of alarms in the current
thread when disposing their identity object, however.

This commit changes the code to always dispose of alarms from
the main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
identity: add some locking around expiration time

We don't want the expiration time to get read while it's getting
written.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
identity: Make verify_identity have one exit path

This makes the control flow easier to follow and lays the way
for a follow up change.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
identity: don't set expiration_time to 0 intermediately while verifying identity

The top of verify_identity calls

set_expiration_time(self, 0);

as a way to make sure the expiration time is 0'd if the identity's
credentials are invalidated.  In the case, they are still valid,
set_expiration_time is called again with the new, most up to date
value. The problem is the intermediate 0 isn't invisible, there's a
window where the identity can be read and 0 will get returned, even
when the identity is valid.

This commit defers setting the expiration time until the very end of
the function.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
kerberos: fail inquiry if provided buffer is too small for password

Right now we just truncate the user's response if it's too big for
the passed in buffer.  That's wrong on a theoretical level; we
shouldn't ever use a password that the user didn't enter
(even if it's a truncated version of what the user did enter).
In practice, it's not actually a problem. The kerberos library provides
a full 1024 byte buffer, which is much longer than a user would
realistically enter into an entry.

Still, this commit addresses the problem by introducing a mechanism for
failing the inquiry.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
kerberos: change is_failed in inquiry struct from bitfield to gboolean

I meant to do that change in the previous commit but forgot to
git commit --amend before running git bz push.

https://bugzilla.gnome.org/show_bug.cgi?id=739593
inquiry: fix edge case when answer is full size of reply buffer

Right now if the user's answer is 1024 bytes exactly then we'll
call strlen() on an unterminated string.

This commit addresses the issue by avoiding the strlen() call and
instead using the already computed length.

https://bugzilla.gnome.org/show_bug.cgi?id=739593