summaryrefslogtreecommitdiffstats
path: root/libssh/kex.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-03-28 21:43:13 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-03-28 21:59:11 +0200
commit9da13d4ff8152d58bb3debe03ab241ec23ac00b4 (patch)
tree1c8a3ce30af05ef84aa966df3dcef3abe288fdfb /libssh/kex.c
parent7d49e49e74c4eed0c14e354efde832c39b2740f4 (diff)
downloadlibssh-9da13d4ff8152d58bb3debe03ab241ec23ac00b4.tar.gz
libssh-9da13d4ff8152d58bb3debe03ab241ec23ac00b4.tar.xz
libssh-9da13d4ff8152d58bb3debe03ab241ec23ac00b4.zip
Fixes the broken algorithm choice for server
Diffstat (limited to 'libssh/kex.c')
-rw-r--r--libssh/kex.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/libssh/kex.c b/libssh/kex.c
index 2098274..4aceb43 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -195,48 +195,48 @@ char **space_tokenize(const char *chain){
return tokens;
}
-/* find_matching gets 2 parameters : a list of available objects (in_d), separated by colons,*/
-/* and a list of prefered objects (what_d) */
+/* find_matching gets 2 parameters : a list of available objects (available_d), separated by colons,*/
+/* and a list of preferred objects (preferred_d) */
/* it will return a strduped pointer on the first prefered object found in the available objects list */
-char *ssh_find_matching(const char *in_d, const char *what_d){
- char ** tok_in, **tok_what;
- int i_in, i_what;
+char *ssh_find_matching(const char *available_d, const char *preferred_d){
+ char ** tok_available, **tok_preferred;
+ int i_avail, i_pref;
char *ret;
- if ((in_d == NULL) || (what_d == NULL)) {
+ if ((available_d == NULL) || (preferred_d == NULL)) {
return NULL; /* don't deal with null args */
}
- tok_in = tokenize(in_d);
- if (tok_in == NULL) {
+ tok_available = tokenize(available_d);
+ if (tok_available == NULL) {
return NULL;
}
- tok_what = tokenize(what_d);
- if (tok_what == NULL) {
- SAFE_FREE(tok_in[0]);
- SAFE_FREE(tok_in);
+ tok_preferred = tokenize(preferred_d);
+ if (tok_preferred == NULL) {
+ SAFE_FREE(tok_available[0]);
+ SAFE_FREE(tok_available);
}
- for(i_what=0; tok_what[i_what] ; ++i_what){
- for(i_in=0; tok_in[i_in]; ++i_in){
- if(!strcmp(tok_in[i_in],tok_what[i_what])){
+ for(i_pref=0; tok_preferred[i_pref] ; ++i_pref){
+ for(i_avail=0; tok_available[i_avail]; ++i_avail){
+ if(!strcmp(tok_available[i_avail],tok_preferred[i_pref])){
/* match */
- ret=strdup(tok_in[i_in]);
+ ret=strdup(tok_available[i_avail]);
/* free the tokens */
- free(tok_in[0]);
- free(tok_what[0]);
- free(tok_in);
- free(tok_what);
+ free(tok_available[0]);
+ free(tok_preferred[0]);
+ free(tok_available);
+ free(tok_preferred);
return ret;
}
}
}
- free(tok_in[0]);
- free(tok_what[0]);
- free(tok_in);
- free(tok_what);
+ free(tok_available[0]);
+ free(tok_preferred[0]);
+ free(tok_available);
+ free(tok_preferred);
return NULL;
}