aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-03-12 15:45:38 +0000
committerAndreas Schneider <mail@cynapses.org>2009-03-12 15:45:38 +0000
commit05495a263aba3e94c4c36a99fc2f5a872f32a5ce (patch)
tree8f49c53b6a16906758f880e53eacaf609ce9d2b0
parent40bce93e97dc3afb14662d9b01ba07154093c4e7 (diff)
downloadlibssh-05495a263aba3e94c4c36a99fc2f5a872f32a5ce.tar.gz
libssh-05495a263aba3e94c4c36a99fc2f5a872f32a5ce.tar.xz
libssh-05495a263aba3e94c4c36a99fc2f5a872f32a5ce.zip
Use ssh_log instead of ssh_say in ssh_list_kex().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@269 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--include/libssh/priv.h2
-rw-r--r--libssh/client.c2
-rw-r--r--libssh/kex.c26
-rw-r--r--libssh/server.c2
4 files changed, 17 insertions, 15 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 0c7105c7..e2767356 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -558,7 +558,7 @@ socket_t ssh_connect_host(SSH_SESSION *session, const char *host,const char
/* in kex.c */
extern char *ssh_kex_nums[];
void ssh_send_kex(SSH_SESSION *session,int server_kex);
-void ssh_list_kex(KEX *kex);
+void ssh_list_kex(SSH_SESSION *session, KEX *kex);
int set_kex(SSH_SESSION *session);
int ssh_get_kex(SSH_SESSION *session, int server_kex);
int verify_existing_algo(int algo, const char *name);
diff --git a/libssh/client.c b/libssh/client.c
index db4a6d45..06750a4a 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -323,7 +323,7 @@ int ssh_connect(SSH_SESSION *session){
return -1;
}
set_status(options,0.6);
- ssh_list_kex(&session->server_kex);
+ ssh_list_kex(session, &session->server_kex);
if(set_kex(session)){
ssh_socket_close(session->socket);
session->alive=0;
diff --git a/libssh/kex.c b/libssh/kex.c
index c1260077..3e20b6a3 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -137,14 +137,12 @@ char *ssh_find_matching(const char *in_d, const char *what_d){
if( ! (in_d && what_d))
return NULL; /* don't deal with null args */
- ssh_say(3,"find_matching(\"%s\",\"%s\") = ",in_d,what_d);
tok_in=tokenize(in_d);
tok_what=tokenize(what_d);
for(i_in=0; tok_in[i_in]; ++i_in){
for(i_what=0; tok_what[i_what] ; ++i_what){
if(!strcmp(tok_in[i_in],tok_what[i_what])){
/* match */
- ssh_say(3,"\"%s\"\n",tok_in[i_in]);
ret=strdup(tok_in[i_in]);
/* free the tokens */
free(tok_in[0]);
@@ -155,7 +153,6 @@ char *ssh_find_matching(const char *in_d, const char *what_d){
}
}
}
- ssh_say(3,"NULL\n");
free(tok_in[0]);
free(tok_what[0]);
free(tok_in);
@@ -204,14 +201,17 @@ int ssh_get_kex(SSH_SESSION *session,int server_kex ){
return 0;
}
-void ssh_list_kex(KEX *kex){
- int i=0;
+void ssh_list_kex(struct ssh_session *session, KEX *kex) {
+ int i = 0;
+
#ifdef DEBUG_CRYPTO
- ssh_print_hexa("session cookie",kex->cookie,16);
+ ssh_print_hexa("session cookie", kex->cookie, 16);
#endif
- for(i=0;i<10;i++){
- ssh_say(2,"%s : %s\n",ssh_kex_nums[i],kex->methods[i]);
- }
+
+ for(i = 0; i < 10; i++) {
+ ssh_log(session, SSH_LOG_FUNCTIONS, "%s: %s",
+ ssh_kex_nums[i], kex->methods[i]);
+ }
}
/* set_kex basicaly look at the option structure of the session and set the output kex message */
@@ -259,7 +259,7 @@ void ssh_send_kex(SSH_SESSION *session, int server_kex){
buffer_add_u8(session->out_buffer,SSH2_MSG_KEXINIT);
buffer_add_data(session->out_buffer,kex->cookie,16);
hashbufout_add_cookie(session);
- ssh_list_kex(kex);
+ ssh_list_kex(session, kex);
for(i=0;i<10;i++){
str=string_from_char(kex->methods[i]);
buffer_add_ssh_string(session->out_hashbuf,str);
@@ -368,8 +368,10 @@ static STRING *encrypt_session_key(SSH_SESSION *session, PUBLIC_KEY *svrkey,
data1=string_new(32);
string_fill(data1,buffer,32);
if(ABS(hlen-slen)<128){
- ssh_say(1,"Difference between server modulus and host modulus is only %d. It's illegal and may not work\n",
- ABS(hlen-slen));
+ ssh_log(session, SSH_LOG_FUNCTIONS,
+ "Difference between server modulus and host modulus is only %d. "
+ "It's illegal and may not work",
+ ABS(hlen-slen));
}
if(modulus_smaller(svrkey,hostkey)){
data2=ssh_encrypt_rsa1(session,data1,svrkey);
diff --git a/libssh/server.c b/libssh/server.c
index 6b34be36..01c42d25 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -292,7 +292,7 @@ int ssh_accept(SSH_SESSION *session){
ssh_send_kex(session,1);
if(ssh_get_kex(session,1))
return -1;
- ssh_list_kex(&session->client_kex);
+ ssh_list_kex(session, &session->client_kex);
crypt_set_algorithms_server(session);
if(dh_handshake_server(session))
return -1;