aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libssh/kex.h2
-rw-r--r--src/auth1.c2
-rw-r--r--src/channels.c112
-rw-r--r--src/channels1.c22
-rw-r--r--src/client.c18
-rw-r--r--src/config.c4
-rw-r--r--src/connect.c20
-rw-r--r--src/dh.c4
-rw-r--r--src/ecdh.c6
-rw-r--r--src/gssapi.c88
-rw-r--r--src/kex.c8
-rw-r--r--src/kex1.c18
-rw-r--r--src/known_hosts.c5
-rw-r--r--src/legacy.c20
-rw-r--r--src/messages.c44
-rw-r--r--src/misc.c4
-rw-r--r--src/packet.c19
-rw-r--r--src/packet1.c20
-rw-r--r--src/packet_cb.c13
-rw-r--r--src/pki.c3
-rw-r--r--src/scp.c8
-rw-r--r--src/server.c40
-rw-r--r--src/session.c2
-rw-r--r--src/sftp.c32
-rw-r--r--src/socket.c10
-rw-r--r--src/wrapper.c12
26 files changed, 268 insertions, 268 deletions
diff --git a/include/libssh/kex.h b/include/libssh/kex.h
index 37d4be8e..1a5b6d41 100644
--- a/include/libssh/kex.h
+++ b/include/libssh/kex.h
@@ -37,7 +37,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1);
#endif
int ssh_send_kex(ssh_session session, int server_kex);
-void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex);
+void ssh_list_kex(struct ssh_kex_struct *kex);
int set_client_kex(ssh_session session);
int ssh_kex_select_methods(ssh_session session);
int verify_existing_algo(int algo, const char *name);
diff --git a/src/auth1.c b/src/auth1.c
index 0f3f096d..20306087 100644
--- a/src/auth1.c
+++ b/src/auth1.c
@@ -51,7 +51,7 @@ static int wait_auth1_status(ssh_session session) {
leave_function();
return SSH_AUTH_ERROR;
}
- ssh_log(session,SSH_LOG_PROTOCOL,"Auth state : %d",session->auth_state);
+ SSH_LOG(SSH_LOG_PROTOCOL,"Auth state : %d",session->auth_state);
leave_function();
switch(session->auth_state) {
case SSH_AUTH_STATE_SUCCESS:
diff --git a/src/channels.c b/src/channels.c
index 687a8ee9..333c26ee 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -144,7 +144,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){
(void)type;
(void)user;
enter_function();
- ssh_log(session,SSH_LOG_PACKET,"Received SSH2_MSG_CHANNEL_OPEN_CONFIRMATION");
+ SSH_LOG(SSH_LOG_PACKET,"Received SSH2_MSG_CHANNEL_OPEN_CONFIRMATION");
buffer_get_u32(packet, &channelid);
channelid=ntohl(channelid);
@@ -167,11 +167,11 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf){
buffer_get_u32(packet,&tmp);
channel->remote_maxpacket=ntohl(tmp);
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Received a CHANNEL_OPEN_CONFIRMATION for channel %d:%d",
channel->local_channel,
channel->remote_channel);
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Remote window : %lu, maxpacket : %lu",
(long unsigned int) channel->remote_window,
(long unsigned int) channel->remote_maxpacket);
@@ -197,7 +197,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open_fail){
(void)type;
channel=channel_from_msg(session,packet);
if(channel==NULL){
- ssh_log(session,SSH_LOG_RARE,"Invalid channel in packet");
+ SSH_LOG(SSH_LOG_RARE,"Invalid channel in packet");
return SSH_PACKET_USED;
}
buffer_get_u32(packet, &code);
@@ -271,7 +271,7 @@ static int channel_open(ssh_channel channel, const char *type_c, int window,
channel->local_maxpacket = maxpacket;
channel->local_window = window;
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Creating a channel %d with %d window and %d max packet",
channel->local_channel, window, maxpacket);
@@ -308,7 +308,7 @@ static int channel_open(ssh_channel channel, const char *type_c, int window,
return err;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a SSH_MSG_CHANNEL_OPEN type %s for channel %d",
type_c, channel->local_channel);
pending:
@@ -360,7 +360,7 @@ static int grow_window(ssh_session session, ssh_channel channel, int minimumsize
}
#endif
if(new_window <= channel->local_window){
- ssh_log(session,SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"growing window (channel %d:%d) to %d bytes : not needed (%d bytes)",
channel->local_channel, channel->remote_channel, new_window,
channel->local_window);
@@ -381,7 +381,7 @@ static int grow_window(ssh_session session, ssh_channel channel, int minimumsize
goto error;
}
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"growing window (channel %d:%d) to %d bytes",
channel->local_channel,
channel->remote_channel,
@@ -447,19 +447,19 @@ SSH_PACKET_CALLBACK(channel_rcv_change_window) {
channel = channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
}
rc = buffer_get_u32(packet, &bytes);
if (channel == NULL || rc != sizeof(uint32_t)) {
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Error getting a window adjust message: invalid packet");
leave_function();
return SSH_PACKET_USED;
}
bytes = ntohl(bytes);
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Adding %d bytes to channel (%d:%d) (from %d bytes)",
bytes,
channel->local_channel,
@@ -489,7 +489,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
channel = channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS,
+ SSH_LOG(SSH_LOG_FUNCTIONS,
"%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
@@ -503,13 +503,13 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
str = buffer_get_ssh_string(packet);
if (str == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid data packet!");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid data packet!");
leave_function();
return SSH_PACKET_USED;
}
len = ssh_string_len(str);
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Channel receiving %" PRIdS " bytes data in %d (local win=%d remote win=%d)",
len,
is_stderr,
@@ -518,7 +518,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
/* What shall we do in this case? Let's accept it anyway */
if (len > channel->local_window) {
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"Data packet too big for our window(%" PRIdS " vs %d)",
len,
channel->local_window);
@@ -537,7 +537,7 @@ SSH_PACKET_CALLBACK(channel_rcv_data){
channel->local_window = 0; /* buggy remote */
}
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Channel windows are now (local win=%d remote win=%d)",
channel->local_window,
channel->remote_window);
@@ -579,12 +579,12 @@ SSH_PACKET_CALLBACK(channel_rcv_eof) {
channel = channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received eof on channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
@@ -609,12 +609,12 @@ SSH_PACKET_CALLBACK(channel_rcv_close) {
channel = channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received close on channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
@@ -628,7 +628,7 @@ SSH_PACKET_CALLBACK(channel_rcv_close) {
channel->state = SSH_CHANNEL_STATE_CLOSED;
}
if (channel->remote_eof == 0) {
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Remote host not polite enough to send an eof before close");
}
channel->remote_eof = 1;
@@ -662,14 +662,14 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
channel = channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS,"%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS,"%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
}
request_s = buffer_get_ssh_string(packet);
if (request_s == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
leave_function();
return SSH_PACKET_USED;
}
@@ -689,7 +689,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
SAFE_FREE(request);
buffer_get_u32(packet, &exit_status);
channel->exit_status = ntohl(exit_status);
- ssh_log(session, SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
+ SSH_LOG(SSH_LOG_PACKET, "received exit-status %d", channel->exit_status);
if(ssh_callbacks_exists(channel->callbacks, channel_exit_status_function)) {
channel->callbacks->channel_exit_status_function(channel->session,
@@ -707,11 +707,11 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
char *sig;
SAFE_FREE(request);
- ssh_log(session, SSH_LOG_PACKET, "received signal");
+ SSH_LOG(SSH_LOG_PACKET, "received signal");
signal_str = buffer_get_ssh_string(packet);
if (signal_str == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
leave_function();
return SSH_PACKET_USED;
}
@@ -724,7 +724,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Remote connection sent a signal SIG %s", sig);
if(ssh_callbacks_exists(channel->callbacks, channel_signal_function)) {
channel->callbacks->channel_signal_function(channel->session,
@@ -750,7 +750,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
tmp = buffer_get_ssh_string(packet);
if (tmp == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
leave_function();
return SSH_PACKET_USED;
}
@@ -769,7 +769,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
tmp = buffer_get_ssh_string(packet);
if (tmp == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
SAFE_FREE(sig);
leave_function();
return SSH_PACKET_USED;
@@ -785,7 +785,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
tmp = buffer_get_ssh_string(packet);
if (tmp == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid MSG_CHANNEL_REQUEST");
SAFE_FREE(errmsg);
SAFE_FREE(sig);
leave_function();
@@ -801,7 +801,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Remote connection closed by signal SIG %s %s", sig, core);
if(ssh_callbacks_exists(channel->callbacks, channel_exit_signal_function)) {
channel->callbacks->channel_exit_signal_function(channel->session,
@@ -819,7 +819,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
}
if(strcmp(request,"keepalive@openssh.com")==0){
SAFE_FREE(request);
- ssh_log(session, SSH_LOG_PROTOCOL,"Responding to Openssh's keepalive");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Responding to Openssh's keepalive");
rc = buffer_add_u8(session->out_buffer, SSH2_MSG_CHANNEL_FAILURE);
if (rc < 0) {
return SSH_PACKET_USED;
@@ -835,7 +835,7 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
if (strcmp(request, "auth-agent-req@openssh.com") == 0) {
SAFE_FREE(request);
- ssh_log(session, SSH_LOG_PROTOCOL, "Received an auth-agent-req request");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Received an auth-agent-req request");
if(ssh_callbacks_exists(channel->callbacks, channel_auth_agent_req_function)) {
channel->callbacks->channel_auth_agent_req_function(channel->session, channel,
channel->callbacks->userdata);
@@ -880,7 +880,7 @@ int channel_default_bufferize(ssh_channel channel, void *data, int len,
return -1;
}
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"placing %d bytes into channel buffer (stderr=%d)", len, is_stderr);
if (is_stderr == 0) {
/* stdout */
@@ -1162,7 +1162,7 @@ int ssh_channel_send_eof(ssh_channel channel){
goto error;
}
rc = packet_send(session);
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a EOF on client channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
@@ -1218,7 +1218,7 @@ int ssh_channel_close(ssh_channel channel){
}
rc = packet_send(session);
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a close on client channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
@@ -1291,7 +1291,7 @@ int channel_write_common(ssh_channel channel, const void *data,
}
if (len > INT_MAX) {
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Length (%u) is bigger than INT_MAX", len);
return SSH_ERROR;
}
@@ -1337,14 +1337,14 @@ int channel_write_common(ssh_channel channel, const void *data,
}
while (len > 0) {
if (channel->remote_window < len) {
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Remote window is %d bytes. going to write %d bytes",
channel->remote_window,
len);
/* What happens when the channel window is zero? */
if(channel->remote_window == 0) {
/* nothing can be written */
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Wait for a growing window message...");
rc = ssh_handle_packets_termination(session, SSH_TIMEOUT_DEFAULT,
ssh_channel_waitwindow_termination,channel);
@@ -1382,7 +1382,7 @@ int channel_write_common(ssh_channel channel, const void *data,
return SSH_ERROR;
}
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"channel_write wrote %ld bytes", (long int) effectivelen);
channel->remote_window -= effectivelen;
@@ -1510,17 +1510,17 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_success){
enter_function();
channel=channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received SSH_CHANNEL_SUCCESS on channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
- ssh_log(session, SSH_LOG_RARE, "SSH_CHANNEL_SUCCESS received in incorrect state %d",
+ SSH_LOG(SSH_LOG_RARE, "SSH_CHANNEL_SUCCESS received in incorrect state %d",
channel->request_state);
} else {
channel->request_state=SSH_CHANNEL_REQ_STATE_ACCEPTED;
@@ -1544,17 +1544,17 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_failure){
enter_function();
channel=channel_from_msg(session,packet);
if (channel == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s", ssh_get_error(session));
leave_function();
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received SSH_CHANNEL_FAILURE on channel (%d:%d)",
channel->local_channel,
channel->remote_channel);
if(channel->request_state != SSH_CHANNEL_REQ_STATE_PENDING){
- ssh_log(session, SSH_LOG_RARE, "SSH_CHANNEL_FAILURE received in incorrect state %d",
+ SSH_LOG(SSH_LOG_RARE, "SSH_CHANNEL_FAILURE received in incorrect state %d",
channel->request_state);
} else {
channel->request_state=SSH_CHANNEL_REQ_STATE_DENIED;
@@ -1615,7 +1615,7 @@ static int channel_request(ssh_channel channel, const char *request,
return rc;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a SSH_MSG_CHANNEL_REQUEST %s", request);
if (reply == 0) {
channel->request_state = SSH_CHANNEL_REQ_STATE_NONE;
@@ -1638,7 +1638,7 @@ pending:
rc=SSH_ERROR;
break;
case SSH_CHANNEL_REQ_STATE_ACCEPTED:
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Channel request %s success",request);
rc=SSH_OK;
break;
@@ -2063,10 +2063,10 @@ SSH_PACKET_CALLBACK(ssh_request_success){
(void)packet;
enter_function();
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received SSH_REQUEST_SUCCESS");
if(session->global_req_state != SSH_CHANNEL_REQ_STATE_PENDING){
- ssh_log(session, SSH_LOG_RARE, "SSH_REQUEST_SUCCESS received in incorrect state %d",
+ SSH_LOG(SSH_LOG_RARE, "SSH_REQUEST_SUCCESS received in incorrect state %d",
session->global_req_state);
} else {
session->global_req_state=SSH_CHANNEL_REQ_STATE_ACCEPTED;
@@ -2088,10 +2088,10 @@ SSH_PACKET_CALLBACK(ssh_request_denied){
(void)packet;
enter_function();
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received SSH_REQUEST_FAILURE");
if(session->global_req_state != SSH_CHANNEL_REQ_STATE_PENDING){
- ssh_log(session, SSH_LOG_RARE, "SSH_REQUEST_DENIED received in incorrect state %d",
+ SSH_LOG(SSH_LOG_RARE, "SSH_REQUEST_DENIED received in incorrect state %d",
session->global_req_state);
} else {
session->global_req_state=SSH_CHANNEL_REQ_STATE_DENIED;
@@ -2166,7 +2166,7 @@ static int global_request(ssh_session session, const char *request,
return rc;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a SSH_MSG_GLOBAL_REQUEST %s", request);
if (reply == 0) {
session->global_req_state=SSH_CHANNEL_REQ_STATE_NONE;
@@ -2181,11 +2181,11 @@ pending:
}
switch(session->global_req_state){
case SSH_CHANNEL_REQ_STATE_ACCEPTED:
- ssh_log(session, SSH_LOG_PROTOCOL, "Global request %s success",request);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Global request %s success",request);
rc=SSH_OK;
break;
case SSH_CHANNEL_REQ_STATE_DENIED:
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Global request %s failed", request);
ssh_set_error(session, SSH_REQUEST_DENIED,
"Global request %s failed", request);
@@ -2716,7 +2716,7 @@ int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_std
* We may have problem if the window is too small to accept as much data
* as asked
*/
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Read (%d) buffered : %d bytes. Window: %d",
count,
buffer_get_rest_len(stdbuf),
diff --git a/src/channels1.c b/src/channels1.c
index 62faf4ae..30030db0 100644
--- a/src/channels1.c
+++ b/src/channels1.c
@@ -72,7 +72,7 @@ int channel_open_session1(ssh_channel chan) {
chan->state = SSH_CHANNEL_STATE_OPEN;
chan->local_maxpacket = 32000;
chan->local_window = 64000;
- ssh_log(session, SSH_LOG_PACKET, "Opened a SSH1 channel session");
+ SSH_LOG(SSH_LOG_PACKET, "Opened a SSH1 channel session");
return 0;
}
@@ -124,7 +124,7 @@ int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col
return -1;
}
- ssh_log(session, SSH_LOG_FUNCTIONS, "Opening a ssh1 pty");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Opening a ssh1 pty");
channel->request_state = SSH_CHANNEL_REQ_STATE_PENDING;
if (packet_send(session) == SSH_ERROR) {
return -1;
@@ -142,13 +142,13 @@ int channel_request_pty_size1(ssh_channel channel, const char *terminal, int col
return SSH_ERROR;
case SSH_CHANNEL_REQ_STATE_ACCEPTED:
channel->request_state=SSH_CHANNEL_REQ_STATE_NONE;
- ssh_log(session, SSH_LOG_RARE, "PTY: Success");
+ SSH_LOG(SSH_LOG_RARE, "PTY: Success");
return SSH_OK;
case SSH_CHANNEL_REQ_STATE_DENIED:
channel->request_state=SSH_CHANNEL_REQ_STATE_NONE;
ssh_set_error(session, SSH_REQUEST_DENIED,
"Server denied PTY allocation");
- ssh_log(session, SSH_LOG_RARE, "PTY: denied\n");
+ SSH_LOG(SSH_LOG_RARE, "PTY: denied\n");
return SSH_ERROR;
}
// Not reached
@@ -179,7 +179,7 @@ int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
return SSH_ERROR;
}
- ssh_log(session, SSH_LOG_PROTOCOL, "Change pty size send");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Change pty size send");
while(channel->request_state==SSH_CHANNEL_REQ_STATE_PENDING){
ssh_handle_packets(session, SSH_TIMEOUT_INFINITE);
}
@@ -191,11 +191,11 @@ int channel_change_pty_size1(ssh_channel channel, int cols, int rows) {
return SSH_ERROR;
case SSH_CHANNEL_REQ_STATE_ACCEPTED:
channel->request_state=SSH_CHANNEL_REQ_STATE_NONE;
- ssh_log(session, SSH_LOG_PROTOCOL, "pty size changed");
+ SSH_LOG(SSH_LOG_PROTOCOL, "pty size changed");
return SSH_OK;
case SSH_CHANNEL_REQ_STATE_DENIED:
channel->request_state=SSH_CHANNEL_REQ_STATE_NONE;
- ssh_log(session, SSH_LOG_RARE, "pty size change denied");
+ SSH_LOG(SSH_LOG_RARE, "pty size change denied");
ssh_set_error(session, SSH_REQUEST_DENIED, "pty size change denied");
return SSH_ERROR;
}
@@ -220,7 +220,7 @@ int channel_request_shell1(ssh_channel channel) {
return -1;
}
- ssh_log(session, SSH_LOG_RARE, "Launched a shell");
+ SSH_LOG(SSH_LOG_RARE, "Launched a shell");
return 0;
}
@@ -250,7 +250,7 @@ int channel_request_exec1(ssh_channel channel, const char *cmd) {
return -1;
}
- ssh_log(session, SSH_LOG_RARE, "Executing %s ...", cmd);
+ SSH_LOG(SSH_LOG_RARE, "Executing %s ...", cmd);
return 0;
}
@@ -267,11 +267,11 @@ SSH_PACKET_CALLBACK(ssh_packet_data1){
str = buffer_get_ssh_string(packet);
if (str == NULL) {
- ssh_log(session, SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
return SSH_PACKET_USED;
}
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Adding %" PRIdS " bytes data in %d",
ssh_string_len(str), is_stderr);
diff --git a/src/client.c b/src/client.c
index 6203bc4c..1879bf93 100644
--- a/src/client.c
+++ b/src/client.c
@@ -66,7 +66,7 @@ static void socket_callback_connected(int code, int errno_code, void *user){
leave_function();
return;
}
- ssh_log(session,SSH_LOG_RARE,"Socket connection callback: %d (%d)",code, errno_code);
+ SSH_LOG(SSH_LOG_RARE,"Socket connection callback: %d (%d)",code, errno_code);
if(code == SSH_SOCKET_CONNECTED_OK)
session->session_state=SSH_SESSION_STATE_SOCKET_CONNECTED;
else {
@@ -115,7 +115,7 @@ static int callback_receive_banner(const void *data, size_t len, void *user) {
ret=i+1;
session->serverbanner=str;
session->session_state=SSH_SESSION_STATE_BANNER_RECEIVED;
- ssh_log(session,SSH_LOG_PACKET,"Received banner: %s",str);
+ SSH_LOG(SSH_LOG_PACKET,"Received banner: %s",str);
session->ssh_connection_callback(session);
leave_function();
return ret;
@@ -282,7 +282,7 @@ int ssh_service_request(ssh_session session, const char *service) {
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent SSH_MSG_SERVICE_REQUEST (service %s)", service);
pending:
rc=ssh_handle_packets_termination(session,SSH_TIMEOUT_USER,
@@ -335,7 +335,7 @@ static void ssh_client_connection_callback(ssh_session session){
goto error;
}
set_status(session, 0.4f);
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"SSH server banner: %s", session->serverbanner);
/* Here we analyze the different protocols the server allows. */
@@ -391,7 +391,7 @@ static void ssh_client_connection_callback(ssh_session session){
break;
case SSH_SESSION_STATE_KEXINIT_RECEIVED:
set_status(session,0.6f);
- ssh_list_kex(session, &session->next_crypto->server_kex);
+ ssh_list_kex(&session->next_crypto->server_kex);
if (set_client_kex(session) < 0) {
goto error;
}
@@ -498,7 +498,7 @@ int ssh_connect(ssh_session session) {
leave_function();
return SSH_ERROR;
}
- ssh_log(session,SSH_LOG_RARE,"libssh %s, using threading %s", ssh_copyright(), ssh_threads_get_type());
+ SSH_LOG(SSH_LOG_RARE,"libssh %s, using threading %s", ssh_copyright(), ssh_threads_get_type());
session->ssh_connection_callback = ssh_client_connection_callback;
session->session_state=SSH_SESSION_STATE_CONNECTING;
ssh_socket_set_callbacks(session->socket,&session->socket_callbacks);
@@ -528,7 +528,7 @@ int ssh_connect(ssh_session session) {
set_status(session, 0.2f);
session->alive = 1;
- ssh_log(session,SSH_LOG_PROTOCOL,"Socket connecting, now waiting for the callbacks to work");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Socket connecting, now waiting for the callbacks to work");
pending:
session->pending_call_state=SSH_PENDING_CALL_CONNECT;
if(ssh_is_blocking(session)) {
@@ -537,7 +537,7 @@ pending:
if (timeout == 0) {
timeout = 10 * 1000;
}
- ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual timeout : %d", timeout);
+ SSH_LOG(SSH_LOG_PACKET,"ssh_connect: Actual timeout : %d", timeout);
ret = ssh_handle_packets_termination(session, timeout, ssh_connect_termination, session);
if (ret == SSH_ERROR || !ssh_connect_termination(session)) {
ssh_set_error(session, SSH_FATAL,
@@ -554,7 +554,7 @@ pending:
session->session_state = SSH_SESSION_STATE_ERROR;
}
}
- ssh_log(session,SSH_LOG_PACKET,"ssh_connect: Actual state : %d",session->session_state);
+ SSH_LOG(SSH_LOG_PACKET,"ssh_connect: Actual state : %d",session->session_state);
if(!ssh_is_blocking(session) && !ssh_connect_termination(session)){
leave_function();
return SSH_AGAIN;
diff --git a/src/config.c b/src/config.c
index 632a50bb..7935e884 100644
--- a/src/config.c
+++ b/src/config.c
@@ -324,7 +324,7 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
}
break;
case SOC_UNSUPPORTED:
- ssh_log(session, SSH_LOG_RARE, "Unsupported option: %s, line: %d\n",
+ SSH_LOG(SSH_LOG_RARE, "Unsupported option: %s, line: %d\n",
keyword, count);
break;
default:
@@ -350,7 +350,7 @@ int ssh_config_parse_file(ssh_session session, const char *filename) {
return 0;
}
- ssh_log(session, SSH_LOG_RARE, "Reading configuration data from %s", filename);
+ SSH_LOG(SSH_LOG_RARE, "Reading configuration data from %s", filename);
parsing = 1;
while (fgets(line, sizeof(line), f)) {
diff --git a/src/connect.c b/src/connect.c
index 91e6b6a7..7086b5f4 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -104,7 +104,7 @@ static int ssh_connect_socket_close(socket_t s){
}
-static int getai(ssh_session session, const char *host, int port, struct addrinfo **ai) {
+static int getai(const char *host, int port, struct addrinfo **ai) {
const char *service = NULL;
struct addrinfo hints;
char s_port[10];
@@ -127,7 +127,7 @@ static int getai(ssh_session session, const char *host, int port, struct addrinf
if (ssh_is_ipaddr(host)) {
/* this is an IP address */
- ssh_log(session,SSH_LOG_PACKET,"host %s matches an IP address",host);
+ SSH_LOG(SSH_LOG_PACKET,"host %s matches an IP address",host);
hints.ai_flags |= AI_NUMERICHOST;
}
@@ -157,7 +157,7 @@ static int ssh_connect_ai_timeout(ssh_session session, const char *host,
return -1;
}
- ssh_log(session, SSH_LOG_RARE, "Trying to connect to host: %s:%d with "
+ SSH_LOG(SSH_LOG_RARE, "Trying to connect to host: %s:%d with "
"timeout %d ms", host, port, timeout_ms);
/* The return value is checked later */
@@ -201,7 +201,7 @@ static int ssh_connect_ai_timeout(ssh_session session, const char *host,
}
/* s is connected ? */
- ssh_log(session, SSH_LOG_PACKET, "Socket connected with timeout\n");
+ SSH_LOG(SSH_LOG_PACKET, "Socket connected with timeout\n");
ret = ssh_socket_set_blocking(s);
if (ret < 0) {
ssh_set_error(session, SSH_FATAL,
@@ -232,7 +232,7 @@ socket_t ssh_connect_host(ssh_session session, const char *host,
enter_function();
- rc = getai(session,host, port, &ai);
+ rc = getai(host, port, &ai);
if (rc != 0) {
ssh_set_error(session, SSH_FATAL,
"Failed to resolve hostname %s (%s)", host, gai_strerror(rc));
@@ -253,9 +253,9 @@ socket_t ssh_connect_host(ssh_session session, const char *host,
struct addrinfo *bind_ai;
struct addrinfo *bind_itr;
- ssh_log(session, SSH_LOG_PACKET, "Resolving %s\n", bind_addr);
+ SSH_LOG(SSH_LOG_PACKET, "Resolving %s\n", bind_addr);
- rc = getai(session,bind_addr, 0, &bind_ai);
+ rc = getai(bind_addr, 0, &bind_ai);
if (rc != 0) {
ssh_set_error(session, SSH_FATAL,
"Failed to resolve bind address %s (%s)",
@@ -329,7 +329,7 @@ socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
enter_function();
- rc = getai(session,host, port, &ai);
+ rc = getai(host, port, &ai);
if (rc != 0) {
ssh_set_error(session, SSH_FATAL,
"Failed to resolve hostname %s (%s)", host, gai_strerror(rc));
@@ -350,9 +350,9 @@ socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
struct addrinfo *bind_ai;
struct addrinfo *bind_itr;
- ssh_log(session, SSH_LOG_PACKET, "Resolving %s\n", bind_addr);
+ SSH_LOG(SSH_LOG_PACKET, "Resolving %s\n", bind_addr);
- rc = getai(session,bind_addr, 0, &bind_ai);
+ rc = getai(bind_addr, 0, &bind_ai);
if (rc != 0) {
ssh_set_error(session, SSH_FATAL,
"Failed to resolve bind address %s (%s)",
diff --git a/src/dh.c b/src/dh.c
index 254b7c91..97456cf5 100644
--- a/src/dh.c
+++ b/src/dh.c
@@ -639,7 +639,7 @@ int ssh_client_dh_reply(ssh_session session, ssh_buffer packet){
}
rc=packet_send(session);
- ssh_log(session, SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+ SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
return rc;
error:
return SSH_ERROR;
@@ -762,7 +762,7 @@ int make_sessionid(ssh_session session) {
} else if (session->next_crypto->kex_type == SSH_KEX_ECDH_SHA2_NISTP256){
if(session->next_crypto->ecdh_client_pubkey == NULL ||
session->next_crypto->ecdh_server_pubkey == NULL){
- ssh_log(session,SSH_LOG_WARNING,"ECDH parameted missing");
+ SSH_LOG(SSH_LOG_WARNING, "ECDH parameted missing");
goto error;
}
rc = buffer_add_ssh_string(buf,session->next_crypto->ecdh_client_pubkey);
diff --git a/src/ecdh.c b/src/ecdh.c
index bd46264c..c9c5c329 100644
--- a/src/ecdh.c
+++ b/src/ecdh.c
@@ -186,7 +186,7 @@ int ssh_client_ecdh_reply(ssh_session session, ssh_buffer packet){
}
rc=packet_send(session);
- ssh_log(session, SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+ SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
return rc;
error:
return SSH_ERROR;
@@ -312,7 +312,7 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet){
return SSH_ERROR;
}
- ssh_log(session,SSH_LOG_PROTOCOL, "SSH_MSG_KEXDH_REPLY sent");
+ SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_KEXDH_REPLY sent");
rc = packet_send(session);
if (rc == SSH_ERROR) {
return SSH_ERROR;
@@ -326,7 +326,7 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet){
session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
rc = packet_send(session);
- ssh_log(session, SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+ SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
return rc;
}
diff --git a/src/gssapi.c b/src/gssapi.c
index 163febe6..23a9c1aa 100644
--- a/src/gssapi.c
+++ b/src/gssapi.c
@@ -116,18 +116,18 @@ static int ssh_gssapi_send_response(ssh_session session, ssh_string oid){
}
packet_send(session);
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent SSH_MSG_USERAUTH_GSSAPI_RESPONSE");
return SSH_OK;
}
#endif /* WITH_SERVER */
-static void ssh_gssapi_log_error(ssh_session session, int verb, const char *msg, int maj_stat){
+static void ssh_gssapi_log_error(int verb, const char *msg, int maj_stat){
gss_buffer_desc buffer;
OM_uint32 dummy, message_context;
gss_display_status(&dummy,maj_stat,GSS_C_GSS_CODE, GSS_C_NO_OID, &message_context, &buffer);
- ssh_log(session, verb, "GSSAPI(%s): %s", msg, (const char *)buffer.value);
+ SSH_LOG(verb, "GSSAPI(%s): %s", msg, (const char *)buffer.value);
}
#ifdef WITH_SERVER
@@ -178,7 +178,7 @@ int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n
unsigned char *oid_s = (unsigned char *) ssh_string_data(oids[i]);
size_t len = ssh_string_len(oids[i]);
if(len < 2 || oid_s[0] != SSH_OID_TAG || ((size_t)oid_s[1]) != len - 2){
- ssh_log(session,SSH_LOG_WARNING,"GSSAPI: received invalid OID");
+ SSH_LOG(SSH_LOG_WARNING,"GSSAPI: received invalid OID");
continue;
}
oid.elements = &oid_s[2];
@@ -191,7 +191,7 @@ int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n
}
gss_release_oid_set(&min_stat, &supported);
if (oid_count == 0){
- ssh_log(session,SSH_LOG_PROTOCOL,"GSSAPI: no OID match");
+ SSH_LOG(SSH_LOG_PROTOCOL,"GSSAPI: no OID match");
ssh_auth_reply_default(session, 0);
gss_release_oid_set(&min_stat, &both_supported);
return SSH_OK;
@@ -205,8 +205,8 @@ int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n
maj_stat = gss_import_name(&min_stat, &name_buf,
(gss_OID) GSS_C_NT_HOSTBASED_SERVICE, &server_name);
if (maj_stat != GSS_S_COMPLETE) {
- ssh_log(session, 0, "importing name %d, %d", maj_stat, min_stat);
- ssh_gssapi_log_error(session, 0, "importing name", maj_stat);
+ SSH_LOG(0, "importing name %d, %d", maj_stat, min_stat);
+ ssh_gssapi_log_error(0, "importing name", maj_stat);
return -1;
}
@@ -217,27 +217,27 @@ int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n
gss_release_oid_set(&min_stat, &both_supported);
if (maj_stat != GSS_S_COMPLETE) {
- ssh_log(session, 0, "error acquiring credentials %d, %d", maj_stat, min_stat);
- ssh_gssapi_log_error(session, 0, "acquiring creds", maj_stat);
+ SSH_LOG(0, "error acquiring credentials %d, %d", maj_stat, min_stat);
+ ssh_gssapi_log_error(0, "acquiring creds", maj_stat);
ssh_auth_reply_default(session,0);
return SSH_ERROR;
}
- ssh_log(session, 0, "acquiring credentials %d, %d", maj_stat, min_stat);
+ SSH_LOG(0, "acquiring credentials %d, %d", maj_stat, min_stat);
/* finding which OID from client we selected */
for (i=0 ; i< n_oid ; ++i){
unsigned char *oid_s = (unsigned char *) ssh_string_data(oids[i]);
size_t len = ssh_string_len(oids[i]);
if(len < 2 || oid_s[0] != SSH_OID_TAG || ((size_t)oid_s[1]) != len - 2){
- ssh_log(session,SSH_LOG_WARNING,"GSSAPI: received invalid OID");
+ SSH_LOG(SSH_LOG_WARNING,"GSSAPI: received invalid OID");
continue;
}
oid.elements = &oid_s[2];
oid.length = len - 2;
gss_test_oid_set_member(&min_stat,&oid,selected,&present);
if(present){
- ssh_log(session, SSH_LOG_PACKET, "Selected oid %d", i);
+ SSH_LOG(SSH_LOG_PACKET, "Selected oid %d", i);
break;
}
}
@@ -257,12 +257,12 @@ int ssh_gssapi_handle_userauth(ssh_session session, const char *user, uint32_t n
#endif /* WITH_SERVER */
-static char * ssh_gssapi_name_to_char(ssh_session session, gss_name_t name){
+static char * ssh_gssapi_name_to_char(gss_name_t name){
gss_buffer_desc buffer;
OM_uint32 maj_stat, min_stat;
char *ptr;
maj_stat = gss_display_name(&min_stat, name, &buffer, NULL);
- ssh_gssapi_log_error(session, 0, "converting name", maj_stat);
+ ssh_gssapi_log_error(0, "converting name", maj_stat);
ptr=malloc(buffer.length + 1);
memcpy(ptr, buffer.value, buffer.length);
ptr[buffer.length] = '\0';
@@ -285,7 +285,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
(void)user;
(void)type;
- ssh_log(session, SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_TOKEN");
+ SSH_LOG(SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_TOKEN");
if (!session->gssapi || session->gssapi->state != SSH_GSSAPI_STATE_RCV_TOKEN){
ssh_set_error(session, SSH_FATAL, "Received SSH_MSG_USERAUTH_GSSAPI_TOKEN in invalid state");
return SSH_PACKET_USED;
@@ -318,7 +318,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
return SSH_PACKET_USED;
}
hexa = ssh_get_hexa(ssh_string_data(token),ssh_string_len(token));
- ssh_log(session, SSH_LOG_PACKET, "GSSAPI Token : %s",hexa);
+ SSH_LOG(SSH_LOG_PACKET, "GSSAPI Token : %s",hexa);
SAFE_FREE(hexa);
input_token.length = ssh_string_len(token);
input_token.value = ssh_string_data(token);
@@ -326,14 +326,14 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
maj_stat = gss_accept_sec_context(&min_stat, &session->gssapi->ctx, session->gssapi->server_creds,
&input_token, input_bindings, &client_name, NULL /*mech_oid*/, &output_token, &ret_flags,
NULL /*time*/, &session->gssapi->client_creds);
- ssh_gssapi_log_error(session, 0, "accepting token", maj_stat);
+ ssh_gssapi_log_error(0, "accepting token", maj_stat);
ssh_string_free(token);
if (client_name != GSS_C_NO_NAME){
session->gssapi->client_name = client_name;
- session->gssapi->canonic_user = ssh_gssapi_name_to_char(session, client_name);
+ session->gssapi->canonic_user = ssh_gssapi_name_to_char(client_name);
}
if (GSS_ERROR(maj_stat)){
- ssh_gssapi_log_error(session, SSH_LOG_PROTOCOL, "Gssapi error", maj_stat);
+ ssh_gssapi_log_error(SSH_LOG_PROTOCOL, "Gssapi error", maj_stat);
ssh_auth_reply_default(session,0);
ssh_gssapi_free(session);
session->gssapi=NULL;
@@ -342,7 +342,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_server){
if (output_token.length != 0){
hexa = ssh_get_hexa(output_token.value, output_token.length);
- ssh_log(session, SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
+ SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
SAFE_FREE(hexa);
token = ssh_string_new(output_token.length);
ssh_string_fill(token, output_token.value, output_token.length);
@@ -399,7 +399,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_mic){
(void)user;
(void)type;
- ssh_log(session, SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_MIC");
+ SSH_LOG(SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_MIC");
mic_token = buffer_get_ssh_string(packet);
if (!mic_token){
ssh_set_error(session, SSH_FATAL, "Missing MIC in packet");
@@ -428,8 +428,8 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_mic){
mic_token_buf.value = ssh_string_data(mic_token);
maj_stat = gss_verify_mic(&min_stat, session->gssapi->ctx, &mic_buf, &mic_token_buf, NULL);
- ssh_gssapi_log_error(session, 0, "verifying MIC", maj_stat);
- ssh_gssapi_log_error(session, 0, "verifying MIC (min stat)", min_stat);
+ ssh_gssapi_log_error(0, "verifying MIC", maj_stat);
+ ssh_gssapi_log_error(0, "verifying MIC (min stat)", min_stat);
if (maj_stat == GSS_S_DEFECTIVE_TOKEN || GSS_ERROR(maj_stat))
goto error;
}
@@ -571,7 +571,7 @@ static int ssh_gssapi_match(ssh_session session, char *hostname, char *username,
maj_stat = gss_indicate_mechs(&min_stat, &supported);
for (i=0; i < supported->count; ++i){
ptr=ssh_get_hexa(supported->elements[i].elements, supported->elements[i].length);
- ssh_log(session, SSH_LOG_DEBUG, "GSSAPI oid supported %d : %s\n",i, ptr);
+ SSH_LOG(SSH_LOG_DEBUG, "GSSAPI oid supported %d : %s\n",i, ptr);
SAFE_FREE(ptr);
}
@@ -580,8 +580,8 @@ static int ssh_gssapi_match(ssh_session session, char *hostname, char *username,
maj_stat = gss_import_name(&min_stat, &user_namebuf,
(gss_OID) GSS_C_NT_USER_NAME, &user_name);
if (maj_stat != GSS_S_COMPLETE) {
- ssh_log(session, SSH_LOG_DEBUG, "importing name %d, %d", maj_stat, min_stat);
- ssh_gssapi_log_error(session, SSH_LOG_DEBUG, "importing name", maj_stat);
+ SSH_LOG(SSH_LOG_DEBUG, "importing name %d, %d", maj_stat, min_stat);
+ ssh_gssapi_log_error(SSH_LOG_DEBUG, "importing name", maj_stat);
return -1;
}
@@ -591,8 +591,8 @@ static int ssh_gssapi_match(ssh_session session, char *hostname, char *username,
maj_stat = gss_import_name(&min_stat, &host_namebuf,
(gss_OID) GSS_C_NT_HOSTBASED_SERVICE, &host_name);
if (maj_stat != GSS_S_COMPLETE) {
- ssh_log(session, 0, "importing name %d, %d", maj_stat, min_stat);
- ssh_gssapi_log_error(session, 0, "importing name", maj_stat);
+ SSH_LOG(0, "importing name %d, %d", maj_stat, min_stat);
+ ssh_gssapi_log_error(0, "importing name", maj_stat);
return -1;
}
@@ -611,7 +611,7 @@ static int ssh_gssapi_match(ssh_session session, char *hostname, char *username,
if (session->gssapi->client.client_deleg_creds != GSS_C_NO_CREDENTIAL){
/* we know the oid is ok since init_sec_context worked */
gss_add_oid_set_member(&min_stat, oid, valid_oids);
- ssh_log(session, SSH_LOG_PROTOCOL, "Matched oid %u for server (with forwarding)", i);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Matched oid %u for server (with forwarding)", i);
} else {
gss_create_empty_oid_set(&min_stat, &tmp);
gss_add_oid_set_member(&min_stat, oid, &tmp);
@@ -622,7 +622,7 @@ static int ssh_gssapi_match(ssh_session session, char *hostname, char *username,
if (!GSS_ERROR(maj_stat)){
gss_release_cred(&min_stat, &client_creds);
gss_add_oid_set_member(&min_stat,oid,valid_oids);
- ssh_log(session, SSH_LOG_PROTOCOL, "Matched oid %u for server", i);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Matched oid %u for server", i);
}
}
}
@@ -651,14 +651,14 @@ int ssh_gssapi_auth_mic(ssh_session session){
return SSH_AUTH_ERROR;
- ssh_log(session,SSH_LOG_PROTOCOL, "Authenticating with gssapi to host %s with user %s",
+ SSH_LOG(SSH_LOG_PROTOCOL, "Authenticating with gssapi to host %s with user %s",
session->opts.host, session->opts.username);
rc = ssh_gssapi_match(session,session->opts.host, session->opts.username, &selected, 0);
if (rc == SSH_ERROR)
return SSH_AUTH_DENIED;
n_oids = selected->count;
- ssh_log(session, SSH_LOG_PROTOCOL, "Sending %d oids", n_oids);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Sending %d oids", n_oids);
oids = calloc(n_oids, sizeof(ssh_string));
@@ -709,7 +709,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
(void)type;
(void)user;
- ssh_log(session, SSH_LOG_PACKET, "Received SSH_USERAUTH_GSSAPI_RESPONSE");
+ SSH_LOG(SSH_LOG_PACKET, "Received SSH_USERAUTH_GSSAPI_RESPONSE");
if (session->auth_state != SSH_AUTH_STATE_GSSAPI_REQUEST_SENT){
ssh_set_error(session, SSH_FATAL, "Invalid state in ssh_packet_userauth_gssapi_response");
return SSH_PACKET_USED;
@@ -735,7 +735,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
&session->gssapi->client_creds, NULL, NULL);
gss_release_oid_set(&min_stat, &tmp);
if (GSS_ERROR(maj_stat)){
- ssh_gssapi_log_error(session,SSH_LOG_WARNING,"Error acquiring credentials",maj_stat);
+ ssh_gssapi_log_error(SSH_LOG_WARNING,"Error acquiring credentials",maj_stat);
return SSH_PACKET_USED;
}
}
@@ -745,12 +745,12 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_response){
GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | (deleg ? GSS_C_DELEG_FLAG : 0),
0, NULL, &input_token, NULL, &output_token, NULL, NULL);
if(GSS_ERROR(maj_stat)){
- ssh_gssapi_log_error(session, SSH_LOG_WARNING, "Initializing gssapi context", maj_stat);
+ ssh_gssapi_log_error(SSH_LOG_WARNING, "Initializing gssapi context", maj_stat);
return SSH_PACKET_USED;
}
if (output_token.length != 0){
hexa = ssh_get_hexa(output_token.value, output_token.length);
- ssh_log(session, SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
+ SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
SAFE_FREE(hexa);
token = ssh_string_new(output_token.length);
ssh_string_fill(token, output_token.value, output_token.length);
@@ -770,7 +770,7 @@ static int ssh_gssapi_send_mic(ssh_session session){
gss_buffer_desc mic_token_buf = GSS_C_EMPTY_BUFFER;
ssh_buffer mic_buffer;
- ssh_log(session, SSH_LOG_PACKET,"Sending SSH_MSG_USERAUTH_GSSAPI_MIC");
+ SSH_LOG(SSH_LOG_PACKET,"Sending SSH_MSG_USERAUTH_GSSAPI_MIC");
mic_buffer = ssh_gssapi_build_mic(session);
if(!mic_buffer){
@@ -782,7 +782,7 @@ static int ssh_gssapi_send_mic(ssh_session session){
maj_stat = gss_get_mic(&min_stat,session->gssapi->ctx, GSS_C_QOP_DEFAULT, &mic_buf, &mic_token_buf);
if (GSS_ERROR(maj_stat)){
- ssh_gssapi_log_error(session, 0, "generating MIC", maj_stat);
+ ssh_gssapi_log_error(0, "generating MIC", maj_stat);
return SSH_ERROR;
}
@@ -803,7 +803,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
(void)user;
(void)type;
- ssh_log(session, SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_TOKEN");
+ SSH_LOG(SSH_LOG_PACKET,"Received SSH_MSG_USERAUTH_GSSAPI_TOKEN");
if (!session->gssapi || session->auth_state != SSH_AUTH_STATE_GSSAPI_TOKEN){
ssh_set_error(session, SSH_FATAL, "Received SSH_MSG_USERAUTH_GSSAPI_TOKEN in invalid state");
return SSH_PACKET_USED;
@@ -815,7 +815,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
return SSH_PACKET_USED;
}
hexa = ssh_get_hexa(ssh_string_data(token),ssh_string_len(token));
- ssh_log(session, SSH_LOG_PACKET, "GSSAPI Token : %s",hexa);
+ SSH_LOG(SSH_LOG_PACKET, "GSSAPI Token : %s",hexa);
SAFE_FREE(hexa);
input_token.length = ssh_string_len(token);
input_token.value = ssh_string_data(token);
@@ -828,14 +828,14 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | (deleg ? GSS_C_DELEG_FLAG : 0),
0, NULL, &input_token, NULL, &output_token, NULL, NULL);
- ssh_gssapi_log_error(session, 0, "accepting token", maj_stat);
+ ssh_gssapi_log_error(0, "accepting token", maj_stat);
ssh_string_free(token);
if (client_name != GSS_C_NO_NAME){
session->gssapi->client_name = client_name;
- session->gssapi->canonic_user = ssh_gssapi_name_to_char(session, client_name);
+ session->gssapi->canonic_user = ssh_gssapi_name_to_char(client_name);
}
if (GSS_ERROR(maj_stat)){
- ssh_gssapi_log_error(session, SSH_LOG_PROTOCOL, "Gssapi error", maj_stat);
+ ssh_gssapi_log_error(SSH_LOG_PROTOCOL, "Gssapi error", maj_stat);
ssh_gssapi_free(session);
session->gssapi=NULL;
return SSH_PACKET_USED;
@@ -843,7 +843,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_gssapi_token_client){
if (output_token.length != 0){
hexa = ssh_get_hexa(output_token.value, output_token.length);
- ssh_log(session, SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
+ SSH_LOG(SSH_LOG_PACKET, "GSSAPI: sending token %s",hexa);
SAFE_FREE(hexa);
token = ssh_string_new(output_token.length);
ssh_string_fill(token, output_token.value, output_token.length);
diff --git a/src/kex.c b/src/kex.c
index c678731e..a5dcd7f8 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -277,7 +277,7 @@ SSH_PACKET_CALLBACK(ssh_packet_kexinit){
(void)user;
memset(strings, 0, sizeof(strings));
if (session->session_state == SSH_SESSION_STATE_AUTHENTICATED){
- ssh_log(session,SSH_LOG_WARNING, "Other side initiating key re-exchange");
+ SSH_LOG(SSH_LOG_WARNING, "Other side initiating key re-exchange");
} else if(session->session_state != SSH_SESSION_STATE_INITIAL_KEX){
ssh_set_error(session,SSH_FATAL,"SSH_KEXINIT received in wrong state");
goto error;
@@ -351,7 +351,7 @@ error:
return SSH_PACKET_USED;
}
-void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex) {
+void ssh_list_kex(struct ssh_kex_struct *kex) {
int i = 0;
#ifdef DEBUG_CRYPTO
@@ -362,7 +362,7 @@ void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex) {
if (kex->methods[i] == NULL) {
continue;
}
- ssh_log(session, SSH_LOG_FUNCTIONS, "%s: %s",
+ SSH_LOG(SSH_LOG_FUNCTIONS, "%s: %s",
ssh_kex_descriptions[i], kex->methods[i]);
}
}
@@ -445,7 +445,7 @@ int ssh_send_kex(ssh_session session, int server_kex) {
goto error;
}
- ssh_list_kex(session, kex);
+ ssh_list_kex(kex);
for (i = 0; i < KEX_METHODS_SIZE; i++) {
str = ssh_string_from_char(kex->methods[i]);
diff --git a/src/kex1.c b/src/kex1.c
index b396a719..cbbf810b 100644
--- a/src/kex1.c
+++ b/src/kex1.c
@@ -247,7 +247,7 @@ static ssh_string encrypt_session_key(ssh_session session, ssh_public_key srvkey
}
ssh_string_fill(data1, buffer, 32);
if (ABS(hlen - slen) < 128){
- ssh_log(session, SSH_LOG_FUNCTIONS,
+ SSH_LOG(SSH_LOG_FUNCTIONS,
"Difference between server modulus and host modulus is only %d. "
"It's illegal and may not work",
ABS(hlen - slen));
@@ -320,7 +320,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
enter_function();
(void)type;
(void)user;
- ssh_log(session, SSH_LOG_PROTOCOL, "Got a SSH_SMSG_PUBLIC_KEY");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Got a SSH_SMSG_PUBLIC_KEY");
if(session->session_state != SSH_SESSION_STATE_INITIAL_KEX){
ssh_set_error(session,SSH_FATAL,"SSH_KEXINIT received in wrong state");
goto error;
@@ -354,7 +354,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
if ((ko != sizeof(uint32_t)) || !host_mod || !host_exp
|| !server_mod || !server_exp) {
- ssh_log(session, SSH_LOG_RARE, "Invalid SSH_SMSG_PUBLIC_KEY packet");
+ SSH_LOG(SSH_LOG_RARE, "Invalid SSH_SMSG_PUBLIC_KEY packet");
ssh_set_error(session, SSH_FATAL, "Invalid SSH_SMSG_PUBLIC_KEY packet");
goto error;
}
@@ -364,7 +364,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
protocol_flags = ntohl(protocol_flags);
supported_ciphers_mask = ntohl(supported_ciphers_mask);
supported_authentications_mask = ntohl(supported_authentications_mask);
- ssh_log(session, SSH_LOG_PROTOCOL,
+ SSH_LOG(SSH_LOG_PROTOCOL,
"Server bits: %d; Host bits: %d; Protocol flags: %.8lx; "
"Cipher mask: %.8lx; Auth mask: %.8lx",
server_bits,
@@ -409,7 +409,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
ssh_set_error(session, SSH_FATAL, "Remote server doesn't accept 3DES");
goto error;
}
- ssh_log(session, SSH_LOG_PROTOCOL, "Sending SSH_CMSG_SESSION_KEY");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Sending SSH_CMSG_SESSION_KEY");
if (buffer_add_u8(session->out_buffer, SSH_CMSG_SESSION_KEY) < 0) {
goto error;
@@ -427,7 +427,7 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){
}
bits = ssh_string_len(enc_session) * 8 - 7;
- ssh_log(session, SSH_LOG_PROTOCOL, "%d bits, %" PRIdS " bytes encrypted session",
+ SSH_LOG(SSH_LOG_PROTOCOL, "%d bits, %" PRIdS " bytes encrypted session",
bits, ssh_string_len(enc_session));
bits = htons(bits);
/* the encrypted mpint */
@@ -477,21 +477,21 @@ end:
int ssh_get_kex1(ssh_session session) {
int ret=SSH_ERROR;
enter_function();
- ssh_log(session, SSH_LOG_PROTOCOL, "Waiting for a SSH_SMSG_PUBLIC_KEY");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Waiting for a SSH_SMSG_PUBLIC_KEY");
/* Here the callback is called */
while(session->session_state==SSH_SESSION_STATE_INITIAL_KEX){
ssh_handle_packets(session, SSH_TIMEOUT_USER);
}
if(session->session_state==SSH_SESSION_STATE_ERROR)
goto error;
- ssh_log(session, SSH_LOG_PROTOCOL, "Waiting for a SSH_SMSG_SUCCESS");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Waiting for a SSH_SMSG_SUCCESS");
/* Waiting for SSH_SMSG_SUCCESS */
while(session->session_state==SSH_SESSION_STATE_KEXINIT_RECEIVED){
ssh_handle_packets(session, SSH_TIMEOUT_USER);
}
if(session->session_state==SSH_SESSION_STATE_ERROR)
goto error;
- ssh_log(session, SSH_LOG_PROTOCOL, "received SSH_SMSG_SUCCESS\n");
+ SSH_LOG(SSH_LOG_PROTOCOL, "received SSH_SMSG_SUCCESS\n");
ret=SSH_OK;
error:
leave_function();
diff --git a/src/known_hosts.c b/src/known_hosts.c
index a9ae38c1..185ac157 100644
--- a/src/known_hosts.c
+++ b/src/known_hosts.c
@@ -369,7 +369,7 @@ static int match_hashed_host(ssh_session session, const char *host,
ssh_buffer_free(salt);
ssh_buffer_free(hash);
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Matching a hashed host: %s match=%d", host, match);
leave_function();
@@ -478,8 +478,7 @@ int ssh_is_server_known(ssh_session session) {
if (match) {
/* We got a match. Now check the key type */
if (strcmp(session->current_crypto->server_pubkey_type, type) != 0) {
- ssh_log(session,
- SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"ssh_is_server_known: server type [%s] doesn't match the "
"type [%s] in known_hosts file",
session->current_crypto->server_pubkey_type,
diff --git a/src/legacy.c b/src/legacy.c
index 6ad4fdc2..7f2bb4d0 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -120,11 +120,11 @@ int ssh_userauth_privatekey_file(ssh_session session,
pubkey = publickey_from_file(session, pubkeyfile, &type);
if (pubkey == NULL) {
- ssh_log(session, SSH_LOG_RARE, "Public key file %s not found. Trying to generate it.", pubkeyfile);
+ SSH_LOG(SSH_LOG_RARE, "Public key file %s not found. Trying to generate it.", pubkeyfile);
/* auto-detect the key type with type=0 */
privkey = privatekey_from_file(session, filename, 0, passphrase);
} else {
- ssh_log(session, SSH_LOG_RARE, "Public key file %s loaded.", pubkeyfile);
+ SSH_LOG(SSH_LOG_RARE, "Public key file %s loaded.", pubkeyfile);
privkey = privatekey_from_file(session, filename, type, passphrase);
}
if (privkey == NULL) {
@@ -610,8 +610,8 @@ int ssh_publickey_to_file(ssh_session session,
SAFE_FREE(pubkey_64);
SAFE_FREE(user);
- ssh_log(session, SSH_LOG_RARE, "Trying to write public key file: %s", file);
- ssh_log(session, SSH_LOG_PACKET, "public key file content: %s", buffer);
+ SSH_LOG(SSH_LOG_RARE, "Trying to write public key file: %s", file);
+ SSH_LOG(SSH_LOG_PACKET, "public key file content: %s", buffer);
fp = fopen(file, "w+");
if (fp == NULL) {
@@ -652,9 +652,9 @@ int ssh_try_publickey_from_file(ssh_session session,
}
}
- ssh_log(session, SSH_LOG_PACKET, "Trying to open privatekey %s", keyfile);
+ SSH_LOG(SSH_LOG_PACKET, "Trying to open privatekey %s", keyfile);
if (!ssh_file_readaccess_ok(keyfile)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed to open privatekey %s", keyfile);
+ SSH_LOG(SSH_LOG_PACKET, "Failed to open privatekey %s", keyfile);
return -1;
}
@@ -665,16 +665,16 @@ int ssh_try_publickey_from_file(ssh_session session,
}
snprintf(pubkey_file, len, "%s.pub", keyfile);
- ssh_log(session, SSH_LOG_PACKET, "Trying to open publickey %s",
+ SSH_LOG(SSH_LOG_PACKET, "Trying to open publickey %s",
pubkey_file);
if (!ssh_file_readaccess_ok(pubkey_file)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s",
+ SSH_LOG(SSH_LOG_PACKET, "Failed to open publickey %s",
pubkey_file);
SAFE_FREE(pubkey_file);
return 1;
}
- ssh_log(session, SSH_LOG_PACKET, "Success opening public and private key");
+ SSH_LOG(SSH_LOG_PACKET, "Success opening public and private key");
/*
* We are sure both the private and public key file is readable. We return
@@ -682,7 +682,7 @@ int ssh_try_publickey_from_file(ssh_session session,
*/
pubkey_string = publickey_from_file(session, pubkey_file, &pubkey_type);
if (pubkey_string == NULL) {
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Wasn't able to open public key file %s: %s",
pubkey_file,
ssh_get_error(session));
diff --git a/src/messages.c b/src/messages.c
index 47785ae4..bd925256 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -79,7 +79,7 @@ static ssh_message ssh_message_new(ssh_session session){
* SSH_MSG_UNIMPLEMENTED
*/
static int ssh_message_reply_default(ssh_message msg) {
- ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Reporting unknown packet");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Reporting unknown packet");
if (buffer_add_u8(msg->session->out_buffer, SSH2_MSG_UNIMPLEMENTED) < 0)
goto error;
@@ -501,7 +501,7 @@ SSH_PACKET_CALLBACK(ssh_packet_service_request){
if (service_c == NULL) {
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received a SERVICE_REQUEST for service %s", service_c);
msg=ssh_message_new(session);
if(!msg){
@@ -692,7 +692,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Auth request for service %s, method %s for user '%s'",
service, method,
msg->auth_request.username);
@@ -789,7 +789,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
sig_blob = buffer_get_ssh_string(packet);
if(sig_blob == NULL) {
- ssh_log(session, SSH_LOG_PACKET, "Invalid signature packet from peer");
+ SSH_LOG(SSH_LOG_PACKET, "Invalid signature packet from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR;
goto error;
}
@@ -797,7 +797,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
digest = ssh_msg_userauth_build_digest(session, msg, service);
if (digest == NULL) {
ssh_string_free(sig_blob);
- ssh_log(session, SSH_LOG_PACKET, "Failed to get digest");
+ SSH_LOG(SSH_LOG_PACKET, "Failed to get digest");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error;
}
@@ -810,14 +810,14 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
ssh_string_free(sig_blob);
ssh_buffer_free(digest);
if (rc < 0) {
- ssh_log(session,
+ SSH_LOG(
SSH_LOG_PACKET,
"Received an invalid signature from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_WRONG;
goto error;
}
- ssh_log(session, SSH_LOG_PACKET, "Valid signature received");
+ SSH_LOG(SSH_LOG_PACKET, "Valid signature received");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_VALID;
}
@@ -836,7 +836,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
ssh_set_error(session, SSH_FATAL, "USERAUTH_REQUEST: gssapi-with-mic OID count too big (%d)",n_oid);
goto error;
}
- ssh_log(session, SSH_LOG_PACKET, "gssapi: %d OIDs", n_oid);
+ SSH_LOG(SSH_LOG_PACKET, "gssapi: %d OIDs", n_oid);
oids = calloc(n_oid, sizeof(ssh_string));
if (oids == NULL){
ssh_set_error_oom(session);
@@ -855,7 +855,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
oids[i] = oid;
if(session->common.log_verbosity >= SSH_LOG_PACKET){
hexa = ssh_get_hexa(ssh_string_data(oid), ssh_string_len(oid));
- ssh_log(session, SSH_LOG_PACKET,"gssapi: OID %d: %s",i, hexa);
+ SSH_LOG(SSH_LOG_PACKET,"gssapi: OID %d: %s",i, hexa);
SAFE_FREE(hexa);
}
}
@@ -946,7 +946,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
buffer_get_u32(packet, &nanswers);
if (session->kbdint == NULL) {
- ssh_log(session, SSH_LOG_PROTOCOL, "Warning: Got a keyboard-interactive "
+ SSH_LOG(SSH_LOG_PROTOCOL, "Warning: Got a keyboard-interactive "
"response but it seems we didn't send the request.");
session->kbdint = ssh_kbdint_new();
@@ -958,7 +958,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
}
nanswers = ntohl(nanswers);
- ssh_log(session,SSH_LOG_PACKET,"kbdint: %d answers",nanswers);
+ SSH_LOG(SSH_LOG_PACKET,"kbdint: %d answers",nanswers);
if (nanswers > KBDINT_MAX_PROMPT) {
ssh_set_error(session, SSH_FATAL,
"Too much answers received from client: %u (0x%.4x)",
@@ -971,7 +971,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_info_response){
if(nanswers != session->kbdint->nprompts) {
/* warn but let the application handle this case */
- ssh_log(session, SSH_LOG_PROTOCOL, "Warning: Number of prompts and answers"
+ SSH_LOG(SSH_LOG_PROTOCOL, "Warning: Number of prompts and answers"
" mismatch: p=%u a=%u", session->kbdint->nprompts, nanswers);
}
session->kbdint->nanswers = nanswers;
@@ -1048,7 +1048,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open){
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Clients wants to open a %s channel", type_c);
ssh_string_free(type_s);
type_s=NULL;
@@ -1219,7 +1219,7 @@ int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_c
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Accepting a channel request_open for chan %d", chan->remote_channel);
if (packet_send(session) == SSH_ERROR) {
@@ -1285,7 +1285,7 @@ int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel,
goto error;
}
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received a %s channel_request for channel (%d:%d) (want_reply=%hhd)",
request, channel->local_channel, channel->remote_channel, want_reply);
@@ -1475,7 +1475,7 @@ int ssh_message_channel_request_reply_success(ssh_message msg) {
if (msg->channel_request.want_reply) {
channel = msg->channel_request.channel->remote_channel;
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sending a channel_request success to channel %d", channel);
if (buffer_add_u8(msg->session->out_buffer, SSH2_MSG_CHANNEL_SUCCESS) < 0) {
@@ -1488,7 +1488,7 @@ int ssh_message_channel_request_reply_success(ssh_message msg) {
return packet_send(msg->session);
}
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"The client doesn't want to know the request succeeded");
return SSH_OK;
@@ -1516,7 +1516,7 @@ SSH_PACKET_CALLBACK(ssh_packet_global_request){
buffer_get_u8(packet, &want_reply);
- ssh_log(session,SSH_LOG_PROTOCOL,"Received SSH_MSG_GLOBAL_REQUEST packet");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Received SSH_MSG_GLOBAL_REQUEST packet");
msg = ssh_message_new(session);
if (msg == NULL) {
@@ -1540,10 +1540,10 @@ SSH_PACKET_CALLBACK(ssh_packet_global_request){
msg->global_request.bind_address = bind_addr;
msg->global_request.bind_port = bind_port;
- ssh_log(session, SSH_LOG_PROTOCOL, "Received SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Received SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
if(ssh_callbacks_exists(session->common.callbacks, global_request_function)) {
- ssh_log(session, SSH_LOG_PROTOCOL, "Calling callback for SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Calling callback for SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
session->common.callbacks->global_request_function(session, msg, session->common.callbacks->userdata);
} else {
ssh_message_reply_default(msg);
@@ -1562,7 +1562,7 @@ SSH_PACKET_CALLBACK(ssh_packet_global_request){
msg->global_request.bind_address = bind_addr;
msg->global_request.bind_port = bind_port;
- ssh_log(session, SSH_LOG_PROTOCOL, "Received SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
+ SSH_LOG(SSH_LOG_PROTOCOL, "Received SSH_MSG_GLOBAL_REQUEST %s %d %s:%d", request, want_reply, bind_addr, bind_port);
if(ssh_callbacks_exists(session->common.callbacks, global_request_function)) {
session->common.callbacks->global_request_function(session, msg, session->common.callbacks->userdata);
@@ -1570,7 +1570,7 @@ SSH_PACKET_CALLBACK(ssh_packet_global_request){
ssh_message_reply_default(msg);
}
} else {
- ssh_log(session, SSH_LOG_PROTOCOL, "UNKNOWN SSH_MSG_GLOBAL_REQUEST %s %d", request, want_reply);
+ SSH_LOG(SSH_LOG_PROTOCOL, "UNKNOWN SSH_MSG_GLOBAL_REQUEST %s %d", request, want_reply);
rc = SSH_PACKET_NOT_USED;
}
diff --git a/src/misc.c b/src/misc.c
index 99f60b48..c9ca0f09 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -839,7 +839,7 @@ int ssh_analyze_banner(ssh_session session, int server, int *ssh1, int *ssh2) {
return -1;
}
- ssh_log(session, SSH_LOG_RARE, "Analyzing banner: %s", banner);
+ SSH_LOG(SSH_LOG_RARE, "Analyzing banner: %s", banner);
switch(banner[4]) {
case '1':
@@ -874,7 +874,7 @@ int ssh_analyze_banner(ssh_session session, int server, int *ssh1, int *ssh2) {
major = strtol(openssh + 8, (char **) NULL, 10);
minor = strtol(openssh + 10, (char **) NULL, 10);
session->openssh = SSH_VERSION_INT(major, minor, 0);
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"We are talking to an OpenSSH client version: %d.%d (%x)",
major, minor, session->openssh);
}
diff --git a/src/packet.c b/src/packet.c
index eb31d704..a47efbd7 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -215,7 +215,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
if (to_be_read != 0) {
if(receivedlen - processed < (unsigned int)to_be_read){
/* give up, not enough data in buffer */
- ssh_log(session,SSH_LOG_PACKET,"packet: partial packet (read len) [len=%d]",len);
+ SSH_LOG(SSH_LOG_PACKET,"packet: partial packet (read len) [len=%d]",len);
return processed;
}
@@ -282,7 +282,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
/* We don't want to rewrite a new packet while still executing the packet callbacks */
session->packet_state = PACKET_STATE_PROCESSING;
ssh_packet_parse_type(session);
- ssh_log(session,SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"packet: read type %hhd [len=%d,padding=%hhd,comp=%d,payload=%d]",
session->in_packet.type, len, padding, compsize, payloadsize);
/* execute callbacks */
@@ -290,7 +290,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
session->packet_state = PACKET_STATE_INIT;
if(processed < receivedlen){
/* Handle a potential packet left in socket buffer */
- ssh_log(session,SSH_LOG_PACKET,"Processing %" PRIdS " bytes left in socket buffer",
+ SSH_LOG(SSH_LOG_PACKET,"Processing %" PRIdS " bytes left in socket buffer",
receivedlen-processed);
rc = ssh_packet_socket_callback(((unsigned char *)data) + processed,
receivedlen - processed,user);
@@ -299,7 +299,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
leave_function();
return processed;
case PACKET_STATE_PROCESSING:
- ssh_log(session, SSH_LOG_RARE, "Nested packet processing. Delaying.");
+ SSH_LOG(SSH_LOG_RARE, "Nested packet processing. Delaying.");
return 0;
}
@@ -360,9 +360,9 @@ void ssh_packet_process(ssh_session session, uint8_t type){
int r=SSH_PACKET_NOT_USED;
ssh_packet_callbacks cb;
enter_function();
- ssh_log(session,SSH_LOG_PACKET, "Dispatching handler for packet type %d",type);
+ SSH_LOG(SSH_LOG_PACKET, "Dispatching handler for packet type %d",type);
if(session->packet_callbacks == NULL){
- ssh_log(session,SSH_LOG_RARE,"Packet callback is not initialized !");
+ SSH_LOG(SSH_LOG_RARE,"Packet callback is not initialized !");
goto error;
}
i=ssh_list_get_iterator(session->packet_callbacks);
@@ -382,7 +382,7 @@ void ssh_packet_process(ssh_session session, uint8_t type){
break;
}
if(r==SSH_PACKET_NOT_USED){
- ssh_log(session,SSH_LOG_RARE,"Couldn't do anything with packet type %d",type);
+ SSH_LOG(SSH_LOG_RARE,"Couldn't do anything with packet type %d",type);
ssh_packet_send_unimplemented(session, session->recv_seq-1);
}
error:
@@ -416,11 +416,12 @@ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
*/
SSH_PACKET_CALLBACK(ssh_packet_unimplemented){
uint32_t seq;
+ (void)session; /* unused */
(void)type;
(void)user;
buffer_get_u32(packet,&seq);
seq=ntohl(seq);
- ssh_log(session,SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"Received SSH_MSG_UNIMPLEMENTED (sequence number %d)",seq);
return SSH_PACKET_USED;
}
@@ -529,7 +530,7 @@ static int packet_send2(ssh_session session) {
rc = ssh_packet_write(session);
session->send_seq++;
- ssh_log(session,SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"packet: wrote [len=%d,padding=%hhd,comp=%d,payload=%d]",
ntohl(finallen), padding, compsize, payloadsize);
if (buffer_reinit(session->out_buffer) < 0) {
diff --git a/src/packet1.c b/src/packet1.c
index 56bfb346..1c3efbaa 100644
--- a/src/packet1.c
+++ b/src/packet1.c
@@ -140,7 +140,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
goto error;
}
- ssh_log(session, SSH_LOG_PACKET, "Reading a %d bytes packet", len);
+ SSH_LOG(SSH_LOG_PACKET, "Reading a %d bytes packet", len);
session->in_packet.len = len;
session->packet_state = PACKET_STATE_SIZEREAD;
@@ -182,10 +182,10 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
ssh_print_hexa("read packet decrypted:", ssh_buffer_get_begin(session->in_buffer),
ssh_buffer_get_len(session->in_buffer));
#endif
- ssh_log(session, SSH_LOG_PACKET, "%d bytes padding", padding);
+ SSH_LOG(SSH_LOG_PACKET, "%d bytes padding", padding);
if(((len + padding) != buffer_get_rest_len(session->in_buffer)) ||
((len + padding) < sizeof(uint32_t))) {
- ssh_log(session, SSH_LOG_RARE, "no crc32 in packet");
+ SSH_LOG(SSH_LOG_RARE, "no crc32 in packet");
ssh_set_error(session, SSH_FATAL, "no crc32 in packet");
goto error;
}
@@ -201,7 +201,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
ssh_print_hexa("crc32 on",buffer_get_rest(session->in_buffer),
len + padding - sizeof(uint32_t));
#endif
- ssh_log(session, SSH_LOG_RARE, "Invalid crc32");
+ SSH_LOG(SSH_LOG_RARE, "Invalid crc32");
ssh_set_error(session, SSH_FATAL,
"Invalid crc32: expected %.8x, got %.8x",
crc,
@@ -211,7 +211,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
}
/* pass the padding */
buffer_pass_bytes(session->in_buffer, padding);
- ssh_log(session, SSH_LOG_PACKET, "The packet is valid");
+ SSH_LOG(SSH_LOG_PACKET, "The packet is valid");
/* TODO FIXME
#ifdef WITH_ZLIB
@@ -230,7 +230,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
if(processed < receivedlen){
int rc;
/* Handle a potential packet left in socket buffer */
- ssh_log(session,SSH_LOG_PACKET,"Processing %" PRIdS " bytes left in socket buffer",
+ SSH_LOG(SSH_LOG_PACKET,"Processing %" PRIdS " bytes left in socket buffer",
receivedlen-processed);
rc = ssh_packet_socket_callback1((char *)data + processed,
receivedlen - processed,user);
@@ -239,7 +239,7 @@ int ssh_packet_socket_callback1(const void *data, size_t receivedlen, void *user
leave_function();
return processed;
case PACKET_STATE_PROCESSING:
- ssh_log(session, SSH_LOG_RARE, "Nested packet processing. Delaying.");
+ SSH_LOG(SSH_LOG_RARE, "Nested packet processing. Delaying.");
return 0;
}
@@ -261,7 +261,7 @@ int packet_send1(ssh_session session) {
uint8_t padding;
enter_function();
- ssh_log(session,SSH_LOG_PACKET,"Sending a %d bytes long packet",currentlen);
+ SSH_LOG(SSH_LOG_PACKET,"Sending a %d bytes long packet",currentlen);
/* TODO FIXME
#ifdef WITH_ZLIB
@@ -281,7 +281,7 @@ int packet_send1(ssh_session session) {
}
finallen = htonl(currentlen);
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"%d bytes after comp + %d padding bytes = %d bytes packet",
currentlen, padding, ntohl(finallen));
@@ -331,7 +331,7 @@ SSH_PACKET_CALLBACK(ssh_packet_disconnect1){
(void)packet;
(void)user;
(void)type;
- ssh_log(session, SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT");
+ SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT");
ssh_set_error(session, SSH_FATAL, "Received SSH_MSG_DISCONNECT");
ssh_socket_close(session->socket);
session->alive = 0;
diff --git a/src/packet_cb.c b/src/packet_cb.c
index 41d0985c..75f91947 100644
--- a/src/packet_cb.c
+++ b/src/packet_cb.c
@@ -53,7 +53,7 @@ SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback){
error = ssh_string_to_char(error_s);
ssh_string_free(error_s);
}
- ssh_log(session, SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %d:%s",code,
+ SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %d:%s",code,
error != NULL ? error : "no error");
ssh_set_error(session, SSH_FATAL,
"Received SSH_MSG_DISCONNECT: %d:%s",code,
@@ -73,10 +73,11 @@ SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback){
* @brief Handle a SSH_IGNORE and SSH_DEBUG packet.
*/
SSH_PACKET_CALLBACK(ssh_packet_ignore_callback){
+ (void)session; /* unused */
(void)user;
(void)type;
(void)packet;
- ssh_log(session,SSH_LOG_PROTOCOL,"Received %s packet",type==SSH2_MSG_IGNORE ? "SSH_MSG_IGNORE" : "SSH_MSG_DEBUG");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Received %s packet",type==SSH2_MSG_IGNORE ? "SSH_MSG_IGNORE" : "SSH_MSG_DEBUG");
/* TODO: handle a graceful disconnect */
return SSH_PACKET_USED;
}
@@ -85,7 +86,7 @@ SSH_PACKET_CALLBACK(ssh_packet_dh_reply){
int rc;
(void)type;
(void)user;
- ssh_log(session,SSH_LOG_PROTOCOL,"Received SSH_KEXDH_REPLY");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Received SSH_KEXDH_REPLY");
if(session->session_state!= SSH_SESSION_STATE_DH &&
session->dh_handshake_state != DH_STATE_INIT_SENT){
ssh_set_error(session,SSH_FATAL,"ssh_packet_dh_reply called in wrong state : %d:%d",
@@ -121,7 +122,7 @@ SSH_PACKET_CALLBACK(ssh_packet_newkeys){
(void)packet;
(void)user;
(void)type;
- ssh_log(session, SSH_LOG_PROTOCOL, "Received SSH_MSG_NEWKEYS");
+ SSH_LOG(SSH_LOG_PROTOCOL, "Received SSH_MSG_NEWKEYS");
if(session->session_state!= SSH_SESSION_STATE_DH &&
session->dh_handshake_state != DH_STATE_NEWKEYS_SENT){
ssh_set_error(session,SSH_FATAL,"ssh_packet_newkeys called in wrong state : %d:%d",
@@ -191,7 +192,7 @@ SSH_PACKET_CALLBACK(ssh_packet_newkeys){
if (rc == SSH_ERROR) {
goto error;
}
- ssh_log(session,SSH_LOG_PROTOCOL,"Signature verified and valid");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Signature verified and valid");
/*
* Once we got SSH2_MSG_NEWKEYS we can switch next_crypto and
@@ -237,7 +238,7 @@ SSH_PACKET_CALLBACK(ssh_packet_service_accept){
(void)user;
enter_function();
session->auth_service_state=SSH_AUTH_SERVICE_ACCEPTED;
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Received SSH_MSG_SERVICE_ACCEPT");
leave_function();
return SSH_PACKET_USED;
diff --git a/src/pki.c b/src/pki.c
index 6e0a3360..dd3d915a 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -1220,8 +1220,7 @@ int ssh_pki_signature_verify_blob(ssh_session session,
return SSH_ERROR;
}
- ssh_log(session,
- SSH_LOG_FUNCTIONS,
+ SSH_LOG(SSH_LOG_FUNCTIONS,
"Going to verify a %s type signature",
key->type_c);
diff --git a/src/scp.c b/src/scp.c
index df4f5753..41f0fac7 100644
--- a/src/scp.c
+++ b/src/scp.c
@@ -93,7 +93,7 @@ int ssh_scp_init(ssh_scp scp){
ssh_set_error(scp->session,SSH_FATAL,"ssh_scp_init called under invalid state");
return SSH_ERROR;
}
- ssh_log(scp->session,SSH_LOG_PROTOCOL,"Initializing scp session %s %son location '%s'",
+ SSH_LOG(SSH_LOG_PROTOCOL,"Initializing scp session %s %son location '%s'",
scp->mode==SSH_SCP_WRITE?"write":"read",
scp->recursive?"recursive ":"",
scp->location);
@@ -300,7 +300,7 @@ int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size, int mo
}
file=ssh_basename(filename);
perms=ssh_scp_string_mode(mode);
- ssh_log(scp->session,SSH_LOG_PROTOCOL,"SCP pushing file %s, size %" PRIu64 " with permissions '%s'",file,size,perms);
+ SSH_LOG(SSH_LOG_PROTOCOL,"SCP pushing file %s, size %" PRIu64 " with permissions '%s'",file,size,perms);
snprintf(buffer, sizeof(buffer), "C%s %" PRIu64 " %s\n", perms, size, file);
SAFE_FREE(file);
SAFE_FREE(perms);
@@ -379,7 +379,7 @@ int ssh_scp_response(ssh_scp scp, char **response){
/* Warning */
if(code == 1){
ssh_set_error(scp->session,SSH_REQUEST_DENIED, "SCP: Warning: status code 1 received: %s", msg);
- ssh_log(scp->session,SSH_LOG_RARE,"SCP: Warning: status code 1 received: %s", msg);
+ SSH_LOG(SSH_LOG_RARE,"SCP: Warning: status code 1 received: %s", msg);
if(response)
*response=strdup(msg);
return 1;
@@ -540,7 +540,7 @@ int ssh_scp_pull_request(ssh_scp scp){
p=strchr(buffer,'\n');
if(p!=NULL)
*p='\0';
- ssh_log(scp->session,SSH_LOG_PROTOCOL,"Received SCP request: '%s'",buffer);
+ SSH_LOG(SSH_LOG_PROTOCOL,"Received SCP request: '%s'",buffer);
switch(buffer[0]){
case 'C':
/* File */
diff --git a/src/server.c b/src/server.c
index 5db33bad..59581ec1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -168,9 +168,9 @@ SSH_PACKET_CALLBACK(ssh_packet_kexdh_init){
(void)type;
(void)user;
enter_function();
- ssh_log(session,SSH_LOG_PACKET,"Received SSH_MSG_KEXDH_INIT");
+ SSH_LOG(SSH_LOG_PACKET,"Received SSH_MSG_KEXDH_INIT");
if(session->dh_handshake_state != DH_STATE_INIT){
- ssh_log(session,SSH_LOG_RARE,"Invalid state for SSH_MSG_KEXDH_INIT");
+ SSH_LOG(SSH_LOG_RARE,"Invalid state for SSH_MSG_KEXDH_INIT");
goto error;
}
switch(session->next_crypto->kex_type){
@@ -303,7 +303,7 @@ static int dh_handshake_server(ssh_session session) {
if (packet_send(session) == SSH_ERROR) {
return -1;
}
- ssh_log(session, SSH_LOG_PACKET, "SSH_MSG_NEWKEYS sent");
+ SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_NEWKEYS sent");
session->dh_handshake_state=DH_STATE_NEWKEYS_SENT;
return 0;
@@ -328,7 +328,7 @@ static void ssh_server_connection_callback(ssh_session session){
goto error;
}
set_status(session, 0.4f);
- ssh_log(session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"SSH client banner: %s", session->clientbanner);
/* Here we analyze the different protocols the server allows. */
@@ -391,7 +391,7 @@ static void ssh_server_connection_callback(ssh_session session){
if(ssh_send_kex(session, 1) < 0)
goto error;
}
- ssh_list_kex(session, &session->next_crypto->client_kex); // log client kex
+ ssh_list_kex(&session->next_crypto->client_kex); // log client kex
if (ssh_kex_select_methods(session) < 0) {
goto error;
}
@@ -493,7 +493,7 @@ static int callback_receive_banner(const void *data, size_t len, void *user) {
ret = i + 1;
session->clientbanner = str;
session->session_state = SSH_SESSION_STATE_BANNER_RECEIVED;
- ssh_log(session, SSH_LOG_PACKET, "Received banner: %s", str);
+ SSH_LOG(SSH_LOG_PACKET, "Received banner: %s", str);
session->ssh_connection_callback(session);
leave_function();
@@ -562,7 +562,7 @@ int ssh_handle_key_exchange(ssh_session session) {
pending:
rc = ssh_handle_packets_termination(session, SSH_TIMEOUT_USER,
ssh_server_kex_termination,session);
- ssh_log(session,SSH_LOG_PACKET, "ssh_handle_key_exchange: current state : %d",
+ SSH_LOG(SSH_LOG_PACKET, "ssh_handle_key_exchange: current state : %d",
session->session_state);
if (rc != SSH_OK)
return rc;
@@ -621,7 +621,7 @@ int ssh_auth_reply_default(ssh_session session,int partial) {
/* Strip the comma. */
methods_c[strlen(methods_c) - 1] = '\0'; // strip the comma. We are sure there is at
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sending a auth failure. methods that can continue: %s", methods_c);
methods = ssh_string_from_char(methods_c);
@@ -652,7 +652,7 @@ error:
}
static int ssh_message_channel_request_open_reply_default(ssh_message msg) {
- ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a channel");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Refusing a channel");
if (buffer_add_u8(msg->session->out_buffer
, SSH2_MSG_CHANNEL_OPEN_FAILURE) < 0) {
@@ -686,7 +686,7 @@ static int ssh_message_channel_request_reply_default(ssh_message msg) {
if (msg->channel_request.want_reply) {
channel = msg->channel_request.channel->remote_channel;
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sending a default channel_request denied to channel %d", channel);
if (buffer_add_u8(msg->session->out_buffer, SSH2_MSG_CHANNEL_FAILURE) < 0) {
@@ -699,7 +699,7 @@ static int ssh_message_channel_request_reply_default(ssh_message msg) {
return packet_send(msg->session);
}
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"The client doesn't want to know the request failed!");
return SSH_OK;
@@ -719,7 +719,7 @@ int ssh_message_service_reply_success(ssh_message msg) {
}
session = msg->session;
- ssh_log(session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sending a SERVICE_ACCEPT for service %s", msg->service_request.service);
if (buffer_add_u8(session->out_buffer, SSH2_MSG_SERVICE_ACCEPT) < 0) {
return -1;
@@ -738,7 +738,7 @@ int ssh_message_service_reply_success(ssh_message msg) {
}
int ssh_message_global_request_reply_success(ssh_message msg, uint16_t bound_port) {
- ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Accepting a global request");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Accepting a global request");
if (msg->global_request.want_reply) {
if (buffer_add_u8(msg->session->out_buffer
@@ -758,7 +758,7 @@ int ssh_message_global_request_reply_success(ssh_message msg, uint16_t bound_por
if(msg->global_request.type == SSH_GLOBAL_REQUEST_TCPIP_FORWARD
&& msg->global_request.bind_port == 0) {
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"The client doesn't want to know the remote port!");
}
@@ -768,7 +768,7 @@ error:
}
static int ssh_message_global_request_reply_default(ssh_message msg) {
- ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a global request");
+ SSH_LOG(SSH_LOG_FUNCTIONS, "Refusing a global request");
if (msg->global_request.want_reply) {
if (buffer_add_u8(msg->session->out_buffer
@@ -777,7 +777,7 @@ static int ssh_message_global_request_reply_default(ssh_message msg) {
}
return packet_send(msg->session);
}
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"The client doesn't want to know the request failed!");
return SSH_OK;
@@ -802,7 +802,7 @@ int ssh_message_reply_default(ssh_message msg) {
case SSH_REQUEST_GLOBAL:
return ssh_message_global_request_reply_default(msg);
default:
- ssh_log(msg->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Don't know what to default reply to %d type",
msg->type);
break;
@@ -958,7 +958,7 @@ int ssh_message_auth_interactive_request(ssh_message msg, const char *name,
/* fill in the kbdint structure */
if (msg->session->kbdint == NULL) {
- ssh_log(msg->session, SSH_LOG_PROTOCOL, "Warning: Got a "
+ SSH_LOG(SSH_LOG_PROTOCOL, "Warning: Got a "
"keyboard-interactive response but it "
"seems we didn't send the request.");
@@ -1043,11 +1043,11 @@ int ssh_auth_reply_success(ssh_session session, int partial) {
r = packet_send(session);
if(session->current_crypto && session->current_crypto->delayed_compress_out){
- ssh_log(session,SSH_LOG_PROTOCOL,"Enabling delayed compression OUT");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Enabling delayed compression OUT");
session->current_crypto->do_compress_out=1;
}
if(session->current_crypto && session->current_crypto->delayed_compress_in){
- ssh_log(session,SSH_LOG_PROTOCOL,"Enabling delayed compression IN");
+ SSH_LOG(SSH_LOG_PROTOCOL,"Enabling delayed compression IN");
session->current_crypto->do_compress_in=1;
}
return r;
diff --git a/src/session.c b/src/session.c
index 1faf0d69..61e14320 100644
--- a/src/session.c
+++ b/src/session.c
@@ -641,7 +641,7 @@ int ssh_get_version(ssh_session session) {
void ssh_socket_exception_callback(int code, int errno_code, void *user){
ssh_session session=(ssh_session)user;
enter_function();
- ssh_log(session,SSH_LOG_RARE,"Socket exception callback: %d (%d)",code, errno_code);
+ SSH_LOG(SSH_LOG_RARE,"Socket exception callback: %d (%d)",code, errno_code);
session->session_state=SSH_SESSION_STATE_ERROR;
ssh_set_error(session,SSH_FATAL,"Socket error: %s",strerror(errno_code));
session->ssh_connection_callback(session);
diff --git a/src/sftp.c b/src/sftp.c
index 73b1f301..a4670384 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -217,11 +217,11 @@ int sftp_server_init(sftp_session sftp){
return -1;
}
- ssh_log(session, SSH_LOG_PACKET, "Received SSH_FXP_INIT");
+ SSH_LOG(SSH_LOG_PACKET, "Received SSH_FXP_INIT");
buffer_get_u32(packet->payload, &version);
version = ntohl(version);
- ssh_log(session, SSH_LOG_PACKET, "Client version: %d", version);
+ SSH_LOG(SSH_LOG_PACKET, "Client version: %d", version);
sftp->client_version = version;
sftp_packet_free(packet);
@@ -244,7 +244,7 @@ int sftp_server_init(sftp_session sftp){
}
ssh_buffer_free(reply);
- ssh_log(session, SSH_LOG_RARE, "Server version sent");
+ SSH_LOG(SSH_LOG_RARE, "Server version sent");
if (version > LIBSFTP_VERSION) {
sftp->version = LIBSFTP_VERSION;
@@ -302,7 +302,7 @@ int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
if (size < 0) {
return -1;
} else if((uint32_t) size != buffer_get_rest_len(payload)) {
- ssh_log(sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Had to write %d bytes, wrote only %d",
buffer_get_rest_len(payload),
size);
@@ -450,7 +450,7 @@ static sftp_message sftp_get_message(sftp_packet packet) {
return NULL;
}
- ssh_log(packet->sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Packet with id %d type %d",
msg->id,
msg->packet_type);
@@ -539,7 +539,7 @@ int sftp_init(sftp_session sftp) {
/* TODO: are we sure there are 4 bytes ready? */
buffer_get_u32(packet->payload, &version);
version = ntohl(version);
- ssh_log(sftp->session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"SFTP server version %d",
version);
@@ -564,7 +564,7 @@ int sftp_init(sftp_session sftp) {
ssh_string_free(ext_data_s);
return -1;
}
- ssh_log(sftp->session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"SFTP server extension: %s, version: %s",
ext_name, ext_data);
@@ -705,7 +705,7 @@ static int sftp_enqueue(sftp_session sftp, sftp_message msg) {
return -1;
}
- ssh_log(sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Queued msg type %d id %d",
msg->id, msg->packet_type);
@@ -746,7 +746,7 @@ static sftp_message sftp_dequeue(sftp_session sftp, uint32_t id){
}
msg = queue->message;
request_queue_free(queue);
- ssh_log(sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Dequeued msg id %d type %d",
msg->id,
msg->packet_type);
@@ -1222,7 +1222,7 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf,
break;
}
- ssh_log(sftp->session, SSH_LOG_RARE, "Name: %s", attr->name);
+ SSH_LOG(SSH_LOG_RARE, "Name: %s", attr->name);
longname = buffer_get_ssh_string(buf);
if (longname == NULL) {
@@ -1253,7 +1253,7 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf,
}
flags = ntohl(flags);
attr->flags = flags;
- ssh_log(sftp->session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"Flags: %.8lx\n", (long unsigned int) flags);
if (flags & SSH_FILEXFER_ATTR_SIZE) {
@@ -1261,7 +1261,7 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf,
break;
}
attr->size = ntohll(attr->size);
- ssh_log(sftp->session, SSH_LOG_RARE,
+ SSH_LOG(SSH_LOG_RARE,
"Size: %llu\n",
(long long unsigned int) attr->size);
}
@@ -1450,7 +1450,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir) {
}
ssh_buffer_free(payload);
- ssh_log(sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Sent a ssh_fxp_readdir with id %d", id);
while (msg == NULL) {
@@ -1507,7 +1507,7 @@ sftp_attributes sftp_readdir(sftp_session sftp, sftp_dir dir) {
return NULL;
}
- ssh_log(sftp->session, SSH_LOG_RARE, "Count is %d", dir->count);
+ SSH_LOG(SSH_LOG_RARE, "Count is %d", dir->count);
attr = sftp_parse_attr(sftp, dir->buffer, 1);
if (attr == NULL) {
@@ -1683,7 +1683,7 @@ sftp_file sftp_open(sftp_session sftp, const char *file, int flags,
sftp_flags |= SSH_FXF_TRUNC;
if (flags & O_EXCL)
sftp_flags |= SSH_FXF_EXCL;
- ssh_log(sftp->session,SSH_LOG_PACKET,"Opening file %s with sftp flags %x",file,sftp_flags);
+ SSH_LOG(SSH_LOG_PACKET,"Opening file %s with sftp flags %x",file,sftp_flags);
id = sftp_get_new_id(sftp);
if (buffer_add_u32(buffer, id) < 0 ||
buffer_add_ssh_string(buffer, filename) < 0) {
@@ -2002,7 +2002,7 @@ ssize_t sftp_write(sftp_file file, const void *buf, size_t count) {
if (len < 0) {
return -1;
} else if (len != packetlen) {
- ssh_log(sftp->session, SSH_LOG_PACKET,
+ SSH_LOG(SSH_LOG_PACKET,
"Could not write as much data as expected");
}
diff --git a/src/socket.c b/src/socket.c
index 0f6c0a83..5f7e754a 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -305,7 +305,7 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int r
#endif
/* First, POLLOUT is a sign we may be connected */
if(s->state == SSH_SOCKET_CONNECTING){
- ssh_log(s->session,SSH_LOG_PACKET,"Received POLLOUT in connecting state");
+ SSH_LOG(SSH_LOG_PACKET,"Received POLLOUT in connecting state");
s->state = SSH_SOCKET_CONNECTED;
ssh_poll_set_events(p,POLLOUT | POLLIN);
r = ssh_socket_set_blocking(ssh_socket_get_fd_in(s));
@@ -543,7 +543,7 @@ static int ssh_socket_unbuffered_write(ssh_socket s, const void *buffer,
s->write_wontblock = 0;
/* Reactive the POLLOUT detector in the poll multiplexer system */
if(s->poll_out){
- ssh_log(s->session, SSH_LOG_PACKET, "Enabling POLLOUT for socket");
+ SSH_LOG(SSH_LOG_PACKET, "Enabling POLLOUT for socket");
ssh_poll_set_events(s->poll_out,ssh_poll_get_events(s->poll_out) | POLLOUT);
}
if (w < 0) {
@@ -762,7 +762,7 @@ int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bin
return SSH_ERROR;
}
fd=ssh_connect_host_nonblocking(s->session,host,bind_addr,port);
- ssh_log(session,SSH_LOG_PROTOCOL,"Nonblocking connection socket: %d",fd);
+ SSH_LOG(SSH_LOG_PROTOCOL,"Nonblocking connection socket: %d",fd);
if(fd == SSH_INVALID_SOCKET)
return SSH_ERROR;
ssh_socket_set_fd(s,fd);
@@ -825,14 +825,14 @@ int ssh_socket_connect_proxycommand(ssh_socket s, const char *command){
return SSH_ERROR;
}
- ssh_log(session,SSH_LOG_PROTOCOL,"Executing proxycommand '%s'",command);
+ SSH_LOG(SSH_LOG_PROTOCOL,"Executing proxycommand '%s'",command);
pid = fork();
if(pid == 0){
ssh_execute_command(command,out_pipe[0],in_pipe[1]);
}
close(in_pipe[1]);
close(out_pipe[0]);
- ssh_log(session,SSH_LOG_PROTOCOL,"ProxyCommand connection pipe: [%d,%d]",in_pipe[0],out_pipe[1]);
+ SSH_LOG(SSH_LOG_PROTOCOL,"ProxyCommand connection pipe: [%d,%d]",in_pipe[0],out_pipe[1]);
ssh_socket_set_fd_in(s,in_pipe[0]);
ssh_socket_set_fd_out(s,out_pipe[1]);
s->state=SSH_SOCKET_CONNECTED;
diff --git a/src/wrapper.c b/src/wrapper.c
index b8a489d4..c5260a25 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -183,7 +183,7 @@ static int crypt_set_algorithms2(ssh_session session){
wanted);
goto error;
}
- ssh_log(session, SSH_LOG_PACKET, "Set output algorithm to %s", wanted);
+ SSH_LOG(SSH_LOG_PACKET, "Set output algorithm to %s", wanted);
session->next_crypto->out_cipher = cipher_new(i);
if (session->next_crypto->out_cipher == NULL) {
@@ -204,7 +204,7 @@ static int crypt_set_algorithms2(ssh_session session){
wanted);
goto error;
}
- ssh_log(session, SSH_LOG_PACKET, "Set input algorithm to %s", wanted);
+ SSH_LOG(SSH_LOG_PACKET, "Set input algorithm to %s", wanted);
session->next_crypto->in_cipher = cipher_new(i);
if (session->next_crypto->in_cipher == NULL) {
@@ -288,7 +288,7 @@ int crypt_set_algorithms_server(ssh_session session){
"no crypto algorithm function found for %s",method);
goto error;
}
- ssh_log(session,SSH_LOG_PACKET,"Set output algorithm %s",method);
+ SSH_LOG(SSH_LOG_PACKET,"Set output algorithm %s",method);
session->next_crypto->out_cipher = cipher_new(i);
if (session->next_crypto->out_cipher == NULL) {
@@ -305,7 +305,7 @@ int crypt_set_algorithms_server(ssh_session session){
"no crypto algorithm function found for %s",method);
goto error;
}
- ssh_log(session,SSH_LOG_PACKET,"Set input algorithm %s",method);
+ SSH_LOG(SSH_LOG_PACKET,"Set input algorithm %s",method);
session->next_crypto->in_cipher = cipher_new(i);
if (session->next_crypto->in_cipher == NULL) {
@@ -316,7 +316,7 @@ int crypt_set_algorithms_server(ssh_session session){
/* compression */
method = session->next_crypto->kex_methods[SSH_CRYPT_C_S];
if(strcmp(method,"zlib") == 0){
- ssh_log(session,SSH_LOG_PACKET,"enabling C->S compression");
+ SSH_LOG(SSH_LOG_PACKET,"enabling C->S compression");
session->next_crypto->do_compress_in=1;
}
if(strcmp(method,"zlib@openssh.com") == 0){
@@ -325,7 +325,7 @@ int crypt_set_algorithms_server(ssh_session session){
}
method = session->next_crypto->kex_methods[SSH_CRYPT_S_C];
if(strcmp(method,"zlib") == 0){
- ssh_log(session,SSH_LOG_PACKET,"enabling S->C compression\n");
+ SSH_LOG(SSH_LOG_PACKET, "enabling S->C compression\n");
session->next_crypto->do_compress_out=1;
}
if(strcmp(method,"zlib@openssh.com") == 0){