1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fix bad failf() and info() usage

Calls to failf() are not supposed to provide trailing newline.
Calls to infof() must provide trailing newline.

Fixed 30 or so strings.
This commit is contained in:
Yang Tse 2012-06-14 13:32:05 +02:00
parent a8259945c4
commit 6085ca2aed
10 changed files with 33 additions and 32 deletions

View File

@ -163,10 +163,10 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
if(sspi_status != SEC_E_OK) { if(sspi_status != SEC_E_OK) {
if(sspi_status == SEC_E_WRONG_PRINCIPAL) if(sspi_status == SEC_E_WRONG_PRINCIPAL)
failf(data, "schannel: SNI or certificate check failed: %s\n", failf(data, "schannel: SNI or certificate check failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
else else
failf(data, "schannel: AcquireCredentialsHandleA failed: %s\n", failf(data, "schannel: AcquireCredentialsHandleA failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
free(connssl->cred); free(connssl->cred);
connssl->cred = NULL; connssl->cred = NULL;
@ -204,10 +204,10 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
if(sspi_status != SEC_I_CONTINUE_NEEDED) { if(sspi_status != SEC_I_CONTINUE_NEEDED) {
if(sspi_status == SEC_E_WRONG_PRINCIPAL) if(sspi_status == SEC_E_WRONG_PRINCIPAL)
failf(data, "schannel: SNI or certificate check failed: %s\n", failf(data, "schannel: SNI or certificate check failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
else else
failf(data, "schannel: initial InitializeSecurityContextA failed: %s\n", failf(data, "schannel: initial InitializeSecurityContextA failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
free(connssl->ctxt); free(connssl->ctxt);
connssl->ctxt = NULL; connssl->ctxt = NULL;
@ -221,7 +221,7 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
written = swrite(conn->sock[sockindex], outbuf.pvBuffer, outbuf.cbBuffer); written = swrite(conn->sock[sockindex], outbuf.pvBuffer, outbuf.cbBuffer);
s_pSecFn->FreeContextBuffer(outbuf.pvBuffer); s_pSecFn->FreeContextBuffer(outbuf.pvBuffer);
if(outbuf.cbBuffer != (size_t)written) { if(outbuf.cbBuffer != (size_t)written) {
failf(data, "schannel: failed to send initial handshake data: %d\n", failf(data, "schannel: failed to send initial handshake data: %d",
written); written);
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
@ -276,8 +276,7 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
return CURLE_OK; return CURLE_OK;
} }
else if(nread == 0) { else if(nread == 0) {
failf(data, "schannel: failed to receive handshake, connection " failf(data, "schannel: failed to receive handshake, connection failed");
"failed\n");
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
} }
@ -347,7 +346,7 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
written = swrite(conn->sock[sockindex], written = swrite(conn->sock[sockindex],
outbuf[i].pvBuffer, outbuf[i].cbBuffer); outbuf[i].pvBuffer, outbuf[i].cbBuffer);
if(outbuf[i].cbBuffer != (size_t)written) { if(outbuf[i].cbBuffer != (size_t)written) {
failf(data, "schannel: failed to send next handshake data: %d\n", failf(data, "schannel: failed to send next handshake data: %d",
written); written);
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
@ -361,10 +360,10 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
} }
else { else {
if(sspi_status == SEC_E_WRONG_PRINCIPAL) if(sspi_status == SEC_E_WRONG_PRINCIPAL)
failf(data, "schannel: SNI or certificate check failed: %s\n", failf(data, "schannel: SNI or certificate check failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
else else
failf(data, "schannel: next InitializeSecurityContextA failed: %s\n", failf(data, "schannel: next InitializeSecurityContextA failed: %s",
Curl_sspi_strerror(conn, sspi_status)); Curl_sspi_strerror(conn, sspi_status));
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
@ -419,17 +418,17 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
/* check if the required context attributes are met */ /* check if the required context attributes are met */
if(connssl->ret_flags != connssl->req_flags) { if(connssl->ret_flags != connssl->req_flags) {
if(!(connssl->ret_flags & ISC_RET_SEQUENCE_DETECT)) if(!(connssl->ret_flags & ISC_RET_SEQUENCE_DETECT))
failf(data, "schannel: failed to setup sequence detection\n"); failf(data, "schannel: failed to setup sequence detection");
if(!(connssl->ret_flags & ISC_RET_REPLAY_DETECT)) if(!(connssl->ret_flags & ISC_RET_REPLAY_DETECT))
failf(data, "schannel: failed to setup replay detection\n"); failf(data, "schannel: failed to setup replay detection");
if(!(connssl->ret_flags & ISC_RET_CONFIDENTIALITY)) if(!(connssl->ret_flags & ISC_RET_CONFIDENTIALITY))
failf(data, "schannel: failed to setup confidentiality\n"); failf(data, "schannel: failed to setup confidentiality");
if(!(connssl->ret_flags & ISC_RET_EXTENDED_ERROR)) if(!(connssl->ret_flags & ISC_RET_EXTENDED_ERROR))
failf(data, "schannel: failed to setup extended errors\n"); failf(data, "schannel: failed to setup extended errors");
if(!(connssl->ret_flags & ISC_RET_ALLOCATED_MEMORY)) if(!(connssl->ret_flags & ISC_RET_ALLOCATED_MEMORY))
failf(data, "schannel: failed to setup memory allocation\n"); failf(data, "schannel: failed to setup memory allocation");
if(!(connssl->ret_flags & ISC_RET_STREAM)) if(!(connssl->ret_flags & ISC_RET_STREAM))
failf(data, "schannel: failed to setup stream orientation\n"); failf(data, "schannel: failed to setup stream orientation");
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
@ -446,7 +445,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
retcode = Curl_ssl_addsessionid(conn, (void*)connssl->cred, retcode = Curl_ssl_addsessionid(conn, (void*)connssl->cred,
sizeof(struct curl_schannel_cred)); sizeof(struct curl_schannel_cred));
if(retcode) { if(retcode) {
failf(data, "schannel: failed to store credential handle\n"); failf(data, "schannel: failed to store credential handle");
return retcode; return retcode;
} }
else { else {

View File

@ -132,7 +132,7 @@ cyassl_connect_step1(struct connectdata *conn,
if(data->set.ssl.verifypeer) { if(data->set.ssl.verifypeer) {
/* Fail if we insiste on successfully verifying the server. */ /* Fail if we insiste on successfully verifying the server. */
failf(data,"error setting certificate verify locations:\n" failf(data,"error setting certificate verify locations:\n"
" CAfile: %s\n CApath: %s\n", " CAfile: %s\n CApath: %s",
data->set.str[STRING_SSL_CAFILE]? data->set.str[STRING_SSL_CAFILE]?
data->set.str[STRING_SSL_CAFILE]: "none", data->set.str[STRING_SSL_CAFILE]: "none",
data->set.str[STRING_SSL_CAPATH]? data->set.str[STRING_SSL_CAPATH]?

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -1239,7 +1239,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
} }
else { else {
if(data) if(data)
failf(data, "couldn't open file \"%s\"\n", file->contents); failf(data, "couldn't open file \"%s\"", file->contents);
*finalform = NULL; *finalform = NULL;
result = CURLE_READ_ERROR; result = CURLE_READ_ERROR;
} }

View File

@ -413,7 +413,7 @@ gtls_connect_step1(struct connectdata *conn,
data->set.ssl.CRLfile, data->set.ssl.CRLfile,
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
if(rc < 0) { if(rc < 0) {
failf(data, "error reading crl file %s (%s)\n", failf(data, "error reading crl file %s (%s)",
data->set.ssl.CRLfile, gnutls_strerror(rc)); data->set.ssl.CRLfile, gnutls_strerror(rc));
return CURLE_SSL_CRL_BADFILE; return CURLE_SSL_CRL_BADFILE;
} }

View File

@ -1601,7 +1601,7 @@ CURLcode Curl_add_timecondition(struct SessionHandle *data,
result = Curl_gmtime(data->set.timevalue, &keeptime); result = Curl_gmtime(data->set.timevalue, &keeptime);
if(result) { if(result) {
failf(data, "Invalid TIMEVALUE\n"); failf(data, "Invalid TIMEVALUE");
return result; return result;
} }
tm = &keeptime; tm = &keeptime;

View File

@ -6,6 +6,7 @@
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
* Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -90,7 +91,7 @@ static void polarssl_debug(void *context, int level, char *line)
data = (struct SessionHandle *)context; data = (struct SessionHandle *)context;
infof(data, "%s", line); infof(data, "%s\n", line);
} }
#else #else
#endif #endif
@ -289,7 +290,7 @@ polarssl_connect_step2(struct connectdata *conn,
if(ret && data->set.ssl.verifypeer) { if(ret && data->set.ssl.verifypeer) {
if(ret & BADCERT_EXPIRED) if(ret & BADCERT_EXPIRED)
failf(data, "Cert verify failed: BADCERT_EXPIRED\n"); failf(data, "Cert verify failed: BADCERT_EXPIRED");
if(ret & BADCERT_REVOKED) { if(ret & BADCERT_REVOKED) {
failf(data, "Cert verify failed: BADCERT_REVOKED"); failf(data, "Cert verify failed: BADCERT_REVOKED");

View File

@ -6,6 +6,7 @@
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com> * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com>
* Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -102,7 +103,7 @@ static int check_gss_err(struct SessionHandle *data,
} }
gss_release_buffer(&min_stat, &status_string); gss_release_buffer(&min_stat, &status_string);
} }
failf(data, "GSSAPI error: %s failed:\n%s\n", function, buf); failf(data, "GSSAPI error: %s failed:\n%s", function, buf);
return(1); return(1);
} }

View File

@ -58,7 +58,7 @@ static int check_sspi_err(struct connectdata *conn,
status != SEC_I_COMPLETE_AND_CONTINUE && status != SEC_I_COMPLETE_AND_CONTINUE &&
status != SEC_I_COMPLETE_NEEDED && status != SEC_I_COMPLETE_NEEDED &&
status != SEC_I_CONTINUE_NEEDED) { status != SEC_I_CONTINUE_NEEDED) {
failf(conn->data, "SSPI error: %s failed: %s\n", function, failf(conn->data, "SSPI error: %s failed: %s", function,
Curl_sspi_strerror(conn, status)); Curl_sspi_strerror(conn, status));
return 1; return 1;
} }

View File

@ -2540,7 +2540,7 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn,
left = Curl_timeleft(data, NULL, duringconnect); left = Curl_timeleft(data, NULL, duringconnect);
if(left < 0) { if(left < 0) {
failf(data, "Operation timed out\n"); failf(data, "Operation timed out");
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }

View File

@ -1653,7 +1653,7 @@ ossl_connect_step1(struct connectdata *conn,
if(data->set.ssl.verifypeer) { if(data->set.ssl.verifypeer) {
/* Fail if we insist on successfully verifying the server. */ /* Fail if we insist on successfully verifying the server. */
failf(data,"error setting certificate verify locations:\n" failf(data,"error setting certificate verify locations:\n"
" CAfile: %s\n CApath: %s\n", " CAfile: %s\n CApath: %s",
data->set.str[STRING_SSL_CAFILE]? data->set.str[STRING_SSL_CAFILE]?
data->set.str[STRING_SSL_CAFILE]: "none", data->set.str[STRING_SSL_CAFILE]: "none",
data->set.str[STRING_SSL_CAPATH]? data->set.str[STRING_SSL_CAPATH]?
@ -1688,7 +1688,7 @@ ossl_connect_step1(struct connectdata *conn,
if(!lookup || if(!lookup ||
(!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE], (!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE],
X509_FILETYPE_PEM)) ) { X509_FILETYPE_PEM)) ) {
failf(data,"error loading CRL file: %s\n", failf(data,"error loading CRL file: %s",
data->set.str[STRING_SSL_CRLFILE]); data->set.str[STRING_SSL_CRLFILE]);
return CURLE_SSL_CRL_BADFILE; return CURLE_SSL_CRL_BADFILE;
} }
@ -2346,7 +2346,7 @@ static CURLcode servercert(struct connectdata *conn,
fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r"); fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r");
if(!fp) { if(!fp) {
if(strict) if(strict)
failf(data, "SSL: Unable to open issuer cert (%s)\n", failf(data, "SSL: Unable to open issuer cert (%s)",
data->set.str[STRING_SSL_ISSUERCERT]); data->set.str[STRING_SSL_ISSUERCERT]);
X509_free(connssl->server_cert); X509_free(connssl->server_cert);
connssl->server_cert = NULL; connssl->server_cert = NULL;
@ -2355,7 +2355,7 @@ static CURLcode servercert(struct connectdata *conn,
issuer = PEM_read_X509(fp,NULL,ZERO_NULL,NULL); issuer = PEM_read_X509(fp,NULL,ZERO_NULL,NULL);
if(!issuer) { if(!issuer) {
if(strict) if(strict)
failf(data, "SSL: Unable to read issuer cert (%s)\n", failf(data, "SSL: Unable to read issuer cert (%s)",
data->set.str[STRING_SSL_ISSUERCERT]); data->set.str[STRING_SSL_ISSUERCERT]);
X509_free(connssl->server_cert); X509_free(connssl->server_cert);
X509_free(issuer); X509_free(issuer);
@ -2365,7 +2365,7 @@ static CURLcode servercert(struct connectdata *conn,
fclose(fp); fclose(fp);
if(X509_check_issued(issuer,connssl->server_cert) != X509_V_OK) { if(X509_check_issued(issuer,connssl->server_cert) != X509_V_OK) {
if(strict) if(strict)
failf(data, "SSL: Certificate issuer check failed (%s)\n", failf(data, "SSL: Certificate issuer check failed (%s)",
data->set.str[STRING_SSL_ISSUERCERT]); data->set.str[STRING_SSL_ISSUERCERT]);
X509_free(connssl->server_cert); X509_free(connssl->server_cert);
X509_free(issuer); X509_free(issuer);