infof: remove newline from format strings, always append it

- the data needs to be "line-based" anyway since it's also passed to the
  debug callback/application

- it makes infof() work like failf() and consistency is good

- there's an assert that triggers on newlines in the format string

- Also removes a few instances of "..."

- Removes the code that would append "..." to the end of the data *iff*
  it was truncated in infof()

Closes #7357
This commit is contained in:
Daniel Stenberg 2021-07-06 17:05:17 +02:00
parent 1026b36ea0
commit e7416cfd2b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
69 changed files with 936 additions and 947 deletions

View file

@ -303,7 +303,7 @@ static void mystate(struct Curl_easy *data, sshstate nowstate
if(sshc->state != nowstate) {
infof(data, "SSH %p state change from %s to %s (line %d)\n",
infof(data, "SSH %p state change from %s to %s (line %d)",
(void *) sshc, names[sshc->state], names[nowstate],
lineno);
}
@ -368,7 +368,7 @@ static int myssh_is_known(struct Curl_easy *data)
for(i = 0; i < 16; i++)
msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
infof(data, "SSH MD5 fingerprint: %s\n", md5buffer);
infof(data, "SSH MD5 fingerprint: %s", md5buffer);
if(!strcasecompare(md5buffer, pubkey_md5)) {
failf(data,
@ -732,7 +732,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE;
infof(data, "Authenticated with none\n");
infof(data, "Authenticated with none");
state(data, SSH_AUTH_DONE);
break;
}
@ -744,7 +744,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
sshc->auth_methods = ssh_userauth_list(sshc->ssh_session, NULL);
if(sshc->auth_methods & SSH_AUTH_METHOD_PUBLICKEY) {
state(data, SSH_AUTH_PKEY_INIT);
infof(data, "Authentication using SSH public key file\n");
infof(data, "Authentication using SSH public key file");
}
else if(sshc->auth_methods & SSH_AUTH_METHOD_GSSAPI_MIC) {
state(data, SSH_AUTH_GSSAPI);
@ -810,7 +810,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) {
rc = SSH_OK;
sshc->authed = TRUE;
infof(data, "Completed public key authentication\n");
infof(data, "Completed public key authentication");
state(data, SSH_AUTH_DONE);
break;
}
@ -827,12 +827,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE;
infof(data, "Completed public key authentication\n");
infof(data, "Completed public key authentication");
state(data, SSH_AUTH_DONE);
break;
}
else {
infof(data, "Failed public key authentication (rc: %d)\n", rc);
infof(data, "Failed public key authentication (rc: %d)", rc);
MOVE_TO_SECONDARY_AUTH;
}
break;
@ -852,7 +852,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) {
rc = SSH_OK;
sshc->authed = TRUE;
infof(data, "Completed gssapi authentication\n");
infof(data, "Completed gssapi authentication");
state(data, SSH_AUTH_DONE);
break;
}
@ -878,7 +878,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(rc == SSH_OK) {
sshc->authed = TRUE;
infof(data, "completed keyboard interactive authentication\n");
infof(data, "completed keyboard interactive authentication");
}
state(data, SSH_AUTH_DONE);
break;
@ -901,7 +901,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == SSH_AUTH_SUCCESS) {
sshc->authed = TRUE;
infof(data, "Completed password authentication\n");
infof(data, "Completed password authentication");
state(data, SSH_AUTH_DONE);
}
else {
@ -919,7 +919,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
/*
* At this point we have an authenticated ssh session.
*/
infof(data, "Authentication complete\n");
infof(data, "Authentication complete");
Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */
@ -930,7 +930,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_SFTP_INIT);
break;
}
infof(data, "SSH CONNECT phase done\n");
infof(data, "SSH CONNECT phase done");
state(data, SSH_STOP);
break;
@ -970,7 +970,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
we get the homedir here, we get the "workingpath" in the DO action
since the homedir will remain the same between request but the
working path will not. */
DEBUGF(infof(data, "SSH CONNECT phase done\n"));
DEBUGF(infof(data, "SSH CONNECT phase done"));
state(data, SSH_STOP);
break;
@ -983,7 +983,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(data->set.quote) {
infof(data, "Sending quote commands\n");
infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE);
}
@ -994,7 +994,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
case SSH_SFTP_POSTQUOTE_INIT:
if(data->set.postquote) {
infof(data, "Sending quote commands\n");
infof(data, "Sending quote commands");
sshc->quote_item = data->set.postquote;
state(data, SSH_SFTP_QUOTE);
}
@ -1367,7 +1367,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(sshc->slash_pos) {
*sshc->slash_pos = 0;
infof(data, "Creating directory '%s'\n", protop->path);
infof(data, "Creating directory '%s'", protop->path);
state(data, SSH_SFTP_CREATE_DIRS_MKDIR);
break;
}
@ -1731,7 +1731,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) {
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n");
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
@ -1764,7 +1764,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
}
Curl_safefree(protop->path);
DEBUGF(infof(data, "SFTP DONE done\n"));
DEBUGF(infof(data, "SFTP DONE done"));
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
After nextstate is executed, the control should come back to
@ -1933,7 +1933,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
break;
}
if(rc != SSH_OK) {
infof(data, "Failed to close libssh scp channel: %s\n",
infof(data, "Failed to close libssh scp channel: %s",
ssh_get_error(sshc->ssh_session));
}
}
@ -1946,7 +1946,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
ssh_scp_free(sshc->scp_session);
sshc->scp_session = NULL;
}
DEBUGF(infof(data, "SCP DONE phase complete\n"));
DEBUGF(infof(data, "SCP DONE phase complete"));
ssh_set_blocking(sshc->ssh_session, 0);
@ -2213,7 +2213,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
}
if(conn->user && conn->user[0] != '\0') {
infof(data, "User: %s\n", conn->user);
infof(data, "User: %s", conn->user);
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_USER, conn->user);
if(rc != SSH_OK) {
failf(data, "Could not set user");
@ -2222,7 +2222,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
}
if(data->set.str[STRING_SSH_KNOWNHOSTS]) {
infof(data, "Known hosts: %s\n", data->set.str[STRING_SSH_KNOWNHOSTS]);
infof(data, "Known hosts: %s", data->set.str[STRING_SSH_KNOWNHOSTS]);
rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS,
data->set.str[STRING_SSH_KNOWNHOSTS]);
if(rc != SSH_OK) {
@ -2279,7 +2279,7 @@ static CURLcode scp_doing(struct Curl_easy *data, bool *dophase_done)
result = myssh_multi_statemach(data, dophase_done);
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
}
@ -2300,7 +2300,7 @@ CURLcode scp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n"));
DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */
@ -2312,7 +2312,7 @@ CURLcode scp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
@ -2481,7 +2481,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n"));
DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */
@ -2494,7 +2494,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
@ -2506,7 +2506,7 @@ static CURLcode sftp_doing(struct Curl_easy *data,
{
CURLcode result = myssh_multi_statemach(data, dophase_done);
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
}
@ -2521,7 +2521,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
CURLcode result = CURLE_OK;
(void) dead_connection;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n"));
DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */
@ -2529,7 +2529,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
result = myssh_block_statemach(data, TRUE);
}
DEBUGF(infof(data, "SSH DISCONNECT is done\n"));
DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result;

View file

@ -378,7 +378,7 @@ static void state(struct Curl_easy *data, sshstate nowstate)
DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST);
if(sshc->state != nowstate) {
infof(data, "SFTP %p state change from %s to %s\n",
infof(data, "SFTP %p state change from %s to %s",
(void *)sshc, names[sshc->state], names[nowstate]);
}
#endif
@ -491,7 +491,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
break;
#endif
default:
infof(data, "unsupported key type, can't check knownhosts!\n");
infof(data, "unsupported key type, can't check knownhosts!");
keybit = 0;
break;
}
@ -519,7 +519,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
&host);
#endif
infof(data, "SSH host check: %d, key: %s\n", keycheck,
infof(data, "SSH host check: %d, key: %s", keycheck,
(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
host->key:"<none>");
@ -586,7 +586,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
LIBSSH2_KNOWNHOST_KEYENC_RAW|
keybit, NULL);
if(addrc)
infof(data, "Warning adding the known host %s failed!\n",
infof(data, "Warning adding the known host %s failed!",
conn->host.name);
else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE ||
rc == CURLKHSTAT_FINE_REPLACE) {
@ -597,7 +597,7 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
data->set.str[STRING_SSH_KNOWNHOSTS],
LIBSSH2_KNOWNHOST_FILE_OPENSSH);
if(wrc) {
infof(data, "Warning, writing %s failed!\n",
infof(data, "Warning, writing %s failed!",
data->set.str[STRING_SSH_KNOWNHOSTS]);
}
}
@ -626,7 +626,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
int i;
for(i = 0; i < 16; i++)
msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char) fingerprint[i]);
infof(data, "SSH MD5 fingerprint: %s\n", md5buffer);
infof(data, "SSH MD5 fingerprint: %s", md5buffer);
}
/* Before we authenticate we check the hostkey's MD5 fingerprint
@ -645,7 +645,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data)
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
infof(data, "MD5 checksum match!\n");
infof(data, "MD5 checksum match!");
/* as we already matched, we skip the check for known hosts */
return CURLE_OK;
}
@ -702,7 +702,7 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
if(store->name[0] == '[') {
kh_name_end = strstr(store->name, "]:");
if(!kh_name_end) {
infof(data, "Invalid host pattern %s in %s\n",
infof(data, "Invalid host pattern %s in %s",
store->name, data->set.str[STRING_SSH_KNOWNHOSTS]);
continue;
}
@ -729,7 +729,7 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
}
if(found) {
infof(data, "Found host %s in %s\n",
infof(data, "Found host %s in %s",
conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
switch(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) {
@ -768,13 +768,13 @@ static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data)
return CURLE_SSH;
}
infof(data, "Set \"%s\" as SSH hostkey type\n", hostkey_method);
infof(data, "Set \"%s\" as SSH hostkey type", hostkey_method);
result = libssh2_session_error_to_CURLE(
libssh2_session_method_pref(
sshc->ssh_session, LIBSSH2_METHOD_HOSTKEY, hostkey_method));
}
else {
infof(data, "Did not find host %s in %s\n",
infof(data, "Did not find host %s in %s",
conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
}
}
@ -874,7 +874,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(!sshc->authlist) {
if(libssh2_userauth_authenticated(sshc->ssh_session)) {
sshc->authed = TRUE;
infof(data, "SSH user accepted with no authentication\n");
infof(data, "SSH user accepted with no authentication");
state(data, SSH_AUTH_DONE);
break;
}
@ -887,7 +887,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
}
break;
}
infof(data, "SSH authentication methods available: %s\n",
infof(data, "SSH authentication methods available: %s",
sshc->authlist);
state(data, SSH_AUTH_PKEY_INIT);
@ -972,8 +972,8 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
sshc->passphrase = "";
if(sshc->rsa_pub)
infof(data, "Using SSH public key file '%s'\n", sshc->rsa_pub);
infof(data, "Using SSH private key file '%s'\n", sshc->rsa);
infof(data, "Using SSH public key file '%s'", sshc->rsa_pub);
infof(data, "Using SSH private key file '%s'", sshc->rsa);
state(data, SSH_AUTH_PKEY);
}
@ -1000,14 +1000,14 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized SSH public key authentication\n");
infof(data, "Initialized SSH public key authentication");
state(data, SSH_AUTH_DONE);
}
else {
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "SSH public key authentication failed: %s\n", err_msg);
infof(data, "SSH public key authentication failed: %s", err_msg);
state(data, SSH_AUTH_PASS_INIT);
rc = 0; /* clear rc and continue */
}
@ -1035,7 +1035,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized password authentication\n");
infof(data, "Initialized password authentication");
state(data, SSH_AUTH_DONE);
}
else {
@ -1069,7 +1069,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(!sshc->ssh_agent) {
sshc->ssh_agent = libssh2_agent_init(sshc->ssh_session);
if(!sshc->ssh_agent) {
infof(data, "Could not create agent object\n");
infof(data, "Could not create agent object");
state(data, SSH_AUTH_KEY_INIT);
break;
@ -1080,7 +1080,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN)
break;
if(rc < 0) {
infof(data, "Failure connecting to agent\n");
infof(data, "Failure connecting to agent");
state(data, SSH_AUTH_KEY_INIT);
rc = 0; /* clear rc and continue */
}
@ -1100,7 +1100,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN)
break;
if(rc < 0) {
infof(data, "Failure requesting identities to agent\n");
infof(data, "Failure requesting identities to agent");
state(data, SSH_AUTH_KEY_INIT);
rc = 0; /* clear rc and continue */
}
@ -1136,13 +1136,13 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(rc < 0)
infof(data, "Failure requesting identities to agent\n");
infof(data, "Failure requesting identities to agent");
else if(rc == 1)
infof(data, "No identity would match\n");
infof(data, "No identity would match");
if(rc == LIBSSH2_ERROR_NONE) {
sshc->authed = TRUE;
infof(data, "Agent based authentication successful\n");
infof(data, "Agent based authentication successful");
state(data, SSH_AUTH_DONE);
}
else {
@ -1174,7 +1174,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized keyboard interactive authentication\n");
infof(data, "Initialized keyboard interactive authentication");
}
state(data, SSH_AUTH_DONE);
break;
@ -1190,7 +1190,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
/*
* At this point we have an authenticated ssh session.
*/
infof(data, "Authentication complete\n");
infof(data, "Authentication complete");
Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSH is connected */
@ -1201,7 +1201,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_SFTP_INIT);
break;
}
infof(data, "SSH CONNECT phase done\n");
infof(data, "SSH CONNECT phase done");
state(data, SSH_STOP);
break;
@ -1261,7 +1261,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
a time-out or similar */
result = CURLE_SSH;
sshc->actualcode = result;
DEBUGF(infof(data, "error = %lu makes libcurl = %d\n",
DEBUGF(infof(data, "error = %lu makes libcurl = %d",
sftperr, (int)result));
state(data, SSH_STOP);
break;
@ -1271,7 +1271,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
we get the homedir here, we get the "workingpath" in the DO action
since the homedir will remain the same between request but the
working path will not. */
DEBUGF(infof(data, "SSH CONNECT phase done\n"));
DEBUGF(infof(data, "SSH CONNECT phase done"));
state(data, SSH_STOP);
break;
@ -1285,7 +1285,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(data->set.quote) {
infof(data, "Sending quote commands\n");
infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE);
}
@ -1296,7 +1296,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
case SSH_SFTP_POSTQUOTE_INIT:
if(data->set.postquote) {
infof(data, "Sending quote commands\n");
infof(data, "Sending quote commands");
sshc->quote_item = data->set.postquote;
state(data, SSH_SFTP_QUOTE);
}
@ -2048,7 +2048,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(sshc->slash_pos) {
*sshc->slash_pos = 0;
infof(data, "Creating directory '%s'\n", sshp->path);
infof(data, "Creating directory '%s'", sshp->path);
state(data, SSH_SFTP_CREATE_DIRS_MKDIR);
break;
}
@ -2411,7 +2411,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) {
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n");
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
@ -2446,14 +2446,14 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg);
infof(data, "Failed to close libssh2 file: %d %s", rc, err_msg);
}
sshc->sftp_handle = NULL;
}
Curl_safefree(sshp->path);
DEBUGF(infof(data, "SFTP DONE done\n"));
DEBUGF(infof(data, "SFTP DONE done"));
/* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
After nextstate is executed, the control should come back to
@ -2483,7 +2483,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session, &err_msg,
NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg);
infof(data, "Failed to close libssh2 file: %d %s", rc, err_msg);
}
sshc->sftp_handle = NULL;
}
@ -2493,7 +2493,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to stop libssh2 sftp subsystem\n");
infof(data, "Failed to stop libssh2 sftp subsystem");
}
sshc->sftp_session = NULL;
}
@ -2668,7 +2668,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to send libssh2 channel EOF: %d %s\n",
infof(data, "Failed to send libssh2 channel EOF: %d %s",
rc, err_msg);
}
}
@ -2685,7 +2685,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to get channel EOF: %d %s\n", rc, err_msg);
infof(data, "Failed to get channel EOF: %d %s", rc, err_msg);
}
}
state(data, SSH_SCP_WAIT_CLOSE);
@ -2701,7 +2701,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Channel failed to close: %d %s\n", rc, err_msg);
infof(data, "Channel failed to close: %d %s", rc, err_msg);
}
}
state(data, SSH_SCP_CHANNEL_FREE);
@ -2717,12 +2717,12 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n",
infof(data, "Failed to free libssh2 scp subsystem: %d %s",
rc, err_msg);
}
sshc->ssh_channel = NULL;
}
DEBUGF(infof(data, "SCP DONE phase complete\n"));
DEBUGF(infof(data, "SCP DONE phase complete"));
#if 0 /* PREV */
state(data, SSH_SESSION_DISCONNECT);
#endif
@ -2743,7 +2743,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n",
infof(data, "Failed to free libssh2 scp subsystem: %d %s",
rc, err_msg);
}
sshc->ssh_channel = NULL;
@ -2758,7 +2758,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to disconnect libssh2 session: %d %s\n",
infof(data, "Failed to disconnect libssh2 session: %d %s",
rc, err_msg);
}
}
@ -2787,7 +2787,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to disconnect from libssh2 agent: %d %s\n",
infof(data, "Failed to disconnect from libssh2 agent: %d %s",
rc, err_msg);
}
libssh2_agent_free(sshc->ssh_agent);
@ -2809,7 +2809,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to free libssh2 session: %d %s\n", rc, err_msg);
infof(data, "Failed to free libssh2 session: %d %s", rc, err_msg);
}
sshc->ssh_session = NULL;
}
@ -3085,10 +3085,10 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#ifdef CURL_LIBSSH2_DEBUG
if(conn->user) {
infof(data, "User: %s\n", conn->user);
infof(data, "User: %s", conn->user);
}
if(conn->passwd) {
infof(data, "Password: %s\n", conn->passwd);
infof(data, "Password: %s", conn->passwd);
}
sock = conn->sock[FIRSTSOCKET];
#endif /* CURL_LIBSSH2_DEBUG */
@ -3122,7 +3122,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
sshrecv.recvptr = ssh_tls_recv;
sshsend.sendptr = ssh_tls_send;
infof(data, "Uses HTTPS proxy!\n");
infof(data, "Uses HTTPS proxy!");
/*
Setup libssh2 callbacks to make it read/write TLS from the socket.
@ -3160,7 +3160,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#if LIBSSH2_VERSION_NUM >= 0x010208
if(libssh2_session_flag(sshc->ssh_session, LIBSSH2_FLAG_COMPRESS, 1) < 0)
#endif
infof(data, "Failed to enable compression for ssh session\n");
infof(data, "Failed to enable compression for ssh session");
}
#ifdef HAVE_LIBSSH2_KNOWNHOST_API
@ -3178,14 +3178,14 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
data->set.str[STRING_SSH_KNOWNHOSTS],
LIBSSH2_KNOWNHOST_FILE_OPENSSH);
if(rc < 0)
infof(data, "Failed to read known hosts from %s\n",
infof(data, "Failed to read known hosts from %s",
data->set.str[STRING_SSH_KNOWNHOSTS]);
}
#endif /* HAVE_LIBSSH2_KNOWNHOST_API */
#ifdef CURL_LIBSSH2_DEBUG
libssh2_trace(sshc->ssh_session, ~0);
infof(data, "SSH socket: %d\n", (int)sock);
infof(data, "SSH socket: %d", (int)sock);
#endif /* CURL_LIBSSH2_DEBUG */
state(data, SSH_INIT);
@ -3212,7 +3212,7 @@ CURLcode scp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n"));
DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */
@ -3225,7 +3225,7 @@ CURLcode scp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
@ -3239,7 +3239,7 @@ static CURLcode scp_doing(struct Curl_easy *data,
result = ssh_multi_statemach(data, dophase_done);
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
}
@ -3401,7 +3401,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
{
CURLcode result = CURLE_OK;
DEBUGF(infof(data, "DO phase starts\n"));
DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */
@ -3414,7 +3414,7 @@ CURLcode sftp_perform(struct Curl_easy *data,
*connected = data->conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
@ -3427,7 +3427,7 @@ static CURLcode sftp_doing(struct Curl_easy *data,
CURLcode result = ssh_multi_statemach(data, dophase_done);
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
}
@ -3442,7 +3442,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
struct ssh_conn *sshc = &conn->proto.sshc;
(void) dead_connection;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n"));
DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(sshc->ssh_session) {
/* only if there's a session still around to use! */
@ -3450,7 +3450,7 @@ static CURLcode sftp_disconnect(struct Curl_easy *data,
result = ssh_block_statemach(data, conn, TRUE);
}
DEBUGF(infof(data, "SSH DISCONNECT is done\n"));
DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result;

View file

@ -205,7 +205,7 @@ static void state(struct Curl_easy *data, sshstate nowstate)
DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST);
if(sshc->state != nowstate) {
infof(data, "wolfssh %p state change from %s to %s\n",
infof(data, "wolfssh %p state change from %s to %s",
(void *)sshc, names[sshc->state], names[nowstate]);
}
#endif
@ -274,7 +274,7 @@ static ssize_t wsftp_send(struct Curl_easy *data, int sockindex,
return -1;
}
DEBUGASSERT(rc == (int)len);
infof(data, "sent %zd bytes SFTP from offset %zd\n",
infof(data, "sent %zd bytes SFTP from offset %zd",
len, sshc->offset);
sshc->offset += len;
return (ssize_t)rc;
@ -348,7 +348,7 @@ static int userauth(byte authtype,
void *ctx)
{
struct Curl_easy *data = ctx;
DEBUGF(infof(data, "wolfssh callback: type %s\n",
DEBUGF(infof(data, "wolfssh callback: type %s",
authtype == WOLFSSH_USERAUTH_PASSWORD ? "PASSWORD" :
"PUBLICCKEY"));
if(authtype == WOLFSSH_USERAUTH_PASSWORD) {
@ -468,7 +468,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
state(data, SSH_STOP);
return CURLE_SSH;
}
infof(data, "wolfssh connected!\n");
infof(data, "wolfssh connected!");
state(data, SSH_STOP);
break;
case SSH_STOP:
@ -489,7 +489,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK;
}
else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP connected!\n");
infof(data, "wolfssh SFTP connected!");
state(data, SSH_SFTP_REALPATH);
}
else {
@ -518,7 +518,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
else {
memcpy(sshc->homedir, name->fName, name->fSz);
sshc->homedir[name->fSz] = 0;
infof(data, "wolfssh SFTP realpath succeeded!\n");
infof(data, "wolfssh SFTP realpath succeeded!");
}
wolfSSH_SFTPNAME_list_free(name);
state(data, SSH_STOP);
@ -536,7 +536,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
}
if(data->set.quote) {
infof(data, "Sending quote commands\n");
infof(data, "Sending quote commands");
sshc->quote_item = data->set.quote;
state(data, SSH_SFTP_QUOTE);
}
@ -616,7 +616,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK;
}
else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP open succeeded!\n");
infof(data, "wolfssh SFTP open succeeded!");
}
else {
failf(data, "wolfssh SFTP upload open failed: %d", rc);
@ -727,7 +727,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK;
}
else if(rc == WS_SUCCESS) {
infof(data, "wolfssh SFTP open succeeded!\n");
infof(data, "wolfssh SFTP open succeeded!");
state(data, SSH_SFTP_DOWNLOAD_STAT);
return CURLE_OK;
}
@ -753,7 +753,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
return CURLE_OK;
}
else if(rc == WS_SUCCESS) {
infof(data, "wolfssh STAT succeeded!\n");
infof(data, "wolfssh STAT succeeded!");
}
else {
failf(data, "wolfssh SFTP open failed: %d", rc);
@ -769,12 +769,12 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
data->req.maxdownload = size;
Curl_pgrsSetDownloadSize(data, size);
infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes\n", size);
infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes", size);
/* We cannot seek with wolfSSH so resuming and range requests are not
possible */
if(data->state.use_range || data->state.resume_from) {
infof(data, "wolfSSH cannot do range/seek on SFTP\n");
infof(data, "wolfSSH cannot do range/seek on SFTP");
return CURLE_BAD_DOWNLOAD_RESUME;
}
@ -782,7 +782,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->req.size == 0) {
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded\n");
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
@ -911,7 +911,7 @@ static CURLcode wssh_multi_statemach(struct Curl_easy *data, bool *done)
/* if there's no error, it isn't done and it didn't EWOULDBLOCK, then
try again */
if(*done) {
DEBUGF(infof(data, "wssh_statemach_act says DONE\n"));
DEBUGF(infof(data, "wssh_statemach_act says DONE"));
}
} while(!result && !*done && !block);
@ -937,7 +937,7 @@ CURLcode wsftp_perform(struct Curl_easy *data,
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
DEBUGF(infof(data, "DO phase starts\n"));
DEBUGF(infof(data, "DO phase starts"));
*dophase_done = FALSE; /* not done yet */
@ -950,7 +950,7 @@ CURLcode wsftp_perform(struct Curl_easy *data,
*connected = conn->bits.tcpconnect[FIRSTSOCKET];
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
@ -1107,7 +1107,7 @@ static CURLcode wsftp_doing(struct Curl_easy *data,
CURLcode result = wssh_multi_statemach(data, dophase_done);
if(*dophase_done) {
DEBUGF(infof(data, "DO phase is complete\n"));
DEBUGF(infof(data, "DO phase is complete"));
}
return result;
}
@ -1119,7 +1119,7 @@ static CURLcode wsftp_disconnect(struct Curl_easy *data,
CURLcode result = CURLE_OK;
(void)dead;
DEBUGF(infof(data, "SSH DISCONNECT starts now\n"));
DEBUGF(infof(data, "SSH DISCONNECT starts now"));
if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */
@ -1127,7 +1127,7 @@ static CURLcode wsftp_disconnect(struct Curl_easy *data,
result = wssh_block_statemach(data, TRUE);
}
DEBUGF(infof(data, "SSH DISCONNECT is done\n"));
DEBUGF(infof(data, "SSH DISCONNECT is done"));
return result;
}