[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/11] cleanup: use ssh_ prefix in the kex (non-static) functions


Having "ssh_" prefix in the functions' name will avoid possible clashes
when compiling libssh statically.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 include/libssh/kex.h | 6 +++---
 src/client.c         | 2 +-
 src/kex.c            | 8 ++++----
 src/known_hosts.c    | 2 +-
 src/options.c        | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/libssh/kex.h b/include/libssh/kex.h
index 1a5b6d4..e872bde 100644
--- a/include/libssh/kex.h
+++ b/include/libssh/kex.h
@@ -38,10 +38,10 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1);
 
 int ssh_send_kex(ssh_session session, int server_kex);
 void ssh_list_kex(struct ssh_kex_struct *kex);
-int set_client_kex(ssh_session session);
+int ssh_set_client_kex(ssh_session session);
 int ssh_kex_select_methods(ssh_session session);
-int verify_existing_algo(int algo, const char *name);
-char **space_tokenize(const char *chain);
+int ssh_verify_existing_algo(int algo, const char *name);
+char **ssh_space_tokenize(const char *chain);
 int ssh_get_kex1(ssh_session session);
 char *ssh_find_matching(const char *in_d, const char *what_d);
 const char *ssh_kex_get_supported_method(uint32_t algo);
diff --git a/src/client.c b/src/client.c
index 64ce5de..0c2b7e4 100644
--- a/src/client.c
+++ b/src/client.c
@@ -399,7 +399,7 @@ static void ssh_client_connection_callback(ssh_session session){
 		case SSH_SESSION_STATE_KEXINIT_RECEIVED:
 			set_status(session,0.6f);
 			ssh_list_kex(&session->next_crypto->server_kex);
-			if (set_client_kex(session) < 0) {
+			if (ssh_set_client_kex(session) < 0) {
 				goto error;
 			}
 			if (ssh_kex_select_methods(session) == SSH_ERROR)
diff --git a/src/kex.c b/src/kex.c
index 497c67a..55b8318 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -172,7 +172,7 @@ static char **tokenize(const char *chain){
 
 /* same as tokenize(), but with spaces instead of ',' */
 /* TODO FIXME rewrite me! */
-char **space_tokenize(const char *chain){
+char **ssh_space_tokenize(const char *chain){
     char **tokens;
     int n=1;
     int i=0;
@@ -512,7 +512,7 @@ static char *ssh_client_select_hostkeys(ssh_session session){
 	for (i=0;preferred_hostkeys[i] != NULL; ++i){
 		for (j=0; methods[j] != NULL; ++j){
 			if(strcmp(preferred_hostkeys[i], methods[j]) == 0){
-				if (verify_existing_algo(SSH_HOSTKEYS, methods[j])){
+				if (ssh_verify_existing_algo(SSH_HOSTKEYS, methods[j])){
 					if(needcoma)
 						strncat(methods_buffer,",",sizeof(methods_buffer)-strlen(methods_buffer)-1);
 					strncat(methods_buffer, methods[j], sizeof(methods_buffer)-strlen(methods_buffer)-1);
@@ -539,7 +539,7 @@ static char *ssh_client_select_hostkeys(ssh_session session){
  * @brief sets the key exchange parameters to be sent to the server,
  *        in function of the options and available methods.
  */
-int set_client_kex(ssh_session session){
+int ssh_set_client_kex(ssh_session session){
     struct ssh_kex_struct *client= &session->next_crypto->client_kex;
     const char *wanted;
     int i;
@@ -656,7 +656,7 @@ error:
 }
 
 /* returns 1 if at least one of the name algos is in the default algorithms table */
-int verify_existing_algo(int algo, const char *name){
+int ssh_verify_existing_algo(int algo, const char *name){
     char *ptr;
     if(algo>9 || algo <0)
         return -1;
diff --git a/src/known_hosts.c b/src/known_hosts.c
index 263289f..32f795a 100644
--- a/src/known_hosts.c
+++ b/src/known_hosts.c
@@ -134,7 +134,7 @@ static char **ssh_get_knownhost_line(FILE **file, const char *filename,
       continue; /* skip empty lines */
     }
 
-    tokens = space_tokenize(buffer);
+    tokens = ssh_space_tokenize(buffer);
     if (tokens == NULL) {
       fclose(*file);
       *file = NULL;
diff --git a/src/options.c b/src/options.c
index e715c09..70b4ca5 100644
--- a/src/options.c
+++ b/src/options.c
@@ -164,7 +164,7 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
 
 int ssh_options_set_algo(ssh_session session, int algo,
     const char *list) {
-  if (!verify_existing_algo(algo, list)) {
+  if (!ssh_verify_existing_algo(algo, list)) {
     ssh_set_error(session, SSH_REQUEST_DENIED,
         "Setting method: no algorithm for method \"%s\" (%s)\n",
         ssh_kex_get_description(algo), list);
-- 
2.4.3


References:
[PATCH 00/11] cleanup and removing some warningsFabiano Fidêncio <fidencio@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org