From e1922617883d5a70a282ed0e9e756a27eeed6bba Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 11 Dec 2001 13:13:01 +0000 Subject: [PATCH] failf() calls should not have newlines in the message string! --- lib/connect.c | 2 +- lib/dict.c | 4 ++-- lib/ftp.c | 2 +- lib/http.c | 10 +++++----- lib/krb4.c | 2 +- lib/security.c | 8 ++++---- lib/sendf.c | 5 +++-- lib/ssluse.c | 12 ++++++------ 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 69308df2b..9f8efdbd6 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -284,7 +284,7 @@ static CURLcode bindlocal(struct connectdata *conn, failf(data, "Insufficient kernel memory was available: %d", errno); break; default: - failf(data, "errno %d\n", errno); + failf(data, "errno %d", errno); break; } /* end of switch(errno) */ diff --git a/lib/dict.c b/lib/dict.c index bbb5fe146..79b5a7786 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -121,7 +121,7 @@ CURLcode Curl_dict(struct connectdata *conn) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing\n"); + failf(data, "lookup word is missing"); } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; @@ -174,7 +174,7 @@ CURLcode Curl_dict(struct connectdata *conn) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing\n"); + failf(data, "lookup word is missing"); } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; diff --git a/lib/ftp.c b/lib/ftp.c index 7091e9f8e..ce566eb86 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1634,7 +1634,7 @@ CURLcode ftp_perform(struct connectdata *conn) passed += actuallyread; if(actuallyread != readthisamountnow) { - failf(data, "Could only read %d bytes from the input\n", passed); + failf(data, "Could only read %d bytes from the input", passed); return CURLE_FTP_COULDNT_USE_REST; } } diff --git a/lib/http.c b/lib/http.c index f1d3fb326..ffb442089 100644 --- a/lib/http.c +++ b/lib/http.c @@ -449,7 +449,7 @@ CURLcode Curl_http_done(struct connectdata *conn) if(0 == (http->readbytecount + conn->headerbytecount)) { /* nothing was read from the HTTP server, this can't be right so we return an error here */ - failf(data, "Empty reply from server\n"); + failf(data, "Empty reply from server"); return CURLE_GOT_NOTHING; } @@ -610,7 +610,7 @@ CURLcode Curl_http(struct connectdata *conn) passed += actuallyread; if(actuallyread != readthisamountnow) { - failf(data, "Could only read %d bytes from the input\n", + failf(data, "Could only read %d bytes from the input", passed); return CURLE_READ_ERROR; } @@ -621,7 +621,7 @@ CURLcode Curl_http(struct connectdata *conn) data->set.infilesize -= conn->resume_from; if(data->set.infilesize <= 0) { - failf(data, "File already completely uploaded\n"); + failf(data, "File already completely uploaded"); return CURLE_PARTIAL_FILE; } } @@ -793,7 +793,7 @@ CURLcode Curl_http(struct connectdata *conn) char contentType[256]; int linelength=0; if(Curl_FormInit(&http->form, http->sendit)) { - failf(data, "Internal HTTP POST error!\n"); + failf(data, "Internal HTTP POST error!"); return CURLE_HTTP_POST_ERROR; } @@ -824,7 +824,7 @@ CURLcode Curl_http(struct connectdata *conn) 1, (FILE *)&http->form); if(linelength == -1) { - failf(data, "Could not get Content-Type header line!\n"); + failf(data, "Could not get Content-Type header line!"); return CURLE_HTTP_POST_ERROR; } add_buffer(req_buffer, contentType, linelength); diff --git a/lib/krb4.c b/lib/krb4.c index 96cc4520d..9b752afa1 100644 --- a/lib/krb4.c +++ b/lib/krb4.c @@ -374,7 +374,7 @@ void Curl_krb_kauth(struct connectdata *conn) memset(schedule, 0, sizeof(schedule)); memset(passwd, 0, sizeof(passwd)); if(Curl_base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) { - failf(conn->data, "Out of memory base64-encoding.\n"); + failf(conn->data, "Out of memory base64-encoding."); Curl_set_command_prot(conn, save); return; } diff --git a/lib/security.c b/lib/security.c index 2a92d0bc9..1be54c8b8 100644 --- a/lib/security.c +++ b/lib/security.c @@ -362,11 +362,11 @@ Curl_sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap conn); free(buf); if(len < 0) { - failf(conn->data, "Failed to encode command.\n"); + failf(conn->data, "Failed to encode command."); return -1; } if(Curl_base64_encode(enc, len, &buf) < 0){ - failf(conn->data, "Out of memory base64-encoding.\n"); + failf(conn->data, "Out of memory base64-encoding."); return -1; } if(conn->command_prot == prot_safe) @@ -421,7 +421,7 @@ sec_prot_internal(struct connectdata *conn, int level) return -1; if(conn->data->state.buffer[0] != '2'){ - failf(conn->data, "Failed to set protection buffer size.\n"); + failf(conn->data, "Failed to set protection buffer size."); return -1; } conn->buffer_size = s; @@ -441,7 +441,7 @@ sec_prot_internal(struct connectdata *conn, int level) return -1; if(conn->data->state.buffer[0] != '2'){ - failf(conn->data, "Failed to set protection level.\n"); + failf(conn->data, "Failed to set protection level."); return -1; } diff --git a/lib/sendf.c b/lib/sendf.c index 2a0aa78c3..ae4ce6737 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -137,8 +137,9 @@ void Curl_infof(struct SessionHandle *data, const char *fmt, ...) } } -/* Curl_failf() is for messages stating why we failed, the LAST one will be - returned for the user (if requested) */ +/* Curl_failf() is for messages stating why we failed. + * The message SHALL NOT include any LF or CR. + */ void Curl_failf(struct SessionHandle *data, const char *fmt, ...) { diff --git a/lib/ssluse.c b/lib/ssluse.c index b167bfd28..df891e2db 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -201,7 +201,7 @@ int cert_stuff(struct connectdata *conn, if (SSL_CTX_use_certificate_file(conn->ssl.ctx, cert_file, SSL_FILETYPE_PEM) != 1) { - failf(data, "unable to set certificate file (wrong password?)\n"); + failf(data, "unable to set certificate file (wrong password?)"); return(0); } if (key_file == NULL) @@ -210,7 +210,7 @@ int cert_stuff(struct connectdata *conn, if (SSL_CTX_use_PrivateKey_file(conn->ssl.ctx, key_file, SSL_FILETYPE_PEM) != 1) { - failf(data, "unable to set public key file\n"); + failf(data, "unable to set public key file"); return(0); } @@ -229,7 +229,7 @@ int cert_stuff(struct connectdata *conn, /* Now we know that a key and cert have been set against * the SSL context */ if (!SSL_CTX_check_private_key(conn->ssl.ctx)) { - failf(data, "Private key does not match the certificate public key\n"); + failf(data, "Private key does not match the certificate public key"); return(0); } #ifndef HAVE_USERDATA_IN_PWD_CALLBACK @@ -578,7 +578,7 @@ Curl_SSLConnect(struct connectdata *conn) if(data->set.ssl.cipher_list) { if (!SSL_CTX_set_cipher_list(conn->ssl.ctx, data->set.ssl.cipher_list)) { - failf(data, "failed setting cipher list\n"); + failf(data, "failed setting cipher list"); return CURLE_SSL_CONNECT_ERROR; } } @@ -591,7 +591,7 @@ Curl_SSLConnect(struct connectdata *conn) if (!SSL_CTX_load_verify_locations(conn->ssl.ctx, data->set.ssl.CAfile, data->set.ssl.CApath)) { - failf(data,"error setting cerficate verify locations\n"); + failf(data,"error setting cerficate verify locations"); return CURLE_SSL_CONNECT_ERROR; } } @@ -713,7 +713,7 @@ Curl_SSLConnect(struct connectdata *conn) if(data->set.ssl.verifypeer) { data->set.ssl.certverifyresult=SSL_get_verify_result(conn->ssl.handle); if (data->set.ssl.certverifyresult != X509_V_OK) { - failf(data, "SSL certificate verify result: %d\n", + failf(data, "SSL certificate verify result: %d", data->set.ssl.certverifyresult); retcode = CURLE_SSL_PEER_CERTIFICATE; }