diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-11-24 18:05:55 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2008-11-24 18:05:55 +0000 |
commit | f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1 (patch) | |
tree | 5e80eb3b78683d183d47759582f9712e23bf84b6 /libssh/kex.c | |
parent | f880011d727e598561fe64a805a2fb22a39ffcee (diff) | |
download | libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.tar.gz libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.tar.xz libssh-f7700f2bc2f2d5876c91bbbf3eaae233ee1548b1.zip |
patches 0001-Save-the-last-error-and-provide-a-function-to-get-it.patch,
0002-Use-const-whereever-it-makes-sense.patch,
0003-Implement-function-to-retrieve-userauth-possabilitie.patch
from Andreas Schneider
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@191 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/kex.c')
-rw-r--r-- | libssh/kex.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libssh/kex.c b/libssh/kex.c index 9838a7c5..b5a2f633 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -63,11 +63,12 @@ char *ssh_kex_nums[]={ "compression algo server->client","languages client->server","languages server->client",NULL}; /* tokenize will return a token of strings delimited by ",". the first element has to be freed */ -static char **tokenize(char *chain){ +static char **tokenize(const char *chain){ char **tokens; int n=1; int i=0; - char *ptr=chain=strdup(chain); + char *tmp = strdup(chain); + char *ptr = tmp; while(*ptr){ if(*ptr==','){ n++; @@ -77,7 +78,7 @@ static char **tokenize(char *chain){ } /* now n contains the number of tokens, the first possibly empty if the list was empty too e.g. "" */ tokens=malloc(sizeof(char *) * (n+1) ); /* +1 for the null */ - ptr=chain; + ptr=tmp; for(i=0;i<n;i++){ tokens[i]=ptr; while(*ptr) @@ -89,11 +90,12 @@ static char **tokenize(char *chain){ } /* same as tokenize(), but with spaces instead of ',' */ -char **space_tokenize(char *chain){ +char **space_tokenize(const char *chain){ char **tokens; int n=1; int i=0; - char *ptr=chain=strdup(chain); + char *tmp = strdup(chain); + char *ptr = tmp; while(*ptr==' ') ++ptr; /* skip initial spaces */ while(*ptr){ @@ -108,7 +110,7 @@ char **space_tokenize(char *chain){ } /* now n contains the number of tokens, the first possibly empty if the list was empty too e.g. "" */ tokens=malloc(sizeof(char *) * (n+1) ); /* +1 for the null */ - ptr=chain; /* we don't pass the initial spaces because the "chain" pointer is needed by the caller */ + ptr=tmp; /* we don't pass the initial spaces because the "tmp" pointer is needed by the caller */ /* function to free the tokens. */ for(i=0;i<n;i++){ tokens[i]=ptr; @@ -128,7 +130,7 @@ char **space_tokenize(char *chain){ /* and a list of prefered objects (what_d) */ /* it will return a strduped pointer on the first prefered object found in the available objects list */ -char *ssh_find_matching(char *in_d, char *what_d){ +char *ssh_find_matching(const char *in_d, const char *what_d){ char ** tok_in, **tok_what; int i_in, i_what; char *ret; @@ -272,7 +274,7 @@ void ssh_send_kex(SSH_SESSION *session, int server_kex){ } /* returns 1 if at least one of the name algos is in the default algorithms table */ -int verify_existing_algo(int algo, char *name){ +int verify_existing_algo(int algo, const char *name){ char *ptr; if(algo>9 || algo <0) return -1; |