X-Git-Url: https://git.toastfreeware.priv.at/gregoa/bti.git/blobdiff_plain/bfe6897366a85b1d76be9528e41b5ee8bb3a570c..faf1ebab9ce65a8ec7b8bb83f0e969396417cfd5:/bti.c diff --git a/bti.c b/bti.c index 6f77ddc..11cd0ab 100644 --- a/bti.c +++ b/bti.c @@ -258,9 +258,9 @@ const char identica_name[] = "identi.ca"; static const char twitter_request_token_uri[] = "http://twitter.com/oauth/request_token"; static const char twitter_access_token_uri[] = "http://twitter.com/oauth/access_token"; static const char twitter_authorize_uri[] = "http://twitter.com/oauth/authorize?oauth_token="; -static const char identica_request_token_uri[] = "http://identi.ca/api/oauth/request_token?oauth_callback=oob"; -static const char identica_access_token_uri[] = "http://identi.ca/api/oauth/access_token"; -static const char identica_authorize_uri[] = "http://identi.ca/api/oauth/authorize?oauth_token="; +static const char identica_request_token_uri[] = "https://identi.ca/api/oauth/request_token?oauth_callback=oob"; +static const char identica_access_token_uri[] = "https://identi.ca/api/oauth/access_token"; +static const char identica_authorize_uri[] = "https://identi.ca/api/oauth/authorize?oauth_token="; static const char user_uri[] = "/user_timeline/"; static const char update_uri[] = "/update.xml"; @@ -519,10 +519,10 @@ static int request_access_token(struct session *session) fprintf(stdout, "Please put these two lines in your bti " - "configuration file (~/.bti):\n" + "configuration file (%s):\n" "access_token_key=%s\n" "access_token_secret=%s\n", - at_key, at_secret); + session->configfile, at_key, at_secret); return 0; } @@ -557,8 +557,10 @@ static int send_request(struct session *session) curl_buf->session = session; curl = curl_init(); - if (!curl) + if (!curl) { + bti_curl_buffer_free(curl_buf); return -EINVAL; + } if (!session->hosturl) session->hosturl = strdup(twitter_host); @@ -658,6 +660,10 @@ static int send_request(struct session *session) if (res) { fprintf(stderr, "error(%d) trying to " "perform operation\n", res); + curl_easy_cleanup(curl); + if (session->action == ACTION_UPDATE) + curl_formfree(formpost); + bti_curl_buffer_free(curl_buf); return -EINVAL; } @@ -665,19 +671,32 @@ static int send_request(struct session *session) curl_buf->length, "response.xml", NULL, XML_PARSE_NOERROR); - if (doc == NULL) + if (doc == NULL) { + curl_easy_cleanup(curl); + if (session->action == ACTION_UPDATE) + curl_formfree(formpost); + bti_curl_buffer_free(curl_buf); return -EINVAL; + } current = xmlDocGetRootElement(doc); if (current == NULL) { fprintf(stderr, "empty document\n"); xmlFreeDoc(doc); + curl_easy_cleanup(curl); + if (session->action == ACTION_UPDATE) + curl_formfree(formpost); + bti_curl_buffer_free(curl_buf); return -EINVAL; } if (xmlStrcmp(current->name, (const xmlChar *)"status")) { fprintf(stderr, "unexpected document type\n"); xmlFreeDoc(doc); + curl_easy_cleanup(curl); + if (session->action == ACTION_UPDATE) + curl_formfree(formpost); + bti_curl_buffer_free(curl_buf); return -EINVAL; }