in src/oslogin_utils.cc [932:959]
bool ParseJsonToEmail(const string& json, string* email) {
bool ret = false;
json_object* root = ParseJsonRoot(json);
if (root == NULL) {
return ret;
}
// Locate the email object.
json_object* login_profiles;
json_object* json_email;
if (!json_object_object_get_ex(root, "loginProfiles", &login_profiles)) {
goto cleanup;
}
if (json_object_get_type(login_profiles) != json_type_array) {
goto cleanup;
}
login_profiles = json_object_array_get_idx(login_profiles, 0);
if (!json_object_object_get_ex(login_profiles, "name", &json_email)) {
goto cleanup;
}
ret = true;
*email = json_object_get_string(json_email);
cleanup:
json_object_put(root);
return ret;
}