if(!tmp_head)
goto fail;
head = tmp_head;
- *date_header = curl_maprintf("%s: %s\r\n", date_hdr_key, timestamp);
+ *date_header = aprintf("%s: %s\r\n", date_hdr_key, timestamp);
}
else {
char *value;
result = CURLE_OUT_OF_MEMORY;
canonical_request =
- curl_maprintf("%s\n" /* HTTPRequestMethod */
- "%s\n" /* CanonicalURI */
- "%s\n" /* CanonicalQueryString */
- "%s\n" /* CanonicalHeaders */
- "%s\n" /* SignedHeaders */
- "%.*s", /* HashedRequestPayload in hex */
- method,
- Curl_dyn_ptr(&canonical_path),
- Curl_dyn_ptr(&canonical_query) ?
- Curl_dyn_ptr(&canonical_query) : "",
- Curl_dyn_ptr(&canonical_headers),
- Curl_dyn_ptr(&signed_headers),
- (int)payload_hash_len, payload_hash);
+ aprintf("%s\n" /* HTTPRequestMethod */
+ "%s\n" /* CanonicalURI */
+ "%s\n" /* CanonicalQueryString */
+ "%s\n" /* CanonicalHeaders */
+ "%s\n" /* SignedHeaders */
+ "%.*s", /* HashedRequestPayload in hex */
+ method,
+ Curl_dyn_ptr(&canonical_path),
+ Curl_dyn_ptr(&canonical_query) ?
+ Curl_dyn_ptr(&canonical_query) : "",
+ Curl_dyn_ptr(&canonical_headers),
+ Curl_dyn_ptr(&signed_headers),
+ (int)payload_hash_len, payload_hash);
if(!canonical_request)
goto fail;
/* provider 0 lowercase */
Curl_strntolower(provider0, provider0, strlen(provider0));
- request_type = curl_maprintf("%s4_request", provider0);
+ request_type = aprintf("%s4_request", provider0);
if(!request_type)
goto fail;
- credential_scope = curl_maprintf("%s/%s/%s/%s",
- date, region, service, request_type);
+ credential_scope = aprintf("%s/%s/%s/%s",
+ date, region, service, request_type);
if(!credential_scope)
goto fail;
* Google allows using RSA key instead of HMAC, so this code might change
* in the future. For now we only support HMAC.
*/
- str_to_sign = curl_maprintf("%s4-HMAC-SHA256\n" /* Algorithm */
- "%s\n" /* RequestDateTime */
- "%s\n" /* CredentialScope */
- "%s", /* HashedCanonicalRequest in hex */
- provider0,
- timestamp,
- credential_scope,
- sha_hex);
+ str_to_sign = aprintf("%s4-HMAC-SHA256\n" /* Algorithm */
+ "%s\n" /* RequestDateTime */
+ "%s\n" /* CredentialScope */
+ "%s", /* HashedCanonicalRequest in hex */
+ provider0,
+ timestamp,
+ credential_scope,
+ sha_hex);
if(!str_to_sign) {
goto fail;
}
/* provider 0 uppercase */
- secret = curl_maprintf("%s4%s", provider0,
- data->state.aptr.passwd ?
- data->state.aptr.passwd : "");
+ secret = aprintf("%s4%s", provider0,
+ data->state.aptr.passwd ?
+ data->state.aptr.passwd : "");
if(!secret)
goto fail;
sha256_to_hex(sha_hex, sign0);
/* provider 0 uppercase */
- auth_headers = curl_maprintf("Authorization: %s4-HMAC-SHA256 "
- "Credential=%s/%s, "
- "SignedHeaders=%s, "
- "Signature=%s\r\n"
- /*
- * date_header is added here, only if it was not
- * user-specified (using CURLOPT_HTTPHEADER).
- * date_header includes \r\n
- */
- "%s"
- "%s", /* optional sha256 header includes \r\n */
- provider0,
- user,
- credential_scope,
- Curl_dyn_ptr(&signed_headers),
- sha_hex,
- date_header ? date_header : "",
- content_sha256_hdr);
+ auth_headers = aprintf("Authorization: %s4-HMAC-SHA256 "
+ "Credential=%s/%s, "
+ "SignedHeaders=%s, "
+ "Signature=%s\r\n"
+ /*
+ * date_header is added here, only if it was not
+ * user-specified (using CURLOPT_HTTPHEADER).
+ * date_header includes \r\n
+ */
+ "%s"
+ "%s", /* optional sha256 header includes \r\n */
+ provider0,
+ user,
+ credential_scope,
+ Curl_dyn_ptr(&signed_headers),
+ sha_hex,
+ date_header ? date_header : "",
+ content_sha256_hdr);
if(!auth_headers) {
goto fail;
}
#include <fcntl.h>
#endif
-#include <curl/mprintf.h>
+#include <curlx.h>
#include "tool_findfile.h"
for(i = 0; i < (dotscore ? 2 : 1); i++) {
char *c;
if(dotscore)
- c = curl_maprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
+ c = aprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
else
- c = curl_maprintf("%s" DIR_CHAR "%s", home, fname);
+ c = aprintf("%s" DIR_CHAR "%s", home, fname);
if(c) {
int fd = open(c, O_RDONLY);
if(fd >= 0) {
continue;
}
if(conf_list[i].append) {
- char *c = curl_maprintf("%s%s", home, conf_list[i].append);
+ char *c = aprintf("%s%s", home, conf_list[i].append);
curl_free(home);
if(!c)
return NULL;
/* build a nice-looking prompt */
if(!i && last)
- curl_msnprintf(prompt, sizeof(prompt),
- "Enter %s password for user '%s':",
- kind, *userpwd);
+ msnprintf(prompt, sizeof(prompt),
+ "Enter %s password for user '%s':",
+ kind, *userpwd);
else
- curl_msnprintf(prompt, sizeof(prompt),
- "Enter %s password for user '%s' on URL #%zu:",
- kind, *userpwd, i + 1);
+ msnprintf(prompt, sizeof(prompt),
+ "Enter %s password for user '%s' on URL #%zu:",
+ kind, *userpwd, i + 1);
/* get password */
getpass_r(prompt, passwd, sizeof(passwd));