if (log != NULL) mh_oauth_log_to(stderr, ctx);
- fn = mh_xstrdup(mh_oauth_cred_fn(svc));
+ fn = mh_oauth_cred_fn(svc);
fp = lkfopendata(fn, "r+", &failed_to_lock);
if (fp == NULL) {
if (errno == ENOENT) {
if (curl_ctx->res_len > 0
&& is_json(curl_ctx->content_type)
&& get_json_strings(curl_ctx->res_body, curl_ctx->res_len, ctx->log,
- "error", &error, (void *)NULL)
+ "error", &error, NULL)
&& error != NULL) {
if (strcmp(error, "invalid_grant") == 0) {
code = MH_OAUTH_BAD_GRANT;
"client_id", ctx->svc.client_id,
"redirect_uri", ctx->svc.redirect_uri,
"scope", ctx->svc.scope,
- (void *)NULL)) {
+ NULL)) {
set_err(ctx, MH_OAUTH_REQUEST_INIT);
return NULL;
}
"access_token", &access_token,
"expires_in", &expires_in,
"refresh_token", &refresh_token,
- (void *)NULL)) {
+ NULL)) {
goto out;
}
"redirect_uri", ctx->svc.redirect_uri,
"client_id", ctx->svc.client_id,
"client_secret", ctx->svc.client_secret,
- (void *)NULL)) {
+ NULL)) {
set_err(ctx, MH_OAUTH_REQUEST_INIT);
return NULL;
}
"refresh_token", cred->refresh_token,
"client_id", ctx->svc.client_id,
"client_secret", ctx->svc.client_secret,
- (void *)NULL)) {
+ NULL)) {
set_err(ctx, MH_OAUTH_REQUEST_INIT);
return false;
}
return false;
}
- if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE,
- &ctx->res_code) != CURLE_OK
- || curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE,
- &ctx->content_type) != CURLE_OK) {
- return false;
- }
-
- return true;
+ return curl_easy_getinfo(curl,
+ CURLINFO_RESPONSE_CODE, &ctx->res_code) == CURLE_OK &&
+ curl_easy_getinfo(curl,
+ CURLINFO_CONTENT_TYPE, &ctx->content_type) == CURLE_OK;
}
/*******************************************************************************
of the response body. */
*tokens = mh_xrealloc(*tokens, *tokens_len * sizeof **tokens);
}
- if (r <= 0) {
- return false;
- }
- return true;
+ return r > 0;
}
/*