1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

Calls to Curl_failf() are not supposed to provide a trailing newline as the

function itself adds that. Fixed on 50 or something strings!
This commit is contained in:
Daniel Stenberg 2008-01-15 23:19:02 +00:00
parent 991505e077
commit ed6466d176
10 changed files with 64 additions and 59 deletions

View File

@ -6,6 +6,10 @@
Changelog
Daniel S (16 Jan 2008)
- Calls to Curl_failf() are not supposed to provide a trailing newline as the
function itself adds that. Fixed on 50 or something strings!
Daniel S (15 Jan 2008)
- I made the torture test on test 530 go through. This was actually due to
silly code left from when we switched to let the multi handle "hold" the dns

View File

@ -53,6 +53,7 @@ This release includes the following bugfixes:
o curl-config --libs skips /usr/lib64
o range support for file:// transfers
o libcurl hang with huge POST request and request-body read from callback
o removed extra newlines from many error messages
This release includes the following known bugs:

View File

@ -934,7 +934,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL,
0, NIFLAGS);
if(rc) {
failf(data, "getnameinfo() returned %d \n", rc);
failf(data, "getnameinfo() returned %d", rc);
return CURLE_FTP_PORT_FAILED;
}
host = hbuf; /* use this host name */
@ -2630,7 +2630,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
ftpc->count1 = 1;
break;
default:
failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d\n",
failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d",
data->set.ftpsslauth);
return CURLE_FAILED_INIT; /* we don't know what to do */
}

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* Copyright (c) 2004 - 2007 Daniel Stenberg
* Copyright (c) 2004 - 2008 Daniel Stenberg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -362,7 +362,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
tmp=0;
}
if(!tmp || !ptr) {
Curl_failf(conn->data, "Failed to decode base64 in reply.\n");
Curl_failf(conn->data, "Failed to decode base64 in reply");
Curl_set_command_prot(conn, save);
return CURLE_FTP_WEIRD_SERVER_REPLY;
}

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -436,10 +436,10 @@ static int display_error(struct connectdata *conn, PRInt32 err,
{
switch(err) {
case SEC_ERROR_BAD_PASSWORD:
failf(conn->data, "Unable to load client key: Incorrect password\n");
failf(conn->data, "Unable to load client key: Incorrect password");
return 1;
case SEC_ERROR_UNKNOWN_CERT:
failf(conn->data, "Unable to load certificate %s\n", filename);
failf(conn->data, "Unable to load certificate %s", filename);
return 1;
default:
break;
@ -521,10 +521,10 @@ static SECStatus nss_Init_Tokens(struct connectdata * conn)
if(PK11_NeedLogin(slot) && PK11_NeedUserInit(slot)) {
if(slot == PK11_GetInternalKeySlot()) {
failf(conn->data, "The NSS database has not been initialized.\n");
failf(conn->data, "The NSS database has not been initialized");
}
else {
failf(conn->data, "The token %s has not been initialized.",
failf(conn->data, "The token %s has not been initialized",
PK11_GetTokenName(slot));
}
PK11_FreeSlot(slot);
@ -1057,7 +1057,7 @@ int Curl_nss_send(struct connectdata *conn, /* connection data */
return CURLE_OPERATION_TIMEDOUT;
}
failf(conn->data, "SSL write: error %d\n", err);
failf(conn->data, "SSL write: error %d", err);
return -1;
}
return rc; /* number of bytes */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -108,7 +108,7 @@ static CURLcode Curl_qsossl_init_session(struct SessionHandle * data)
break;
case SSL_ERROR_IO:
failf(data, "SSL_Init() I/O error: %s\n", strerror(errno));
failf(data, "SSL_Init() I/O error: %s", strerror(errno));
return CURLE_SSL_CONNECT_ERROR;
case SSL_ERROR_BAD_CIPHER_SUITE:
@ -125,7 +125,7 @@ static CURLcode Curl_qsossl_init_session(struct SessionHandle * data)
return CURLE_SSL_CERTPROBLEM;
default:
failf(data, "SSL_Init(): %s\n", SSL_Strerror(rc, NULL));
failf(data, "SSL_Init(): %s", SSL_Strerror(rc, NULL));
return CURLE_SSL_CONNECT_ERROR;
}
@ -142,9 +142,9 @@ static CURLcode Curl_qsossl_create(struct connectdata * conn, int sockindex)
h = SSL_Create(conn->sock[sockindex], SSL_ENCRYPT);
if(!h) {
failf(conn->data, "SSL_Create() I/O error: %s\n", strerror(errno));
failf(conn->data, "SSL_Create() I/O error: %s", strerror(errno));
return CURLE_SSL_CONNECT_ERROR;
}
}
connssl->handle = h;
return CURLE_OK;
@ -232,11 +232,11 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex)
return CURLE_SSL_CERTPROBLEM;
case SSL_ERROR_IO:
failf(data, "SSL_Handshake(): %s\n", SSL_Strerror(rc, NULL));
failf(data, "SSL_Handshake(): %s", SSL_Strerror(rc, NULL));
return CURLE_SSL_CONNECT_ERROR;
default:
failf(data, "SSL_Init(): %s\n", SSL_Strerror(rc, NULL));
failf(data, "SSL_Init(): %s", SSL_Strerror(rc, NULL));
return CURLE_SSL_CONNECT_ERROR;
}
@ -282,12 +282,12 @@ static int Curl_qsossl_close_one(struct ssl_connect_data * conn,
if(rc) {
if(rc == SSL_ERROR_IO) {
failf(data, "SSL_Destroy() I/O error: %s\n", strerror(errno));
failf(data, "SSL_Destroy() I/O error: %s", strerror(errno));
return -1;
}
/* An SSL error. */
failf(data, "SSL_Destroy() returned error %d\n", SSL_Strerror(rc, NULL));
failf(data, "SSL_Destroy() returned error %d", SSL_Strerror(rc, NULL));
return -1;
}
@ -359,7 +359,7 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex)
nread = read(conn->sock[sockindex], buf, sizeof(buf));
if(nread < 0) {
failf(data, "read: %s\n", strerror(errno));
failf(data, "read: %s", strerror(errno));
rc = -1;
}
@ -399,12 +399,12 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, void * mem,
return 0;
}
failf(conn->data, "SSL_Write() I/O error: %s\n", strerror(errno));
failf(conn->data, "SSL_Write() I/O error: %s", strerror(errno));
return -1;
}
/* An SSL error. */
failf(conn->data, "SSL_Write() returned error %d\n",
failf(conn->data, "SSL_Write() returned error %d",
SSL_Strerror(rc, NULL));
return -1;
}
@ -442,11 +442,11 @@ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf,
return -1;
}
failf(conn->data, "SSL_Read() I/O error: %s\n", strerror(errno));
failf(conn->data, "SSL_Read() I/O error: %s", strerror(errno));
return -1;
default:
failf(conn->data, "SSL read error: %s\n", SSL_Strerror(nread, NULL));
failf(conn->data, "SSL read error: %s", SSL_Strerror(nread, NULL));
return -1;
}
}

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -733,7 +733,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
break;
}
else {
failf(data, "Failure initialising sftp session\n");
failf(data, "Failure initialising sftp session");
state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT;
break;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -426,7 +426,7 @@ int cert_stuff(struct connectdata *conn,
key_file=cert_file;
case SSL_FILETYPE_ASN1:
if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) {
failf(data, "unable to set private key file: '%s' type %s\n",
failf(data, "unable to set private key file: '%s' type %s",
key_file, key_type?key_type:"PEM");
return 0;
}
@ -440,7 +440,7 @@ int cert_stuff(struct connectdata *conn,
UI_METHOD *ui_method = UI_OpenSSL();
#endif
if(!key_file || !key_file[0]) {
failf(data, "no key set to load from crypto engine\n");
failf(data, "no key set to load from crypto engine");
return 0;
}
/* the typecast below was added to please mingw32 */
@ -451,40 +451,40 @@ int cert_stuff(struct connectdata *conn,
#endif
data->set.str[STRING_KEY_PASSWD]);
if(!priv_key) {
failf(data, "failed to load private key from crypto engine\n");
failf(data, "failed to load private key from crypto engine");
return 0;
}
if(SSL_CTX_use_PrivateKey(ctx, priv_key) != 1) {
failf(data, "unable to set private key\n");
failf(data, "unable to set private key");
EVP_PKEY_free(priv_key);
return 0;
}
EVP_PKEY_free(priv_key); /* we don't need the handle any more... */
}
else {
failf(data, "crypto engine not set, can't load private key\n");
failf(data, "crypto engine not set, can't load private key");
return 0;
}
}
break;
#else
failf(data, "file type ENG for private key not supported\n");
failf(data, "file type ENG for private key not supported");
return 0;
#endif
case SSL_FILETYPE_PKCS12:
if(!cert_done) {
failf(data, "file type P12 for private key not supported\n");
failf(data, "file type P12 for private key not supported");
return 0;
}
break;
default:
failf(data, "not supported file type for private key\n");
failf(data, "not supported file type for private key");
return 0;
}
ssl=SSL_new(ctx);
if(NULL == ssl) {
failf(data,"unable to create an SSL structure\n");
failf(data,"unable to create an SSL structure");
return 0;
}
@ -1855,19 +1855,19 @@ ssize_t Curl_ossl_send(struct connectdata *conn,
equivalent. */
return 0;
case SSL_ERROR_SYSCALL:
failf(conn->data, "SSL_write() returned SYSCALL, errno = %d\n",
failf(conn->data, "SSL_write() returned SYSCALL, errno = %d",
SOCKERRNO);
return -1;
case SSL_ERROR_SSL:
/* A failure in the SSL library occurred, usually a protocol error.
The OpenSSL error queue contains more information on the error. */
sslerror = ERR_get_error();
failf(conn->data, "SSL_write() error: %s\n",
failf(conn->data, "SSL_write() error: %s",
ERR_error_string(sslerror, error_buffer));
return -1;
}
/* a true error */
failf(conn->data, "SSL_write() return error %d\n", err);
failf(conn->data, "SSL_write() return error %d", err);
return -1;
}
return (ssize_t)rc; /* number of bytes */

View File

@ -331,7 +331,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
state->conn->ip_addr->ai_addr,
state->conn->ip_addr->ai_addrlen);
if(sbytes < 0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
}
Curl_safefree(filename);
break;
@ -353,7 +353,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
break;
default:
failf(state->conn->data, "tftp_send_first: internal error\n");
failf(state->conn->data, "tftp_send_first: internal error");
break;
}
return res;
@ -384,7 +384,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
"Received unexpected DATA packet block %d\n", rblock);
state->retries++;
if(state->retries>state->retry_max) {
failf(data, "tftp_rx: giving up waiting for block %d\n",
failf(data, "tftp_rx: giving up waiting for block %d",
state->block+1);
return CURLE_TFTP_ILLEGAL;
}
@ -399,7 +399,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
(struct sockaddr *)&state->remote_addr,
state->remote_addrlen);
if(sbytes < 0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
@ -429,7 +429,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
state->remote_addrlen);
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
}
@ -440,7 +440,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
break;
default:
failf(data, "%s\n", "tftp_rx: internal error");
failf(data, "%s", "tftp_rx: internal error");
return CURLE_TFTP_ILLEGAL; /* not really the perfect return code for
this */
}
@ -487,7 +487,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
state->remote_addrlen);
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
res = CURLE_SEND_ERROR;
}
}
@ -512,7 +512,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
state->remote_addrlen);
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
/* Update the progress meter */
@ -538,7 +538,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
state->remote_addrlen);
/* Check all sbytes were sent */
if(sbytes<0) {
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
/* since this was a re-send, we remain at the still byte position */
@ -551,7 +551,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
break;
default:
failf(data, "%s\n", "tftp_tx: internal error");
failf(data, "%s", "tftp_tx: internal error");
break;
}
@ -588,7 +588,7 @@ static CURLcode tftp_state_machine(tftp_state_data_t *state,
break;
default:
DEBUGF(infof(data, "STATE: %d\n", state->state));
failf(data, "%s\n", "Internal state machine error");
failf(data, "%s", "Internal state machine error");
res = CURLE_TFTP_ILLEGAL;
break;
}
@ -650,7 +650,7 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done)
rc = bind(state->sockfd, (struct sockaddr *)&state->local_addr,
conn->ip_addr->ai_addrlen);
if(rc) {
failf(conn->data, "bind() failed; %s\n",
failf(conn->data, "bind() failed; %s",
Curl_strerror(conn, SOCKERRNO));
return CURLE_COULDNT_CONNECT;
}
@ -734,7 +734,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
if(rc == -1) {
/* bail out */
int error = SOCKERRNO;
failf(data, "%s\n", Curl_strerror(conn, error));
failf(data, "%s", Curl_strerror(conn, error));
event = TFTP_EVENT_ERROR;
}
else if(rc==0) {
@ -759,7 +759,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
/* Sanity check packet length */
if(state->rbytes < 4) {
failf(data, "Received too short packet\n");
failf(data, "Received too short packet");
/* Not a timeout, but how best to handle it? */
event = TFTP_EVENT_TIMEOUT;
}
@ -791,7 +791,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
case TFTP_EVENT_RRQ:
case TFTP_EVENT_WRQ:
default:
failf(data, "%s\n", "Internal error: Unexpected packet");
failf(data, "%s", "Internal error: Unexpected packet");
break;
}

View File

@ -131,7 +131,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
buffersize, conn->fread_in);
if(nread == CURL_READFUNC_ABORT) {
failf(data, "operation aborted by callback\n");
failf(data, "operation aborted by callback");
return CURLE_ABORTED_BY_CALLBACK;
}
else if(nread == CURL_READFUNC_PAUSE) {
@ -250,7 +250,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET);
if(err) {
failf(data, "seek callback returned error %d\n", (int)err);
failf(data, "seek callback returned error %d", (int)err);
return CURLE_SEND_FAIL_REWIND;
}
}
@ -263,7 +263,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
if(err) {
/* FIXME: convert to a human readable error message */
failf(data, "ioctl callback returned error %d\n", (int)err);
failf(data, "ioctl callback returned error %d", (int)err);
return CURLE_SEND_FAIL_REWIND;
}
}
@ -278,7 +278,7 @@ CURLcode Curl_readrewind(struct connectdata *conn)
}
/* no callback set or failure aboe, makes us fail at once */
failf(data, "necessary data rewind wasn't possible\n");
failf(data, "necessary data rewind wasn't possible");
return CURLE_SEND_FAIL_REWIND;
}
}
@ -1818,7 +1818,7 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
CURLcode res;
if(!data->change.url) {
/* we can't do anything wihout URL */
failf(data, "No URL set!\n");
failf(data, "No URL set!");
return CURLE_URL_MALFORMAT;
}